Skip to content

Ask the code gate which role came back unread, not what ratio it read at - #149

Merged
max-sixty merged 1 commit into
mainfrom
fix/ci-33340636265
Aug 31, 2026
Merged

Ask the code gate which role came back unread, not what ratio it read at#149
max-sixty merged 1 commit into
mainfrom
fix/ci-33340636265

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

ci on main has been red on tests/test_render_gate.py::test_the_render_gate_reports_code_the_reader_cannot_tell_from_its_block since a8b6636 ("Improve code and diff presentation"), and it is still red on today's main — reproduced locally at 2d46d4a:

AssertionError: ['[light] code marked cm reads at 3.4:1 against the block it is set on']
assert []

The test pinned the exact contrast ratio the gate's finding prints. That ratio is a reading of the theme's own surfaces, so when the commit moved --pre-bg from #f5f2e9 to #f5f5f3 as part of the near-neutral code palette, the faint fixture's #8b8577 went from 3.3:1 to 3.4:1 and the startswith(... "reads at 3.3:1") filter came back empty. Nothing about the gate or the palette is wrong — the theme change was the point of the commit, and the same commit deleted the theme comment that was the 3.3 digit's source.

Solution

Both ratio-pinned assertions now ask which role came back unread rather than what number it read at. unreadSyntax emits that sentence only where read < 4.5, so the finding's presence is the claim the test is making; the digits proved nothing extra and made every palette change a failure of this test rather than of the page. The second assertion carried the identical brittleness on --syn-string and is fixed in the same pass rather than left to redden on the next palette move. The two fixture comments that restated the same theme-owned digits are updated to state the colour and not the reading.

Nothing is loosened that the cases were arranged to distinguish. The faint case still asserts that only the role the style touched is named. The tinted case still discriminates the per-surface reading from a per-role one, because that role clears the threshold on the block — a gate that stopped at its clean line reports nothing at all.

Testing

  • The single test fails on origin/main (2d46d4a) and passes with this change.
  • uv run pytest tests/test_render_gate.py — 69 passed.
  • Mutation check on the assertion this change loosened: keying unreadSyntax's seen set on the role alone instead of role-plus-surface — the "one block colour taken once per role" bug the tinted case exists to catch — still fails the test, with the finding list empty. The gate was restored afterwards; this PR touches no runtime file.
  • ruff format --check and ruff check clean on both files.

The other 29 tests red in that run predate this commit, and the two that appeared alongside this one (test_a_reader_arrives_at_what_they_left_rather_than_watching_it_arrive, test_a_label_press_keeps_the_controls_keyboard_standing) did not recur on the next commit's run and pass locally — races rather than regressions, so they are out of scope here.

How the failure was isolated

Failure lists from three consecutive ci runs on main, diffed:

run commit failures
33340551132 f8dffeb (parent) 30
33340636265 a8b6636 32
33340823726 650db7e (child) 31

Three failures are new at a8b6636; only this one recurs on the child run.

Arithmetic behind the move: #8b8577 has relative luminance 0.2360. Against #f5f2e9 (0.8880) that is (0.938)/(0.286) = 3.28 → 3.3; against #f5f5f3 (0.9119) it is 3.36 → 3.4.

grep for other pinned ratios across tests/*.py found only test_interact_document.py:3590, which computes its threshold rather than pinning a reading.

This follows the shape of #66, which replaced a pinned number with the relation it stood for.


Automated fix for failed run

The gate test pinned the exact contrast ratios its findings print. Those ratios are readings of the theme's own surfaces, so "Improve code and diff presentation" moving --pre-bg from #f5f2e9 to #f5f5f3 turned the faint fixture's 3.3:1 into 3.4:1 and reddened the nightly suite.

The gate prints that sentence only for a role it read under 4.5:1, so the finding's presence is the claim the test is making; the digits added nothing and made every palette change a failure here. Both assertions now ask which role came back unread. The tinted case still discriminates: that role clears the threshold on the block, so a gate taking one colour per role reports nothing at all.
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.

2 participants