Repository navigation
Conversation
…rs' as data
The browser fixture's per-page problem list (`page.lf_errors`) now holds
`Finding` records (`render_gate/findings.py`) instead of sentences: the
console entries, failed responses, exceptions and window errors it takes
from Playwright's events, as the render gate takes them, and the health
sensors' findings. `write_watch.js`, `shift_watch.js` and `words_watch.js`
hand each finding over through a `__leafWatchFinding` binding as
`{code, ...values}`. They no longer write a sentence to the console, and
the shift watch's evidence travels as a field, not as `shift evidence:
{json}` inside one. The sensors' codes are `moved-without-input`,
`typing-moved`, `shift-watch-missed`, `unchanged-write` and
`words-left-screen`, and their words, written once in the findings
module, are the sentences the sensors used to print. A console entry's
record also carries the script that wrote it (`url`).
Tests name an expected problem by its fields, `{"code": "failed-load",
"status": 400}` or a function of the record, or by a fragment of what the
page itself said (`render_harness.is_problem`). The fragment checks over
the harness's and sensors' sentences, about 140 of them, are now field
checks. A recurring ResizeObserver notice is the notice's record with
`confirmation: recurred`, as the gate reports it. `collect_page_errors`
and `collect_page_exceptions` collect records, and `leaf-dev probe`,
`verify-site`, the journey and the example previews render them at their
output. A failing test prints each problem in its words.
No user-visible behaviour changes. `leaf-dev probe`'s `errors` and the
verifier's messages print the same words as before.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/scripts/leaf/findings.py # tests/render_harness.py
leaf-agent
reviewed
Oct 12, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The code review found no issue. The PR description says this branch is stacked on #2684 and will be retargeted to main after that merges. I’m withholding approval until that dependency lands and the resulting PR is ready to merge.
max-sixty
added a commit
that referenced
this pull request
Oct 13, 2026
…rs' as data (#2694) The browser fixture's per-page problem list (`page.lf_errors`) now holds `Finding` records (`leaf/findings.py`, #2662) instead of sentences. Tests read the records by field, and render text only in a failing assertion's message. This is the second follow-up #2662 named. The third, `package check --json`, landed in #2684. This replaces #2691, which closed when its stacked base branch was deleted. ## Before and after: one harness entry A refused event POST, before: ```python "400 http://127.0.0.1:53111/api/event" ``` matched by `consume_browser_errors(page, "400")`, which read a leading `400 `. After: ```python Finding(code="failed-load", values={"status": 400, "url": "http://127.0.0.1:53111/api/event"}) ``` matched by `consume_browser_errors(page, {"code": "failed-load", "status": 400})`. A health sensor's report, before, a console sentence that `shift_evidence` split the JSON back out of: ``` button#control moved without input by (0, 40)px shift evidence: {"kind": "passive", "node": "button#control", "comparisons": [...]} ``` After, a record the shift watch hands over through a binding, which `str()` still words as above: ```python Finding(code="moved-without-input", values={"node": "button#control", "by": [0, 40], "beside": [], "evidence": {"kind": "passive", "node": "button#control", "comparisons": [...]}}) ``` ## What changed - **Playwright's events.** `watched()` keeps the record `console_finding`, `window_finding` and `exception_finding` already built, rather than `str()` of it. These are the same readers the render gate uses. A console entry's record also carries the script that wrote it (`url`). A recurring ResizeObserver notice is that notice's record with `confirmation: "recurred"`, as the gate reports it, and `RECURRING_RESIZE_NOTICE` is gone. - **Sensors hand over data.** `write_watch.js`, `shift_watch.js` and `words_watch.js` call a `__leafWatchFinding` binding with `{code, ...values}`. Before, they wrote sentences to the console. The new codes are `moved-without-input`, `typing-moved`, `shift-watch-missed`, `unchanged-write` and `words-left-screen`. Their words live in `leaf/findings.py` and are the sentences the sensors used to print. Shift evidence is the `evidence` field, and `shift_evidence()` reads it directly. - **Matching.** `render_harness.is_problem` is the one matcher behind `consume_browser_errors` and `reported_browser_errors`. It accepts three forms: - a dict `{code, ...fields}`, each field compared by equality; - a function of the record; - a string, a fragment of the first line of what the page itself said (`said()`), for console entries, exceptions and window errors. The digit-prefix rule (`_names`) is gone. Every fragment check over a harness or sensor sentence is now a field check: HTTP statuses, shift nodes and offsets, typed words and their field, unchanged writes. The shift tests' `moved_within(place)` and `names_move` read the watch's node names, which place a text node or a shadow-tree node inside its element (`#text in button#control`). The old substring checks relied on that. - **Other collectors.** `collect_page_errors` and `collect_page_exceptions` collect records. The gate's own page-error listener uses `collect_page_exceptions`. `leaf-dev probe`, the site verifier, `leaf-dev journey`, the example previews and the arrangement gate print the records' words where they output, so their output is unchanged. - `tests/journeys/test_render_commands.py::test_plain_check_reports_page_request_failures_but_ignores_optional_assets` still called `.startswith` on `run_page_code`'s records, which have been `Finding`s since #2662. It now reads their fields. - `tests/AGENTS.md`, "Browser errors", says how to name an expected problem. No user-visible behaviour changes. ## Proof - Every browser-tier test whose source this changes, by node ID: 422 passed. The touched journeys-tier tests: 48 passed and 4 failed. `test_message_delivery_appearance_and_first_frame[panel*]` (appearance changed in the pending states, a macOS image comparison) fails the same way on the base commit, run in a throwaway checkout. `test_an_authenticated_navigation_journey_becomes_credential_free_review_evidence` also failed on the base: it asserted `get_by_role("dialog")` visible, which resolves to the 0x0 `.lf-auxiliary-envelope`. It now reads the `Threads` region inside the envelope, and passes. - `tests/model/test_chrome_contracts.py` passes; its fake page now holds records too. - `tests/browser/test_website_server.py` and `test_html_control_uses_browser_without_leaf_payload` pass. The latter fails only when it shares an xdist worker with a browser-fixture test ("Sync API inside the asyncio loop"), independent of this change. ## Left for a follow-up - The sensors still name a node with a string grammar (`#text in div.cm-line in shadow of leaf-text#field`), which `moved_within` reads by suffix. Reporting the node's element and shadow host as fields would remove that last parse. > _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.
The browser fixture's per-page problem list (
page.lf_errors) now holdsFindingrecords (leaf/findings.py, #2662) instead of sentences. Tests read the records by field, and render text only in a failing assertion's message. This is the second follow-up #2662 named. Stacked on #2684 (package check --json, the third follow-up); this PR retargets tomainonce that merges.Before and after: one harness entry
A refused event POST, before:
"400 http://127.0.0.1:53111/api/event"matched by
consume_browser_errors(page, "400"), which read a leading400. After:matched by
consume_browser_errors(page, {"code": "failed-load", "status": 400}).A health sensor's report, before, a console sentence that
shift_evidencesplit the JSON back out of:After, a record the shift watch hands over through a binding, which
str()still words as above:What changed
watched()keeps the recordconsole_finding,window_findingandexception_findingalready built, rather thanstr()of it. These are the same readers the render gate uses. A console entry's record also carries the script that wrote it (url). A recurring ResizeObserver notice is that notice's record withconfirmation: "recurred", as the gate reports it, andRECURRING_RESIZE_NOTICEis gone.write_watch.js,shift_watch.jsandwords_watch.jscall a__leafWatchFindingbinding with{code, ...values}. Before, they wrote sentences to the console. The new codes aremoved-without-input,typing-moved,shift-watch-missed,unchanged-writeandwords-left-screen. Their words live inleaf/findings.pyand are the sentences the sensors used to print. Shift evidence is theevidencefield, andshift_evidence()reads it directly.render_harness.is_problemis the one matcher behindconsume_browser_errorsandreported_browser_errors. It accepts three forms:{code, ...fields}, each field compared by equality;said()), for console entries, exceptions and window errors.The digit-prefix rule (
_names) is gone. Every fragment check over a harness or sensor sentence is now a field check: HTTP statuses, shift nodes and offsets, typed words and their field, unchanged writes. The shift tests'moved_within(place)andnames_moveread the watch's node names, which place a text node or a shadow-tree node inside its element (#text in button#control). The old substring checks relied on that.collect_page_errorsandcollect_page_exceptionscollect records. The gate's own page-error listener usescollect_page_exceptions.leaf-dev probe, the site verifier,leaf-dev journey, the example previews and the arrangement gate print the records' words where they output, so their output is unchanged.tests/journeys/test_render_commands.py::test_plain_check_reports_page_request_failures_but_ignores_optional_assetsstill called.startswithonrun_page_code's records, which have beenFindings since Report render-gate and page-check findings as records, withpage check --json#2662. It now reads their fields.tests/AGENTS.md, "Browser errors", says how to name an expected problem.No user-visible behaviour changes.
Proof
test_message_delivery_appearance_and_first_frame[panel*](appearance changed in the pending states) andtest_an_authenticated_navigation_journey_becomes_credential_free_review_evidence(Threads dialog not visible aftergShift+t).tests/browser/test_website_server.pyandtest_html_control_uses_browser_without_leaf_payloadpass. The latter fails only when it shares an xdist worker with a browser-fixture test ("Sync API inside the asyncio loop"), independent of this change.Left for a follow-up
#text in div.cm-line in shadow of leaf-text#field), whichmoved_withinreads by suffix. Reporting the node's element and shadow host as fields would remove that last parse.