test(agents): restore portable sandbox resolver coverage (BRNS-DESK-059) - #91
Conversation
nir-ssvlabs
left a comment
There was a problem hiding this comment.
AC4 checks out where it matters: both removals sit inside #[cfg(test)] mod tests, and the only non-test edit is the #[path] module declaration — no policy text, resolver, or gate moved. For a change touching sandbox.rs that's the claim worth proving rather than accepting.
The trade is a real gain on the second test. an_unresolvable_root_refuses_to_produce_a_policy could only ever run on macOS, because policy() checks the platform before the roots — off macOS it passed for the wrong reason. Going through params() instead means a missing required root is now pinned as SandboxError::Path on every platform, which is strictly more coverage than what was deleted.
- 🟢 The resolution assertion is only load-bearing where the temp path actually contains a symlink. It compares
params()againststd::fs::canonicalize(path), so on a symlink-free root that's a tautology and a resolver returning its input unchanged would pass. In practice macOS tempdirs land under/var/folders(a symlink), so the platform that runs Seatbelt still exercises it — the old/tmp→/private/tmpassertion just failed louder by naming the answer. Asymlinkin the fixture pointing at the real dir would restore that property portably.
Checked: that every removed line is inside the test module, the new tests' assertions against what the deleted ones covered, and that params() is reached without policy(). Not read: the macOS-only Seatbelt/preflight tests that stay put — unchanged here.
Merge: ✅ into dev.
stefan-ssv-labs
left a comment
There was a problem hiding this comment.
✅ review-pr (self-review, cannot approve): clean — BRNS-DESK-059 requirements are satisfied; no blockers or criticals.
Finding
BRNS-DESK-059
Requirement → change
SandboxRoots::params()and assertsSandboxError::Path, without callingpolicy().Verification
cargo fmt --all --check— passed.cargo clippy --workspace --all-targets -- -D warnings— passed (only the pre-existingblock v0.1.6future-incompatibility notice).cargo test --target-dir /private/tmp/brains-desk-059-refactor-target -p brains-local-agents --lib— passed: 109 tests, including both new portable resolver tests.npm run lint:size— passed;sandbox.rsis 545 lines.cargo test --workspace -q— all ordinary suites passed. The two existing macOS Keychain-dependentheadless_sandboxtests failed locally:a_confined_run_reads_its_login_but_writes_no_secreta_scheduled_run_is_confined_and_still_does_its_workThe same two failures reproduce on clean
origin/devwith CI-equivalent Recall bundle stubs, so this is a non-regression environment baseline.Platform evidence and gaps
Risks and non-goals
This does not broaden non-macOS Seatbelt support or alter the order of sandbox policy construction. It only restores portable coverage at the path-resolution seam.
Shipping impact
No packaging, capabilities, updater, persisted-state, or release-action impact.
Regression provenance
Reproduction
SandboxError::Pathbefore any Seatbelt policy is constructed.Expected: resolver coverage runs portably while actual Seatbelt enforcement remains macOS-only.
Merge
Squash merge after review and required checks pass.