Skip to content

fix(containment): restore Linux test compilation - #289

Closed
kevin-orellana wants to merge 1 commit into
mainfrom
feature/repair-linux-protection-alias-tests
Closed

kevin-orellana wants to merge 1 commit into
mainfrom
feature/repair-linux-protection-alias-tests

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem: Linux containment tests do not compile after #254 and #266 merged. Two test helpers still use the earlier function signature.

Solution: Update both helpers to pass the target path for each writable grant to the protection helper. The existing tests can then compile and run.

Trade-off: This repairs test setup only. It does not change runtime behavior or address separate runtime test failures.

Description

Both call sites now select writable Grant / Bind entries and pass each entry.target to protect_parents. Using the target preserves protection through aliases, including paths that differ from the source path.

The change touches one Linux unit-test file. All test assertions, names, and prerequisite checks remain unchanged. It extracts the same repair already present in #234 and #262, without their startup or interpreter changes.

Related Issues

Supports #48. Repairs the test integration between #254 and #266.

Type of Change

Bug fix

Testing

Tested on Amazon Linux 2023 ARM64 with Rust 1.98.1 and EXPERIMENTAL_LINUX_SUPPORT=TRUE. Base: 26521e4ba9bb2b6c11a9e9a17ed99bbc27fce3db. Commit: 35b2b50cd1b63f8819733b363651ba379cd13ee4. Tested Git tree: ca39a71e7dd6d0c2d2f9680b591d79f430c12490.

Check Result
Unchanged base: cargo test -p strands-box-containment --locked --all-features --lib --no-run Reproduced two E0061 compiler errors at the obsolete calls.
Repaired protection_alias tests 10 passed; zero failed, ignored, or prerequisite skips; 465 other tests filtered out.
bash scripts/test-all.sh Passed. Runs workspace tests with all features; the containment library ran all 475 tests successfully.
cargo build --workspace --all-features --locked Passed.
cargo fmt --all --check and git diff --check Passed.
Workspace Clippy with repository allowances Passed; allowances are listed below.
cargo clippy -p strands-box-containment --all-targets --all-features --locked -- -D warnings Passed without command-line lint allowances.
cargo build -p strands-box-containment --no-default-features --locked Passed with 66 warnings from unchanged production code. The all-features containment Clippy run has zero warnings.
Linux test-output audit Passed with the existing omissions described below.
bash test-integ/run.sh RED: 126 passed, two failed, nine declared macOS-only skips; all 137 expected rows recorded.

The workspace output retains existing ignored tests, one credential-service prerequisite skip, and an omitted alias-read assertion. That alias test executed its write assertions. The 10 repaired protection-alias tests had no prerequisite skips. The manual SDK tutorial and local macOS tests were not run.

The full deterministic run failed the remote tool-server case (CN-MR-01) with a resource-unavailable error and the metadata-permission case (SH-PROBE-PERMISSION) with PermissionError instead of the expected PY=False. Separate single-case replays passed CN-MR-01 and reproduced the metadata-permission failure. The initial full-suite RED result remains unchanged.

Those runtime artifacts exclude this unit-test module. Their production and deterministic harness sources match the base byte-for-byte. The metadata-response repair is tracked separately in #288. This PR does not establish a full integration pass; that failure can block the required hosted checks.

Workspace Clippy used --workspace --all-targets --all-features --locked -- -D warnings with the repository's allowances: clippy::too_many_arguments, clippy::only_used_in_recursion, clippy::await_holding_refcell_ref, clippy::explicit_auto_deref, clippy::chunks_exact_to_as_chunks, dead_code, and non_snake_case. The separate containment-scoped run used no command-line allowances.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features)
  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings

The checked run attestations refer to the delegated executions and exact allowances above. They do not mean that the deterministic suite passed.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

The two personal author attestations remain unchecked for Kevin. Codex read the contribution guidance and prepared and reviewed this change at Kevin's request. A separate Codex reviewer checked the repair and test evidence. These delegated checks do not represent Kevin's personal review or satisfy the required human approval.

Existing tests provide the regression coverage: unchanged main produces two compiler errors, and the repaired tests execute their existing assertions. No new test is needed. Documentation changes do not apply to this private test-setup repair.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

Two protection-alias test helpers still call protect_parents with one argument.
The grant-scoped helper introduced by #254 requires the target path as a second
argument, so the tests added by #266 do not compile on main.

## Solution

Pass each writable Grant/Bind entry target to protect_parents in both fixtures.
Keep the existing assertions and fixture ordering. Change only the Linux unit
test setup; do not include the unrelated changes from #234 or #262.

## Tests

Reproduced both E0061 errors on base 26521e4. The repaired protection-alias tests
pass 10/10, and all 475 containment library tests pass in the full workspace run.
Formatting, workspace build/tests, CI-equivalent workspace Clippy, unsuppressed
containment Clippy, no-default containment build, and the Linux output audit pass.
The no-default build retains 66 warnings from unchanged production code.

The separate deterministic suite remains RED: 126 pass, two fail, nine declared
macOS-only skips. A single-case replay passes the remote-MCP case and reproduces
the existing metadata-permission failure tracked by #288. Runtime and harness
sources match main. Existing workspace skips and lint allowances are documented
in the pull request; this is not a full integration pass.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Assessment: Comment

This fixes the two E0061 compile errors. The repaired tests ran on Linux (10/10, using a runner with user namespaces enabled), and bash scripts/test-all.sh passed. The tests now compile, but they no longer follow the mount order materialize has used since #266, so one regression can slip through. Details are in the inline comment. It doesn't block merge, since the PR's stated scope is to restore compilation.

Assumptions and rules checked that held
  • Every parent is still pinned: each planned protected parent sits strictly beneath some writable bind target. So pinning per grant covers the same set as the old protect_parents(root).
  • Using entry.target, not source, is correct: for the alias grants, the parents are planned under the alias spelling (z-project-link/sub).
  • The redirect cases are unaffected: they never call protect_parents, and the change leaves their behaviour as it was.
  • Premise rule: "Do not delete or #[ignore] a security test" (root AGENTS.md). No assertion, test name, or prerequisite check was removed.
  • Frozen surfaces: no interface, pub use set, or production code changed.

kevin-orellana pushed a commit that referenced this pull request Nov 3, 2026
Import the published test-only repair from PR #289 into the metadata-response
branch so its Linux checks can compile. Preserve the existing test assertions
and fixture ordering. Priya's metadata implementation remains unchanged.

Source commit: 35b2b50
Combined Linux validation: workspace build and tests passed (4,855 test passes,
17 ignored). All 10 protection-alias tests and 131 integration cases passed,
with nine declared macOS exclusions. Format, Linux output audit, CI-equivalent
workspace Clippy, and unsuppressed containment Clippy passed. The no-default
build passed with 66 warnings from unchanged code. Test tree: 5787cc8.
Hosted merge checks and human approval remain required.
@kevin-orellana

Copy link
Copy Markdown
Collaborator Author

Superseded by #288, which merged the exact Linux test-compilation repair into main. The repaired file in main matches this PR. Closing this duplicate; no additional merge is needed.

auto-merge was automatically disabled November 4, 2026 01:10

Pull request was closed

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

Labels

Area - Agent Containment bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants