Skip to content

fix: unambiguous AllowlistApprover constructors + documented decision pipeline - #70

Merged
ajianaz merged 1 commit into
developfrom
fix/approver-ctor-semantics
Sep 12, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/approver-ctor-semantics

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

AllowlistApprover gains allow_only(patterns) (allow exactly these, deny the rest) and deny_only(patterns) (deny exactly these, allow the rest; Destructive stays always-denied), implemented via an explicit deny_mode flag. new() keeps its behavior (0.2.0 is published on crates.io) but now documents the decision pipeline with the concrete trap example, and a regression test codifies it.

Why (the problem you're solving)

Found while re-reading the #68 tests: new's two arguments read as 'allow these, deny the rest', but the pipeline is pattern-match → Allow with default applying only to NON-matches — so new(vec!["bomb"], Decision::Deny) actually allows bomb. The misleading shape is what made the original guarded-replay livelock test look correct for months.

Testing (how you verified this works)

  • New unit tests: allow_only (listed allow / rest deny), deny_only (listed deny / rest allow), and new_with_deny_default_still_allows_matches codifying the trap so nobody silently changes it in either direction.
  • Full workspace green (159 tests), mobile profile green, fmt + clippy -D warnings clean, CodeCora diff review clean.

… pipeline

Found while re-reading the #68 tests: AllowlistApprover::new's two
arguments read as 'allow these, deny the rest', but the pipeline is
pattern-match -> Allow with default applying to NON-matches, so
new(vec!["bomb"], Decision::Deny) actually ALLOWS bomb.

- Document the pipeline on new() with the concrete trap example
  (behavior unchanged: 0.2.0 is published on crates.io and interactive
  UX relies on it), now codified by a regression test.
- allow_only(patterns): allow exactly these, deny the rest.
- deny_only(patterns): deny exactly these, allow the rest (Destructive
  stays always-denied). Implemented with an explicit deny_mode flag so
  deny_only cannot be expressed as the misleading shape that started
  this.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

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