Skip to content

RE: fix brittle byte-window test for diagram render-failure fallback - #116

Merged
dwolfson merged 1 commit into
mainfrom
re/diagram-test-ordering-fix
Sep 17, 2026
Merged

dwolfson merged 1 commit into
mainfrom
re/diagram-test-ordering-fix

Conversation

@dwolfson

Copy link
Copy Markdown
Owner

Summary

  • test_a_render_failure_degrades_the_answer_not_the_whole_message asserted a fixed 2200-byte window contained catch after the mermaid try-block — brittle to any upstream edit shifting byte offsets (this is exactly what broke when re/honest-stages split app.js).
  • Replaced with brace-matching: find the try { block immediately following f.value.mermaid, then check catch appears within 200 chars of that block's actual closing brace.

Test plan

  • uv run pytest tests/test_fact_answer_rendering.py -q

🤖 Generated with Claude Code

test_a_render_failure_degrades_the_answer_not_the_whole_message asserted
"catch" within a fixed byte distance of f.value.mermaid in
_renderEnvelopeMarkdown (index.html) -- widened once already (2026-09-08)
when the success branch grew a perspective note, and drifted past the new
window again after this week's "found by" rename (RULING-WHAT-A-VERDICT-
IS-ABOUT.md), which is unrelated to the guarantee the test exists to pin.

The comment already said the guarantee is ordering, not a specific byte
distance -- the assertion just didn't match it. Brace-match the try{}
immediately after f.value.mermaid and check its own catch{} follows,
which cannot drift as the surrounding success branch grows.

Flagged by a peer session mid-dispatch: this failure blocks the full
suite for every branch touching app.js-adjacent rendering, independent
of PLAN-FINISH-REPOS.md's app.js split.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
@dwolfson
dwolfson merged commit cb7379e into main Sep 17, 2026
3 checks passed
dwolfson added a commit that referenced this pull request Sep 17, 2026
re/honest-stages branched before #116 merged, so its CI ran against
the old byte-window assertion and failed on the same pre-existing
bug #116 fixes — not a regression from this branch's own changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant