Conversation
2 tasks
bootjp
added a commit
that referenced
this pull request
May 15, 2026
Four findings from r5 reviewers, all addressed in this commit: 1. Codex r5 P1 (line 275, confused-deputy via path.Clean): path.Clean collapses '/queues//messages' to '/queues/messages', so a request missing the queue name would be silently rewritten to target a queue literally named 'messages' — wrong-queue purge / delete / describe risk. §3.4 now commits to a two-step routing rule: first, scan r.URL.Path's segments and reject any empty segment between 'queues' and the next non-empty token (returns 400 Validation 'queue name is required'); only AFTER that gate apply path.Clean. Order matters because path.Clean is destructive; the empty-segment check has to inspect the original path. 2. Claude #13 (Medium, admin_peek bucket aliases Default '*'): resolveActionConfig falls through to ('*', DefaultCapacity, DefaultRefillPerSecond) for any unknown action, so silently joining the '*' branch would alias the same queue's ReceiveMessage-via-Default key. Interleaved peek/receive calls would force loadOrInit to CompareAndDelete+LoadOrStore the bucket on every request, perpetually wiping each other's state. §3.1 now requires a new const bucketActionAdminPeek = 'admin_peek' and an explicit case in resolveActionConfig returning (bucketActionAdminPeek, AdminPeekCapacity, AdminPeekRefillPerSecond) so the bucket key stays distinct from '*'. Throttle config struct gains AdminPeekCapacity / AdminPeekRefillPerSecond fields seeded from the existing adminPeekRPS=5 / adminPeekBurst=20 defaults at server boot. 3. Claude #14 (Medium, writeSQSErrorFromErr 500-on-rate-limit regression): writeSQSErrorFromErr pattern-matches only on *sqsAPIError; once tryPurgeQueueOnce stops emitting one for the rate-limit case, the SigV4 purgeQueue handler's writeSQSErrorFromErr(w, err) falls through to the generic 500 branch — silently regressing 400 PurgeQueueInProgress to 500 InternalFailure. §3.2 now spells out that Phase 2 adds an errors.As(*purgeRateLimitedError) branch to writeSQSErrorFromErr rendering sqsErrPurgeInProgress with the duration embedded in the message string (character-for-character compatible with the prior newSQSAPIError output). Without this, Phase 2 cannot ship because the SigV4 wire surface would break for existing clients. 4. Claude #15 (Minor, '*ms' pseudo-unit ambiguity in §3.2 pseudocode): the earlier 'remaining := sqsPurgeRateLimitMillis*ms - …*ms' notation looked like '* time.Millisecond' to an implementer skimming the doc. Since sqsPurgeRateLimitMillis is already in milliseconds (= 60_000), 'sqsPurgeRateLimitMillis * time.Millisecond' would yield a 60_000× too-large duration. §3.2 now uses the unit-correct Go form: time.Duration(sqsPurgeRateLimitMillis - (now - meta.LastPurgedAtMillis)) * time.Millisecond. An inline note explains the unit logic so the next reviewer doesn't re-flag it. No code in this PR; doc-only update. Phase 2 (Purge backend) is unblocked by #14; Phase 3 (Peek backend) is unblocked by #13; Phase 4 (HTTP handler) is unblocked by the routing pre-check from finding #1.
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.
No description provided.