Skip to content

Commit 225a5d7

Browse files
authored
test(adoption): cover the agent-bash-tool embedding shape, on Windows too (#2249)
The composition an embedder actually writes — realfs workspace mount + CommandResolver bridging unresolved names to host processes + HostMounts mapping the cwd back — was only ever validated downstream. The first adopter shipped two defects bashkit's tests could not see: a harness that emptied PATH, and a stdin pipe that never reached EOF and hung the suite. Add thirdparty_adoption_tests covering that composition end to end. The stdin test was verified by injecting the EOF defect: it first passed (proving the test was wrong — it used `cat`, a bashkit builtin, so the bridge never ran), then hung, and only after bounding the bridge's wait and guarding the pipe drain does it report a named 20s failure instead of a hung job. Add a windows-latest job running these suites, and gate Check on it and on the existing windows-containment job, which was never wired into the gate and so could not block a merge. Gate harness_example_tests on cfg(unix): it uses std::os::unix, which broke the integration binary's Windows compile.
1 parent fd7eb7b commit 225a5d7

5 files changed

Lines changed: 449 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ jobs:
218218
- name: Run realfs tests
219219
run: cargo test --features realfs -p bashkit --test realfs_tests -p bashkit-cli
220220

221+
# The third-party adoption and host-mount suites are `cfg(realfs)`, so
222+
# the main "Run tests" step (no realfs) compiles them out entirely.
223+
- name: Run realfs integration tests
224+
run: cargo test -p bashkit --test integration --features realfs -- host_mounts_tests thirdparty_adoption_tests
225+
221226
- name: Run fail-point tests (single-threaded)
222227
run: cargo test --features failpoints --test security_failpoint_tests -- --test-threads=1
223228

@@ -247,6 +252,33 @@ jobs:
247252
- name: Test RealFS and overlay containment
248253
run: cargo test -p bashkit --test realfs_tests --features realfs windows_containment
249254

255+
# The adoption shape this covers — bashkit as an agent's shell, with commands
256+
# bridged to host processes — exists to work on Windows without a real bash.
257+
# Kept separate from `windows-containment`: that job pins path-containment
258+
# semantics (TM-ESC-033), this one pins the embedding contract. Scoped to the
259+
# adoption suites rather than the whole workspace.
260+
test-windows:
261+
name: Test (Windows adoption shape)
262+
runs-on: windows-latest
263+
steps:
264+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
265+
266+
- name: Install Rust toolchain
267+
uses: dtolnay/rust-toolchain@e081816240890017053eacbb1bdf337761dc5582 # 1.95.0
268+
269+
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
270+
with:
271+
shared-key: windows-adoption
272+
273+
- name: Run third-party adoption tests
274+
run: cargo test -p bashkit --test integration --features realfs -- thirdparty_adoption_tests
275+
276+
- name: Run host mount mapping tests
277+
run: cargo test -p bashkit --test integration --features realfs -- host_mounts_tests
278+
279+
- name: Run command resolver tests
280+
run: cargo test -p bashkit --test integration -- command_resolver_tests
281+
250282
examples:
251283
name: Examples
252284
runs-on: ubuntu-latest
@@ -377,14 +409,16 @@ jobs:
377409
check:
378410
name: Check
379411
if: always()
380-
needs: [lint, audit, test, examples, fuzz-check]
412+
needs: [lint, audit, test, windows-containment, test-windows, examples, fuzz-check]
381413
runs-on: ubuntu-latest
382414
steps:
383415
- name: Verify all jobs passed
384416
run: |
385417
if [[ "${{ needs.lint.result }}" != "success" ]] || \
386418
[[ "${{ needs.audit.result }}" != "success" ]] || \
387419
[[ "${{ needs.test.result }}" != "success" ]] || \
420+
[[ "${{ needs.windows-containment.result }}" != "success" ]] || \
421+
[[ "${{ needs.test-windows.result }}" != "success" ]] || \
388422
[[ "${{ needs.examples.result }}" != "success" ]] || \
389423
[[ "${{ needs.fuzz-check.result }}" != "success" ]]; then
390424
echo "One or more required jobs failed"

crates/bashkit/tests/integration/harness_example_tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Unix-only: uses `std::os::unix` (file modes, symlinks). The integration
2+
//! binary is built on Windows by the `Test (Windows adoption shape)` job, so
3+
//! this module must gate itself out rather than break that compile.
4+
#![cfg(unix)]
5+
16
use std::fs;
27
use std::os::unix::fs::{PermissionsExt, symlink};
38
use std::path::Path;

crates/bashkit/tests/integration/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ pub mod sqlite_security_tests;
107107
pub mod stack_overflow_regression_tests;
108108
pub mod subst_depth_limit_tests;
109109
pub mod symlink_overlay_security_tests;
110+
pub mod thirdparty_adoption_tests;
110111
pub mod threat_model_doc_tests;
111112
pub mod threat_model_tests;
112113
pub mod time_command_tests;

0 commit comments

Comments
 (0)