Repository navigation
test(console): fake api refusals with codes the routes really send - #3626
Merged
Merged
Conversation
Finding 2446: browser fakes answered with RATE_LIMITED, ACCESS_DENIED, UNAVAILABLE, SERVICE_UNAVAILABLE and RESOURCE_NOT_FOUND, none of which the API sends. Route them through apiErrorResponse with the route's real code, or proxyErrorResponse(429) where the route has no 429, and drop the two local envelope helpers.
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Contributor
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: test(console): fake api refusals with codes the routes really send This is item 1/1 in the current shard. Shard 0/1. This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
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.
Problem
Some browser fakes still answered with error codes the API never sends:
RATE_LIMITED,ACCESS_DENIED,UNAVAILABLE,SERVICE_UNAVAILABLE,RESOURCE_NOT_FOUNDandTOO_MANY_REQUESTS. Some also used a 429 on routes that have no 429. Two files built envelopes with their own helper, so the contract check inapiErrorResponse(#3612, #3615) never saw them. A Console change that matched one of the invented codes would pass these tests and break against the real API.Change
Each fake now uses the code its route really sends, or the proxy page for a status the route never sends. Each test still checks what it checked before.
console-agent-channelsACCESS_DENIED×3 (Configuration PATCH ×2, access-binding POST); grant loop 403ACCESS_DENIED/ 429TOO_MANY_REQUESTSFORBIDDEN; 429 →proxyErrorResponse(429)console-drafts-keptRATE_LIMITED(Configuration POST, credential-source POST); localapiErrorhelperproxyErrorResponse(429); helper removed,apiErrorResponseconsole-namespace-createRATE_LIMITED(Namespace POST); 503UNAVAILABLE×2 (/observability, Namespace POST)proxyErrorResponse(429); 503DEPENDENCY_UNAVAILABLEconsole-agents.test.tsRATE_LIMITEDproxyErrorResponse(429)(case renamed "proxy rate limited")console-agent-deploy-againfailure()helper: 503UNAVAILABLE, and a 429 deployment-record read withUNAVAILABLEapiErrorResponse503DEPENDENCY_UNAVAILABLE/ 403FORBIDDEN; 429 →proxyErrorResponse(429)console-agent-overviewSERVICE_UNAVAILABLEDEPENDENCY_UNAVAILABLEconsole-agent-stateRESOURCE_NOT_FOUND; 503SERVICE_UNAVAILABLE; 503UNAVAILABLENOT_FOUND; 503DEPENDENCY_UNAVAILABLEconsole-agents-2.test.tsSERVICE_UNAVAILABLE×2DEPENDENCY_UNAVAILABLEWhere a test asserts a request ID, the fake keeps it.
Left for a follow-up, because open work touches these files:
console-agent-detail.test.mjs:1511and:2520answer 403ACCESS_DENIED. An in-flight console permissions change edits this file.console-agent-detail-2.test.mjs:514answers a repeat Agent DELETE with 429INVALID_REQUESTand nometa. It goes with the same follow-up.Not changed: the diagnostics
UNAVAILABLEcheck codes inconsole-agent-stateare check results, not error envelopes.console.test.mjsuses the session route, not the API's error envelope.Verification
All browser runs used a remote test VM, each in a private network namespace.
apiErrorResponserefuses every code removed here.RATE_LIMITED(namespaces.mts).a rate-limited or malformed creation answer is reportedfails on the branch and passes on main.ACCESS_DENIED(list.mtsmessage).Channel drawer does not grant Slack Secret access when Configuration save is rejectedfails on the branch and passes on main.tsc(repo and tests), ESLint and Prettier pass on the touched files.Risks
Test-only. No product, docs or suite-mapping change.