Repository navigation
test: clean up concurrent integration fixtures and share move scenarios - #256
Conversation
## Problem A callback panic or readiness timeout can leave the integration fixture child running. A configured callback panic also leaves its temporary command installed. Shell and Monty repeat the same move-replacement setup and state checks. ## Solution Move concurrent execution into a private process module. Stop and reap the owned child when execution unwinds. Restore the baseline command before resuming the original callback panic. Keep existing BoxFixture method names and production timeouts. Share move-replacement setup and common assertions through MoveReplacement. Keep separately reported cases, commands, interpreter checks, and route-specific refusals. Document extension through helper composition and distinguish helper unit tests from integration coverage. ## Tests Seven process helper unit tests pass on Linux and macOS. when_the_callback_panics_then_the_child_is_stopped_and_reaped and when_readiness_times_out_then_the_child_is_stopped_and_reaped pin child cleanup. when_a_configured_callback_panics_then_the_baseline_command_is_restored and when_an_environment_callback_panics_then_the_baseline_command_is_restored pin configuration restoration. The other tests preserve early-exit, successful callback, and captured timeout results. Each of seven deliberate helper defects fails its corresponding test; the restored tests pass. SH-MV-REPLACE and MO-MV-REPLACE retain successful moves, replacement refusals, and final file contents. 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. Cleanup of all descendants is not claimed. Native macOS checks cover helper units and compilation; full macOS integration and deployment qualification are separate.
|
Assessment: Comment I reviewed head Checks that held
The new helper is now testable with injected timeouts, which is useful. |
|
Assessment: Approve (no new findings) I reviewed Checks that held on this head
|
Human readable section
Problem: A callback failure or startup wait timeout can leave an integration-test child running. A failed configured callback also leaves temporary configuration installed.
Solution: Give concurrent execution its own helper module and restore configuration before resuming the original panic. Request normal Box shutdown before forcing termination, so Box can stop and reap its workload groups. Keep timeout results failed even when cleanup exits successfully. Share repeated move-replacement setup and state checks while keeping separate Shell and Monty cases.
Trade-off: Failure cleanup allows five seconds for normal shutdown, then force-stops the direct child. If Box ignores shutdown, this fallback cannot guarantee descendant cleanup or bounded inherited-pipe draining. No production containment implementation changes.
Description
The fixture's existing public methods and production timeouts remain unchanged. Eleven new unit tests exercise failure and success paths using local subprocess fixtures.
Seven original deliberate-defect controls verified direct-child cleanup and configuration restoration. Four further tests cover separate workload groups, graceful timeout exits, and forced termination. The forced-termination test enforces its own twelve-second deadline and cleans up its fixture before failing.
These checks verify the test helper, not Box containment.
MoveReplacementshares only setup and common results. Shell retains its entry and exit-status assertions; Monty retains interpreter identity andPermissionErrorchecks.Both cases still assert a successful fresh move, refusal of replacement by
no_deletes, and preserved file contents.The README explains composition through small helpers and independent case reporting. Runtime extraction is a separate companion change.
CN-I-11do not prove terminal isolation; complete Linux/macOS parity is not established.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, andCN-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 runtime-restructuring PR #249 and the integration coverage work in #187.
Runtime extraction remains in PR #249; bulk renaming has been withdrawn, and PR #257 is superseded. This cleanup PR remains separate.
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. Includes a cleanup and configuration-restoration bug fix in the test helper.
Testing
Exact source. Base
e4ca8b80359b2213d684de31cd6ef32e0d61478a; published headcf227b7615b31ec4682c309967e30f26d0d328f7.The final candidate tree is
be334ba4da15bde015cbca13c5c4a686aacf79d8. The follow-up patch overeb656874aca1057ecd4368d2ff2f1d89d144339ehas SHA-2567a8436c6d74c4946c5fdef4a74b179800826a3038618e2d48dc1c51cfeb9d437.The combined check applies #249 head
49f7f1b6fb9476061d5e26e40a57df27e4712aa7and both helper patches to that base.The full combined integration run used tree
f3d845b246b550d98dd9ee7adffbceaa07ce8bac. A subsequent watchdog-only unit-test change produced final combined tree34a3c373f4095a4e019711389b6f5874de839aad; all eleven affected unit tests, formatting, and strict Clippy passed again. Integration case bodies and helper implementation were unchanged after the full run.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.20261102as reported by/etc/os-release, AArch64, kernel6.12.113-138.209.amzn2023.aarch64, Rust/Cargo 1.98.1.Runs used
EXPERIMENTAL_LINUX_SUPPORT=TRUE,CARGO_BUILD_JOBS=2, and the builttarget/debugdirectory first onPATH.The alias helper was also installed beside the workspace test binaries.
HOMEwas unchanged.box_librarytarget emits no count and is excluded.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 earlier combined deterministic run covered both helper implementations and the then-proposed case renames. Those renames have since been withdrawn; the cleanup implementation in this PR is unchanged. The final watchdog-only adjustment received focused validation as stated above. Earlier isolated candidate runs and native patch hashes match these source changes.
A combined formatting attempt with
--allencountered the enclosing checkout's workspace discovery throughtest-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:
justis 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/targetand the primary checkout's unchanged Box binaries.Native macOS used
cargo test --manifest-path test-integ/Cargo.toml --all-features --lib process::tests -- --show-output, followed by--all-features --no-run,cargo fmt --check, andcargo build --no-default-featuresfor the same manifest.Review correction. The initial automated finding identified a real descendant leak when direct forced termination bypassed Box teardown. Separate Linux and macOS probes reproduced it. The follow-up now requests normal shutdown on callback failure, readiness timeout, and exit timeout. Independent macOS validation confirmed shutdown receipt, workload termination, and supervisor reaping. Deliberately removing forced termination failed through the test's own deadline.
Hosted validation. Initial CI run 41286760441 passed for the earlier head
eb656874aca1057ecd4368d2ff2f1d89d144339e, using merge revision14af67ae0a0099958f83046f8a07fae596f342ff. Linux recorded 124 passed and nine macOS-only skips; macOS recorded 121 passed and twelve Linux-only skips. Both recorded all 133 cases without failures/errors. Separate library unit counts were 100 Linux and 99 macOS; support counts were 16 and 11. Each platform ignored one documentation example. The hosted workspace Rust and native-filesystem jobs were skipped by changed-path filters.The latest follow-up
cf227b7615b31ec4682c309967e30f26d0d328f7passed all applicable hosted checks in CI run 41287958730. The automated re-review confirmed that the cleanup finding is fixed and found no new issues. This prose assessment does not supply formal GitHub approval. The original review thread is resolved after the reviewer verified the fix on the current head. Formal approval, merge, and deployment qualification remain separate.just check, orcargo test --workspace --all-features).cargo fmt --alland the repository Clippy gate; the existing lint allowances are listed above.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.