Repository navigation
Refuse events on findings with stable codes, not sentences - #2697
Merged
Merged
Conversation
Every gate at the append door now returns a `Finding` (`findings.py`): a stable code and the values it read, among them the refused event's `kind` and the identity or field it concerns, with what was offered and what would have been admitted where a value was refused. `EventRefused` and `AttemptConflict` carry that one finding; the words for every code live in `findings._TEXT` beside the check findings, so they are written once. Schema refusals carry the JSON pointer of the `field` and the schema `rule` it breaks. The layer-protocol refusals (`foreign-layer`, `foreign-revision`) are findings too, so serving and admission share them. The event door's refusal answer (HTTP 400/409) carries `findings` beside `error`, the words the browser shows; `refusals.Refusal`'s separate user words become a `_USER` entry per code (`stale-move`, `stale-edit`). `Refused.json()` is the one JSON shape of a refusal. A failed thread title records the refusal's code. 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 (`refused_on`); those that read the CLI's printed text follow with the command line's `--json` refusals. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 13, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The new field value needs JSON Pointer escaping for custom detail keys; the inline suggestion fixes it.
A custom detail key such as a/b named a nested b; ~ and / now escape as RFC 6901 says. No user-visible behaviour changed. 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/event_contracts.py # skills/leaf/scripts/leaf/findings.py # skills/leaf/scripts/leaf/layer.py # skills/leaf/scripts/leaf/todos.py # skills/leaf/scripts/leaf/work.py # tests/model/test_asks.py
leaf-agent
previously approved these changes
Oct 13, 2026
# Conflicts: # skills/leaf/scripts/leaf/findings.py
leaf-agent
previously approved these changes
Oct 13, 2026
# Conflicts: # skills/leaf/scripts/leaf/findings.py # tests/model/test_interact_contract.py
leaf-agent
approved these changes
Oct 13, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 13, 2026
main gained #2697, #2700 and #2708. The three files that conflicted (event_contracts.py, findings.py, work.py) take main's content with the sweep's edits re-applied by .tmp/standing/apply.py; the "not visible under the page's standing outcomes" message moved from work.py to findings.py, and the script now edits it there. main added no other non-glossary "standing". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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]>
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.
Every gate at the event log's append door now refuses on a
Findingrecord (#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'skind, 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, infindings._TEXT.event_contracts,events.UndoReading,tasks.task_error,work.widget_seat_error,read_stateandlayerreturnFinding | None.EventRefusedandAttemptConflictcarry that one finding. A schema refusal (invalid-event,invalid-detail) names the JSON pointer of itsfieldand the schemaruleit breaks (registry.schema.schema_complaint).layer.incompatible_layerandincompatible_revisionreturn findings too (foreign-layer,retired-layer,foreign-revision,retired-revision), so serving, admission andpage check --jsonreport the same record.page check --jsonreports the layer's own code where it usedinvalid-registry.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 fromfindings._USER, throughRejected.user.findingsbesideerror, 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.findingsimportsregistry.schemaonly 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--jsonrefusal shape. The rest assert the user-facing words or text that does not come from the append door.