Skip to content

fix(schema): align error-code prose recovery tags with the recovery enum - #7656

Merged
bokelley merged 2 commits into
adcontextprotocol:mainfrom
sujanchalla0510:fix/error-code-recovery-prose-enum
Sep 23, 2026
Merged

bokelley merged 2 commits into
adcontextprotocol:mainfrom
sujanchalla0510:fix/error-code-recovery-prose-enum

Conversation

@sujanchalla0510

Copy link
Copy Markdown
Contributor

Summary

Three enums/error-code.json codes tag a recovery classification in prose that is not a member of the recovery enum, and that contradicts their own enumMetadata:

Code enumDescriptions prose enumMetadata.recovery
FORMAT_DECLARATION_V1_LOSSY_MULTI_SIZE Recovery: warning correctable
PIXEL_TRACKER_LOSSY_DOWNGRADE Recovery: warning correctable
PIXEL_TRACKER_UPGRADE_INFERRED Recovery: warning correctable

core/error.json closes recovery to ["transient", "correctable", "terminal"]. warning is not in it. And the enumMetadata block's own $comment is explicit about which side wins:

SDKs MUST consume this block instead of parsing 'Recovery: X' from enumDescriptions prose. … enumDescriptions is retained for human readability and will continue to carry the canonical narrative; the recovery classification embedded in that prose is normative and MUST match the value here.

So the prose both leaves the closed enum and contradicts the authority it is required to match.

Why it matters

recovery is the field a receiver is required to read when it does not recognise an error code, so it is the only machine-readable signal for these three. An SDK author transcribing the prose emits warning, which no receiver can decode.

That is not hypothetical. It is exactly how adcp-go shipped retry / revise / contact_support on the wire (adcontextprotocol/adcp-go#530, fixed in adcp-go#542 and #543) — a hand-written vocabulary copied from prose rather than read from enumMetadata. Same failure mode, same root, one repo upstream.

The fix

Prose becomes Recovery: correctable — non-fatal advisory, do not auto-retry.

That keeps the non-fatal, no-retry semantics the original wording was reaching for — all three codes are advisories emitted alongside a successful response in errors[] — while expressing it in words instead of an invented enum member, and matching the metadata that already says correctable. Nothing else in the three descriptions changes; the diff is exactly three lines, one per code.

Not changed: the enumMetadata values themselves. Moving those would be a wire-behaviour change, and correctable is the published classification consumers already act on. Worth flagging for the record that none of the three enum members express "advisory, non-fatal" cleanly — that is presumably why the prose author reached for warning — but that is a vocabulary question for the WG, not something to settle by editing prose.

Regression test

This invariant is already enforced for the sibling enum. tests/error-recovery-vectors.test.cjs has 'request-signing prose codes have one machine-readable recovery authority', which asserts for every request-signing-error-code.json entry that the prose tag is an enum member and equals enumMetadata.recovery. error-code.json was never held to the same rule — which is why these three sat there.

Added 'error-code prose recovery tags agree with the machine-readable authority' alongside it, reusing the sibling's assertion shape and the same RECOVERY_VALUES set. It asserts every code's enumMetadata.recovery is a valid member, and that where prose tags a recovery it matches. Codes whose prose carries no Recovery: tag are skipped rather than failed — REQUOTE_REQUIRED and FORMAT_SHAPE_PROMOTED are the only two of 120 in that position, and requiring a tag from them is an editorial change beyond this defect. Happy to add it if you'd rather the invariant be total.

Verified by revert-and-reconfirm — reverting only the schema and keeping the test:

AssertionError: FORMAT_DECLARATION_V1_LOSSY_MULTI_SIZE prose and enumMetadata recovery
must agree, and the prose value must be a member of the recovery enum
  actual: undefined,  expected: 'correctable'

(undefined because the capture group only admits the three real members — the same regex the request-signing test uses.)

Scope note

The three codes carry the identical defect on 3.1.x. This PR targets main; happy to send the backport if you want it on the 3.1 line.

Validation

  • tests/error-recovery-vectors.test.cjs 9/9 (was 8 pass / 1 fail before the schema fix)
  • npm run test:schemas — 302 + 10 + 6 assertions, all pass
  • npm run build:schemas clean; npm run typecheck clean
  • Full npm run precommit passed
  • patch changeset included; no schema shape or wire-behaviour change

🤖 Generated with Claude Code

core/error.json closes recovery to transient / correctable / terminal,
and enums/error-code.json's own enumMetadata $comment makes that block
the normative authority: "the recovery classification embedded in that
prose is normative and MUST match the value here."

Three codes ended their enumDescriptions with "Recovery: warning":

  FORMAT_DECLARATION_V1_LOSSY_MULTI_SIZE
  PIXEL_TRACKER_LOSSY_DOWNGRADE
  PIXEL_TRACKER_UPGRADE_INFERRED

"warning" is not a member of the enum, and all three carry correctable
in enumMetadata, so the prose both leaves the enum and contradicts the
authority it is required to match. recovery is the field a receiver must
read when it does not recognise a code, so an SDK author transcribing
the prose emits a value no receiver can decode.

Prose now reads "Recovery: correctable — non-fatal advisory, do not
auto-retry", keeping the non-fatal semantics in words rather than in an
invented enum member. No schema shape or wire-behaviour change.

Extends tests/error-recovery-vectors.test.cjs to hold error-code.json to
the same prose/metadata agreement it already asserts for
request-signing-error-code.json.

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

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ladon verdict: Request changes

Request changes — 1 blocking finding.

Blocking findings

  • docs/snippets/compliance-error-codes.mdx:624/882/901 — Generated compliance reference not regenerated after the schema change; prose bodies still ship Recovery: warning while accordion titles read correctable, asserting a recovery value outside the closed enum (schema↔docs drift). Fix: run npm run build:compliance and commit the regenerated output.

The underlying schema fix is sound: the three error-code.json recovery prose tags are corrected from the invalid warning to correctable, matching each code's enumMetadata (the normative authority), and the added test invariant is correct. The patch, protocol-scoped changeset is correct and immutable dist/** artifacts were untouched. Row 1 fires on the high-severity schema↔docs drift finding, which takes precedence over the gated-paths / high-risk signals.

Blocking findings

  • docs/snippets/compliance-error-codes.mdx:624/882/901 — Generated compliance reference not regenerated; prose bodies still ship Recovery: warning (outside the closed recovery enum) while accordion titles read correctable — schema↔docs drift. Run npm run build:compliance.

…se fix

docs/snippets/compliance-error-codes.mdx is generated from
enums/error-code.json by scripts/generate-compliance-snippets.mjs and is
committed to the repo, so it has to be rebuilt alongside the schema. Its
accordion titles already read 'correctable' (they render enumMetadata)
while the prose bodies still carried 'Recovery: warning', so the
generated reference contradicted itself and still published a value
outside the closed recovery enum.

npm run build:compliance; three lines changed, one per code. Released
dist/docs/** snapshots are immutable and deliberately untouched.

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

Copy link
Copy Markdown
Contributor Author

Fixed in c56500a.

The finding is correct and I'd missed it: docs/snippets/compliance-error-codes.mdx is generated from enums/error-code.json by scripts/generate-compliance-snippets.mjs and is committed to the repo, so it has to be rebuilt alongside the schema. I ran npm run build:schemas but not npm run build:compliance.

The self-contradiction you flagged is exactly right and worth spelling out, because it made the generated reference worse than the schema was: the accordion titles and the summary table render enumMetadata.recovery and so already read correctable, while the prose bodies rendered enumDescriptions and still read Recovery: warning. So a reader of that page saw both values for the same code, one of them outside the closed enum.

npm run build:compliance regenerated it — three lines, one per code, and the file now carries no Recovery: warning at all. Released dist/docs/** snapshots still contain the old prose and are deliberately untouched, since those are immutable published artifacts.

Verification after the regen:

  • tests/error-recovery-vectors.test.cjs — 9/9
  • npm run test:schemas — 302 + 10 + 6, all pass
  • full npm run precommit passed

One note for completeness: npm run test:snippets fails locally with ModuleNotFoundError: No module named 'adcp', but it fails identically on this branch with my change stashed, so it is a missing local Python venv rather than anything from this PR.

🤖 Generated with Claude Code

@aao-secretariat
aao-secretariat Bot dismissed their stale review September 23, 2026 06:52

Superseded by a later Ladon review that rechecked and resolved its blocking findings.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Sep 23, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ladon verdict: Escalate to human review

Escalate — gated path requires human/CODEOWNERS approval.

This PR modifies static/schemas/source/enums/error-code.json, which matches the repo's gated-paths glob static/schemas/source/**. gated_paths is true and review_decision is REVIEW_REQUIRED (not APPROVED), so decision-table row 2 fires: the hard approval gate is not satisfied and the outcome cannot be approve.

The diff itself is clean on the merits: the sole prior blocker is resolved — the generated docs/snippets/compliance-error-codes.mdx now reads Recovery: correctable at lines 624, 882, and 901, matching the enumDescriptions and normative enumMetadata.recovery values (all three correctable, a valid member of core/error.json's closed recovery enum). Changeset is present, patch-scoped, protocol-scoped, no wire-shape change, and dist/** is untouched. A new test correctly pins prose to metadata. No current critical/high/medium findings.

Because there are no blocking findings, this is not request-changes — but the unsatisfied gated-path gate blocks auto-approval. A human/CODEOWNERS review of the gated schema file is required.

Escalation reasons:

  • static/schemas/source/enums/error-code.json is under a hard approval gate (static/schemas/source/**) and review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge.

Why human review

  • static/schemas/source/enums/error-code.json is under a hard approval gate (static/schemas/source/**) and review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/enums/error-code.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

Copy link
Copy Markdown
Contributor

RC5 train status: exact head c56500a04ef595a90ceb32bdb3530e366ec07bb1 is green, the generated compliance-snippet blocker is resolved, and all review threads are resolved. This patch is also the next release-relevant change on current main; after the required human/CODEOWNER approval and merge, the release workflow will regenerate the stale RC5 candidate from the exact new base.

@bokelley
bokelley merged commit a601dfb into adcontextprotocol:main Sep 23, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants