Skip to content

refactor(auth): deterministic allowlist list order - #1

Merged
KeyCode17 merged 1 commit into
mainfrom
refactor/allowlist-deterministic-list
May 18, 2026
Merged

refactor(auth): deterministic allowlist list order#1
KeyCode17 merged 1 commit into
mainfrom
refactor/allowlist-deterministic-list

Conversation

@KeyCode17

Copy link
Copy Markdown
Owner

Summary

  • Switch YamlAllowlistStore from HashMap<String, AllowlistEntry> to BTreeMap, so list() returns entries sorted by domain.
  • Add unit tests covering the sort guarantee and the lookup path.

Why

HashMap iteration order is non-deterministic, which makes px-cli allowlist list flaky and breaks reproducible audit diffs when the store is rebuilt. BTreeMap keeps lookup() semantics identical while giving operators a stable, sorted view.

Test plan

  • cargo test -p pxsolver-auth --lib yaml_allowlist_store — 2/2 passing
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features clean against the lefthook ruleset (-D warnings -D unwrap_used -D expect_used -D panic -D dbg_macro -D todo -D unimplemented)
  • Lefthook pre-commit + pre-push hooks pass locally

🤖 Generated with Claude Code

Use BTreeMap so YamlAllowlistStore::list() returns entries sorted by
domain. Previously a HashMap iteration could return entries in any
order, which surfaced as flaky `px-cli allowlist list` output and
non-reproducible audit diffs when the store is rebuilt.

Added unit tests for the sort guarantee and the lookup path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@KeyCode17
KeyCode17 merged commit 7ccc300 into main May 18, 2026
6 checks passed
@KeyCode17
KeyCode17 deleted the refactor/allowlist-deterministic-list branch May 18, 2026 07:40
KeyCode17 added a commit that referenced this pull request May 18, 2026
Lifts workspace.package.version 1.2.0 -> 1.3.0 and aligns the 16
internal workspace.dependencies pins from 1.1.0 -> 1.3.0 so published
metadata records the current release line.

Releases since 1.2.0:
- refactor(auth): deterministic allowlist list() ordering (#1)
- feat(server): graceful shutdown on SIGTERM / Ctrl-C (#4)
- feat(cli): complete Phase 04 subcommand surface (#3)
- docs(readme): reflect v1.2.0 published state (#2)
- ci(release): port rust-ai-surfer publish pattern

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant