Skip to content

hotfix(api/auth): unbreak main — use local user_api_keys snapshot#3250

Merged
houko merged 1 commit into
mainfrom
hotfix/middleware-user-api-keys-iter
Apr 26, 2026
Merged

hotfix(api/auth): unbreak main — use local user_api_keys snapshot#3250
houko merged 1 commit into
mainfrom
hotfix/middleware-user-api-keys-iter

Conversation

@houko

@houko houko commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Merge race between #3236 (loopback attribution) and #3233 (rotate-key race lock).

#3233 changed AuthState.user_api_keys from Arc<Vec<ApiUserAuth>> to Arc<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 uses auth_state.user_api_keys.iter() directly. Once they both landed in main the trunk no longer compiles:

error[E0599]: no method named `iter` found for struct `Arc<RwLock<Vec<ApiUserAuth>>>`
   --> crates/librefang-api/src/middleware.rs:430

Fix

auth() already snapshots the lock at line ~363 into a local user_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.

…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.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@houko
houko merged commit d412a67 into main Apr 26, 2026
14 of 15 checks passed
@houko
houko deleted the hotfix/middleware-user-api-keys-iter branch April 26, 2026 14:43
@github-actions github-actions Bot added size/XS < 10 lines changed ready-for-review PR is ready for maintainer review and removed ready-for-review PR is ready for maintainer review labels Apr 26, 2026
@houko houko mentioned this pull request Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS < 10 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant