Skip to content

Collect the suite's browser problems as records, and the health sensors' as data - #2694

Merged
max-sixty merged 8 commits into
mainfrom
browser-problem-records
Oct 13, 2026
Merged

max-sixty merged 8 commits into
mainfrom
browser-problem-records

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

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:

"400 http://127.0.0.1:53111/api/event"

matched by consume_browser_errors(page, "400"), which read a leading 400 . After:

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:

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 Findings since Report render-gate and page-check findings as records, with page 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

  • 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

max-sixty and others added 6 commits October 12, 2026 15:34
`leaf package check PACKAGE --render --json` prints one object: `status`,
each widget quality finding as a record (`code`, `at`, `values`,
`severity`, `text`), and `browser`, naming the gate asked for and run and
the browser that ran it, or why none could. Without `--render` it prints
the object with no findings and a null `browser`. Without `--json`, the
lines a reader sees are unchanged.

The command boundary now renders a `WidgetQuality` record rather than
printing as it reads. Worked examples that cannot be drawn become an
`unreadable-examples` error finding; its words are the line the command
printed before.

`test_package_check_render_reports_findings_as_advice` reads the records
from `--json` instead of regex-parsing first-paint sizes out of the lines.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…-json`

`package check --json` now prints its object when the package check
refuses the package, with the refusal as a `package` error finding and
status 1, rather than exiting with empty stdout. Examples that cannot be
drawn keep the name of the browser that tried to draw them. Without
`--json`, output is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…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
# Conflicts:
#	skills/leaf/scripts/leaf/findings.py
#	tests/render_harness.py
# Conflicts:
#	skills/leaf/scripts/leaf/findings.py
leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
No user-visible behaviour changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
…iew journey

`get_by_role("dialog")` resolves to `.lf-auxiliary-envelope`, a native
dialog sized 0x0 by design (`chrome.css`), so `to_be_visible()` failed
on main too and `to_be_hidden()` held whether or not the panel closed.
The journey now checks the `Threads` region the envelope holds. No
user-visible behaviour changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a8a2674 into main Oct 13, 2026
3 checks passed
@max-sixty
max-sixty deleted the browser-problem-records branch October 13, 2026 00:34
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