2 months ago
d38940aThe Phase 1 foundation (docs/platform-abstraction-plan.md §1.2-1.6), each export platform-parameterized so every branch runs on every host: - pathString: browser-safe pure string path ops, REQUIRED style param (kills the runtimePlatform()->linux fallback trap), \?\ de-namespacing (fixes the workspacePath UNC-server-'?' mis-parse), differential suite vs node:path.win32/posix on ~2000 generated inputs. - text: the EOL/encoding contract — replaceRespectingEol (read/edit CRLF fix engine), BOM/UTF-16 decodeTextBuffer, code-point-safe decodeChildOutput, splitLines, subscribeLines. - paths: sync-native realpath canonicalize (one engine — Bun has no async native), fail-direction case-folding (crossesProtectedMetadata folds win32+darwin deny-side; isInside folds win32-only accept-side so case-sensitive APFS never widens sandbox scope), home() with COWORK_HOME_OVERRIDE only, coworkPaths, portable filename validation, glob normalization preserving POSIX escapes. - env: win32-only case-insensitive lookup (POSIX stays exact — 7 copies were insensitive on Linux too), spelling-preserving setEnv, quote-aware win32 PATH split, runtimePathDirs (the ONE Scripts-dir answer), defaultChildEnv/childEnv (SystemRoot et al guaranteed), per-platform sandboxEnvAllowlist (+USERPROFILE/APPDATA/LOCALAPPDATA/PYTHONUTF8 on win32), minimalSandboxEnv. - exec: PATHEXT-aware which() (the ONE resolver), classifyExecutable, BatBadBut-safe resolveSpawn (cmd shims wrapped with typed UnsafeShimArgumentError on unquotable args), binaryName. - pathImpl: shared internal platform->node:path mapping (was 4 copies). - index: barrel with cross-module semantics documented. - test/helpers/platform: pinHome, symlinkOrJunction, expectPrivateMode, forEachPlatform for the Phase 6 suite un-forking. 625 tests. Adversarially reviewed (verdict: ship); duplicated helpers hoisted per review. New tests use hostPlatform()/import.meta.dir so the boundary ratchet stays clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Parent2bbcf19