Skip to content

The 26 sibling IHttpResponse literals in packages/rest are green because nothing checks them — and 5 of them for a different reason than #13454 recorded #14356

Description

@os-trump

Filed unassigned and ungraded by the domain:cli dev seat, session session_016yfqQh2dBgPAymYd7xipza, while implementing #13454. Not graded, not routed. Observation class: no runtime consequence, nothing regressed, nothing here is a blocker for anything.

A dedup search over this repo found no card for it; the only hits for the dedup query were #13454 (the card being worked) and #13377 (the request half), which is also the control that proves the search was answering.

What was measured

#13454 repaired the 2 ledgered TS2345 in packages/rest/src/rest.test.ts by adopting a response builder at those two sites. Its body records the other 26 literals of that shape as sitting "behind an argument-1 error or an as any". Measured on origin/main at 909a44171, that is right about 21 of them and wrong about 5.

rest.test.ts holds 28 const res = { json: vi.fn(), ... } declarations (positive control for the scan: the same package reports 283 .handler( call sites in src/*.test.ts, so a zero on either count would read as instrument failure). After #13454 the split is:

count why it is green sites
2 was red — repaired by #13454 2062, 2087
21 argument 2 is written res as any 1381 … 1761
5 the call itself is untyped: the enclosing rest / route binding is declared any, so route.handler(...) checks neither argument 1899, 1987, 3900, 3974, 4042

The 5 are the correction. There is no argument-1 error masking them and no as any on the response: nothing is checked at all, so no repair to argument 1 will ever surface them and the ledger can never see them. Three of the five (3900, 3974, 4042) even supply all four required members already — they would conform if anything looked.

The neighbouring makeRes() helpers

Three other files in the package build their response through a local makeRes() typed any and assert on a mirrored res.statusCode / res.body that the helper maintains off status / json:

  • packages/rest/src/analytics-dataset-dimension-gate.test.ts
  • packages/rest/src/meta-public-book-grant.test.ts
  • packages/rest/src/rest-batch-size-cap.test.ts

These cannot adopt src/http-response-test-builder.ts by substitution. That builder deliberately records through its spies and nowhere else (a mirror is a second, derived record of the same call, and the two can disagree — a mirror keeps only the last status where mock.calls keeps every one), so converting them changes the assertion rather than the fixture. That makes it a decision of its own, which is why #13454 left it: its dispatch order scoped these files to "report, do not fix".

Why this is worth a card and not just a note

The builder from #13454 states the four required members once, but nothing makes a site use it. The mechanism #13454 documents has not gone away: tsc reports at most one argument-assignability error per call expression, so the moment someone types an argument 1 properly at any of the 21 as any sites, that site's response literal becomes the next red — with packages/rest/test-typecheck-debt.json now empty, that red lands on whoever made the unrelated repair.

The as any census is explicitly the shape #13377 declined to expand into for the request half (it left 151 such .handler( sites when it repaired the 4 ledgered ones), so this is a deliberate standing decision being recorded, not an oversight being reported. What is new here is only that the same decision now has a measured shape on the response side, and that 5 sites sit outside every mechanism that could ever report them.

Re-check

cd packages/rest
grep -c 'const res = { json: vi.fn()' src/rest.test.ts
grep -rn 'function makeRes' src/*.test.ts
npx tsc --noEmit --pretty false -p tsconfig.test.json

Refs

Severity not judged; no urgency claimed. Nothing here is measured as regressing, and an empty ledger is accurate about the checked layer either way.

Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions