Replace a 250ms sleep in the work-line test with a real control - #44
Merged
Merged
Conversation
leaf-agent
commented
Aug 26, 2026
leaf-agent
left a comment
Collaborator
Author
There was a problem hiding this comment.
The control is the right shape and the bug-back in the description checks out — #answer() is reachable only from this.#done.onclick (lf-options.js:242), so the group sends nothing but the one choose in this flow, and jobs being choose multiple keeps the #job-mounts chosen assertion load-bearing rather than letting the heater pick clear it.
One narrowing came along with the rewrite that the fix doesn't need — noted inline.
This was referenced Aug 26, 2026
max-sixty
added a commit
that referenced
this pull request
Aug 27, 2026
`test_local_work_chrome_does_not_take_its_holder_gesture` asserted an absence — no `action` in the log after clicking the work line — behind `page.wait_for_timeout(250)` and with no control. `tests/CLAUDE.md` names both halves of that: a wait consumes a fact the system states, and "an absence is also what a page that never had the behaviour produces, so a test asserting one names a control that must first produce the presence: the same gesture where it is supposed to work." The fix keeps the forbidden gesture, then presses a neighbouring option as that control and lets its send settle through `round_trip`. One outbox in gesture order means a pick the work line had taken would already stand ahead of it, so the whole log is read once and compared exactly — no budget, and the verdict now rests on a product fact. <details><summary>Bug-back, both directions</summary> The reading this guards is the `.lf-work-line` entry in `worksInside` ([leaf.js:842](https://github.com/max-sixty/leaf/blob/27631a26/plugins/leaf/skills/leaf/assets/leaf.js#L842)). **The new test still catches the real defect.** Dropping `".lf-work-line"` from that selector list makes the work line cast its holder's pick, and the new assertion fails on it: ``` At index 0 diff: ('jobs', {'options': ['job-mounts']}) != ('jobs', {'options': ['job-heater']}) ``` **The old test went green over a dead gesture.** With `lf-options`' click handler disabled outright — no option pickable anywhere on the page — the old form passed (`1 passed`), because nothing was left that could have written an `action`. The new form fails there, as a test with a control should: the control is not met. Worth being precise about what was *not* wrong: on this machine the 250 ms budget was not itself load-bearing. With the work-line defect injected, the old test failed even at `wait_for_timeout(0)` — the POST goes out inside the click and the server is in-process. The sleep is a convention violation and a standing hazard rather than the thing that hid a bug; the missing control is what made the test vacuous. </details> <details><summary>Verification</summary> - `uv run pytest tests/test_render_options.py -q --run-nightly` — 46 passed - `uv run pytest tests -q` — 549 passed, 6 skipped - `ruff format --diff` / `ruff check` — clean </details> --------- Co-authored-by: leaf-agent <318509791+leaf-agent@users.noreply.github.com> Co-authored-by: Maximilian Roos <m@maxroos.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_local_work_chrome_does_not_take_its_holder_gestureasserted an absence — noactionin the log after clicking the work line — behindpage.wait_for_timeout(250)and with no control.tests/CLAUDE.mdnames both halves of that: a wait consumes a fact the system states, and "an absence is also what a page that never had the behaviour produces, so a test asserting one names a control that must first produce the presence: the same gesture where it is supposed to work."The fix keeps the forbidden gesture, then presses a neighbouring option as that control and lets its send settle through
round_trip. One outbox in gesture order means a pick the work line had taken would already stand ahead of it, so the whole log is read once and compared exactly — no budget, and the verdict now rests on a product fact.Bug-back, both directions
The reading this guards is the
.lf-work-lineentry inworksInside(leaf.js:842).The new test still catches the real defect. Dropping
".lf-work-line"from that selector list makes the work line cast its holder's pick, and the new assertion fails on it:The old test went green over a dead gesture. With
lf-options' click handler disabled outright — no option pickable anywhere on the page — the old form passed (1 passed), because nothing was left that could have written anaction. The new form fails there, as a test with a control should: the control is not met.Worth being precise about what was not wrong: on this machine the 250 ms budget was not itself load-bearing. With the work-line defect injected, the old test failed even at
wait_for_timeout(0)— the POST goes out inside the click and the server is in-process. The sleep is a convention violation and a standing hazard rather than the thing that hid a bug; the missing control is what made the test vacuous.Verification
uv run pytest tests/test_render_options.py -q --run-nightly— 46 passeduv run pytest tests -q— 549 passed, 6 skippedruff format --diff/ruff check— clean