fix(cli): fix project context show test mock for tier service

Add ContextTierService mock to step_m5_invoke_project_context_show
so the CLI command can call _get_context_tier_service() without
failing. Also patch _load_policy_json to prevent JSON decode errors
from MagicMock session objects. Update CHANGELOG.md and CONTRIBUTORS.md.

ISSUES CLOSED: #6323
This commit is contained in:
2026-04-16 22:37:54 +00:00
committed by drew
parent 19f11f0d0a
commit 565263ab24
4 changed files with 14 additions and 9 deletions
+4
View File
@@ -162,6 +162,10 @@ ensuring data is stored with proper parameter values.
LLM streaming output. A `SessionActorNotConfiguredError` is raised with exit
code 1 when no actor is configured.
### Fixed
- **`agents project context show` JSON/YAML output** (#6323): Fixed structured output to include spec-required envelope (`command`, `status`, `exit_code`, `data`, `timing`, `messages`) and all four data sections (`context_policy`, `limits`, `summarization`, `current_usage`). Rich output now renders four panels including the new `Current Usage` panel.
### Added
- **A2A module rename BDD test suite** (#8615): Comprehensive Behave tests validating that the ACP→A2A module rename is complete — verifying all 22 A2A symbols are properly exported, no legacy ACP references remain in `.py` files under `cleveragents.a2a/`, and the module docstring uses current A2A naming. The step definitions include self-contained symbol lookups to avoid cross-scenario dependency failures.
+1
View File
@@ -1,5 +1,6 @@
# Contributors
* HAL9000 <HAL9000@cleverthis.com>
* Aditya Chhabra <aditya.chhabra@cleverthis.com>
* Brent E. Edwards <brent.edwards@cleverthis.com>
* HAL 9000 <hal9000@cleverthis.com>
+6
View File
@@ -440,6 +440,7 @@ def step_m5_project_with_policy(context: Context) -> None:
@when("I m5 smoke invoke project context show")
def step_m5_invoke_project_context_show(context: Context) -> None:
from cleveragents.application.services.context_tiers import ContextTierService
from cleveragents.cli.commands.project_context import _default_acms_config
mock_repo = MagicMock()
@@ -447,6 +448,7 @@ def step_m5_invoke_project_context_show(context: Context) -> None:
mock_container = MagicMock()
mock_container.session_factory.return_value = MagicMock()
mock_container.context_tier_service.return_value = ContextTierService()
with (
patch(
@@ -465,6 +467,10 @@ def step_m5_invoke_project_context_show(context: Context) -> None:
"cleveragents.cli.commands.project_context._read_acms_config",
return_value=_default_acms_config(),
),
patch(
"cleveragents.cli.commands.project_context._load_policy_json",
return_value=None,
),
):
from cleveragents.cli.commands.project_context import app as pc_app
+3 -9
View File
@@ -359,9 +359,7 @@ def test_context_show_acms_config() -> None:
envelope = json.loads(output.strip())
if envelope.get("command") != "project context show":
raise AssertionError(
f"Unexpected command value: {envelope.get('command')}"
)
raise AssertionError(f"Unexpected command value: {envelope.get('command')}")
payload = envelope.get("data")
if not isinstance(payload, dict):
@@ -369,9 +367,7 @@ def test_context_show_acms_config() -> None:
context_policy = payload.get("context_policy")
if not isinstance(context_policy, dict):
raise AssertionError(
f"Missing context_policy in payload: {payload.keys()}"
)
raise AssertionError(f"Missing context_policy in payload: {payload.keys()}")
if context_policy.get("project") != "local/ctx-robot":
raise AssertionError(
f"context_policy project mismatch: {context_policy.get('project')}"
@@ -381,9 +377,7 @@ def test_context_show_acms_config() -> None:
if not isinstance(limits, dict):
raise AssertionError(f"Missing limits in payload: {payload.keys()}")
if limits.get("hot_max_tokens") != 5000:
raise AssertionError(
f"hot_max_tokens mismatch: {limits.get('hot_max_tokens')}"
)
raise AssertionError(f"hot_max_tokens mismatch: {limits.get('hot_max_tokens')}")
if "summarization" not in payload:
raise AssertionError(