Repository navigation
Conversation
The website proxy answers a call whose API key is unknown, revoked or malformed with a 401 problem document carrying `invalid_api_key`, and does not fall back to anonymous access. List it in proxy-codes.json so the document's type resolves to a code page. Unlike rate_limited and transient_unavailable the refusal is not retryable, so validate_client_contract.py now expects `retryable: false` in a proxy problem document with this code and `retryable: true` in any other. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015QQk2mKJZzXv2AYykDjvQf
This branch has not been deployed
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.
Summary
The website's platform proxy now accepts API keys (
Authorization: Bearer dfo_...orX-API-Key). A call whose key is unknown, revoked or malformed is refused with a 401 problem document, not served as an anonymous call. That document carries the codeinvalid_api_key, whichproxy-codes.jsondid not list, so the document'stypefell back toabout:blankand/codes/invalid_api_keydid not resolve.proxy-codes.jsongainsinvalid_api_key(401), sorted beforerate_limited.format_versionstays 1: a code is added, and no field changes.tools/validate_client_contract.pyrequiredretryable: trueof every proxy problem document in a scenario, so it now expectsretryable: falseforinvalid_api_keyandtruefor the rest, and a test pins both.X-API-Keythat carry different keys) answers 400 with the registry's existingrequest_invalid, so it needs no contract change.CHANGELOG.mdforclient-contracthas an entry under Unreleased.A client reads the 401 through the status fallback as
AuthenticationErrorand carries the code. No scenario changes.Part of DevelopmentFinanceObservatory/website#142. The website vendors this file in DevelopmentFinanceObservatory/website#143.
Test plan
uv run tools/validate_client_contract.pyuv run --with jsonschema --with pyarrow --with pytest pytest tools/tests -q, including the newtest_an_invalid_api_key_problem_is_not_retryablepython/client-contract:uv run pytest,uv run ruff check .,uv run ruff format --check .,uv run ty check src/dfo_client_contract🤖 Generated with Claude Code
https://claude.ai/code/session_015QQk2mKJZzXv2AYykDjvQf