feat(scripts): check:route-envelope audits rest-server.ts — dialect facts only (#7295) - #7459
Merged
Merged
Conversation
…acts only (#7295) `discover()` collected `*-routes.ts` plus one named exception, so `packages/rest/src/rest-server.ts` — the largest response-emitting file in the repo (#5949), 208 hand-built write sites — had never been audited by the gate whose own header promises that "a module nobody thought to convert still gets audited". Per the maintainer ruling of 2026-08-10 (option 3), it is now discovered and held to DIALECT FACTS ONLY, never to `responses`: a write-site ratchet on a file that changes several times a day would go red for edits that are not envelope drift, and the pressure would be to raise the number rather than fix anything (option 2, rejected). - `discover()` takes an `OFF_CONVENTION_MODULES` set — `i18n-service-plugin.ts` as before, plus `rest-server.ts`. - New `siblingCode` counter: a top-level `code` as a SIBLING of `error` instead of a key inside it — the second dialect from #7035, which no counter here could see. Shorthand (`{ error, code }`) is the same dialect; nested (`{ error: { code, message } }`) is the conformant envelope and is not counted. Asserted for every audited module, defaulting to 0. - New `dialectOnly` module state, exclusive with `responses`/`ok`/`err`/ `privateOk` and requiring a `ratchet`. Its two counts ratchet in ONE direction: an increase is a new non-conforming body, and a decrease must be banked by lowering the baseline. - Baseline measured on this branch point, not assumed: stringError 44, siblingCode 77. - Self-test: three positives (literal pair, computed message, shorthand) and four negatives (nested code, code inside `data`, a lone `code`, commented-out prose). `packages/rest/src/rest-server.ts` itself is untouched — converting it onto the shared sendOk/sendError is #7035 option 1 and stays out of scope. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRQebqrpJZU1tJZpzYy3xL
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
os-help
marked this pull request as ready for review
August 10, 2026 13:50
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.
Fixes #7295
discover()collected*-routes.tsplus one named exception, sopackages/rest/src/rest-server.ts— the largest response-emitting file in the repo (#5949), 208 hand-built write sites — had never been audited by the gate whose own header promises that "a module nobody thought to convert still gets audited".Per the maintainer ruling of 2026-08-10 (option 3), it is now discovered and held to dialect facts only, never to
responses: a write-site ratchet on a file that changes several times a day would go red for edits that are not envelope drift, and the pressure would be to raise the number rather than fix anything (option 2, rejected).What changed
discover()takes anOFF_CONVENTION_MODULESset —i18n-service-plugin.tsas before, plusrest-server.ts.siblingCodecounter: a top-levelcodeas a sibling oferrorinstead of a key inside it — the second dialect from finding:rest-server.ts里三个相邻/metahandler 的错误信封是三种不同形状,其中两种不符合 ADR-0112 #7035, which no counter here could see. Shorthand ({ error, code }) is the same dialect; nested ({ error: { code, message } }) is the conformant envelope and is not counted. Asserted for every audited module, defaulting to 0.dialectOnlymodule state, exclusive withresponses/ok/err/privateOkand requiring aratchet. Its two counts ratchet in ONE direction: an increase is a new non-conforming body, and a decrease must be banked by lowering the baseline.stringError44,siblingCode77.data, a lonecode, commented-out prose).packages/rest/src/rest-server.tsitself is untouched — converting it onto the sharedsendOk/sendErroris #7035 option 1 and stays out of scope.Scope
One file:
scripts/check-route-envelope.mjs(+277/−17). No package source changes, hence no changeset.Implemented by a dispatched dev agent in its own container; PR opened by the PM seat because the container had git push but no GitHub API access. Full rationale is preserved verbatim in the commit message of
bb9966fa3.Generated by Claude Code