hotfix(api/auth): unbreak main — use local user_api_keys snapshot#3250
Merged
Conversation
…tribution Merge race between #3236 (loopback attribution) and #3233 (rotate-key race lock) left main with a rustc error: `auth_state.user_api_keys` became `Arc<tokio::sync::RwLock<Vec<ApiUserAuth>>>` which has no `.iter()` method. The earlier in-handler snapshot (line ~363) clones into a local `user_api_keys: Vec<ApiUserAuth>` exactly so downstream code doesn't have to re-acquire the lock — line ~429 just needs to read from that snapshot the same way line ~757 already does. Pure rename. No behavior change.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Merge race between #3236 (loopback attribution) and #3233 (rotate-key race lock).
#3233 changed
AuthState.user_api_keysfromArc<Vec<ApiUserAuth>>toArc<tokio::sync::RwLock<Vec<ApiUserAuth>>>so the rotate handler could hold the write lock across persist + reload + snapshot swap. #3236 was authored against the old type and usesauth_state.user_api_keys.iter()directly. Once they both landed in main the trunk no longer compiles:Fix
auth()already snapshots the lock at line ~363 into a localuser_api_keys: Vec<ApiUserAuth>for exactly this reason — every other downstream read uses it. The new loopback-attribution path needs to do the same. One-line rename.Test plan
CI compile alone is the regression gate. No behavior change.