Repository navigation
fix: validate published TSRX source with a consumer-shaped typecheck - #732
Merged
trueadm merged 10 commits intoAug 13, 2026
Merged
Conversation
Packages that ship .tsrx were typechecked by tsgo, which drops those files from the program entirely. Their published source was therefore never checked at all. Bindings publish raw source and point exports at it, so every one of those errors is visible to a consumer. - Generate canonical consumer projects from the same tsconfig the CLI scaffolds, with a drift check, so what is validated cannot diverge from what users actually compile against. - Move the .tsrx-publishing projects that already pass onto tsrx-tsc. - Add a no-@types/node lane to the packed-tarball canary. The existing lane sets types: ["node"], so it cannot see `process` references in published source, which a browser app does not resolve. - Add a guardrail over source-published packages with an enumerated allowlist of the remaining violations. A stale entry fails the check, so the list can only shrink.
octanejs#733 rebuilds the packed TSRX consumer canary around automatic discovery of every binding that ships .tsrx, which is a better answer than the package list this branch was extending. Drop the overlapping edits to package-pack-canaries.mjs, check-package-packs.mjs and their test so the two branches stop touching the same files. What remains here is the part octanejs#733 does not cover: the root typecheck chain still runs tsgo over packages that ship .tsrx, so those files are absent from the program CI actually runs.
This was referenced Aug 12, 2026
Two defects Cursor Bugbot found on this PR, both confirmed. The nodeTypes and excluded rules only saw projects discovered by parsing inline compiler invocations out of the root typecheck chain. A package validated through a package script, a node wrapper, or absent from the chain never entered the loop, so the gate stayed green while missing the defect it claims to block. They now walk each source-published package's own tsconfigs; the tsgo rule still follows the chain, since that rule genuinely is a claim about what the chain runs. The excluded rule matched an exclude entry only when it named a shipped file exactly, so `src`, `src/**` or `src/**/*.tsrx` could drop packed source without tripping it. Exclude entries are now translated into path predicates following tsc's own wildcard shape. The allowlist grows from 100 to 112. All twelve additions are node-types-in-validation-tsconfig entries that chain-only discovery could not see, including the four Bugbot named. The previous number was not the real debt, only the part the gate could reach.
Third Bugbot finding, confirmed. The trailing `($|/)` was appended to every pattern, so a wildcard final segment behaved like a directory prefix: `src/*` matched `src/a/b/deep.ts` and `*` matched `src/a/b.ts`, where tsc's `*` and `?` do not cross `/`. Only a literal final segment, or `**` whose `.*` already spans, keeps the directory suffix now. Totals are unchanged at 112; no current entry depended on the over-match.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit cdca961. Configure here.
Fourth Bugbot finding, confirmed. The generated projects omitted `types` to mirror `octane init`, but the two omissions mean opposite things. A freshly scaffolded app has no `@types/*` installed at all; these projects run inside the monorepo, where an omitted `types` makes TypeScript auto-include every installed one. Published source was being handed the Node globals it must not see, which is the exact gap these projects exist to catch. Proved before and after with a probe compiled under the base config inside the repo: `process.env.NODE_ENV` resolved cleanly, and now reports TS2591. The packed-tarball consumer already pins `types` empty for the same reason, so this makes the in-repo projects agree with it.
…k-validation # Conflicts: # scripts/consumer-tsconfigs/base.json # scripts/generate-consumer-tsconfigs.mjs # scripts/generate-consumer-tsconfigs.test.mjs
dudusotero
marked this pull request as ready for review
August 13, 2026 14:54
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.

Summary
Rescoped. Everything this PR originally carried has already landed on main: #734 was stacked on this branch, so merging it brought the consumer projects, the
tsgototsrx-tscmigration and the source-publication guardrail along with it. What remains here is one fix, for the fourth Bugbot finding on this PR.The generated consumer projects omitted
compilerOptions.typesin order to mirror whatoctane initwrites. The two omissions mean opposite things. A freshly scaffolded application has no@types/*installed at all, so omitting the field grants nothing. These projects run inside the monorepo, where omitting it makes TypeScript auto-include every installed@types/*, including@types/node.So the projects were handing published source the Node globals a browser application never gets. That is the exact condition they exist to catch: it is gap C from #721, the one where
process.env.NODE_ENVin published source is an error for a real consumer and invisible to us.Confirmed with a probe compiled under the base config from inside the repo, before and after:
types: []is now set explicitly, with a comment recording why it deliberately diverges from the scaffolded template rather than tracking it.createPackedTsrxConsumerConfigalready pins it the same way for the same reason, so the in-repo projects and the packed-tarball consumer now agree.The generator test is split accordingly: one case still asserts that every scaffolded option reaches the consumer projects unchanged, and a second states the deliberate divergence and asserts both halves of it, so the next person to compare the two files finds the reason instead of a discrepancy.
Refs #721.
Validation
pnpm format:checkpnpm typecheckpnpm testnode --test scripts/generate-consumer-tsconfigs.test.mjs scripts/check-source-publication.test.mjs(21 passed)pnpm consumer:tsconfigs:check(52 projects, no drift after regeneration)pnpm sync(clean, no generated drift)pnpm testwas not run against this commit. The diff is three files of generated-config tooling with no runtime reach; the suite ran green on this branch's earlier heads, and CI runs it here.Risk / follow-ups
Pinning
types: []makes the consumer projects stricter than they were, so a package that appeared to pass one may now reportprocess,Bufferor similar. That is the point, and it is why the projects are deliberately not in a CI gate yet.SOURCE_PUBLICATION_DEBTis unaffected: the guardrail reads package tsconfigs, not these projects, and stays at 112.extendsis still not resolved when reading a package tsconfig, so a config inheritingtypes: ["node"]from a base is not reported. Pre-existing and out of scope here.Provenance
agent-authored)Note
Low Risk
Config-only change to validation tooling; may surface new type errors in consumer projects but does not affect runtime or the main CI typecheck gate.
Overview
Consumer-shaped typecheck projects now set
compilerOptions.typesto[]in the generated base config and increateConsumerBaseConfig, with comments explaining why this intentionally diverges fromoctane init(omittedtypesin a fresh app vs. monorepo auto-including every@types/*).That closes a gap where published source could reference Node globals like
processwithout error in-repo while real browser consumers would fail.Tests split scaffold parity (all options except
types) from a dedicated case assertingtypes: []on consumer configs andundefinedon the scaffold template.Reviewed by Cursor Bugbot for commit 087a731. Bugbot is set up for automated code reviews on this repo. Configure here.