The documented error table is held to ERROR_RULES - #600
Open
JArmandoAnaya wants to merge 1 commit into
Open
Conversation
docs/api.md's "full table" is where a client author reads the code inventory, and nothing checked it against the code. It fell nineteen codes behind before anybody noticed; #533 synced it, and syncing alone was never the fix, because an unchecked mirror is a second spelling waiting to drift. Three tests, the same exact-correspondence construction the module already uses for ERROR_RULES against kernel/errors.py, with the markdown as the other side: - every rule appears in the table under its own status - every documented code still exists at that status, or is one of the five the framework and the auth guard raise - the 5xx opt-out table equals expose_message, exactly, both ways Codes are collected as (code, status) pairs rather than a mapping, so a code listed under two statuses arrives as two members instead of one silently overwriting the other, and a table that parses as empty raises rather than letting the second test pass on nothing. Also corrects errors.py's own docstring, which said four errors opt out of 5xx opacity when it has been six since the inference work landed.
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.
docs/api.md's "full table" is where a client author reads the error-code inventory, and nothingheld it to the code. It fell nineteen codes behind before anybody noticed.
The sync half was already delivered
Measured at the merge-base before writing anything, rather than taken from the issue body:
The documentation audit #533 (
d723c4b, 2026-08-10) synced the table and the issue was neverupdated. The five remaining extras are exactly the five the document itself names in prose as
raised by the framework and the auth guard. So the drift is gone and this PR is the other half
— which was always the half that mattered, since an ungated mirror is a second spelling waiting to
drift back.
Mechanism: parse the markdown in place
The issue leaves the choice open between parsing the table and promoting it to a
generated-and-committed artifact on
openapi.json's footing. Parsing, because the artifact routeneeds a script, a
--checkmode, a CI step and a regeneration ritual, for a table whose rows carrygrouping and prose a generator would flatten — and the invariant is identical either way. It is
~55 lines in a module that already imports
ERROR_RULES.Placement is
tests/server/test_errors.py, besidetest_the_status_and_code_of_every_error: thattest already owns the
ERROR_RULES↔kernel/errors.pycorrespondence, and the document is athird side of the same triangle.
frontend/ui-core/src/tokens.test.tsis the precedent for holdinga document this way.
What landed
Three tests, both directions and the status:
test_every_error_rule_appears_in_the_documented_tabletest_every_documented_code_still_existstest_the_published_message_table_matches_expose_messageexpose_messagedisagree either wayFRAMEWORK_CODESnames the five that have no kernel class to map (VALIDATION_ERROR,NOT_FOUND,METHOD_NOT_ALLOWED,UNAUTHORIZED,INTERNAL_ERROR) — the document is the onlyplace they are written down, so they are listed rather than derived.
Two decisions worth the diff:
(code, status)pairs, not a mapping. A mapping lets one code listedunder two statuses silently overwrite the other; as pairs it arrives as two members and the
stale one is caught.
M3below is that case.test_every_documented_code_still_existspass on nothing — a gate that stops guarding exactlywhen the document is being edited carelessly, which is the only time it matters.
M6is thatcase.
Also corrects
server/errors.py's own module docstring, which said four errors opt out of 5xxopacity when it has been six since the inference work landed. The 5xx table in
docs/api.mdwas already right; only the docstring had drifted, and it is now gated from the document side.
Test plan
Every stage's exit code, staged against the harness ceiling:
bash scripts/check.sh python(106s tests, ruff, mypy, 4/4 import contracts)bash scripts/check.sh frontend generatedbash scripts/check.sh docsbash scripts/check.sh browser(245s e2e + 81s real-server cycle)tests/server/test_errors.py: 26 passed.Mutation-verified — six cases, each turning a named test red, reverted by its own recorded
diff with a clean-tree assertion before and after:
## The full tableheading renamedM1 reddened only test 1 and M2 only test 2, which is the evidence that the two directions are
independent rather than one test doing both jobs.
Found, not fixed
did. Removing the count instead was considered; the correction is what was scoped here, and the
countless phrasing is a one-word follow-up if it is wanted.
pnpm installandpnpm --dir docs-site installbeforecheck.shreaches the frontend and docs stages. Pre-existing, unrelated to this diff.
Closes #524.