Skip to content

fix(acp): isolate permission.rs tests from real acp-permissions.toml#6514

Merged
bug-ops merged 2 commits into
mainfrom
fix/6512-acp-permission-test-isolation
Jul 19, 2026
Merged

fix(acp): isolate permission.rs tests from real acp-permissions.toml#6514
bug-ops merged 2 commits into
mainfrom
fix/6512-acp-permission-test-isolation

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • permission.rs's test suite constructed AcpPermissionGate::new(conn, None) in 9 places, which falls back to the developer's real acp-permissions.toml config file instead of a test fixture, persisting test-injected allow/reject decisions to a file the live zeph --acp binary also reads.
  • Adds a temp_perm_path() helper and backs every gate in the test module with an isolated tempfile::tempdir(), mirroring the pattern already used in terminal.rs (fix(security): close quarantine fail-open and ACP shell permission cache gaps #6511).
  • No production code changed — default_permission_file() is untouched.

Closes #6512

Test plan

  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" -E 'package(zeph-acp)' --lib --bins — 168/168 passed
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 14703/14703 passed
  • Confirmed the real ~/Library/Application Support/zeph/acp-permissions.toml mtime predates the test run (untouched)
  • Confirmed zero remaining AcpPermissionGate::new(_, None) call sites in permission.rs; workspace-wide grep confirms no other affected sites
  • cargo +nightly fmt --check clean
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings clean
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler" clean
  • gitleaks protect --staged clean

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes bug Something isn't working size/M Medium PR (51-200 lines) labels Jul 19, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 19, 2026 21:30
@bug-ops
bug-ops force-pushed the fix/6512-acp-permission-test-isolation branch 5 times, most recently from 7633b21 to c1500de Compare July 19, 2026 22:07
bug-ops added 2 commits July 20, 2026 00:16
permission.rs's test suite constructed AcpPermissionGate::new(conn, None),
which falls back to the developer's real permission config file instead of
a fixture. Every allow_always/reject_always test persisted a real entry to
that file, which the live zeph --acp binary also reads.

Add temp_perm_path() and back every gate in the test module with an
isolated tempfile::tempdir(), mirroring the pattern already used in
terminal.rs (#6511).
@bug-ops
bug-ops force-pushed the fix/6512-acp-permission-test-isolation branch from c1500de to c1ddcba Compare July 19, 2026 22:16
@bug-ops
bug-ops merged commit 43fd592 into main Jul 19, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/6512-acp-permission-test-isolation branch July 19, 2026 22:25
bug-ops added a commit that referenced this pull request Jul 19, 2026
…introduction (#6524)

A None second argument falls back to the developer's real acp-permissions.toml
instead of an isolated test path, silently persisting AllowAlways/RejectAlways
decisions across unrelated test runs (#6512, fixed for both terminal.rs and
permission.rs by PR #6514). Adds a self-testing bash guard,
check_acp_permission_gate.sh, wired into the lint-shellcheck CI job, that fails
the build if the pattern reappears in crates/zeph-acp/src.

Closes #6515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zeph-acp: permission.rs tests write allow/reject decisions to the real, non-fixture acp-permissions.toml

1 participant