Skip to content

Report capture and sample history problems as findings - #2709

Merged
max-sixty merged 5 commits into
mainfrom
capture-sample-findings
Oct 16, 2026
Merged

max-sixty merged 5 commits into
mainfrom
capture-sample-findings

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

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):

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 (Name the code's ask and to-do records asks and to-dos, as the interface does #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

max-sixty and others added 2 commits October 12, 2026 17:53
The tests in `test_interact_contract.py` that matched the words of a
registry refusal now read its record: `page check --json` through
`check_findings`, a direct validation through `registry_refusal`, and
`page init` through `command_refusal`. They pin facts the words only
suggested, such as both verbs that claim one record slot, the slot's
kind and attribute, and the keyword of a schema complaint.

No user-visible behaviour changed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A refused capture and a refused sample history now reach `page check` as
coded records, where they reached it as one `capture-failed` or
`sample-history` record holding the refusal's text. `ArtifactError` is a
`findings.Rejected` carrying one finding, such as `dependency-unreadable`
or `module-outside-page`, with the file and the reference in it as
`values.file` and `values.specifier`. `initial_sample_events` raises a
`Rejected` whose finding names the script (`values.reference`) and, for
one of its events, which (`values.event`): `sample-json`, `fixture-ts`,
`fixture-markup` holding the message gate's own findings, and so on. A
refusal from the event contract or the anchor capture keeps its words as
`fixture-refused`. The human output of `page check` is unchanged.

The suite's `command_findings` replaces `command_refusal` and returns
every finding a refused command carries, so the sample tests read the
message door's refusal through it.

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 CSS capture findings still lose their source file. In _css_references, css-invalid, css-url, and css-import are raised without file; the exception reaches page check unchanged. With multiple stylesheets, page check --json gives a coded refusal but no way to identify which stylesheet needs repair. I reproduced css-invalid as {"code":"css-invalid","values":{"error":"EOF in URL"}}. Carry the source path through the CSS reference walk so these records identify the offending file, including /index.html for authored CSS.

`css-invalid`, `css-url` and `css-import` now carry the file whose CSS
they read, `/index.html` for the page's own `<style>` and `style`
attributes, so their words open with it as every other capture
refusal's do: `/page/style.css: invalid CSS: bad URL token`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 13, 2026
max-sixty and others added 2 commits October 15, 2026 23:36
Main now refuses events with findings (`EventRefused`, and `command_error`
returns one), so a sample history's event-contract refusal is `fixture-event`
holding those findings in `values.findings`, as `fixture-markup` holds the
message gate's. `fixture-refused` keeps only the anchor capture's words. The
printed words are unchanged.

Main's `command_refusal` callers move to `command_findings`, which replaces it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 22d651e into main Oct 16, 2026
4 checks passed
@max-sixty
max-sixty deleted the capture-sample-findings branch October 16, 2026 06:49
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