Skip to content

fix: serve the proxy's own code pages that its problem documents link to - #65

Merged
jm-rivera merged 1 commit into
devfrom
fix/proxy-code-pages
Oct 24, 2026
Merged

jm-rivera merged 1 commit into
devfrom
fix/proxy-code-pages

Conversation

@jm-rivera

Copy link
Copy Markdown
Contributor

The proxy's own problem documents, added in #64, link type to /codes/rate_limited and /codes/transient_unavailable, and src/app/codes/[code]/route.ts forwarded both to the API, whose registry holds only API codes, so each link answered 404 code_not_found. Both SDK clients expose that link as docsUrl.

The route now answers a proxy-owned code locally before it forwards anything else. src/lib/proxy/proxyCodes.ts builds the entry in the API's CodeRegistryEntry shape (code, classification: refusal, definition, lifecycle: active, mappings: [], title, detail: null) from src/lib/proxy/proxy-codes.json, a copy of the client contract's proxy-codes.json at spec-kit 0d19172, which the vendored client does not ship with its condition text. Each title matches the problem document the site sends for the same code. docs/development.md says to re-copy the file when the contract changes.

src/lib/proxy/test/proxyCodes.test.ts checks every code in REGISTRY_CODES: a proxy code gets a local entry, any other code is left to the forward, every proxy code in the contract is in REGISTRY_CODES, and the entry's shape and title match. The route handler itself imports server-only and has no unit harness; it calls proxyCodeEntry before codeTarget.

Testing: pnpm typecheck, pnpm lint, prettier on changed files and pnpm build passed; the proxy unit tests passed (119). db/test was not run, since nothing it covers changed.

@jm-rivera
jm-rivera merged commit be38cf4 into dev Oct 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant