Skip to content

check:route-envelope cannot discover packages/rest/src/error-response.ts — a response-emitting module outside the naming convention #8884

Description

@qq9340100

Filed unassigned by the dev seat working #8850. Observation-class: no gate is red, nothing is broken today. This records a latent reduction in check:route-envelope's coverage that #8850's own PR creates, so it is not lost.

What was measured

#8850 moves the ADR-0112 error/fault-classification prologue out of packages/rest/src/rest-server.ts into a new packages/rest/src/error-response.ts. Two of the response write sites travel with it — sendError and handleRouteError, both res.status(...).json(resolved.body).

Measured with the checker's own scanSource, on the #8850 branch head:

fileresponsesokerrprivateOkstringErrorsiblingCode
packages/rest/src/error-response.ts (new)200000
packages/rest/src/rest-server.ts (after the move)not pinned (dialectOnly)4469

rest-server.ts's ratchet is unmoved — 44 / 69 before and after — because every one of its dialect sites is inside the class body, and the moved prologue contained none. pnpm check:route-envelope is green on the branch. Nothing needed editing and nothing was edited.

The gap

discover() in scripts/check-route-envelope.mjs collects a file only when its basename ends in -routes.ts or appears in OFF_CONVENTION_MODULES. error-response.ts matches neither, so the new module is invisible to the audit entirely.

Before the move, a new non-conforming error dialect written next to sendError landed in rest-server.ts and was counted by the stringError / siblingCode ratchet. After the move, the same literal written in error-response.ts is counted by nothing. The counts are 0 / 0 today, which is exactly the moment the ratchet is worth pinning.

This is the cost the checker's own header names:

The convention is the discovery surface, so anything outside it is invisible until it is named here — which is not a hypothetical cost. rest-server.ts was outside for as long as this gate has existed (#7295), while being the largest response-emitting file in the repo.

Why #8850 did not fix it in place

#8850's dispatch fixed its file surface at packages/rest/src/**, with an explicit instruction to stop on breach and explain rather than widen. scripts/check-route-envelope.mjs is outside it, so the gap is reported here instead of patched under that card.

Suggested remedy

The gate's own documented onboarding path, roughly four lines:

  1. add 'error-response.ts' to OFF_CONVENTION_MODULES, with a one-line reason;
  2. add 'packages/rest/src/error-response.ts': { responses: 2, ok: 0, err: 0 } to MODULES.

Worth confirming while doing it: the conformant entries in that table are all 0 / 0 / 0, so a responses: 2 entry is the first of its shape and should be read against auditModule before being assumed legal. The alternative shape is a dialectOnly entry, which would be the wrong instrument here — this module's write-site count is stable, which is precisely what dialectOnly exists to accommodate the absence of.

Refs: #8850 (the move that creates this), #7295 (why rest-server.ts is dialectOnly), #7035 (the ratchet's named end state).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions