Skip to content

Read a chart's two labels on each other as two labels - #62

Merged
max-sixty merged 2 commits into
mainfrom
fix/covered-words-label-reach
Aug 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/covered-words-label-reach

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Problem

This came out of reviewing #58, which landed as 999f933c while the review was running. The fix itself is right and this does not touch it — what it leaves behind is an exemption with one leg.

999f933c holds a label's own lines out of COVERED_WORDS: an SVG <text> spells a line break as an element, so two lines of one tick are two nodes where a wrapped paragraph's are one, and the pair overlapped by construction on a drawing where no glyph comes near another. test_the_gate_passes_a_chart_whose_tick_names_its_month_on_a_second_line proves the hold fires. Nothing proves it is narrow.

Widen el.closest('text') to closest('g') or closest('svg') — every tick of an axis sits inside both — and every word of a chart stops being read against every other word of that chart. The whole suite stays green. I ran it rather than reasoning about it: with the predicate widened, tests/test_render_gate.py, tests/test_render_widgets.py and tests/test_render_export.py give 18 passed over every case naming this pass, the new exemption test among them.

Nothing else in the suite can see it, for four separate reasons:

  • The corpus sweeps and the copy assert this pass returns nothing, which a wider hold only makes more true.
  • test_no_two_of_a_chart_s_words_land_in_the_same_place reads CHART_COLLISIONS, which compares whole <text> boxes and never reaches this pass.
  • The exemption test defeats the predicate wholesale (.replace("a.label && a.label === b.label", "false")), so its reported leg is identical however label was computed.
  • The only standing bug-back on COVERED_WORDS reporting is test_the_covered_words_gate_still_reads_a_control_in_the_flow, and that is an HTML page whose runs never get an SVG label at all.

That test's docstring is the precedent this is written from: "a gate that has only ever passed has been tested for nothing, and this one is one predicate away from exempting every control there is." The same sentence is true of the new predicate one element up. tests/CLAUDE.md states the general shape under Make a green test non-vacuous — "A reading blind to one mechanism does not report that it is blind — it returns the same clean result it returns when nothing is wrong."

Solution

The other half, put back as a bug, the way the float's two halves are already written. One whole <text> stood on another by copying its transform, so the labels stay whole and what lands is two of them rather than two lines of one. Arranged that way rather than by spreading a label's lines, because the hold asks which <text> drew a line and not how far a line was moved — and because it depends on neither the axis's leading nor a neighbouring chart's layout.

Test-only. render_checks.py is untouched.

Testing

Every run below at -n0 on this branch, based on 999f933c.

  • uv run pytest tests/test_render_widgets.py — 58 passed.
  • Bug-back, closest('text') → closest('svg'): the new test fails on two of a chart's labels stood on each other unreported: []; the exemption test still passes.
  • Bug-back, closest('text') → closest('g'): same failure, same complement.
  • The complement, with if (a.label && a.label === b.label) continue; removed entirely: the exemption test fails on held with <lf-chart id=c-line> draws "1" in the same place as <lf-chart id=c-line>'s "Jun", and the new test still passes. The two are about different halves and neither stands in for the other.
  • Repeated 5× at -n0: passed each time.
  • pre-commit run --files tests/test_render_widgets.py — passed.
What the arrangement produces

The two ticks and the finding, printed from the reading during development:

MOVED: ['20', '22']
FOUND: ['<lf-chart id=c-line> draws "20" in the same place as <lf-chart id=c-line>\'s "22"']

The assertion matches on both labels in their quoted form rather than on the chart id, so a finding about some other pair in the same chart cannot satisfy it.

999f933 holds a label's own lines out of the pass hunting words drawn on
other words: an SVG <text> spells a line break as an element, so two lines
of one tick are two nodes where a wrapped paragraph's are one, and the pair
overlapped by construction on a drawing where no glyph comes near another.

The exemption has one leg. `test_the_gate_passes_a_chart_whose_tick_names_its_month_on_a_second_line`
proves the hold fires, and nothing proves it is narrow: widen
`el.closest('text')` to `closest('g')` or `closest('svg')` and every word of
a chart stops being read against every other word of that chart, with the
whole suite still green. The corpus sweeps and the copy assert this pass
returns nothing, which a wider hold only makes more true; the chart's own
collision test reads CHART_COLLISIONS, which compares whole <text> boxes and
cannot see this pass; and the exemption test defeats the predicate wholesale,
so its reported leg is the same either way. The only standing bug-back on
this pass reporting is the float's, and that is an HTML page whose runs never
get an SVG label at all.

So the other half, put back as a bug, the way the float's two halves are
already written: one whole <text> stood on another, where the labels stay
whole and what lands is two of them rather than two lines of one. It fails
under both widenings above and passes with the fix as it stands; the
exemption test is the complement and fails with the hold removed while this
one still passes.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test-only, and it pins the leg #58's exemption left unheld. I reran the widening bug-back independently on this branch rather than taking the description's word for it: with const label = el.closest('text') in render_checks.py changed to closest('g'), this test fails on two of a chart's labels stood on each other unreported: [] while test_the_gate_passes_a_chart_whose_tick_names_its_month_on_a_second_line stays green. So the pair does hold the predicate where it is, from both sides.

One robustness point inline on how the two ticks are picked.

Comment thread tests/test_render_widgets.py Resolved
@max-sixty
max-sixty merged commit 8a8902d into main Aug 26, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/covered-words-label-reach branch August 26, 2026 23:59
max-sixty added a commit that referenced this pull request Aug 27, 2026
## Problem

This came out of reviewing #58, which landed as
[999f933](999f933)
while the review was running. The fix itself is right and this does not
touch it — what it leaves behind is an exemption with one leg.

`999f933c` holds a label's own lines out of `COVERED_WORDS`: an SVG
`<text>` spells a line break as an element, so two lines of one tick are
two nodes where a wrapped paragraph's are one, and the pair overlapped
by construction on a drawing where no glyph comes near another.
`test_the_gate_passes_a_chart_whose_tick_names_its_month_on_a_second_line`
proves the hold fires. Nothing proves it is narrow.

Widen `el.closest('text')` to `closest('g')` or `closest('svg')` — every
tick of an axis sits inside both — and every word of a chart stops being
read against every other word of that chart. The whole suite stays
green. I ran it rather than reasoning about it: with the predicate
widened, `tests/test_render_gate.py`, `tests/test_render_widgets.py` and
`tests/test_render_export.py` give 18 passed over every case naming this
pass, the new exemption test among them.

Nothing else in the suite can see it, for four separate reasons:

- The corpus sweeps and the copy assert this pass returns nothing, which
a wider hold only makes more true.
- `test_no_two_of_a_chart_s_words_land_in_the_same_place` reads
`CHART_COLLISIONS`, which compares whole `<text>` boxes and never
reaches this pass.
- The exemption test defeats the predicate wholesale (`.replace("a.label
&& a.label === b.label", "false")`), so its `reported` leg is identical
however `label` was computed.
- The only standing bug-back on `COVERED_WORDS` *reporting* is
`test_the_covered_words_gate_still_reads_a_control_in_the_flow`, and
that is an HTML page whose runs never get an SVG label at all.

That test's docstring is the precedent this is written from: "a gate
that has only ever passed has been tested for nothing, and this one is
one predicate away from exempting every control there is." The same
sentence is true of the new predicate one element up. `tests/CLAUDE.md`
states the general shape under **Make a green test non-vacuous** — "A
reading blind to one mechanism does not report that it is blind — it
returns the same clean result it returns when nothing is wrong."

## Solution

The other half, put back as a bug, the way the float's two halves are
already written. One whole `<text>` stood on another by copying its
`transform`, so the labels stay whole and what lands is two of them
rather than two lines of one. Arranged that way rather than by spreading
a label's lines, because the hold asks which `<text>` drew a line and
not how far a line was moved — and because it depends on neither the
axis's leading nor a neighbouring chart's layout.

Test-only. `render_checks.py` is untouched.

## Testing

Every run below at `-n0` on this branch, based on `999f933c`.

- `uv run pytest tests/test_render_widgets.py` — 58 passed.
- Bug-back, `closest('text')` → `closest('svg')`: the new test fails on
`two of a chart's labels stood on each other unreported: []`; the
exemption test still passes.
- Bug-back, `closest('text')` → `closest('g')`: same failure, same
complement.
- The complement, with `if (a.label && a.label === b.label) continue;`
removed entirely: the exemption test fails on `held` with `<lf-chart
id=c-line> draws "1" in the same place as <lf-chart id=c-line>'s "Jun"`,
and the new test still passes. The two are about different halves and
neither stands in for the other.
- Repeated 5× at `-n0`: passed each time.
- `pre-commit run --files tests/test_render_widgets.py` — passed.

<details><summary>What the arrangement produces</summary>

The two ticks and the finding, printed from the reading during
development:

```
MOVED: ['20', '22']
FOUND: ['<lf-chart id=c-line> draws "20" in the same place as <lf-chart id=c-line>\'s "22"']
```

The assertion matches on both labels in their quoted form rather than on
the chart id, so a finding about some other pair in the same chart
cannot satisfy it.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
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