From 78af8cd6d54a8de123e2a37b2850e39f9fc97698 Mon Sep 17 00:00:00 2001 From: garrytan Date: Sat, 24 Oct 2026 21:28:20 +0000 Subject: [PATCH] test(pregate): the Rust end-to-end runs put the cargo shim under Windows' own Path key windows-free-shard (5) still failed both end-to-end cases at fe99b200 with the same symptom (the runner's real cargo, exit 1, no test result lines). runBin merges process.env, whose Windows key is 'Path', with the shim's 'PATH', so the child got two path variables and read the original. Write the shim under the key process.env actually uses, as test/helpers/unreachable-gbrain.ts and sync-gbrain-readiness-fixture.ts do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 +- test/pregate-rust.test.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c21f4f0c4..afbb9128f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ ### Tests - `test/pregate-rust.test.ts` (new, vilano93) covers the crate model, the dependency forms, workspace membership, the cargo summary parser and three end-to-end lane runs. New cases: crates named `evil;touch pwned-by-crate-name` and `evil{files}` never reach the shell (nothing is created, both are unclaimed) while `naïve_crate-2` still runs quoted; `crates/[ab]`, `nested/**/leaf` and `unicode/?` (a 📦 directory) members inherit workspace dependencies; a plain `#[test]` dependent and a `cfg(any(test, feature = "<300 chars>"))` are tests; and a same-named non-member past the size cap is unclaimed rather than run as the member; a hostile members glob, a million unmatched `[` and 100,000 unclosed `#[cfg(` run in a supervised Bun that kills a super-linear version at 30 s. Each failed before its fix. -- The cargo stand-in now wins PATH lookup everywhere. On windows-free-shard (5) two end-to-end cases failed deterministically because the shim PATH was joined with `:` (Git Bash never saw it) and the runner's real cargo ran against the fixture. On hosts where Bun and cargo share a directory, the lane puts Bun's directory first and the real cargo won the same way. The shim PATH now uses the platform delimiter, adds `cargo.cmd` for Windows lookup, and on POSIX the lane's bash puts the shim first again through `BASH_ENV`. +- The cargo stand-in now wins PATH lookup everywhere. On windows-free-shard (5) two end-to-end cases failed deterministically because the shim PATH was joined with `:` (Git Bash never saw it) and the runner's real cargo ran against the fixture. On hosts where Bun and cargo share a directory, the lane puts Bun's directory first and the real cargo won the same way. The shim PATH now uses the platform delimiter and Windows' own `Path` key (a second `PATH` key beside it was the one the child ignored), adds `cargo.cmd` for Windows lookup, and on POSIX the lane's bash puts the shim first again through `BASH_ENV`. - `test/pregate-selection.test.ts` (vilano93) covers nested pnpm/yarn/vitest/jest packages. Its `pnpm` stand-in gets the same `BASH_ENV` fix: on a host with a real pnpm beside Bun, the end-to-end case installed vitest from the network and came back incomplete. ### Gate integrity diff --git a/test/pregate-rust.test.ts b/test/pregate-rust.test.ts index 4085f3a44..a68c45da9 100644 --- a/test/pregate-rust.test.ts +++ b/test/pregate-rust.test.ts @@ -292,7 +292,9 @@ describe('Cargo membership and test detection (port review)', () => { }); describe('gstack-pregate on a Rust workspace', () => { - const run = (repo: FixtureRepo, env: Record) => runBin(repo, 'gstack-pregate', ['--base', 'main', '--allow-repo-commands', '--stage', 'tests', '--only', 'lanes'], env); + /** Windows names it `Path`: a second `PATH` key beside it leaves the child's lookup to whichever the OS reads first. */ + const pathKey = Object.keys(process.env).find(key => key.toLowerCase() === 'path') ?? 'PATH'; + const run = (repo: FixtureRepo, { PATH, ...env }: Record) => runBin(repo, 'gstack-pregate', ['--base', 'main', '--allow-repo-commands', '--stage', 'tests', '--only', 'lanes'], { ...env, [pathKey]: PATH! }); const log = (out: string) => fs.readFileSync(/log: (\S+)/.exec(out)![1]!, 'utf8'); // Value: protects=the reported case end to end: a touched src file of a workspace crate is not PREGATE_NO_LANE, its crate and the