Skip to content

fix(data-testing): mark conformance-case calls @__PURE__ so unused fixtures tree-shake - #185

Merged
krisnye merged 3 commits into
mainfrom
krisnye/pure-conformance
Aug 22, 2026
Merged

fix(data-testing): mark conformance-case calls @__PURE__ so unused fixtures tree-shake#185
krisnye merged 3 commits into
mainfrom
krisnye/pure-conformance

Conversation

@krisnye

@krisnye krisnye commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • An unused co-located cases export (export const cases = Conformance.cases(fn, ...)) is not eliminated from a production bundle just because @adobe/data-testing's package.json sets sideEffects: false — that flag only lets a bundler drop an unused import of the package. Conformance.cases(fn, ...) / Conformance.derivations(fn, ...) is an ordinary, unannotated function call happening in the consuming transform file, so Rollup/esbuild conservatively keeps it whenever the module is reachable (i.e. whenever fn itself is genuinely used), even though the cases export it initializes is never read.
  • Verified empirically against a real Vite/Rollup production build (data-lit-todo): wiring a transition into the actual app entry point and calling only the function (never cases) shipped the full case-fixture data and the builder's inlined logic into the bundle. Adding /*@__PURE__*/ immediately before the call eliminated it completely, confirmed by rebuild.
  • Annotates all 34 existing Conformance.cases(...) / Conformance.derivations(...) call sites across the reference apps (data-lit-todo, data-lit-tictactoe, data-gpu-hopper, data-lit-space-rock-game, data-react-pixie), corrects the misleading sideEffects: false comment in packages/data-testing/src/index.ts, and updates the data-ai guidance (state.md) to require the annotation on every future call, with the mechanism explained so it isn't dropped by accident.
  • Standard pnpm -w run bump version bump included per workspace convention.

Test plan

  • pnpm run lint — passes
  • pnpm run typecheck — passes across all 18 workspace packages
  • pnpm --filter <touched-app> run test — all pass (data-lit-todo 106/106, data-lit-tictactoe 99/99, data-lit-space-rock-game 135/135, data-gpu-hopper 90/90, data-react-pixie 42/42, data-testing 18/18)
  • Re-ran the real Vite production build after the fix to confirm no regression in bundle output

🤖 Generated with Claude Code

krisnye and others added 3 commits August 20, 2026 16:40
…s @__PURE__ so unused fixtures tree-shake

An unused `cases` export whose initializer is an unannotated function call
(`Conformance.cases(fn, ...)`) is kept by Rollup/esbuild even when the
transition `fn` it sits beside is genuinely imported elsewhere — the
package's `sideEffects: false` only elides unused *imports*, not this
call. Verified against a real Vite production build: the case-fixture
data and builder logic shipped without the annotation, and were fully
eliminated with it. Annotates all 34 existing call sites across the
reference apps, corrects the misleading comment in data-testing's
index.ts, and updates the data-ai guidance to require the annotation on
every future Conformance.cases/derivations call.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@krisnye
krisnye merged commit 6bf65d9 into main Aug 22, 2026
3 checks passed
@krisnye
krisnye deleted the krisnye/pure-conformance branch August 22, 2026 02:10
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