Repository navigation
Description
Found by a post-hoc review of #1775 (merged as a1508de3), commissioned specifically because the fixes applied after that PR's review were never re-reviewed before merge.
The problem
#1775 reverted a hand-rolled title_template pre-check that disagreed with the authoritative validate_template_tokens. Its commit message claims:
"Its three tests are replaced by three against the real authority, two of which pin the exact inputs where the pre-check diverged, so a future reintroduction fails."
That claim was false. Both tests passed with and without the diverging pre-check present, so neither would have caught a reintroduction.
Cause
The commit's own divergence table specified fields: [] for the empty-placeholder case — that is what makes the pre-check emit its confidently-wrong prescription. The test was written with fields: [{"name":"status"}], which resolves the placeholder, empties the pre-check's missing list, silences it, and lets the authority run anyway. Right fixture documented, wrong fixture used.
The unclosed case ("{equipment} {status") is structurally un-pinnable by an outcome assertion: pre-check and authority agree on the outcome (both reject) and differ only in which one speaks.
Fix (in this change)
test_create_schema_title_template_empty_placeholder_rejected:fieldscorrected to[], and the assertion tightened to the authority's exact phrasing (contains an empty '{}' placeholder) so a second validator speaking first is detected. Verified by reintroducing the pre-check and confirming the test fails, then removing it.test_create_schema_title_template_unclosed_placeholder_rejected: dropped the un-pinnable claim; now asserts the authority's exact wording, which at least catches a reintroduction that rewords the error. Comment states plainly what this input can and cannot guarantee.
Also in this change
- Stale comment at
agent_loop.rstail-inference path said "Reached only via the duplicate-call guard's break" — the consecutive-parse-failure guard added in Agent emits malformed tool calls: title_template referencing undefined fields, and calls with empty arguments #1775 is a second entry point. - The deferred Display/Debug sweep: four
"Invalid parameters: {}"sites inschema/mod.rsproducedinvalid params: Invalid parameters: ...to the model, andtools.rsstill Debug-formatted aMarkdownErrorincreate_nodes_from_markdown. These were skipped from Agent emits malformed tool calls: title_template referencing undefined fields, and calls with empty arguments #1775 as scope creep; the review judged that call wrong given the same defect was fixed one function away in the same change, and it is right.
The general lesson
A regression test must fail on the code it exists to exclude. A test that passes either way is not a guard — it is worse than no test, because the accompanying claim invites a future maintainer to trust a ratchet that is not there. Verify a new regression test by actually reintroducing the defect.
Acceptance criteria
- The empty-placeholder test fails when the diverging pre-check is reintroduced (demonstrated, not assumed)
- The unclosed-placeholder test no longer carries a guarantee it cannot provide
-
agent_loop.rstail-path comment names both entry points - No
MarkdownErrorreaches the model via{:?}; no doubledinvalid params:preamble
Activity
Make the title_template regression tests actually fail on the defect (c…