Repository navigation
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 <[email protected]> Co-authored-by: Maximilian Roos <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 23, 2026
…3692) The workspace section of `skills/leaf/references/page-layout.md` now asks authors to aim to keep each region's decision in view in a window about 720px tall, because many readers open workspaces on laptops that give about that much height. Before this, the section named a 720px width breakpoint but no height, so nothing prompted an author to look at how a workspace reads in a short window. The laptop windows in question run about 540–730px tall: a 1080p Windows laptop at 125–150% scaling, or a 13-inch MacBook Air with the Dock shown. rust-sort's stage pane, for one, overflows by 44px at 1280×720 and puts its closing comparison out of view. The line is a goal the authoring agent weighs against its page. No check enforces it, and `page check` gives no new advice. This is Max's decision #43 on the overnight report ("Guidance only: no check; the goal line alone"). A temporary eval (not committed) asked Claude Code for a two-region workspace whose stage holds a drawing, a comparison and a three-way choice, with no window size in the request, and judged whether the choice stays in view at 1280×720. Both arms read `page-layout.md`; both scored 0 of 3, every page stacking a 280–440px drawing and its text above the choice. A stronger wording ("plan each region's height for that window as well as its width") also scored 0 of 3, so this PR keeps the shorter line. The probe can't render, so it measures only what the line does without a picture; `page check --render` screens at a laptop height, proposed as decision #44, are what would let an author see the overflow. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 23, 2026
…3696) `page check --render` now reads a page's desktop at the window of the browser that last reported viewing it, and at a fixed 1280×720 laptop window when no browser has reported in the last day. Before, it read every page at 1200×900, taller than many laptop windows, so it never saw a page that only breaks in a shorter one. This implements Max's decisions #44 ("Read desktop at 1280×720") and #45 ("for the normal runtime we should do the current viewport; for evals etc we should obv override it") on the overnight report. **Which window.** The gate takes the latest report in the page's `user-views.json` (`render_gate.command.desktop_viewport`). It uses the report's layout `viewport`, such as Max's 1728×999, and not its `shown_window` (1728×941), because the gate draws Leaf's panel into the viewport just as the user's browser did. Matching the shown window would subtract the panel twice. A report counts while the page keeps it, which is one day (`user_views.RETAIN_FOR`); window sizes rarely change, so any kept report is a better guess than the fixed window. **What follows the window.** The width sweep (360–1920px), the margin-width renders and the saved desktop and widest-window screens use the chosen window's height. The phone render stays at 540×720 with its own sweep, and the phone screens stay at 390×844. The page's own code run (`run_page_code`) and `package check --render` have no viewer to follow, so they read at the fixed window, which is now 1280×720. **The pin.** Callers whose verdicts must not depend on who last viewed a page set `LEAF_RENDER_VIEWPORT=fixed`, which reads 1280×720 whatever the page has seen. The suite's `isolated_session` fixture sets it, which covers CI, and so does `leaf_dev.arms.environment`, which every eval agent, journey and arm command takes its environment from. Any other value is an error. Tests and the corpus that call `render_version` directly get 1280×720 by default. **Output.** `browser.desktop` in the `page check` JSON names the window and where it came from: `{"width": 1728, "height": 999, "from": "the user's window"}`, or `"fixed, since no browser has shown the page in a day"`, or `"fixed, pinned by LEAF_RENDER_VIEWPORT"`. `page-checkpoints.md` and `conversation-loop.md` tell the agent so. **Checks.** - A new model test covers the choice: no report gives 1280×720, the latest of two reports wins, a report more than a day old drops out, the pin gives 1280×720, and a bad pin raises. - A new journey test runs `page check --render` on a page with a 1000×640 report. Unpinned, it reads `{"width": 1000, "height": 640, "from": "the user's window"}` and saves `1000px-1.png`. Pinned, it reads 1280×720. - On a copy of a real page carrying Max's 1728×999 report, the unpinned check read 1728×999 and saved `1728px-*.png`. With the pin it read 1280×720. Both passed. - I ran the render gate over all 40 corpus pages (shipped examples, regression pages and developer pages) at 1200×900 before this change and at 1280×720 after it. Only one page gained a refusal: `developer/visual-review-gallery`. Its mobile-capture `lf-shot` already failed at 1200×900, drawn 18px outside its box at every width. That page already fails `test_page_fixture_renders` in the nightly run. At 720px tall, its bounded region leaves the shot about 5px, so its toolbar controls are clipped at 720–920px wide. The shorter window shows a real defect on a page that was already red, so this PR leaves it as is. The only other change was in advice: pr-walkthrough's `lf-pr-brief` now draws 1034px tall where it drew 1062px. The overflowing panes the earlier survey named, rust-sort's stage and source and wt-merge's step list, scroll and refuse nothing. Per #43, they stay unchecked. - `test_the_render_gate_fails_a_page_that_scrolls_sideways_only_between_viewports` now reads a 1280×900 desktop. At 720px tall, the desktop sweep would also catch its short-window case, which is meant to show that the phone sweep catches a clip a taller user window would miss. `test_bundled_widgets_meet_the_widget_quality_checks` fails on its `lf-code` and `lf-shot` worked examples at 1280×720, and fails with the same findings at 1200×900 on this tree, so that failure was there before this change. `evals/record-read-without-the-notes` still quotes an old check's "1200x900" output, because it replays a recorded session. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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