Skip to content

Follow-up to #1775: title_template regression tests do not fail on the defect they claim to guard #1783

Closed

Description

@malibio

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: fields corrected 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

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.rs tail-path comment names both entry points
  • No MarkdownError reaches the model via {:?}; no doubled invalid params: preamble

Activity

  1. added
    bug
    on Jul 28, 2026
  2. added a commit that references this issue on Jul 28, 2026
    751d149
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions