Skip to content

fix: restore strict consumer types for published bindings - #834

Merged
domgan-oai merged 4 commits into
octanejs:mainfrom
openai-oss-forks:codex/fix-strict-binding-consumers
Aug 24, 2026
Merged

domgan-oai merged 4 commits into
octanejs:mainfrom
openai-oss-forks:codex/fix-strict-binding-consumers

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #726.
Closes #721.

Earlier fixes left Recharts implementations unchecked and retained packed-source exceptions for all five reported bindings. This PR repairs the authored source and validates the actual published compiler and tarballs.

  • Restore authored TypeScript for Recharts' 123 untyped JavaScript modules from its existing, checksum-verified Recharts 3.9.2 source pin. Export the actual component prop types, resolve .tsrx imports explicitly, and remove declaration facades and published-source exclusions.
  • Repair Octane's optional/composed ref types and nested useImperativeHandle refs. Correct native chart event/ref handling and missing radial geometry, with regressions at their owning boundaries.
  • Complete Visx's browser source contracts and Remix Router's published native ref declarations. Keep Redux Toolkit query subpaths browser-checkable with module-local environment types.
  • Check all five bindings through the Octane tsrx-tsc backend. Add strict ESNext packed browser coverage, negative Node-global/public-prop probes, public JS/TS subpaths, canonical implementation roots, and parser-diagnostic enforcement.
  • Require published @tsrx/core 0.1.60 and remove the obsolete repository-only compiler patch. Bundle the standalone Volar compiler's tested parser/printer graph while keeping Octane helpers shared; check its public declaration against source JSDoc. This protects installed consumers from esrap 2.3.6's typed-tuple incompatibility.
  • Keep Recharts on a compatible Redux Toolkit 2.10 / Immer 10 dependency family so ESNext consumers do not encounter Immer 11's conflicting Iterator declaration.

Validation

  • Full pnpm typecheck on Node 24.
  • Full pnpm format:check; the upstream license file is retained byte-for-byte.
  • Core development/production ref, cleanup, SSR/hydration, element-inspection, and strict public-type regressions. Final Volar owner suite: 22 tests; 4,386 strict/loose corpus comparisons preserve code, mappings, diagnostics, and structural AST results.
  • All 39 Recharts conformance/differential cases are included in the passing full-root shards. Native-event, ref-ownership, scatter-coordinate, and radial-geometry regressions fail before their repairs.
  • Visx strict source/parity, declaration generation, and client/server compilation checks.
  • Packed-canary/source-publication unit checks: 43 tests; workflow/tooling checks: 109 tests.
  • Immutable source/license and type-erased runtime comparison evidence recorded alongside the Recharts package.
  • Root test prechecks and all four normal-config Vitest shards: 2,300 files / 23,986 tests passed, without exclusions (Node 24, 8 GiB heap, two workers). Command: pnpm exec vitest run --shard=N/4 --maxWorkers=2 --silent=passed-only. The original unsharded 4 GiB run exhausted its heap and is not counted as a pass.
  • pnpm packages:pack:check: 101 tarballs, 792 preserved TSRX files, and strict Node/browser checks for 37 bindings. The five reported bindings pass ESNext browser checking with external esrap 2.3.6. A focused seven-tarball install also checks all 60 public binding imports and all 348 shipped TSRX implementations, with active negative Node-global/prop/ref/event/generic/tuple probes and no workspace paths, patches, or overrides.
  • All seven required SWR non-Vitest parity lanes, including pristine upstream tests and all pristine/adapted type projects. Replaced an incorrect negative expectation with contextual tuple/data checks verified against pristine SWR; the older compiler had discarded its error directive. Production code and public types are unchanged by this follow-up.
  • Current-head CI and automated review passed for a8c5bbb50; no actionable review threads remain.

Risk / follow-ups

The Volar-only compiler bundle isolates the tested dependency graph without changing application output. It adds 214,549 gzip bytes (about 209.5 KiB) of compiler JavaScript, plus 1,171 gzip bytes of notices for its eight MIT dependencies. Octane's own compiler modules remain shared, and no compiler source map is added. The declaration gate checks TypeScript emit from authored JSDoc, not full compiler-graph checkJs.

The private parser/printer graph also initializes alongside external compiler dependencies reached through the shared helpers, including through the public compiler index. On Node 24.19 / Apple M5 Max, 32 balanced fresh-process pairs per scenario (warm filesystem cache, disabled disk compile cache) measured median added import time of 7.63 ms for standalone Volar and 8.47 ms for the public compiler index. After preloading the runtime compiler, incremental Volar import added 7.81 ms (paired IQR 7.62–8.03 ms), 0.55 MiB retained heap, and 3.25 MiB post-GC RSS. Source/published code and mapping controls matched. These are local compiler-startup costs of current authored versus published code, not application-rendering, peak-memory, first-compilation, or whole-PR measurements.

Recharts' private RTK 2.10 / Immer 10 dependency family can require an additional installed copy in applications using newer families. Other pre-existing packed-source exceptions remain explicit; all five bindings reported in #721 are now enrolled.

The Recharts source pin and MIT notice are preserved. This repair does not upgrade its upstream version or claim complete upstream parity; the existing recorded-unverified status and unsupported Brush/Treemap runtime surface remain explicit.

The new imperative-array path adds no work to unchanged-dependency renders. Existing static/state-hook production bundles are byte-identical; the imperative-handle fixture adds 156 gzip bytes on Node 24. Scalar source-level closure/array creation counts are unchanged. These are bundle and deterministic creation-event measurements, not browser timing or heap-allocation claims.

Provenance

  • An agent produced this diff (agent-authored)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

High Risk
Touches published compiler packaging, runtime ref attachment, and public types for Recharts/Visx/Remix Router/RTK. A bad printer pin or ref-array change would break installed consumers and chart event/ref behavior.

Overview
Fixes strict browser TypeScript for source-published bindings (Recharts, Visx, Remix Router, Redux Toolkit) and stops relying on a workspace-only TSRX patch.

Recharts now ships authored TypeScript, explicit component imports, and real component prop types. Chart runtime also defers native events, keeps imperative/Cell refs off unrelated hosts, and restores missing radial geometry without dropping rows. Visx typechecks without Node globals; Remix Router keeps native a/form refs; RTK query hooks type a bundler env.

Octane composed refs accept optional entries and nested arrays in useImperativeHandle (callback cleanup and primitive handles). Spread-ref typing preserves generic Pie props and polar-axis native group targets.

The Volar compiler is bundled with its tested parser/printer graph and checked public declarations so newer transitive printers (esrap) cannot double-print typed tuple parameters in installed consumers. Typecheck for jotai/recharts/visx/redux now goes through tsrx-tsc.

Reviewed by Cursor Bugbot for commit a8c5bbb. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 23, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review August 23, 2026 23:05
@domgan-oai
domgan-oai merged commit 6927595 into octanejs:main Aug 24, 2026
31 checks passed
o-alexandrov added a commit that referenced this pull request Oct 2, 2026
…d helper

Keep the #834 contract that an index-signature spread composed with an
explicit ref is rejected, and declare ref?: undefined on the seven binding
bags that never carry a ref. Point the .tsrx check scripts at octane-tsc.
trueadm pushed a commit that referenced this pull request Oct 2, 2026
* ci: typecheck every project with TypeScript 7.1 in one parallel build

* style: format octane-tsc and spread typetest

* fix: mark binding spread bags ref-free instead of loosening the spread helper

Keep the #834 contract that an index-signature spread composed with an
explicit ref is rejected, and declare ref?: undefined on the seven binding
bags that never carry a ref. Point the .tsrx check scripts at octane-tsc.

* chore: add xyflow Panel ref changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@octanejs/recharts is unusable under a strict consumer typecheck Several published TSRX source bindings fail strict consumer tsrx-tsc typechecking

1 participant