Repository navigation
fix: serve the proxy's own code pages that its problem documents link to - #65
Merged
Merged
Conversation
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.
The proxy's own problem documents, added in #64, link
typeto/codes/rate_limitedand/codes/transient_unavailable, andsrc/app/codes/[code]/route.tsforwarded both to the API, whose registry holds only API codes, so each link answered 404code_not_found. Both SDK clients expose that link asdocsUrl.The route now answers a proxy-owned code locally before it forwards anything else.
src/lib/proxy/proxyCodes.tsbuilds the entry in the API'sCodeRegistryEntryshape (code,classification: refusal,definition,lifecycle: active,mappings: [],title,detail: null) fromsrc/lib/proxy/proxy-codes.json, a copy of the client contract'sproxy-codes.jsonat spec-kit 0d19172, which the vendored client does not ship with its condition text. Eachtitlematches the problem document the site sends for the same code.docs/development.mdsays to re-copy the file when the contract changes.src/lib/proxy/test/proxyCodes.test.tschecks every code inREGISTRY_CODES: a proxy code gets a local entry, any other code is left to the forward, every proxy code in the contract is inREGISTRY_CODES, and the entry's shape and title match. The route handler itself importsserver-onlyand has no unit harness; it callsproxyCodeEntrybeforecodeTarget.Testing:
pnpm typecheck,pnpm lint, prettier on changed files andpnpm buildpassed; the proxy unit tests passed (119).db/testwas not run, since nothing it covers changed.