fix(ci): stabilize TS transpile cache and pin TypeScript to 6.x#140
Merged
Conversation
registerTsTranspile.cjs shared a transpile cache across concurrently spawned
script children but published entries with a non-atomic writeFileSync and keyed
them by a path string truncated to 180 chars. Under load a child could read a
half-written entry, and long checkout paths collided sibling modules to one
entry, both yielding a truncated module missing its trailing exports ('X is not
a function' in workflowScriptsBoundary.spec.ts). Publish atomically via a unique
temp file + rename, and key the cache by a sha256 hash so it is fixed-length and
collision-resistant.
Also ignore semver-major typescript bumps in Dependabot: typescript-eslint@8
peer-requires typescript <6.1.0, so a 7.x bump fails npm ci with ERESOLVE.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mainunit tests started failing after the weekly dependency bumps merged (#132/#135/#137), even on unrelated PRs (e.g. a README-only change). Two independent latent bugs in the test transpile-cache helper were exposed:tests/helpers/registerTsTranspile.cjstranspiles.tsfiles into a cache shared by concurrently spawned script children. It wrote entries with a plainfs.writeFileSync, so under load one child could read another's half-written entry — a truncated module drops its trailing exports and fails at runtime with... is not a function. The dependency bump shifted process-startup timing enough to lose this race reliably (old deps: 5/5 pass; new deps: 5/5 fail).base64url(tsVersion \0 absPath \0 mtime).slice(0, 180). On long checkout paths the truncation cuts before the filename, so sibling modules collide to one cache entry and a module is served another file's transpile.Symptom:
workflowScriptsBoundary.spec.ts › observability backend validator writes JSON diagnostics on process success and failure→(0, backendSnapshot_1.parseObservabilitySnapshotCliOptions) is not a function.What
rename(atomic on the same filesystem) so a reader only ever sees a complete entry or none.sha256, fixed-length, collision-resistant) instead of truncating a path string.typescript-eslint@8peer-requirestypescript <6.1.0, so a semver-major bump (the open TS-7 PR) failsnpm ciwithERESOLVE. Ignore semver-majortypescriptupdates until the type-aware lint toolchain supports the next major (mirrors the existingeslint/@eslint/jspins). Contract updated to enforce it.Verification
lint/typecheck/format:check/workflows:lint.No product/source behavior changes — test-tooling and dependency policy only.