Repository navigation
Report registry problems as findings - #2698
Merged
Merged
Conversation
A registry refusal now carries one `Finding`: a code per kind of problem (104, such as `layer-facts`, `unknown-declarations`, `awaits-verbs`, `record-unit`), the element declaration it concerns in `at`, the registry file in `values.registry`, and what the check read there. `page check --json` reports that record where it reported one `invalid-registry` record holding the error's text, and `package check --json` reports it where it reported a `package` record. The words are written once, in `findings.py`; the human output of both commands is unchanged. `RegistryError` is a `findings.Rejected`, which now takes its findings first and an optional heading. `schema_reading` gives a JSON Schema complaint's keyword, path and words, shared with `attribute-schema`. `layer_facts_error` becomes `check_layer_facts`, which raises, and `reference_relation_error` returns a code and values. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Oct 13, 2026
# Conflicts: # skills/leaf/scripts/leaf/registry/state.py # skills/leaf/scripts/leaf/registry/widgets.py
leaf-agent
previously approved these changes
Oct 13, 2026
# Conflicts: # skills/leaf/scripts/leaf/findings.py
leaf-agent
approved these changes
Oct 13, 2026
This was referenced Oct 13, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 13, 2026
…ls (#2710) This follows #2697, which made the append door refuse on `Finding` records. Here the command line gets one JSON shape for a refusal, and the thread and task commands' own refusals get stable codes, so tests and scripts read the code instead of parsing text. - **One rendering of a refusal**: `LeafGroup`, the command line's one translation of a refusal, prints `Refused.json()` (`error`, plus the `findings` with each code and its fields) on stdout when the command was given `--json`. Otherwise it prints the words on stderr, as before. Either way the command exits 1. The HTTP event door's refusal answer has the same `error`/`findings` shape. - **Where `--json` comes from**: `json_option` records the request where `LeafGroup` reads it. So `page check`, `package check` and `page interactions` refuse in JSON under the flag they already had. Every write that prints its records (the `thread`, `response` and `task` groups' commands, `page stamp` and `page report`) gets `--json` from its command class (`RecordsCommand`, set once on `RecordsGroup`), with no per-command flag. - **Codes for the thread and task commands**: the refusals in `thread.py` and `todos.cmd_open` become findings worded in `findings._TEXT`. An attempt reused for another reply shares the door's `attempt-conflict` code. - **Tests**: tests that matched these commands' refusal text now read codes through `command_refusal` (from #2698, which now takes any argument type) or through `--json` and `refused_on`. A heuristic count of assertions matching refusal words from the append door or the thread commands fell from 97 before #2697 to 28. What remains is the stop guard's reason, the user-facing words of `stale-move`/`stale-edit`, the re-vendor remedy that `page init`/`server start`/`wait` print, and a thread refusal's guidance about which command to use. All of that is wording the reader acts on. User-visible: `--json` on those commands prints a refusal as JSON. An anchored comment on an invalid saved source now reads "cannot anchor while index.html is invalid", worded like a reply's "cannot reply while …". Every other refusal reads as before. The help snapshot gains the `--json` lines. > _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 16, 2026
Follows #2698 (merged). Capture refusals and sample-history refusals now reach `page check` as coded records. Before, each was one `capture-failed` or `sample-history` record whose only value was the refusal's text. The tests that matched registry, capture and sample-history words now read the records. ## What changed - **Capture.** `ArtifactError` is now a `findings.Rejected` carrying one finding. Its 24 raise sites call `artifact_error(code, file, specifier, **values)`. The codes include `dependency-unreadable`, `dependency-not-local`, `module-outside-page`, `module-type`, `dependency-symlink`, `css-import` and `manifest-digest`. `values.file` is the file the problem was read in and `values.specifier` is the reference in it. The words are written in `findings.py` (`_captured`). `page check` adds the refusal's findings to its errors. - **Sample history.** `initial_sample_events` raises a `Rejected` instead of a `ValueError` that wrapped the inner refusal's text. Its finding names the script (`values.reference`) and, for a problem with one of its events, which one (`values.event`). The codes include `sample-script`, `sample-json`, `sample-array`, `fixture-kind`, `fixture-ts` and `fixture-id-taken`. - `fixture-markup` holds the message gate's own findings in `values.findings`, under its kind, and `fixture-media` holds the media check's findings the same way. - An event the append door refuses is `fixture-event`, holding the door's findings (`EventRefused`, or `command_error`'s) in `values.findings` the same way. An anchor-capture refusal keeps its words as `fixture-refused` (`values.error`). - `page check` sets the template ids on each finding's `samples`, as it does for markup findings. The HTTP sample door catches `Rejected` beside `ValueError` and answers with the same text. - **Codes deleted.** `capture-failed` and `sample-history` no longer exist. - **Test helper.** `command_findings(*args)` replaces `command_refusal`, and every caller moves to it. It returns every finding a refused command carries, or none when the command succeeds. The sample tests read the message door's refusal through it. ## Human output: before and after One wording changed, for consistency. The three CSS refusals from the stylesheet walk (`css-invalid`, `css-url`, `css-import`) used to name no file. They now carry and print the file whose CSS they read, as every other capture refusal does. For the page's own `<style>` and `style` attributes, that file is `/index.html`. Without it, a page with several stylesheets got a coded refusal with no way to tell which sheet to fix: ``` < - invalid CSS: bad URL token > - /page/style.css: invalid CSS: bad URL token < - CSS @import requires a stylesheet with CSS MIME type > - /page/style.css: CSS @import requires a stylesheet with CSS MIME type ``` I ran `leaf page check` from the merge base and from this branch on 33 pages. Three changed, all with the CSS wording above. On the other 30, stdout, stderr and exit status were byte-identical. They cover every sample-history case the suite exercises (including the three message-markup ones) and every module and stylesheet capture case. I filtered out the `leaf-version` advice line, because the two trees run as different Leafs. A page whose module imports a missing file: ``` Error: index.html has 1 validation issue - /page/missing.js: cannot capture dependency: No such file or directory ``` A page whose sample history has a bad timestamp in its second event: ``` Error: index.html has 1 validation issue - sample 'practice': data-sample-events 'fixture', event 2: ts must be an ISO timestamp with a time zone ``` `page check`'s JSON, before and after (`text` omitted): ```json before: {"code": "capture-failed", "severity": "error", "values": {"error": "/page/missing.js: cannot capture dependency: No such file or directory"}} after: {"code": "dependency-unreadable", "severity": "error", "values": {"error": "No such file or directory", "file": "/page/missing.js"}} before: {"code": "sample-history", "severity": "error", "samples": ["practice"], "values": {"error": "data-sample-events 'fixture', event 2: ts must be an ISO timestamp with a time zone"}} after: {"code": "fixture-ts", "severity": "error", "samples": ["practice"], "values": {"reference": "fixture", "event": 2}} ``` ## Tests - **Registry tests.** The rest of the tests that matched registry words in `test_interact_contract.py` now read records: about 45 tests, through `check_findings`, `registry_refusal` and, for `page init`, `command_findings`. So does `test_a_layer_stamped_with_its_revision_still_names_the_revendor`, which arrived from main. They pin facts the words only suggested, such as both verbs that claim one record slot, the slot's kind and attribute, and a schema complaint's keyword. - **Capture and sample tests.** The sample-fixture, sample-document and capture tests in `test_interact_contract.py`, `test_interact_document.py` and `test_revision_delivery.py` assert codes and fields. - The two activation tests still refuse through `activate_source`. They now read the reason from `page check`'s findings, because `Activation.error` is a joined string. - `test_check_validates_each_sample_document` lost its `sample_holder_check` helper. It asserts codes and `samples` for both holders now. - **Runs.** I ran `test_interact_contract`, `test_interact_layer`, `test_interact_document`, `test_revision_delivery` and `test_server_lifetime` in full. - **Word scramble.** I replaced the words of every registry, capture and sample finding with a constant and ran those files, plus `test_interact_product`, `test_product_page`, `test_interact_preview`, `test_live_shell_artifact`, `test_todos`, `test_stop_guard` and `test_render_gate`. 917 of 919 passed. Both failures read a capture refusal's file name through text that is still a sentence: the `Refused` that `page stamp` raises from `Activation.error`, and that same joined string. ## Left for follow-ups - **`Activation.error`.** It joins `check_source`'s findings into one string, and `thread`, `agent_state`, `samples`, `served_state` and `revisioning` read it as text. Carrying the findings would let those consumers and their tests read fields. - **`layer.incompatible_layer`.** Its refusal (#2658) reaches `page check` as the one remaining `invalid-registry` text record. The page servers, the event door and the website also read it as a sentence. > _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.
Registry problems now reach
page checkandpackage checkas records, like the markup and render findings from #2662 and #2686. Before, each one was aRegistryErrorsentence, andpage check --jsonwrapped it as oneinvalid-registryrecord whose only value was that text.What changed
registry/, plus the example and incoming-layer checks invalidation/composition.py, now raisesregistry_error(code, registry, tag, **values). The result is aRegistryErrorthat carries oneFinding:code: one of 104 codes. Sites that raise the same kind of problem share one, sounknown-declarationscoversx-ownersandx-unique(values.key), andpredicate-*coversx-awaitsandx-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.valueshold what the check read: the verb, the attribute, the offending names or value. A JSON Schema complaint also carrieskeyword,pathandreason, fromregistry.schema.schema_reading. The markup check'sattribute-schemanow uses the same helper.findings.py, under_declared. That helper adds the file prefix and the re-vendor suffix.page checkadds the refusal's findings to its errors. Whenpackage check --jsonmeets a refusal that carries findings, it reports those findings in place of apackagerecord.findings.Rejectedis nowRejected(findings, heading=None). With no heading, its text is the findings' own words.RegistryErrorsubclasses it.layer_facts_error, which returned a string, is replaced bycheck_layer_facts, which raises.reference_relation_erroris nowreference_relation_problemand returns a code and values. Theinvalid-registrycode now covers only the refusal Name the code's ask and to-do records asks and to-dos, as the interface does #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 checkfrom 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'sleaf-versionadvice line, which comes from running an exported tree, so I filtered it out.A page whose own
page/registry.jsondeclares anx-awaitsanswering verb it doesn't have:A page whose vendored
registry.jsonhas$languages.names: 3: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
$eventsmember, and together they reached nearly every code. All were identical.page check --jsonfor the second page:For the first page:
after: {"code": "awaits-verbs", "severity": "error", "at": "<lf-local>", "values": {"verbs": ["submit"], "registry": "…/authored/page/registry.json"}, "text": "…"}Tests
test_interact_layer.py,test_server_lifetime.pyandjourneys/test_interact_contract.pythat matched registry words over to codes and fields. They use two newinteract_supporthelpers: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 aspage initandpackage init.test_package_check_requires_a_non_empty_widget_descriptionnow expectsno-descriptionwhere it expected apackagerecord. That is the user-visible change topackage check --json.test_interact_contract.pystill matches the words, which are unchanged. A follow-up PR cuts it over.tests/model/test_interact_contract.py,test_interact_layer.pyandtest_server_lifetime.pyin 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 oftest_interact_contract.pyapplied. All 876 tests passed, so no other test in them reads registry words.