Repository navigation
fix: answer every refusal the site builds as a problem document - #64
Merged
Merged
Conversation
The proxy's own 429 and 502, the codes and Studio routes, the Studio allowance, and the share, conversations, roadmap, events, source-doc, version-download, download-pin and live-share routes answer application/problem+json through src/lib/proxy/problem.ts, with a code, retryable and trace_id; the 429s send Retry-After. A code the API registry or proxy-codes.json holds links its type to /codes/<code>, and a site code reads about:blank. Browser readers read `code`, and a platform_refused share carries the platform's code in platform_code. The vendored @developmentfinance/client is rebuilt from the SDK, which adds the timed_out no-data reason (with reader text) and the breakdown candidate basis.
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 site answered its own refusals in two shapes: problem documents for the routes website#54 touched, and
{error, retry, detail}or{detail}bodies everywhere else, which the client contract in DevelopmentFinanceObservatory/spec-kit#20 now retires. A timed-out search part also showed "No data matched this query.", because the vendored client predated thetimed_outno-data reason.Every HTTP refusal the site builds is now an
application/problem+jsondocument fromsrc/lib/proxy/problem.ts, withtype,title,status,detail,code,retryableandtrace_id, and thex-dfo-trace-idheader. That covers the proxy's 429 (rate_limited, with its rate-limit headers andRetry-After) and 502 (transient_unavailable) inforward.ts,forwardAsset, the/codes/[code]and Studio routes, the Studio allowance inspendPrompt.ts, and the share, conversations, roadmap votes, events, source-doc, version-download, download-pin and live-share routes. A code the API registry orproxy-codes.jsonholds linkstypeto/codes/<code>; a site code (guest_limit,live_*,refresh_pending,unauthorizedand the rest) readsabout:blank.problem()places extension members first, so none can override a core member. Readers readcode:readShareAnswer,liveCards,cardDownload.liveRefusal(which takes the wait fromRetry-After), andcreateSearchShare, which reads the platform's own code fromplatform_codeonly on aplatform_refusedshare, so a 400 or 413 shows the generic share failure again.vendor/developmentfinance-client-0.1.0.tgzis rebuilt from DevelopmentFinanceObservatory/sdk (the problem-document client), and only its integrity line moves inpnpm-lock.yaml.view.tsgains thetimed_outtext andreadings.tsthebreakdownbasis note the new types require.docs/development.mdnotes that a local re-vendor needs the old copy undernode_modules/.pnpmremoved, since the file name does not change.Left as they are:
/api/feedback, which mirrors the brochure site's{ok, message}, and the plain-texts/[id]/downloadanddocs-mdresponses.liveBackend.refusalOfkeeps itserrorfallback because the dfo-ai backend still sends{error}bodies.A reviewer should check the code chosen for each route and that relayed upstream responses pass unchanged.
Testing:
pnpm typecheckandpnpm lintpassed, prettier passed on the changed files, andpnpm testpassed 1,879 tests includingdb/testagainst Postgres 18.4.