Skip to content

fix: pin typescript and harden lockfile check in docs examples CI#21909

Merged
critesjosh merged 1 commit into
nextfrom
fix/docs-examples-ci-flake
Mar 23, 2026
Merged

fix: pin typescript and harden lockfile check in docs examples CI#21909
critesjosh merged 1 commit into
nextfrom
fix/docs-examples-ci-flake

Conversation

@critesjosh

@critesjosh critesjosh commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pin typescript@^5.3.3 in docs examples validation to match yarn-project. The unpinned yarn add -D typescript started pulling TypeScript 6.0, which changed JSON import type inference and made existing @ts-expect-error directives unused (TS2578 errors), breaking example_swap type-checking.
  • Use git state (git show HEAD:...) instead of filesystem state (-s) for yarn.lock emptiness check. When example_swap fails, GNU parallel's --halt now,fail=1 kills other jobs mid-yarn add before cleanup traps run, leaving lockfiles dirty on disk. On retry, the check found dirty filesystem state and reported the misleading token_bridge/yarn.lock is not empty error.

Context

Multiple unrelated PRs (#21865, #21907, #21812) are failing with:

ERROR: token_bridge/yarn.lock is not empty. These files must be committed empty.

Root cause chain:

  1. yarn add -D typescript (unpinned) pulls TS 6.0, released today
  2. TS 6.0 improved JSON import type inference, making @ts-expect-error directives unused → TS2578 errors in example_swap
  3. example_swap fails → --halt now,fail=1 kills token_bridge mid-yarn add → cleanup trap never runs
  4. Retry finds dirty token_bridge/yarn.lock on filesystem → misleading error

Test plan

  • CI passes on this PR (docs examples validation succeeds)
  • Verify example_swap and token_bridge type-check cleanly with pinned TS 5.x

🤖 Generated with Claude Code

@critesjosh critesjosh marked this pull request as ready for review March 23, 2026 18:03
@critesjosh critesjosh requested a review from a team as a code owner March 23, 2026 18:03
@critesjosh critesjosh enabled auto-merge March 23, 2026 18:05
@critesjosh critesjosh disabled auto-merge March 23, 2026 18:06
@critesjosh critesjosh enabled auto-merge March 23, 2026 18:10
Two fixes for docs examples CI failures affecting all PRs:

1. Pin typescript to ^5.3.3 (matching yarn-project) instead of
   unpinned latest. TypeScript 6.0 changed JSON import type inference,
   making @ts-expect-error directives unused (TS2578 errors).

2. Change yarn.lock emptiness check to use git state (git show HEAD:...)
   instead of filesystem state (-s). When parallel kills a job mid-yarn
   add, the cleanup trap never runs, leaving lockfiles dirty on disk.
   The retry then hits a false positive. Now checks committed state and
   resets filesystem before validation.
@critesjosh critesjosh force-pushed the fix/docs-examples-ci-flake branch from f33dd42 to 1f2a3dc Compare March 23, 2026 18:26
@critesjosh critesjosh changed the title fix: docs examples CI flake from yarn.lock race condition fix: pin typescript and harden lockfile check in docs examples CI Mar 23, 2026
@critesjosh critesjosh added this pull request to the merge queue Mar 23, 2026
critesjosh added a commit that referenced this pull request Mar 23, 2026
… backport) (#21914)

## Summary

Backport of #21909 to `backport-to-v4-next-staging`.

- Pin `typescript@^5.3.3` in docs examples validation (was unpinned,
pulling TS 6.0 which breaks `@ts-expect-error` directives)
- Use git state instead of filesystem state for yarn.lock emptiness
check (prevents false positives on retry after interrupted parallel
runs)

## Context

See #21909 for full details. The same `docs/examples/ts/bootstrap.sh`
exists on this branch with the same two issues.

## Test plan

- [ ] CI passes on this PR


🤖 Generated with [Claude Code](https://claude.com/claude-code)
Merged via the queue into next with commit 8cf313d Mar 23, 2026
21 checks passed
@critesjosh critesjosh deleted the fix/docs-examples-ci-flake branch March 23, 2026 19:12
AztecBot pushed a commit that referenced this pull request Mar 24, 2026
… backport) (#21914)

## Summary

Backport of #21909 to `backport-to-v4-next-staging`.

- Pin `typescript@^5.3.3` in docs examples validation (was unpinned,
pulling TS 6.0 which breaks `@ts-expect-error` directives)
- Use git state instead of filesystem state for yarn.lock emptiness
check (prevents false positives on retry after interrupted parallel
runs)

## Context

See #21909 for full details. The same `docs/examples/ts/bootstrap.sh`
exists on this branch with the same two issues.

## Test plan

- [ ] CI passes on this PR


🤖 Generated with [Claude Code](https://claude.com/claude-code)
Thunkar pushed a commit that referenced this pull request Mar 24, 2026
… backport) (#21914)

## Summary

Backport of #21909 to `backport-to-v4-next-staging`.

- Pin `typescript@^5.3.3` in docs examples validation (was unpinned,
pulling TS 6.0 which breaks `@ts-expect-error` directives)
- Use git state instead of filesystem state for yarn.lock emptiness
check (prevents false positives on retry after interrupted parallel
runs)

## Context

See #21909 for full details. The same `docs/examples/ts/bootstrap.sh`
exists on this branch with the same two issues.

## Test plan

- [ ] CI passes on this PR


🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants