Skip to content

chore(typescript): assert native TS7 per workspace and drop a dead install exemption - #7495

Merged
waleedlatif1 merged 2 commits into
stagingfrom
chore/native-ts7
Sep 5, 2026
Merged

chore(typescript): assert native TS7 per workspace and drop a dead install exemption#7495
waleedlatif1 merged 2 commits into
stagingfrom
chore/native-ts7

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Drop the dead @typescript/native-preview entry from the install age-gate allowlist
  • Assert the native TypeScript 7 compiler in every workspace, not just the repo root

The allowlist entry was dead

bunfig.toml excluded @typescript/native-preview from minimumReleaseAge, on the grounds that it only publishes nightly builds and so can never satisfy an age gate. That was true of the package, but the repo does not depend on it: the root uses @typescript/native (an alias of typescript@^7.0.2), and native-preview appears in no package.json and no bun.lock entry — the only two mentions in the entire repo were the exclude and its own comment.

An allowlist entry that names nothing still weakens the gate, because it is a standing exemption waiting for a package of that name to appear. Removed; bun install --frozen-lockfile still succeeds, which is what proves nothing was relying on it.

The gate itself, and its 7-day window, are unchanged.

The guard only covered the root

check:native-typecheck exists because @typescript/typescript6 pulls in an alias of typescript@6 that ships its own tsc bin, and bin winners are picked by lexical sort rather than dependency depth — so a bare tsc silently drops to the ~10x slower JavaScript compiler unless @typescript/native sorts ahead of it.

It asserted that on node_modules/.bin/tsc alone. But every workspace's type-check is a bare tsc --noEmit, which resolves through the nearest node_modules/.bin walking up from that package. All 29 reach the root bin today, so the root-only assertion happened to be sufficient — but a workspace that installed anything shipping its own tsc would get a local bin that shadows the root one, in exactly the same silent way, and the audit would still pass.

The guard now resolves tsc per workspace the way each script would, and names the offending package and path when one disagrees. Verified by planting a stub reporting Version 6.0.2 in apps/sim/node_modules/.bin: the previous guard passed, this one fails with apps/sim: apps/sim/node_modules/.bin/tsc reports "Version 6.0.2".

Why @typescript/typescript6 stays

Worth recording, since removing it would dissolve the whole bin-shadowing problem. It cannot go: four audit scripts (check-pending-drop-tables, check-sql-date-binding, check-tool-request-boundary, check-egress-boundary) and apps/sim's Function-block runtime read the stable compiler API — createSourceFile, createScanner, forEachChild, SyntaxKind.

typescript@7 exposes no equivalent from its root entry point (that is lib/version.cjs); its compiler API lives entirely under ./unstable/* subpaths. Moving five consumers — one of which transpiles user-supplied code in production — onto a surface the package itself labels unstable is not a trade worth making for a dependency cleanup.

Type of Change

  • Chore (tooling)

Testing

  • bun run check:native-typecheck passes across 29 workspaces, and fails as intended against a planted shadowing bin.
  • bun install --frozen-lockfile succeeds with the allowlist entry removed; bun.lock is unchanged.
  • Full suite, bun run check:audits, bunx turbo run type-check, bun run lint, bun run docs-manifest:check.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@waleedlatif1
waleedlatif1 requested a review from a team as a code owner September 5, 2026 00:24
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 5, 2026 12:33am UTC

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR strengthens TypeScript tooling safeguards by removing an unused install-age exemption and verifying that every declared workspace resolves a native TypeScript 7 compiler.

  • Removes the obsolete @typescript/native-preview release-age exemption.
  • Discovers workspace patterns from the root manifest instead of duplicating them.
  • Resolves and validates each workspace’s nearest tsc executable.
  • Stops compiler resolution at the repository boundary.

Confidence Score: 5/5

The PR appears safe to merge; the prior workspace-discovery and repository-boundary findings are fully addressed.

The audit now derives its workspace patterns from the current root manifest, checks each workspace’s nearest compiler, and stops resolution after examining the repository root. No actionable new failures or repository-rule violations remain.

Important Files Changed

Filename Overview
bunfig.toml Removes an unused package exemption while retaining the seven-day dependency release-age gate.
scripts/check-native-typecheck.ts Expands native compiler validation to all declared workspaces and correctly bounds executable lookup to the repository.

Reviews (2): Last reviewed commit: "fix(scripts): stop the tsc resolver at t..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/check-native-typecheck.ts Outdated
Comment thread scripts/check-native-typecheck.ts Outdated
Comment thread scripts/check-native-typecheck.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.

Re-trigger cubic

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.

1 participant