fs-safe/test
Sarah Fortune 3be7ba6ee3 ci+test: run check on windows and guard windows-only test behavior
Run the check job on windows-latest in addition to ubuntu so the
windows code paths (no O_NOFOLLOW, node fallbacks for fd-relative
ops, ACL inspection) are exercised on every PR rather than only
documented.

Make the test suite pass on the new windows runner by addressing
the platform-specific failures:

- Long happy-path tests that mix supported (mkdir, write, read) and
  unsupported (stat, list, move, exists) operations are guarded
  with skipIf(process.platform === "win32") since the pinned
  filesystem helper throws "unsupported-platform" on win32 by
  design (src/pinned-python.ts).
- Short focused tests where the unsupported operation is the whole
  point (pinned-python, pinned-write-fallback-coverage,
  write-boundary-bypass symlink-move) split into runIf(non-win32)
  and runIf(win32) tests, with the windows variant asserting
  unsupported-platform.
- The expectFsSafeCode helper accepts unsupported-platform on
  windows; new expectedFsSafeCode helper substitutes for
  per-rejects.toMatchObject sites where the windows code differs
  from posix (e.g. path-alias / not-found returning
  unsupported-platform via the helper layer).
- secure-file-reads test split into a posix happy-path runIf and a
  windows runIf that asserts permission-unverified, since ACL
  inspection has no portable equivalent on windows
  (src/secure-file.ts:177).
- safeFileURLToPath test uses hardcoded platform-specific input/
  output instead of building the URL via pathToFileURL+fileURLToPath
  so the assertion verifies the function directly.
- Fix expandHomePrefix to normalize path separators by splitting via
  path.normalize + path.sep and rejoining via path.join. Apply the
  same segment-based check to resolveHomeRelativePath and
  resolveOsHomeRelativePath. Drop input.trim() — whitespace is a
  valid filename character on both platforms and env-var inputs are
  already trimmed upstream via normalizeOptionalString.
- coverage-more's "normalizes empty temp names" decomposes the
  result with path.dirname/path.basename instead of regex-matching
  a path-separator literal.
- extracted-helpers' path-helpers test builds its root with
  path.resolve so the drive letter is present on windows.
- additional-boundary-bypass guards its "..\evil.txt" sanitizer
  assertion behind a non-win32 check (windows reserves "\" as a
  path separator and cannot have it in a filename).
- coverage-more's sibling temp test guards just the posix file-mode
  assertion (stat.mode & 0o777 === 0o600), which has no analog on
  windows. The syncing behaviour the test actually targets still
  runs on both platforms.
- Raise test/new-primitives.test.ts size budget to 1500 to
  accommodate the secure-file-reads test split.

After: 253 passed, 1 failed, 66 skipped on windows-11-arm64. The
single remaining failure is a separate library-side gap (a
SAFE_REJECTED_SUSPICIOUS_WRITE_PAYLOADS payload resolves on windows
instead of rejecting) and will be tracked in a follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 14:59:24 -07:00
..
helpers ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
absolute-directory.test.ts fix: harden absolute directory segment validation 2026-05-07 10:52:57 +01:00
additional-boundary-bypass.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
adversarial-boundary-payloads.test.ts test: stabilize coverage corpus 2026-05-06 04:19:51 +01:00
api-coverage.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
archive-staging.test.ts fix: harden filesystem write fallbacks 2026-05-05 19:18:55 +01:00
archive.test.ts fix: harden filesystem read and temp paths 2026-05-07 08:02:25 +01:00
atomic.test.ts refactor: align atomic and secret helpers 2026-05-05 22:37:01 +01:00
coverage-gaps.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
coverage-more.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
deepsec-regression.test.ts fix: harden filesystem read and temp paths 2026-05-07 08:02:25 +01:00
edge-coverage.test.ts fix(fs): preserve prune and trash fallback behavior 2026-05-06 23:05:13 +01:00
extracted-helpers.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
file-store-sync-read-validation.test.ts fix(store): preserve sync read validation failures 2026-05-06 23:53:33 +01:00
filename.test.ts feat: add reusable safe filesystem primitives 2026-05-05 11:08:33 +01:00
findings-regression.test.ts fix: harden filesystem read and temp paths 2026-05-07 08:02:25 +01:00
fs-safe.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
guarded-write-cleanup.test.ts fix(fs): avoid unsafe guarded cleanup paths 2026-05-06 22:32:09 +01:00
json-durable-queue.test.ts fix(fs): avoid unsafe guarded cleanup paths 2026-05-06 22:32:09 +01:00
json.test.ts add non-durable atomic write option 2026-05-07 10:26:06 +01:00
move-path-regression.test.ts fix: detect stale move fallback sources 2026-05-07 10:17:11 +01:00
new-primitives.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
output.test.ts test: harden external output coverage 2026-05-07 04:34:31 +01:00
pinned-open.test.ts feat: add reusable safe filesystem primitives 2026-05-05 11:08:33 +01:00
pinned-python.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
pinned-write-fallback-coverage.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00
platform-fallback-coverage.test.ts fix(fs): close fallback mkdir and archive cleanup races 2026-05-07 00:19:59 +01:00
read-boundary-bypass.test.ts test: rename boundary bypass suites 2026-05-06 14:42:49 +10:00
root-file.test.ts feat: add reusable safe filesystem primitives 2026-05-05 11:08:33 +01:00
root-paths.test.ts refactor: clean root filesystem API 2026-05-05 16:51:34 +01:00
secret-file.test.ts refactor: align atomic and secret helpers 2026-05-05 22:37:01 +01:00
secure-temp-dir.test.ts feat: add reusable safe filesystem primitives 2026-05-05 11:08:33 +01:00
sibling-temp-write.test.ts feat: add reusable safe filesystem primitives 2026-05-05 11:08:33 +01:00
sidecar-lock-regression.test.ts fix: fail closed on stale sidecar locks 2026-05-07 08:02:36 +01:00
write-boundary-bypass.test.ts ci+test: run check on windows and guard windows-only test behavior 2026-05-07 14:59:24 -07:00