Skip to content

test: separate integration runtime discovery from fixture execution - #257

Closed
kevin-orellana wants to merge 1 commit into
mainfrom
feature/integration-runtime-helpers
Closed

kevin-orellana wants to merge 1 commit into
mainfrom
feature/integration-runtime-helpers

Conversation

@kevin-orellana

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

Copy link
Copy Markdown
Collaborator

Superseded by #249. The author requested combining runtime-helper organization with readable integration-test names. PR249 preserves this exact implementation and commit history; cleanup remains separate in #256. The evidence below describes this original standalone PR.

Human readable section

Problem: Native interpreter discovery and platform configuration share one large file with fixture execution, making their boundaries harder to maintain.

Solution: Move those helpers and their thirteen existing unit test functions into a private runtime module. Keep every public root helper name available to existing cases.

Trade-off: Internal unit-test module paths move to runtime::tests; filters using the old full unit-test path need updating. Integration case paths and behavior stay unchanged.

Description

Independent source comparison verifies all fifteen root helper exports. The moved implementation and test bodies are identical after formatting, except for one qualified documentation link.
Three existing documentation warnings are also corrected: the probe_py runtime link, the private egress constant link, and egress-case list spacing. No production code, case assertion, platform declaration, or ignored status changes.

The README states where runtime discovery belongs and how to extend independently reported integration cases.
Concurrent cleanup and shared scenario helpers are a separate companion change; the combined validation below includes them and naming PR #249.

Category What the tests prove Results and remaining gaps
Containment: 78 deterministic cases The cases distinguish permitted operations, required refusals, and recorded limitations across native filesystem, execution, process, network, and environment behavior. 69 passed and nine skipped on Linux. Nine cases remain declared macOS-only. Terminal observations in CN-I-11 do not prove terminal isolation; complete Linux/macOS parity is not established.
Policy: 9 deterministic cases Mediated requests follow authorization rules and retain deny-only protections. 9 passed on Linux. No authorization or denial assertion was removed.
Shell: 24 deterministic cases Shell requests produce the checked results while preserving policy refusals and request isolation. 24 passed on Linux. The move-replacement case retains its Shell-specific refusal checks.
Monty: 14 deterministic cases Python requests use the restricted interpreter and preserve its operation and policy boundaries. 14 passed on Linux. These checks concern the restricted interpreter, not native Python containment.
Telemetry: 8 deterministic cases Records preserve the checked identity, decision, destination, trace, and payload protections. 8 passed on Linux. A deployed telemetry service is outside this qualification.

The nine Linux skips are CN-D-01, CN-D-02, CN-E-04, CN-F-02, CN-F-03, CN-I-13, CN-L-01, CN-P-02, and CN-T-05.
They are actual test cases declared for macOS. Linux-specific cases test different supported boundaries; this refactor does not close the remaining platform gaps.
The Linux test-gate enforcement from #185 is unchanged. Deployment qualification remains separate.

Related Issues

Companion to naming PR #249 and the integration coverage work in #187.
Execution cleanup and scenario sharing are in companion PR #256. Both PRs target main and apply cleanly together.
The unit-test owner retains Box and containment source ownership. The separate live HTTP repair owns crates/box/tests/box_telemetry.rs.

Type of Change

Other: Test harness organization.

Testing

Exact source. Base e4ca8b80359b2213d684de31cd6ef32e0d61478a; published head 2ebeeade92a82598e0034a670403b15e90904aef.
The candidate tree is 9a19007bf36c8af10ce627d1a34cc541a72e5680, with patch SHA-256 465afa8d9a33bf0333ba5640880cb20dfb561921a975de01e009e164d62142ec.
The combined check applies #249 head 49f7f1b6fb9476061d5e26e40a57df27e4712aa7 and both helper patches to that base.
Its exact tree is 86bb858b0ce3b033b304a030401ef253fb080dc4.
The raw verdict records box_commit: unknown; the verified trees, patch hashes, and build receipts identify its source. The base commit alone does not identify the tested patch set.

Linux environment. Amazon Linux 2023.12.20261102 as reported by /etc/os-release, AArch64, kernel 6.12.113-138.209.amzn2023.aarch64, Rust/Cargo 1.98.1.
Runs used EXPERIMENTAL_LINUX_SUPPORT=TRUE, CARGO_BUILD_JOBS=2, and the built target/debug directory first on PATH.
The alias helper was also installed beside the workspace test binaries. HOME was unchanged.

Check Result and execution boundary
Full workspace unit/bin targets 1,873 passed, zero failed, seven ignored. A nested child-test summary is excluded to avoid counting its parent scenario twice.
Full workspace integration targets Cargo reported 2,709 passed, zero failed, nine ignored. One pass returned before its live credential-daemon assertion; another omitted alias-read protection but executed its write checks. Thus 2,707 passes had neither documented omission. The successful custom box_library target emits no count and is excluded.
Workspace documentation tests 13 passed, zero failed, one ignored.
Combined deterministic integration 124 passed, nine declared macOS-only skips, zero failures/errors; 133 expected and recorded, with no integrity problems. Each of the 133 case identifiers remains separately reported.
Harness helper unit tests 100 library unit tests passed. Five case-local helper tests, ten Phase 3 component checks, and one case-note check also passed; one harness documentation example stayed ignored. These support checks are separate from the 133 integration cases. Cargo counts the nine platform-return wrappers as successful tests; the verdict records them as skips. All thirteen moved runtime functions passed on Linux; no new behavioral assertion was added.
Build, formatting, lint, and documentation Workspace all-features build, formatting, repository Clippy gate, strict standalone-harness Clippy, and strict private rustdoc passed. The workspace gate uses the listed existing lint allowances; the changed harness passes without them.
Existing Linux execution reporter Passed and retained exactly the missing-daemon and partial alias-read diagnostics above.
Example gate Build and command passed, but zero examples executed because no scripted examples remain. The manual tutorial was not run.
Native macOS helper checks Darwin 27.2.0 ARM64. Seven process unit tests and twelve runtime unit tests passed. One of the thirteen moved runtime functions is Linux-only and is excluded on macOS. Both candidate harnesses compiled all test targets; formatting and builds with default features disabled passed. This local check did not run the full macOS integration suite.

The full workspace is unchanged by these standalone harness edits. Its checks ran on the process candidate; source comparison confirms identical workspace sources for the runtime candidate.
The final combined deterministic run covers both helper implementations and the 133 case renames from #249. Earlier isolated candidate runs and native patch hashes match these source changes.
A combined formatting attempt with --all encountered the enclosing checkout's workspace discovery through test-common; formatting the changed standalone crate passed.
No source or assertion changed to bypass that setup error.

Commands, from the applicable checkout root with the environment above:

cargo build --workspace --all-features
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::too_many_arguments -A clippy::only_used_in_recursion -A clippy::await_holding_refcell_ref -A clippy::explicit_auto_deref -A clippy::chunks_exact_to_as_chunks -A dead_code -A non_snake_case
cargo test --workspace --all-features --no-fail-fast -- --show-output
python3 scripts/check-linux-test-output.py <workspace-test.log>
bash scripts/test-all.sh box-examples
cargo fmt --manifest-path test-integ/Cargo.toml --check
cargo clippy --manifest-path test-integ/Cargo.toml --all-targets --all-features -- -D warnings
RUSTDOCFLAGS='-D warnings --document-private-items' cargo doc --manifest-path test-integ/Cargo.toml --all-features --no-deps
cargo test --manifest-path test-integ/Cargo.toml --release --all-features --lib
DET_RESULTS_DIR=<fresh-results-directory> bash test-integ/run.sh --all-features

just is absent on this Linux host, so the listed Cargo commands ran its relevant gates directly.
The combined checkout used CARGO_TARGET_DIR=<primary-checkout>/test-integ/target and the primary checkout's unchanged Box binaries.
Native macOS used cargo test --manifest-path test-integ/Cargo.toml --all-features --lib runtime::tests -- --show-output, followed by --all-features --no-run, cargo fmt --check, and cargo build --no-default-features for the same manifest.

Hosted validation. CI run 41286776896 passed for head 2ebeeade92a82598e0034a670403b15e90904aef, checked out as merge revision 3c4114302277385b07b355d443e384ee3c258875 against the base above. All applicable checks, including CodeQL Rust, passed.

Hosted platform Deterministic integration cases Separate helper and component checks
Ubuntu 24.04 ARM 124 passed, nine macOS-only skips, zero failures/errors; all 133 cases recorded. 93 library unit tests, 16 support checks, and three filesystem-mode controls passed; one documentation example ignored.
macOS latest 121 passed, twelve Linux-only skips, zero failures/errors; all 133 cases recorded. 92 library unit tests, 11 support checks, and four filesystem-mode controls passed; one documentation example ignored.

The hosted workspace Rust and native-filesystem jobs were skipped by their changed-path filters. The local workspace evidence above remains separate.
The automated reviewer found no issues on this head. Its prose approval is not a formal GitHub approval. Its independent unit run lacked the Box binary for three tests; the configured local and hosted runs above passed.
Formal required approval and merge remain outstanding. Deployment qualification is outside this PR.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features).
  • If I touched Rust, I ran cargo fmt --all and the repository Clippy gate; the existing lint allowances are listed above.

Checklist

  • I have read the CONTRIBUTING document.
  • I have reviewed and understand every line of code in this PR, including generated code, and can explain why it works.
  • My change is focused and reasonably small; I split unrelated work into separate PRs.
  • I added or retained the tests needed to verify this change.
  • I 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

Native interpreter discovery and tool configuration share one large file with fixture execution.
Their platform-specific unit tests make that file harder to extend and review.

## Solution

Move runtime discovery and configuration into a private runtime module.
Move its thirteen existing unit test functions into runtime/tests.rs.
Preserve all fifteen root helper exports and every integration case and platform declaration.
The moved implementation and test bodies are unchanged except for indentation and a qualified documentation link.
Document the helper boundary and preserve the one-file-per-case extension pattern.

## Tests

Thirteen runtime unit functions pass on Linux; twelve pass on macOS, where one Linux-only function is excluded.
linux_python_discovery_grants_runtime_libraries_without_the_usr_prefix pins Linux runtime selection.
the_probe_config_grants_only_the_runtime_directories_and_declares_the_search_path pins narrow runtime grants.
the_git_tool_config_declares_the_real_git_and_claims_nothing_about_lookup pins the tool configuration.
Independent source comparison verifies all moved bodies and public root exports.
The combined rename and both helper patches pass 124 Linux integration cases with nine declared macOS-only skips.
All 133 case records are present; 100 harness library unit tests and sixteen support checks pass.
Full workspace tests, all-features build, formatting, repository Clippy, strict harness Clippy, and strict private rustdoc pass.
Workspace output retains the missing credential-daemon and partial alias-read diagnostics.
The example gate builds successfully but executes zero examples because no scripted examples remain.
No new functional coverage is claimed. Native macOS checks cover helper units and compilation;
full macOS integration and deployment qualification are separate.
@github-actions github-actions Bot added Area - Release chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact strands-running labels Nov 1, 2026
@kevin-orellana
kevin-orellana enabled auto-merge (squash) November 1, 2026 09:00
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Assessment: Approve

I reviewed head 2ebeead. This is a clean move with no behavior change, and I have no blocking or inline findings. I checked the moved code against the removed code after stripping whitespace. The only differences are rustfmt line joins and the crate::BoxFixture link.

Assumptions and rules checked (all held)
  • Every caller of a root helper still gets the same item: all 15 pub items in runtime.rs are re-exported. cargo test --all-features --no-run builds every case target.
  • No cfg-gated item is re-exported on the wrong OS: no runtime.rs item has a cfg attribute. Only one test is Linux-only.
  • The test count is preserved: base lib.rs has 46 #[test]. Head has 33 in lib.rs plus 13 in runtime/tests.rs, and runtime:: passes 13/13 here.
  • The test-path change breaks no tooling: none of the moved test names or tests:: paths appear in workflows, run.sh, tools/, or scripts/check-linux-test-output.py.
  • The private select_native_python_on stays private: it is used only inside runtime and its tests.
  • Root AGENTS.md, "private modules so the pub use facade bounds the API": followed. The //! is one sentence.
  • Gates: strict harness Clippy and rustdoc (-D warnings, with and without --document-private-items) pass on head.
  • Lib unit tests: 90 pass. The 3 that fail need a strands-box binary, which this runner does not have, so they are environmental.

Description accuracy (optional): the PR description and commit message say the only non-move edit is "one qualified documentation link". Three more edits are in the diff:

  • the select_native_python → native_python link in probe_py;
  • the private SNAPSHOT_DEADLINE link in egress.rs;
  • the doc-list continuation line in cn_native_egress.rs.

On base e4ca8b8, strict rustdoc and Clippy fail on exactly these three. So the edits are needed, but they are worth one line in the commit message. Also optional: the new README section could be a row in the existing Layout table, so one place lists which src/ file owns what.

This is a well-scoped split, and the source-equivalence evidence makes it easy to review.

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

Labels

Area - Release chore Maintenance tasks, dependency updates, CI changes, refactoring with no user-facing impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants