|
2 | 2 | from __future__ import annotations |
3 | 3 |
|
4 | 4 | import contextlib |
5 | | -import hashlib |
6 | 5 | import io |
7 | 6 | import json |
8 | 7 | import shlex |
@@ -93,26 +92,27 @@ def test_brief_keeps_complete_routes_with_128_character_windows_root() -> None: |
93 | 92 | assert json.loads(encoded) == payload |
94 | 93 | root, _, _, _ = _windows_routes() |
95 | 94 | assert encoded.count(json.dumps(root)[1:-1]) == 20 |
96 | | - # The unchanged fixture on main b5a1a816a measures 10,522 JSON chars and |
97 | | - # 8,579 Markdown. The complete outcome paragraph adds 523 body/Markdown |
98 | | - # chars; omitting absent brief metadata saves 35 JSON chars: 11,010/9,102. |
99 | | - # The later diagnostic-only renderer change retains that full body and JSON, |
100 | | - # prints an identical active/resolved path once and omits absent pre-quota |
101 | | - # metadata: Markdown is 8,867 chars. The expected output was derived from |
102 | | - # b16aeb3's frozen 9,102-char rendering using only those two substitutions. |
103 | | - # These hashes retain every prior clause and route, plus the reviewed |
104 | | - # instruction transition. This is a synthetic spelling, not a Windows run. |
105 | | - assert hashlib.sha256(payload["task_body"].encode()).hexdigest() == ( |
106 | | - "cfc65091d2710ef298174e6a5280edf55f6cc7acdce8e5688a2ae213b5f4b4ac" |
107 | | - ) |
108 | | - assert hashlib.sha256(markdown.encode()).hexdigest() == ( |
109 | | - "e5c10d37ed7cef08e8fa56a450f3c119de92d1ef99e3516ff6b106a8853c8186" |
110 | | - ) |
111 | | - # fd1b23b59 raised the existing body allowance, preserving every clause. |
112 | | - # Only that diagnostic number differs from the earlier frozen rendering. |
113 | | - assert hashlib.sha256(markdown.replace("max_chars=`5400`", "max_chars=`4800`").encode()).hexdigest() == ( |
114 | | - "29604e41d97963976ab8911e69c6328421aeaf63053cdb12c197dbe9b5291b9b" |
115 | | - ) |
| 95 | + # Assert the decision obligations rather than a hash of dated prose. |
| 96 | + # The full body must reach Markdown, with its executable guard only once. |
| 97 | + body = payload["task_body"] |
| 98 | + assert body in markdown |
| 99 | + assert markdown.count(payload["quota_guard_command"]) == 1 |
| 100 | + for obligation in ( |
| 101 | + "true=work+writeback; only false permits no-op", |
| 102 | + "Read agent_channel.work_context and required_reads (or envelope) before work", |
| 103 | + "retain original and cumulative outcome requirements", |
| 104 | + "reuse inline goal_acceptance, inspect only if absent, then refine", |
| 105 | + "Known new-Turn choice: add `--todo-id <id>` to first guard; otherwise", |
| 106 | + "use selection_command when required; re-enter as instructed, do/verify authorized work", |
| 107 | + "Settle with current settlement_plan.ordered_steps, else next_cli_actions", |
| 108 | + "preserve exact identities/effect ids and actual outcomes", |
| 109 | + "Never reconstruct static refresh/spend; ambiguous effects need readback/recovery, not blind retry", |
| 110 | + "Todo done≠Turn settled; no invented successor/--no-follow-up", |
| 111 | + "No wait spend", |
| 112 | + "Finish Goal only on terminal no-follow-up", |
| 113 | + "Destructive Git/production requires explicit authorization", |
| 114 | + ): |
| 115 | + assert obligation in body, obligation |
116 | 116 | spec = CLI_OUTPUT_MODE_VARIANT_BY_ID["heartbeat_prompt_brief"] |
117 | 117 | assert spec.max_chars == {"json": 11_400, "markdown": 9_600} |
118 | 118 | for output_format, text in (("json", encoded), ("markdown", markdown)): |
|
0 commit comments