Repository navigation
test(packages): enforce strict TSRX source consumers - #733
Conversation
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.
|
I had two PRs in flight on the same problem and have rescoped both so neither touches a file this one does: #732 (repository-side typecheck) and #734 (remix-router plus Two gaps I ran into while measuring the same surface, both possibly relevant to "Closes #721". The repository's own typecheck chain still runs The packed canary catches this from outside once a package is enrolled, but a contributor editing a binding in-repo still gets a green local typecheck over source that was never parsed. That is what #732 covers, and it is why I do not think the two overlap. The None of those files is modified here, and they still reference the bare global on #734 fixes those five with a module-local One note on the recharts work absorbed from #730, since you are now carrying it: 177 extensionless relative imports in |
- install the complete packed workspace dependency closure - allow pnpm to install required external peers
- defer Recharts source compilation until tsrx-tsc resolves extensionless TSRX imports
Thanks — agreed on the scope split. I removed the closing claim and now describe #733 as the external packed-consumer portion of #721, with #732 owning repository-side The no-Node lane reaches imported I also confirmed the Recharts extensionless imports make direct source compilation fail independently of its declaration surface. Commit 1a11753 adds an explicit Recharts debt exception with that exact reason, so this PR no longer implies the source graph passes. The declaration consumer probe remains active. |
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 1a11753. Configure here.
- keep precise API probe packages installed when source validation is deferred
…734) * fix: validate published TSRX source with a consumer-shaped typecheck 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. * refactor: cede packed-canary changes to #733 #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 #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. * fix(bindings): fix published source a browser app cannot type-check These packages ship raw source and point exports at it, so a consumer's program compiles every reachable module. The repo checked them with tsgo, which drops .tsrx from the program, so none of this was visible in CI while all of it was visible to consumers. - Declare `process` module-locally at every published `process.env.NODE_ENV` reference. A browser app has no @types/node. The expression stays written out literally so bundler define substitution and the dead-code elimination after it are unaffected, and nothing ambient ships in the tarball. - Let Form and Link accept a null forwarded ref: the compiler composes it as ref={[ref, spread.ref]}, and Ref<T> array members cannot be undefined. - Carry the same process deviation into the remix-router vendoring script, so a re-vendor does not reintroduce the error. The Provider prop typings for jotai and redux are left to #733, which edits the same two files. * fix: widen the source-publication gate past the typecheck chain 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. * fix: stop the spec matcher spanning directories on a wildcard segment 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.
…732) * fix: validate published TSRX source with a consumer-shaped typecheck 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. * refactor: cede packed-canary changes to #733 #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 #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. * fix: widen the source-publication gate past the typecheck chain 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. * fix: stop the spec matcher spanning directories on a wildcard segment 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. * fix: deny the consumer projects the Node globals a browser app lacks 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.

Summary
.tsrxinstead of maintaining a package allowlist.tsrximplementation files with stricttsrx-tscunder Node and browser/no-Node configurationsThis is the external packed-consumer guardrail portion of #721. Repository-side source typechecking remains in #732, and browser-safe
process.env.NODE_ENVreferences remain in #734. Includes and supersedes #730.Known residuals
@octanejs/visxis explicitly deferred while its React SVG/event prop types are migrated to Octane-native types.@octanejs/livestoreis explicitly deferred because LiveStore 0.4 declarations require the exact Effect peer graph captured by the workspace lockfile.@octanejs/rechartssource compilation is explicitly deferred untiltsrx-tscresolves extensionless imports to sibling.tsrxmodules. Its declaration surface remains covered here.All exceptions are named and logged; every other current and future published TSRX binding enrolls automatically.
Testing
node --test scripts/package-pack-canaries.test.mjs(20 tests passed)tsrx-tsc --noEmit -p packages/jotai/tsconfig.jsontsrx-tsc --noEmit -p packages/redux/tsconfig.jsontsrx-tsc --noEmit -p packages/redux-toolkit/tsconfig.jsontsrx-tsc --noEmit -p packages/shadcn/tsconfig.jsongit diff --checkpassedReview
Compound Engineering review completed. All actionable findings were applied.
Post-Deploy Monitoring & Validation
No additional runtime monitoring is required because this changes compile-time package validation only. Watch the package-pack CI job and first main build after merge. Both strict compiler lanes passing is healthy; an enrolled-package diagnostic or missing-entry error is a mitigation trigger.
Note
Medium Risk
Touches published
package.jsonexport/types for Recharts and broad CI pack validation; impact is compile-time and packaging contracts rather than runtime behavior, but failures block releases until exceptions are resolved.Overview
Adds automatic strict packed-consumer validation for every published framework binding that ships
.tsrx, replacing a fixed package list with discovery from tarballs and export maps. The external consumer now installs the full packed workspace closure plus promoted external peers, typechecks installed implementation.tsrxunder stricttsrx-tscin Node and browser (no@types/node) projects, and fails when a enrolled binding has no importable public entry. Known gaps stay on an explicit exception map with logged warnings (including deferred Recharts source compilation).Binding and typing fixes so more packages pass or expose a stable public surface: explicit props/types on Jotai
Provider, ReduxProvider, and RTK QueryApiProvider; Lucide root/// <referencefor icon ambient types; Recharts routestypes/exports.typestoindex.d.ts(runtime stillsrc/index.ts) and expands that declaration file (components, hooks,TooltipFormatter, unsupported exports probed via@ts-expect-error). Canary probes and unit tests cover discovery, closure resolution, dual tsconfigs, and Recharts type assertions.Reviewed by Cursor Bugbot for commit 7332c91. Bugbot is set up for automated code reviews on this repo. Configure here.