Repository navigation
test(windows): honest test harness on unprivileged Windows (#147, #148) - #160
Conversation
…ility, not platform (abogartz#147) On Windows boxes without Developer Mode the fixtures' own symlinkSync throws EPERM before resolveContained is called - a fake red that has footnoted every contributor run of the suite. A skipIf(win32) would be the wrong guard: the GitHub Windows runners HAVE the privilege, so skipping by label would delete coverage CI is actually getting. One mkdtemp+symlinkSync probe per process gates exactly these two tests on the capability the fixture needs; privileged boxes (runners included) still run them. The five existing POSIX-only skipIf(win32) guards are untouched.
…bogartz#148) The sandbox env's PATH was hardcoded POSIX (bun dir + /usr/bin...). On Windows the service host then cannot spawn git, resolveRepo's remote lookup fails, and the store falls back to a path-hash key - so the service-hosted origin-URL stamp (the platform-neutral abogartz#90 contract this suite pins) could never be produced, let alone asserted, on this platform. Platform-aware per the issue: bun dir + the real process.env.PATH on win32, unchanged elsewhere. HOME/XDG isolation untouched; this is executable lookup only. A skip was rejected - with no Windows e2e CI job it would delete the coverage rather than start it.
|
@abogartz Independent review of 201b726: no blocking finding; I recommend merging this test-harness fix. Verified on unprivileged Windows with Bun 1.4.4:
The diff changes only two test files. The capability probe catches only EPERM and rethrows other errors. The PATH branch preserves the existing non-Windows value and leaves the service HOME/XDG/store isolation unchanged. Integration check: locally combined #156 The local integration merge was aborted afterward; tracked files are clean and nothing was pushed by this review. |
|
🎉 This PR is included in version 0.14.16 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What this is
Two Windows reds in the test harness itself — no product code involved. Both have ridden along as the footnoted "known local reds" in every contributor run through this program (#156/#158 bodies included); this branch retires the footnote. #147: two
containment.test.tsfixtures throwEPERMfrom their ownsymlinkSynccall on an unprivileged Windows box — the test dies in setup, beforeresolveContainedis ever called. #148:makeServeGuesthands the service a POSIX-only PATH, so on Windows the service can't spawngit,resolveRepofalls back to a path-hash key, and the service-hosted origin-URL stamp this suite exists to pin (the #90 contract) could never be asserted on this platform at all.#147 — skip on the capability, not the platform label
The file already carries five
test.skipIf(process.platform === "win32")guards for genuinely POSIX-only guarantees; the two direct-symlink fixtures (a dangling symlink in the path…,a link to another file INSIDE the root…) missed the pattern — and awin32guard would be the wrong fix for them anyway: GitHub's Windows runners holdSeCreateSymbolicLinkPrivilege(test-windows runs the rest of the file green), so a platform skip would delete coverage CI is actually getting. The guard is instead a once-per-process capability probe —symlinkSyncinto amkdtempdir,skip()onEPERM, anything else rethrown — gating exactly these two tests. Privileged machines (any CI runner) keep running them on every platform; unprivileged dev boxes stop paying a fake-red triage tax. The five existing guards are untouched, no product-code change.#148 — a PATH that can find git
Exactly the issue's suggested shape: on win32 the guest gets
`${dirname(process.execPath)};${process.env.PATH}`, elsewhere the existing POSIX dirs verbatim. TheHOME/XDG sandbox isolation is untouched — this is executable lookup only, and the hermeticity that matters (identity files, #142's real-~leak class) is enforced by the HOME/XDG keys, not by PATH starvation. A skip was deliberately rejected: there is no Windows e2e CI job, so skipping would silently delete the only place this platform-neutral contract gets exercised instead of starting coverage.Evidence
ed5ecde(Windows 11 / Bun 1.4.4, Developer Mode off):bun test test/containment.test.ts→ 33 pass / 2 fail —EPERM: operation not permitted, symlink …withcode: "EPERM", thrown by the fixture at lines 171/315, not byresolveContained.bun test ./e2e/ --timeout 240000→ 10 pass / 1 fail —Expected to contain: "repo=8960c7c730bb", receivedrepo=427dd92d0ad3(the path-hash fallback) with the repoPath itself correct.bun run test→ 600 pass / 12 skip / 0 fail (base on this box: 600 / 10 / 2 — the two reds became exactly two skips; totals identical at 612).bun x tsc --noEmitclean;bun run lint(the CI gate) exit 0.Boundaries
Two test files, zero
src/lines, zero workflow changes. The other test-integrity family (#144/#146 flakes, epic #68) untouched.Closes #147
Closes #148