Uh oh!
There was an error while loading. Please reload this page.
test(rest): re-point the publish-classification sentinel at ThrownHttpError.declaredStatus - #8814
Conversation
…pError.declaredStatus `package-publish-status-classification.test.ts` asked the shared #8016 rule whether a throw declared a status of its own by hand-probing `resolveThrownHttpError` with a sentinel `fallbackStatus` (0) no producer declares. PR #8633 gave the resolver a field that states this fact directly -- `ThrownHttpError.declaredStatus`, present exactly when the throw declared a status, absent when it did not. Re-point both call sites at that field instead of the hand-spelled sentinel: - the `declaredStatus` helper: `resolveThrownHttpError(error, 0).status !== 0` -> `resolveThrownHttpError(error).declaredStatus !== undefined` - the driver-`code` case: `resolveThrownHttpError(driverError, 0)` / `expect(resolved.status).toBe(0)` -> `resolveThrownHttpError(driverError)` / `expect(resolved.declaredStatus).toBeUndefined()` The case's own unrelated claim -- `declaredCode` and the re-thrown 500 / INTERNAL_ERROR answer -- is untouched. Test file only, no production change (`ThrownHttpError.declaredStatus` already landed in #8633). Fixes#8634 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NaS1PAHJcPfAA2acnV53Tn
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
qq9340100
commented
Aug 15, 2026
ACCEPT (conditional) — PM review, |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#8634
What changed
packages/rest/src/package-publish-status-classification.test.tsasked the shared #8016 rule "did this throw declare a status of its own?" by hand-probingresolveThrownHttpErrorwith a sentinelfallbackStatus(0) no producer declares. PR #8633 gave the resolver a field that states this fact directly —ThrownHttpError.declaredStatus, present exactly when the throw declared a status, absent when it did not. This PR re-points both hand-spelled call sites at that field:declaredStatushelper:resolveThrownHttpError(error, 0).status !== 0→resolveThrownHttpError(error).declaredStatus !== undefinedcodecase:resolveThrownHttpError(driverError, 0)/expect(resolved.status).toBe(0)→resolveThrownHttpError(driverError)/expect(resolved.declaredStatus).toBeUndefined()The case's own unrelated claim —
resolved.declaredCodeand the re-thrown 500/INTERNAL_ERRORanswer — is untouched.This is not a defect fix: the sentinel spelling was not wrong for any producer in this repo today. It is the same question spelled twice, and the hand-spelled copy fails silently in exactly the one case the field cannot — a producer that declares status
0. Test file only, no production change (ThrownHttpError.declaredStatusalready landed in #8633).Verification
An ad-hoc equivalence check (
resolveThrownHttpError(e, 0).status !== 0vsresolveThrownHttpError(e).declaredStatus !== undefined) against every shape this suite exercises —.status,.statusCode, a declared 5xx, a bareError, a string throw,null, and the driver-codecase — showed full agreement. The one constructed divergence, a producer declaringstatus: 0, showed the old sentinel silently answeringfalse("not declared") while the new field-based check correctly answerstrue— confirming the exact failure mode the card describes and that this PR removes it.Tests
At HEAD
a8aca740c:pnpm --filter @objectstack/rest test(full package suite,--maxWorkers=2):Test Files 117 passed (117),Tests 1942 passed (1942), exit 0.pnpm check:nul-bytes: OK.pnpm check:cross-package-test-inputs(both thepnpm runand direct-script forms): OK, 9 declared packages, nothing undeclared.pnpm check:query-options-erasure: ratchet holds,no files addedagainst baselined09d0fd.pnpm check:type-check-coverage(structural half): OK, unaffected by this change.pnpm check:type-check-debt(--re-measure, the ratchet half —@objectstack/restcarries a TEST_DEBT ledger entry since itstsconfig.jsonexcludes*.test.ts): OK. 33 ledger entries re-measured, 1926 raw tsc errors total, none above its recorded number.@objectstack/restre-measured to exactly its recorded 155 (unchanged — this edit introduced no new tsc diagnostic in the hidden test layer). The one entry that moved (@objectstack/lint, -1) is unrelated to this PR.Generated by Claude Code