fix(cli): align project context show structured output
ISSUES CLOSED: #6323
This commit is contained in:
@@ -357,14 +357,47 @@ def test_context_show_acms_config() -> None:
|
||||
if exit_code != 0:
|
||||
raise AssertionError(f"show failed with exit {exit_code}: {output}")
|
||||
|
||||
data = json.loads(output.strip())
|
||||
if "acms_config" not in data:
|
||||
raise AssertionError(f"Missing acms_config in output: {data.keys()}")
|
||||
if data["acms_config"]["hot_max_tokens"] != 5000:
|
||||
envelope = json.loads(output.strip())
|
||||
if envelope.get("command") != "project context show":
|
||||
raise AssertionError(
|
||||
f"hot_max_tokens mismatch: {data['acms_config']['hot_max_tokens']}"
|
||||
f"Unexpected command value: {envelope.get('command')}"
|
||||
)
|
||||
|
||||
payload = envelope.get("data")
|
||||
if not isinstance(payload, dict):
|
||||
raise AssertionError(f"Expected data payload dict, got: {type(payload)!r}")
|
||||
|
||||
context_policy = payload.get("context_policy")
|
||||
if not isinstance(context_policy, dict):
|
||||
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')}"
|
||||
)
|
||||
|
||||
limits = payload.get("limits")
|
||||
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')}"
|
||||
)
|
||||
|
||||
if "summarization" not in payload:
|
||||
raise AssertionError(
|
||||
f"Missing summarization section in payload: {payload.keys()}"
|
||||
)
|
||||
if "current_usage" not in payload:
|
||||
raise AssertionError(
|
||||
f"Missing current_usage section in payload: {payload.keys()}"
|
||||
)
|
||||
|
||||
messages = envelope.get("messages")
|
||||
if messages != ["Context policy loaded"]:
|
||||
raise AssertionError(f"Unexpected messages payload: {messages}")
|
||||
|
||||
print("context-show-acms-ok")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user