fix(p16): the pre-call announcement must state the cap the run will use, not the constants

announce() read _DEFAULT_MAX_ROUNDS/_DEFAULT_MAX_TOKENS directly, which was correct only while
main() could not do otherwise. MEASURED on the first free drill after --max-rounds landed: the same
stdout said "Stops at: 3 rounds / 100000 tokens" two lines above "max_rounds=8, max_tokens=120000".
The announcement is the ONE thing printed before the first paid call and its whole job is to say
what the run will do -- the Fase-3 class, introduced by the very flag being announced.

Load-bearing MEASURED: arm (f) red before the fix; M16 (read the constants again) -> 1 red, that
arm ALONE. Green control 1670/5, golden BYTE-UNCHANGED (ea8c534...).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-14 12:21:29 +02:00
commit a61a3ccda7
3 changed files with 55 additions and 2 deletions

View file

@ -143,3 +143,43 @@ def test_e_the_documented_dry_run_command_form_is_accepted(tmp_path: Path) -> No
)
assert "unrecognized arguments" not in proc.stderr, proc.stderr
assert proc.returncode == 0, proc.stderr
def test_f_the_announcement_states_the_cap_the_run_will_actually_use(
tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
"""``announce`` is the ONE thing printed BEFORE the first paid call, and its whole job is to
say what the run will do. It read ``_DEFAULT_MAX_ROUNDS``/``_DEFAULT_MAX_TOKENS`` directly,
which was correct only by accident while ``main()`` could not do otherwise. MEASURED on the
first free drill after the flags landed: the same stdout said ``Stops at: 3 rounds /
100000 tokens`` two lines above ``max_rounds=8, max_tokens=120000`` the Fase-3 class (a
claim the surface makes about itself), introduced by the flag it announces."""
base = _base(tmp_path)
mandate = tmp_path / "m.json"
mandate.write_text(
'{"objective":"o","success_criteria":"s","approaches":'
'[{"id":"a1","label":"L","affected_codes":["C"],"claimed_saving_nok":1.0}]}',
encoding="utf-8",
)
rc = run_module.main(
[
"P1",
"--profile",
"local",
"--docs-dir",
str(base),
"--bundle-dir",
str(base),
"--mandate",
str(mandate),
"--max-rounds",
"8",
"--max-tokens",
"120000",
"--live-dry-run",
]
)
assert rc == 0
out = capsys.readouterr().out
assert "Stops at: 8 rounds / 120000 tokens" in out, out
assert "3 rounds / 100000 tokens" not in out