Commit 2daa5ac
committed
test(e2e): expand sidecar coverage + simplify PTY harness
Five test surfaces, one bug fix, one YAGNI cleanup, one harness
simplification — all motivated by closing the e2e gap on the new
typed `Envelope.sidecars[]` contract.
- **e2e_safety_advisories.rs** (new, 5 tests): drive the apply
CLI against handcrafted layouts and assert
`envelope.sidecars[].{ecosystem,advisory.code,advisory.severity,
files[]}` for pypi (`pypi_record_stale`), gem
(`gem_bundle_install_reverts`), golang (`go_mod_verify_fails`),
nuget unsigned (deleted files only), and nuget signed (deleted
files + `nuget_signed_package_tampered` advisory together —
the case the pre-typed-contract design lost).
- **e2e_safety_cow.rs** (new, 5 tests): cover `patch/cow.rs` end
to end — hardlink isolation, symlink replacement, multi-file
hardlink, regular-file no-op, and the failure-doesn't-cow path.
Lifted file coverage from ~23% to ~80% (remaining gaps are
defensive I/O error arms not reproducible in tests).
- **e2e_safety_cargo_build.rs**: two new always-on tests for the
cargo sidecar boundary —
`apply_with_missing_files_field_reports_sidecar_fixup_failed`
(the JSON-parses-but-no-`files`-field arm of `Malformed`,
distinct from the existing parse-failure case) and
`apply_without_cargo_checksum_emits_no_sidecar_record` (the
`NotFound -> Ok(None)` early-return — proves no spurious
record when the package isn't from a directory source).
- **interactive_prompts_e2e.rs**: simplify the PTY harness.
Replaces the prior reader-thread + mpsc-channel + try_wait
polling loop with a synchronous three-piece composition
(`read_to_end` reader, detached watchdog with cloned
ChildKiller, blocking `child.wait()` on the main thread). No
pre-write sleep — the PTY buffers input. All six prompt
tests still pass with materially less harness code.
- **common/mod.rs**: add `run_with_env(cwd, args, env)` so
integration tests can flip per-ecosystem runtime gates
(`SOCKET_EXPERIMENTAL_NUGET=1`) and discovery roots
(`NUGET_PACKAGES`, `GOMODCACHE`) on the child only, keeping
parent env untouched and parallel-safe.
- **Bug fix**: `in_process_remote_ecosystems_apply.rs` and
`in_process_rollback_all_ecosystems.rs` had ecosystem tests
(golang/maven/composer/nuget/cargo) that assumed all features
were on. Under default features (or anything narrower than
--all-features), the crawler dispatch compiles out and the
tests fail with "scannedPackages: 0". Gated each test on
`#[cfg(feature = "<eco>")]` to match the build matrix. Quiet
the resulting dead-code noise with a file-level allow.
- **YAGNI**: drop `SidecarFileAction::Created`. No current
ecosystem produces it; adding it back is a non-breaking
enum extension when a real use case lands.
All ~456 workspace tests pass under `--all-features`.
Assisted-by: Claude Code:claude-opus-4-71 parent 6dc3218 commit 2daa5ac
8 files changed
Lines changed: 1150 additions & 51 deletions
File tree
- crates
- socket-patch-cli/tests
- common
- socket-patch-core/src/patch/sidecars
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
0 commit comments