Skip to content

Report render-gate and page-check findings as records, with page check --json - #2662

Merged
max-sixty merged 6 commits into
mainfrom
findings-as-records
Oct 12, 2026
Merged

max-sixty merged 6 commits into
mainfrom
findings-as-records

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The render gate, the page-code run, the markup checks and the widget quality report now report findings as records, and page check --json prints them. A finding (render_gate/findings.py) has a code, the element it names as at (in the form locate.js uses), the measured values, a severity (error or advice), and where it was read: scheme, viewports and swept widths. Each check produces the record where it detects the finding, and the browser probes return records rather than sentences. The words are written once, in the findings module's code table, and printed only at the command boundary. widget_quality.Finding is folded into this type, so the gate and package check --render share one record.

What changed

  • Probes return data. render-checks/*.js (layout, reachability, words, widgets, replay, scrollbars, framing, driver) and the runtime's visual-parts.js return {code, at, …values} instead of strings. A squeezed table carries each column's heading, width and whether it wraps, and a sweep consumer reads the widths from those fields. The deleted test pulled them back out of the sentence with "wraps at (\d+)px".
  • One renderer. str(finding) writes the sentence, adding [scheme], at N–Mpx wide, and (at WxH) from the fields. Finding.json() writes the same record for machines.
  • Retry policy reads fields. version.render_version marks a ResizeObserver notice as recurred or incomplete through a confirmation value. It no longer appends a suffix to the words.
  • Window errors arrive typed. render-checks/init.js used to write window error: … to the console, and Python then classified the line by prefix. It now calls a binding with {text, resizeLoop}, and install_window_errors(page, heard) hands each record to its readers. The gate, the suite's navigate, and the arrival reading route notices by that field. resize_observer_error and RESIZE_OBSERVER_ERROR are deleted.
  • page check --json prints one object with three keys. status is the exit status. findings holds every finding as a record together with its text. browser names the gates asked for and those that ran (failing page code ends the check before the render gate reads), the browser or why none could, plus margin widths and saved screens. The flag is documented in cli.py's help, in references/page-authoring.md ("Pre-handover review"), and in validation.md.
  • Tests read fields. Substring and regex filters over failures/advice in the render-gate tests now compare codes, elements and values. The suite-only wordsInFormControls, apparatusAmongAuthored and unreadSyntax probes return records too. A names(finding, *words) helper in render_harness.py covers the negative checks that ask whether a finding names some element at all.

Before and after: one finding

Before, the probe returned a sentence, and every consumer matched substrings in it:

[light] <div id=wide> is set 600px past the column, out in the margin (at 1200x900)

After, the same finding is a record (page check --render --json on the demo page below):

{"code": "past-column", "severity": "error", "at": "<div id=wide>", "scheme": "light",
 "viewports": ["1200x900"], "values": {"place": "#wide", "past": 600},
 "text": "[light] <div id=wide> is set 600px past the column, out in the margin (at 1200x900)"}

Human output is unchanged

On a page with <div id="wide" style="width:150vw">, leaf page check --render from the merge base and from this branch print byte-identical stdout and stderr (diff is empty):

✓ index.html: valid
  · unpointable — <h1> (line 6) has no id, nor anything enclosing it, so element selection has no target
Error: index.html has 12 render issues
  - [light] the page scrolls sideways by 600px (at 1200x900)
  - [light] <div id=wide> is set 600px past the column, out in the margin (at 1200x900)
  - [light] <div id=wide> is drawn 600px outside <root scrollport>, which does not show it (at 1200x900)
  …

The passing run on the same page without the spill is also identical. Two kinds of wording changed:

  • Findings that spelled an element <lf-x id='a'> now use the form every other finding used: <lf-x id=a>.
  • Swept shrunk-label advice now reads "at 360–800px wide, …", with the comma the other swept findings already had.

Proof

  • Model: tests/model/test_render_gate.py covers the sweep, retry policy, rendering and round-tripping of the record. test_page_check_names_an_older_leaf_beside_its_own covers --json.
  • Browser and journeys: each touched render-gate test was run by node ID. That covers the compact spill, between-viewport sweep, refused document, async and stalled probes, thread seat, visual inventories, replay throw site, diagram refusals, settling, project widgets, verbatim, squeeze, column, misplaced and covered words, chrome words, labels advice, broken probe modules, recurring resize notice, restore cases, page_fixture_renders[triage-board], squeezed tables, clipped boxes, margin furniture, server stop, relative replay, settled slot, widget quality and package check --render, the syntax probe, navigation resize notices, and browser diagnostics.
  • check_render_refuses_what_only_a_browser_can_see now reads the refusal from --json.
  • pnpm run test:runtime passes (visual-parts.js changed).

Left for a follow-up

These are other places where a sentence crosses to a consumer that needs a fact. Each is too large for this PR.

  • Markup validation errors. check_source returns errors/advice as list[str], from about 74 producer sites in validation/, structure.py, styles.py and data*.py. About 199 test calls of interact_support.check() match the CLI's text. --json carries these as markup records whose only value is text until the producers emit codes.
  • The suite's browser-problem list. page.lf_errors is text. There are 215 consume_browser_errors/reported_browser_errors fragment matches, and tests/shift_watch.js embeds shift evidence: {json} in a console sentence that shift_evidence (tests/browser/test_render_shift_watch.py:72) splits back out. The watches could report records through a binding, as install_window_errors now does.
  • package check --render output. tests/journeys/test_widget_quality.py:137 regex-parses the first-paint sizes from the CLI lines. The records already exist (widget_findings), so a --json flag would serve this test.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 3 commits October 12, 2026 14:03
…ck --json`

Every check behind `page check` and `package check --render` now reports a
`Finding` record (render_gate/findings.py): a code, the element it names, the
measured values, a severity, and where it was read (scheme, viewports, swept
widths). The browser probes return those records instead of sentences, and the
words are rendered once, at the command boundary. widget_quality's own Finding
is folded into the shared one.

`page check --json` prints one object: the exit status, every finding as a
record with its rendered text, and which browser gates ran where. The human
output is unchanged, except that every finding names an element the way
locate.js does (`<lf-x id=a>`, where some said `<lf-x id='a'>`) and a swept
advice line reads "at 360–800px wide, <svg> …" with the comma the others had.

Window errors with no exception behind them now reach Python through a
binding that says whether each is a ResizeObserver loop notice, so the gate,
the suite's navigation and the arrival reading route notices by that field;
`resize_observer_error` and the `window error:` prefix test are gone. Tests
read finding fields instead of matching sentences.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The suite's syntax-contrast probe returns each faint token style as a record
(style, ratio) rather than a sentence; the test reads the fields. No
user-visible behaviour changes.

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

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The --json browser summary can report a render check that never ran. When page code reports an error, browser_check stops before render_version, but gates still contains both requested gates. A script reading that field can treat an unchecked page as rendered. Keep the requested gates separately and derive the completed gates from the readings.

…eck --json

Failing page code ends the check before the render gate reads the page, so
the JSON's browser summary now lists `asked` and `ran` separately rather than
one `gates` list a script could read as a completed render check.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
max-sixty and others added 2 commits October 12, 2026 14:52
The fake page the browser-problem collector tests watch gains the binding
call `install_window_errors` now makes, the command-help snapshot records
`--json`, and the broken-probe gate test reads its deliberately faulty page
with the unwatched browser, as its siblings do, so the page's own errors are
the gate's to report rather than the fixture's. No user-visible behaviour
changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a428d3f into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the findings-as-records branch October 12, 2026 22:29
max-sixty added a commit that referenced this pull request Oct 12, 2026
The markup checks behind `page check` now report findings as records, as
#2662 made the render gate do. Each check produces a `Finding` where it
detects the problem. The record carries a stable code, the element it
concerns as `at`, and the line and the offending and expected values in
`values`. A new `samples` field names the live-sample document it was
read in. The words for every code are written once, in the code table in
`findings.py`. `page check --json` now carries these fields. Before, it
wrapped each markup error as a `markup` record whose only value was the
text.

## What changed

- **One record type, in one place.** `findings.py` moves from
`render_gate/` to `leaf/`, because validation, `structure`, `styles` and
`data_contracts` now report through it too. Its code table gains the
markup codes, about 75 of them, such as `unknown-widget`,
`attribute-schema`, `not-member`, `allocation-value`, `duplicate-ids`,
`unpointable`, `contract-conflict` and `css-syntax`.
- **Producers return records.** These modules return records in place of
`list[str]`: `validation/markup.py`, `validation/instances.py`,
`validation/source.py`, `validation/source_history.py`,
`validation/admission.py`, the parser's own errors in `structure.py`,
`styles.css_syntax_errors`, and the binding conflicts and measurement
lag in `data_contracts.py`. `SourceCheck.errors` and `.advice` are
`list[Finding]`. Callers that join them into a refusal (`page stamp`,
activation, a reply while the source is invalid, data writes) print
`str(finding)`.
- **Records are facts, not prose.** An attribute schema failure carries
the JSON Schema `keyword` and `path`. The text of a question context
that asks nothing is now built from data: each framed widget and the
`x-awaits` conditions it lacks (`instances.unasked`). A reference that
breaks a relation carries the relation, its predicate and what the
target declares. A sample's errors carry the template ids in `samples`
instead of a `sample 'x': ` prefix on the sentence.
- **Message markup refusals keep their records.** `check_markup` and
`read_text_arg` raise `findings.Rejected`, a `Refused` that holds
`findings`. `message_markup_errors`, formerly `message_markup_error`,
returns the first failing stage's findings.

## Wording changes

Two wordings were inconsistent with the rest, and now match them:

- An element named by its id reads `<lf-suggestion id=sg>`, the form the
render findings use. Suggestion, question-context, measurement-lag and
owned-twice findings used to write `id='sg'` or `id="sg"`.
- Every message markup refusal opens `<kind> markup doesn't validate:`
and lists its findings. Duplicate ids, taken ids and a looping sample
used to read `<kind> markup: …` on one line. Their findings read the
same as before.

## Human output: before and after

`leaf page check` printed byte-identical stdout, stderr and exit status
at the merge base and on this branch for five shipped examples copied
into fresh pages: `triage-board`, `release-notes` (missing media),
`alert-review`, `heat-loss` and `review-a-plan`.

I ran it on two fixtures with known errors. The first has 44 errors
across most of the codes. The second covers allocations, question
contexts, unclosed tags and errors inside nested samples. The only
differences are the id spellings above:

```
<   - <lf-suggestion id='sg'> (line 36): needs a <lf-old> (what it replaces), a <lf-new> (what it proposes), or both
>   - <lf-suggestion id=sg> (line 36): needs a <lf-old> (what it replaces), a <lf-new> (what it proposes), or both
<   - <lf-ask> (line 12): a Question context registers no Question: <lf-options id="o9"> (line 12) asks only where choose is present
>   - <lf-ask> (line 12): a Question context registers no Question: <lf-options id=o9> (line 12) asks only where choose is present
```

On a set of bad reply fragments, `check_markup`'s refusals were
identical, except for the duplicate-id refusal, which now has the shared
heading:

```
< reply markup: duplicate ids (anchors need unique targets): ["dup"]
> reply markup doesn't validate:
>   - duplicate ids (anchors need unique targets): ["dup"]
```

`page check --json` for one finding, before and after:

```json
{"code":"markup","severity":"error","values":{"text":"<div data-width=\"huge\"> (line 10) has an invalid value; expected one of wide, available"},"text":"…"}
{"code":"allocation-value","severity":"error","at":"<div>","values":{"line":10,"attr":"data-width","value":"huge","allowed":["wide","available"]},"text":"<div data-width=\"huge\"> (line 10) has an invalid value; expected one of wide, available"}
{"code":"unknown-widget","severity":"error","at":"<lf-bogus>","samples":["kid"],"values":{"line":16},"text":"sample 'kid': <lf-bogus> (line 16): unknown widget — not in the vendored registry.json"}
```

## Tests

- Tests that read producers directly now assert on codes and fields:
`fragment_errors`, `reference_errors`, `check_markup`'s refusal, and
`declared_data_bindings`. They use two new `interact_support` helpers:
`check_findings`, which runs `page check --json` in-process, and
`found`, which selects findings by code, element and values.
- I ran these model files: `test_interact_product`,
`test_interact_contract`, `test_interact_document`,
`test_interact_anchors`, `test_interact_layer`, `test_render_gate`,
`test_responses`, `test_receipts`, `test_wait`, `test_stop_guard`,
`test_questions` and `test_delivery`. I also ran the sample, markup,
check and stamp tests in `process/test_interact_server.py`, and the
touched journeys nodes.

## Left for follow-ups

- **Tests that match `page check` text.** About 200 `check()` calls
still match the CLI's words. Their words did not change, so they pass.
Cutting them over to `check_findings` comes next, by area.
- **Registry contract errors.** `RegistryError` is raised from about 100
sites in `registry/` and reaches `page check` as one `invalid-registry`
finding whose value is the error's text. `ArtifactError` reaches it as
`capture-failed`, and a sample's history as `sample-history`. Those
exceptions are a separate producer family.
- **Event admission refusals.** `EventRefused` is matched by text with
`pytest.raises(match=…)` across the suite. It is larger than this
change.

> _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 12, 2026
…2684)

`leaf package check PACKAGE --render --json` prints one object, in the
shape `page check --json` prints (#2662):

- `status`: the exit status.
- `findings`: each finding as a record (`code`, `at`, `values`,
`severity`, `text`).
- `browser`: the gate `asked` for and the gates that `ran`, the browser
that ran them, and `unavailable` with the reason where no browser ran.

Without `--render` it prints `{"status": 0, "findings": [], "browser":
null}`. A package the package check refuses prints status 1 with the
refusal as its one `package` error finding and a null `browser`, rather
than an empty stdout. Without `--json`, the lines a reader sees are
unchanged.

## What changed

- `render_gate/command.py`: `widget_quality_report` used to print as it
read. It is now `widget_quality(package) -> WidgetQuality`, a record,
plus `print_widget_quality(check)` for the lines.
`packages.cmd_package_check` prints the lines or the JSON.
- Worked examples that cannot be drawn become an `unreadable-examples`
error finding (status 1), with the name of the browser that tried. Its
words are the line the command printed before: `Error: widget examples
could not be drawn: …`.
-
`tests/journeys/test_widget_quality.py::test_package_check_render_reports_findings_as_advice`
reads codes, elements and first-paint boxes from `--json` instead of
regex-parsing them out of the CLI lines.
`test_package_check_requires_a_non_empty_widget_description` also reads
the refusal from `--json`.
- `references/packages.md`, "Seeing it", and the command's help name the
flag.

## Proof

- Both tests pass by node id.
- `leaf package check skills/leaf/packages/code-review --render --json`
prints `{"status": 0, "findings": [], "browser": {"asked": ["widget
quality"], "ran": ["widget quality"], "browser": "Chrome"}}`. Without
`--json`, it prints the same two lines as before.

> _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 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]>
leaf-agent added a commit that referenced this pull request Oct 13, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/38317918344) found
four render-gate tests still asserting sentences after #2662 changed the
pre-upgrade proof to return `Finding` records and attach a finding to
`PreUpgradeFailed`. The gate's behavior is unchanged: the tests now
assert the finding code, wait stage, and exact unresolved request paths
instead of its rendered wording.

All four failing node IDs failed on current `main` before this change
and pass after it (`uv run pytest -q -n0` with those four IDs). The
other failures in that run have separate causes and remain under
investigation.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 13, 2026
Registry problems now reach `page check` and `package check` as records,
like the markup and render findings from #2662 and #2686. Before, each
one was a `RegistryError` sentence, and `page check --json` wrapped it
as one `invalid-registry` record whose only value was that text.

## What changed

- **One finding per registry problem.** Each of the ~100 raise sites
under `registry/`, plus the example and incoming-layer checks in
`validation/composition.py`, now raises `registry_error(code, registry,
tag, **values)`. The result is a `RegistryError` that carries one
`Finding`:
- `code`: one of 104 codes. Sites that raise the same kind of problem
share one, so `unknown-declarations` covers `x-owners` and `x-unique`
(`values.key`), and `predicate-*` covers `x-awaits` and `x-thread-seat`.
- `at`: the element declaration the problem concerns, such as
`<lf-local>`, or empty for a `$` fact.
  - `values.registry`: the file or composition it was read in.
- `values.revendor`: present when the fault is in a vendored layer that
re-vendoring fixes.
- The remaining `values` hold what the check read: the verb, the
attribute, the offending names or value. A JSON Schema complaint also
carries `keyword`, `path` and `reason`, from
`registry.schema.schema_reading`. The markup check's `attribute-schema`
now uses the same helper.
- **Words in one place.** The words for every code are in `findings.py`,
under `_declared`. That helper adds the file prefix and the re-vendor
suffix.
- **Commands report the record.** `page check` adds the refusal's
findings to its errors. When `package check --json` meets a refusal that
carries findings, it reports those findings in place of a `package`
record.
- **`findings.Rejected`** is now `Rejected(findings, heading=None)`.
With no heading, its text is the findings' own words. `RegistryError`
subclasses it.
- `layer_facts_error`, which returned a string, is replaced by
`check_layer_facts`, which raises. `reference_relation_error` is now
`reference_relation_problem` and returns a code and values. The
`invalid-registry` code now covers only the refusal #2658 added for a
layer this Leaf cannot serve (`layer.incompatible_layer`). That refusal
is still a sentence that the page servers, the event door and the
website also read.

## Human output: before and after

Human output is byte-identical. I ran `leaf page check` from the merge
base and from this branch on two broken pages and diffed stdout, stderr
and the exit status. The only difference was the base run's
`leaf-version` advice line, which comes from running an exported tree,
so I filtered it out.

A page whose own `page/registry.json` declares an `x-awaits` answering
verb it doesn't have:

```
Error: index.html has 1 validation issue
  - …/authored/page/registry.json: <lf-local> x-awaits answers with verbs ["submit"], which are not x-state verbs the user writes
```

A page whose vendored `registry.json` has `$languages.names: 3`:

```
Error: index.html has 1 validation issue
  - …/vendored/registry.json: $languages.names: 3 is not of type "array"; run `leaf page init …/vendored` to re-vendor it
```

I also compared the refusal text of about 100 broken registries between
the two trees. Each one mutated the shipped registry, a registry file,
an example, the incoming layer or a fixed `$events` member, and together
they reached nearly every code. All were identical.

`page check --json` for the second page:

```json
before: {"code": "invalid-registry", "severity": "error", "values": {"error": "…/vendored/registry.json: $languages.names: 3 is not of type \"array\"; run `leaf page init …/vendored` to re-vendor it"}, "text": "…"}
after:  {"code": "layer-facts", "severity": "error", "values": {"keyword": "type", "path": ["$languages", "names"], "reason": "3 is not of type \"array\"", "registry": "…/vendored/registry.json", "revendor": "…/vendored"}, "text": "…"}
```

For the first page:

```json
after:  {"code": "awaits-verbs", "severity": "error", "at": "<lf-local>", "values": {"verbs": ["submit"], "registry": "…/authored/page/registry.json"}, "text": "…"}
```

## Tests

- I cut the tests in `test_interact_layer.py`, `test_server_lifetime.py`
and `journeys/test_interact_contract.py` that matched registry words
over to codes and fields. They use two new `interact_support` helpers:
  - `registry_refusal(read)` returns the finding a refusal carries.
- `command_refusal(*args)` runs a leaf command in process and returns
its refusal's finding. It covers commands with no `--json`, such as
`page init` and `package init`.
- `test_package_check_requires_a_non_empty_widget_description` now
expects `no-description` where it expected a `package` record. That is
the user-visible change to `package check --json`.
- `test_interact_contract.py` still matches the words, which are
unchanged. A follow-up PR cuts it over.
- I ran `tests/model/test_interact_contract.py`,
`test_interact_layer.py` and `test_server_lifetime.py` in full, and the
changed journeys test by node ID. To check the cut-over, I replaced
every registry finding's words with a constant and reran those files and
seven other model files that write registries, with the follow-up's
conversion of `test_interact_contract.py` applied. All 876 tests passed,
so no other test in them reads registry words.

> _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 13, 2026
Every gate at the event log's append door now refuses on a `Finding`
record (#2662, #2686, #2692 built the type) instead of a sentence. Each
refusal has a stable code and the values the gate read: the refused
event's `kind`, the identity or field it concerns, and, where a value
was refused, what was offered and what would have been admitted. The
words for each code are written once, in `findings._TEXT`.

- **Gates** in `event_contracts`, `events.UndoReading`,
`tasks.task_error`, `work.widget_seat_error`, `read_state` and `layer`
return `Finding | None`. `EventRefused` and `AttemptConflict` carry that
one finding. A schema refusal (`invalid-event`, `invalid-detail`) names
the JSON pointer of its `field` and the schema `rule` it breaks
(`registry.schema.schema_complaint`).
- **Layer refusals**: `layer.incompatible_layer` and
`incompatible_revision` return findings too (`foreign-layer`,
`retired-layer`, `foreign-revision`, `retired-revision`), so serving,
admission and `page check --json` report the same record. `page check
--json` reports the layer's own code where it used `invalid-registry`.
- **User words**: `refusals.Refusal`, the string that carried separate
words for the browser, is gone. The two codes that have their own user
words (`stale-move`, `stale-edit`) get them from `findings._USER`,
through `Rejected.user`.
- **Transports**: the event door's 400/409 answer carries `findings`
beside `error`, which is still the text the browser shows.
`Refused.json()` is the one JSON shape of a refusal. A failed thread
title records the refusal's code.
- **Hook weight**: `findings` imports `registry.schema` only when it
writes words. The event log raises findings, and the Codex tool hook
reads a quiet page without importing jsonschema
(`test_codex_tool_hook_reads_a_quiet_page_without_the_page_model`).

No user-visible behaviour changed: every refusal reads as it did, in the
browser and on the command line.

Tests that matched admission refusal text in-process, or in the door's
answer, now read the code and fields through `refused_on`. A heuristic
count of test assertions that match the original refusal words fell from
63 to 31. Most of the 31 match the CLI's printed output, and a follow-up
PR moves them to a `--json` refusal shape. The rest assert the
user-facing words or text that does not come from the append door.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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