Skip to content

test(containment): restore Linux Git and Cargo workflows - #136

Merged
kevin-orellana merged 4 commits into
mainfrom
feature/linux-git-acceptance
Oct 23, 2026
Merged

kevin-orellana merged 4 commits into
mainfrom
feature/linux-git-acceptance

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem: The Linux suite skips Git and Cargo workflows, so it cannot detect regressions in helper execution after #131.

Solution: Restore both tests with supported grants and real helper execution. Verify denied access alongside successful commits and builds.

Trade-off: Linux test hosts need Git and the selected Rust/GCC toolchain. Cargo uses explicit compiler and library paths; production behavior is unchanged.

Description

Git initializes a repository, stages a file, commits through a real hook, and reads the log.
An independent host check verifies the commit. Its journal must name the exact Git executable.

Cargo compiles an offline crate through Rust and GCC, executes a build script, and runs the generated output.
It discovers the installed toolchain and GCC support directory, and creates a dedicated directory with selected linker-helper aliases.
Ubuntu linker scripts can name /lib/... files while the fixture grants resolved library paths.
The fixture stages installed libc.so and libm.so linker inputs beside its compiler helpers.
It resolves absolute file references in private script copies and adds that directory to the linker search path.
Installed binary libraries remain unchanged. This tests the configured toolchain; it does not establish automatic distribution-wide linker compatibility.
The fixture uses existing read/write/file grants. It adds no Core configuration fields or automatic host access.
The test selects installed Cargo and Rust binaries directly; it does not test Rustup installation or registry downloads.

Both workflows check read-only write refusal, ungranted execution, protected configuration, direct-agent execution, and missing-tool refusal.
Cargo also verifies that a declared output runs while an undeclared copy beside it is refused.
Host controls establish that the programs and files work outside containment.
Exact journal assertions account for Box's home-relative path spelling.

The actual quarantine list is now empty. Runner and reducer tests require both workloads to run.
Generic quarantine integrity tests use a synthetic entry passed through private helpers; production entry points always use the actual compiled list.
A missing result, unexpected skip, duplicate result, or test failure still makes the verdict red.

Codex prepared this patch. A fresh independent adversarial review covered the combined change.
The existing automated Git review's diagnostic-message suggestion is addressed.
Native/cloud qualification and npm/server workflows remain separate work.

Related Issues

Follow-up to #131. Related helper validation: strands-agents/staging-boxy#115.
No issue closes through this PR.

Type of Change

Other: Restore automated test coverage.

Testing

Current correction head: 1736e62aa25808942a847081043b1a775de3df48. Fresh Linux and macOS deterministic checks passed.

Local validation used product base 8390709, which includes merged #131. This PR changes only six files under test-integ.

Check Result
Current Ubuntu 24.04 ARM64 CI GREEN/full: 109 passed, zero failures/errors, 20 declared platform skips. Git and Cargo both passed
Current macOS CI GREEN/full: 121 passed, zero failures/errors, eight declared platform skips
Linux workload cases before the Ubuntu correction All seven passed on Debian, including Git and Cargo, without skips
Ubuntu Cargo reproduction at b834c55 Failed in CI and locally: linker could not find /lib/aarch64-linux-gnu/libmvec.so.1
Corrected Ubuntu workload cases All seven passed as UID 1001; zero ignored; 25.55 seconds. Independent repeat: seven passed in 27.36 seconds
Correction review gates Native all-feature build, 90 serial library tests, strict Clippy, formatting, and no-default-feature build passed
Git baseline control at 913f536 Failed as expected: hook ignored as non-executable
Cargo baseline control at 913f536 Failed as expected: Rust execution refused with OS error 13
Harness unit tests Linux 90 passed; native macOS 90 passed serially
macOS containment test compilation Passed
Quarantine mutation Restoring Cargo quarantine made empty-list, runner, and reducer tests fail; restoring the final source passed
Formatting Workspace and standalone harness checks passed
Harness Clippy Native macOS strict check passed; Linux passed with its existing documentation-lint allowance
Original full Linux deterministic manifest RED: 108 passed, one setup error, 20 platform skips, no quarantine entries

The original full Linux run failed cn_i_09 and host_trace_attaches_detaches_and_rejects_permissive_fault.
Both fail in the unchanged host marker's tracing setup before containment. All other test targets passed.
No failure was suppressed. An empty quarantine list does not make this full-suite run green.
The 20 remaining skips are platform declarations.

The correction review also ran full containment locally: 42 passed and 37 failed.
That run lacked the CI runner's writable server placeholders. Its filesystem stress test then exhausted the private filesystem's file entries.
Later cases failed during setup; the policy target could not create temporary directories.
This run is RED and does not supersede the earlier successful seven-case runs. The successful hosted results above provide the standard-runner validation.

Linux Clippy used -D warnings -A clippy::doc_lazy_continuation for the unchanged warning in cn_native_egress.rs.
The earlier Git-only macOS run exceeded two network-test deadlines during concurrent compilation; its serial rerun and the combined unit run passed.

Commands included:

cargo test --locked --manifest-path test-integ/Cargo.toml --all-features --test containment cn_w_0 -- --nocapture
cargo test --locked --manifest-path test-integ/Cargo.toml --all-features --tests --no-fail-fast
cargo test --locked --manifest-path test-integ/Cargo.toml --all-features --lib -- --test-threads=1
cargo test --locked --manifest-path test-integ/Cargo.toml --all-features --test containment --no-run
cargo fmt --all --check
cargo fmt --manifest-path test-integ/Cargo.toml --all --check
cargo clippy --locked --manifest-path test-integ/Cargo.toml --all-targets --all-features -- -D warnings

The original Linux execution used a privileged Debian ARM64 container on LinuxKit 7.0.12.
The Ubuntu correction also ran in a privileged Ubuntu 24.04 ARM64 container, as an ordinary user.
The shared Docker disk filled during validation; the successful Ubuntu run used an isolated ext4 filesystem backed by host disk.
Containment and file identity checks stayed enabled.
Hosted checks used merge 7257979be94ba03f25382b37871fd56301b7fc5f, combining this head with a86169182d80f4fd19ec0445aceaf7d1f0a86279.
These results establish the selected workflows, not native Linux or cloud acceptance.
The automated reviewer rechecked 1736e62 and reported no new issues. Its existing unused-helper suggestion remains nonblocking.

  • I ran the relevant standalone harness suites with all features; outcomes and existing failures are documented above.
  • I ran workspace and harness formatting checks and harness Clippy; the existing Linux lint allowance is documented above.

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

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

## Problem

The Linux Git workflow is quarantined because its fixture declares unsupported tool exec grants. The suite cannot detect a regression in Git helper execution after PR #131.

## Solution

Use supported filesystem grants and Git's installed helper directory. Run a real commit hook and verify the commit outside Box. Preserve agent, unconfigured-tool, read-only write, protected-path, and ungranted-program refusals. Remove only Git from quarantine and update runner and reducer checks. Cargo remains quarantined. No production interface or permission changes.

## Tests

The Git case passes against current main 8390709 and fails on baseline 913f536 when the hook cannot execute. Harness unit tests: 90 passed on Linux and macOS; macOS required a serial rerun after two existing timing failures. macOS containment tests compile. Formatting passes. Clippy passes on macOS; Linux requires an allowance for the unchanged cn_native_egress.rs documentation warning. Restoring Git quarantine makes the new runner test fail. Full Linux suite remains red on two unchanged uncontained tracing-setup failures. Native Linux and cloud qualification are not claimed.
Comment thread test-integ/tests/containment/cn_w_05.rs Resolved
@github-actions

Copy link
Copy Markdown

Assessment: Approve (Comment)

Clean, well-scoped test restoration. CN-W-05 moves out of quarantine into a real Git workflow, and the quarantine list, runner, and reducer are updated consistently; no production source is touched.

Review Categories
  • Correctness/consistency: Verified end-to-end — TEMPORARY_QUARANTINE now holds only CN-W-06, the pinned/lookup tests, the runner probe tests, and all verdict.rs reducer tests (complete_linux_quarantined ordering, counts 4/3/1, rows[2] targeting) line up with that single-entry list. Deriving the skip test from the list rather than hardcoding IDs is a nice robustness improvement.
  • Harness usage: All helpers used (sh_quote, run_mediated_with_config, assert_spawn_permitted_exactly, built_tool, assert_absent) exist and are applied correctly; assert_spawn_permitted_exactly(&git) against the canonicalized discovered path is more robust than the old literal /usr/bin/git.
  • Test strength: Each denial path (read-only write, ungranted program, protected config) pairs a refusal with a positive ..._REFUSED sentinel assertion, so a permit-instead-of-deny regression fails the case; host-side controls confirm the same operations succeed outside the box. The nested-grant collapse in with_git is correct.
  • Minor: Two assertions lack diagnostic messages (inline comment).

The denial checks plus independent host controls make this a genuinely regression-catching case rather than a happy-path smoke test.

@kevin-orellana kevin-orellana changed the title test(containment): restore Linux Git helper coverage test(containment): restore Linux Git and Cargo workflows Oct 21, 2026
Comment thread test-integ/src/quarantine.rs Resolved
@github-actions

Copy link
Copy Markdown

Assessment: Approve (Comment)

Re-reviewed at b834c55. The scope expanded cleanly from the earlier Git-only change: CN-W-06 (Cargo) is now a real workflow, the production quarantine list is empty, and the mechanism stays under test via a synthetic entry. My earlier diagnostic-message suggestion on cn_w_05.rs is addressed.

Review notes
  • Quarantine plumbing: Parameterizing the runner (run_case_on_with_quarantine) and reducer (build_with_quarantine) while the public build/run_case_on always pass the compiled (now-empty) list is a clean way to keep the skip/integrity machinery tested without skipping a real case. The synthetic CN-Q-01 is only reachable through private test helpers — good. build()'s signature is unchanged, so the collector is unaffected.
  • New coverage: restored_workloads_require_results_without_quarantine (PASS→GREEN/full; SKIP/FAIL/ERROR/missing/duplicate→RED) and the_restored_workloads_run_on_linux properly pin that emptying the list actually requires both workloads to run.
  • CN-W-06 (Cargo): Each ..._REFUSED marker is gated behind a build-script assertion that must pass first, so a permit-instead-of-deny regression fails the build and the marker is absent — same robust pattern as the Git hook. Host controls validate the crate/flags before containment, and journal_path correctly accounts for the home-relative journal spelling. read/write/read_file grants line up with the denial checks.
  • Minor: quarantine::lookup/for_platform are now only used by their own module test (inline comment).

Both restored cases are large single det_cases, but that matches the harness's one-heavyweight-fixture style and every denial path has a positive sentinel, making these genuinely regression-catching.

@github-actions

Copy link
Copy Markdown

Assessment: Approve (Comment)

Re-reviewed the delta at 1736e62 (the clone is shallow, so I compared the current cn_w_06.rs against the revision I reviewed previously). The only change is the new stage_linker_library helper + the -L{helpers} link-arg, which correctly resolves the Ubuntu/Debian case where libc.so/libm.so under multiarch are GNU ld scripts (GROUP(...)) rather than ELF symlinks.

Review notes
  • Correctness: ELF-vs-script branch keys on the \x7fELF magic, and the script path is guarded by a "/* GNU ld script" assertion with a DET_ERROR message — explicit and easy to triage. Canonicalizing each absolute-file token and re-emitting the script into the granted helpers dir (plus -L{helpers}) makes the referenced inputs resolvable under containment.
  • Safe heuristic: tokens without surrounding whitespace (e.g. GROUP(/path) won't match is_absolute() and pass through unchanged, but those absolute paths still fall under the granted canonical /usr/lib roots, so linking still succeeds.
  • Host control stays representative: -L{helpers} is folded into the same flags used by the pre-containment host build, and an extra search path is harmless there.

No new issues. My earlier quarantine.rs suggestion (lookup/for_platform now only used by their own test) remains open but is non-blocking.

EA-b13
EA-b13 previously approved these changes Oct 21, 2026
@github-actions

Copy link
Copy Markdown

Assessment: Approve

Re-reviewed at e43c743. This commit removes the vestigial lookup/for_platform helpers and simplifies the_quarantine_is_empty to assert on the list directly — exactly resolving my earlier suggestion. Verified there are no remaining references in test-integ, and the runner/reducer continue to read the passed-in slice, so the module now has a single source of truth.

All prior review feedback is now addressed (the cn_w_05.rs diagnostic messages and this cleanup). No outstanding issues from my side.

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.

3 participants