Repository navigation
fix(id): evict expired pending directory auth codes on issuance (#1732) - #3748
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Verification update (queue task 4789): the first |
Fixes #1732 · queue task 4789
What
DirectoryAuth::issue_codenow sweeps expired pending codes before issuing:self.codes.retain(|_, pending| pending.expires_at > now)— the same shape as the existing session sweep inopen_session. Previously an expired code for an address that never came back stayed in the per-worldcodesmap forever (until restart);check_codeonly ever removed the addressed record.Properties preserved
CODE_RESEND_MS) and the 5-attempt limit behave exactly as before.check_code: a code is expired atexpires_at <= now, and the sweep retains onlyexpires_at > now— pinned by a test atnow + CODE_TTL_MS - 1(kept) andnow + CODE_TTL_MS(evicted).Cost / limits (documented in the
issue_codedoc comment)The sweep is opportunistic — it runs only on issuance, so nothing is reclaimed while the world is idle and there is no hard cardinality bound.
HashMap::retainscans the whole map, so issuance costs O(pending codes); accepted because issuance is already rate-limited per address. This wording follows task 1957's triage guidance — no idle cleanup or hard bound is claimed.Tests
New in-module tests in
pkgs/id/src/directory_auth.rs:issuing_for_another_address_evicts_expired_codes_at_the_ttl_boundarythe_sweep_keeps_unexpired_codes_even_after_their_attempts_run_outTargeted run
cargo test --lib directory_auth(pkgs/id) is executing on the laptop under heavy parallel fleet load; result will be posted here when it lands. CI on main is the backstop.Need help on this PR? Tag
@codesmith-botwith what you need.