Back to Plate

Issue 4895 Regression Investigation

docs/plans/4895-regression.md

53.0.54.6 KB
Original Source

Issue 4895 Regression Investigation

Task

  • Source: GitHub issue #4895
  • Title: @platejs/[email protected] — TablePlugin typed as any
  • Type: investigation
  • Goal: determine whether the TablePlugin React entrypoint type degrading to any is a regression, using local source/build evidence and a temporary negative type test in the templates playground if useful

Plan

  1. Read issue details and repo instructions.
  2. Search docs/solutions/ for related type/export learnings.
  3. Inspect current @platejs/table source and generated type output.
  4. Reproduce the failure with a minimal negative type test in templates playground.
  5. Trace history to identify when the type changed.
  6. Conclude whether this is a regression and note the likely cause.

Findings

  • Issue reports TablePlugin in dist/react/index.d.ts is any, causing .configure() callback params to lose inference.
  • Published @platejs/[email protected] has a typed React declaration entrypoint; published 52.3.6 degrades TablePlugin, TableRowPlugin, TableCellPlugin, and TableCellHeaderPlugin to any.
  • PR #4856 is the regression window that matters:
    • it switched tsdown declarations to dts.bundle: true
    • it removed package-local platejs devDependency resolution in packages/table/package.json
  • The exact broken output reproduces locally when packages/plate/dist is unavailable during the packages/table build.
  • The same broken output reproduces with both TypeScript 5.8.3 and 6.0.2, so this is not a TypeScript-version regression. It is a build-contract or import-resolution race on built workspace exports.
  • Current HEAD rebuilds and packs a correct @platejs/[email protected] tarball when packages/plate/dist is present before the table build starts.
  • Restoring platejs as a workspace devDependency of @platejs/table makes Turbo build platejs before table, which closes the reproducer: hiding packages/plate/dist no longer causes the table declarations to collapse to any when building through pnpm turbo build --filter=./packages/table.
  • All 42 workspace packages that declare peerDependencies.platejs also import platejs in source, so the right repo-wide fix is to restore devDependencies.platejs = workspace:^ for the whole set, not just table.
  • A small repo-level manifest guard is enough to keep this from drifting again: fail if any workspace package declares peerDependencies.platejs without the matching workspace devDependencies.platejs.
  • pnpm test:slowest had a second, unrelated paper cut: CI runners were tripping the fast-suite hard-fail bucket with timings that stayed green locally.
  • The fix there is configuration, not test churn: keep the strict local fast-lane thresholds, but widen only the CI hard-fail bucket and keep the old local limits visible as CI warnings.

Progress

  • 2026-03-26: Fetched issue and loaded task, planning-with-files, learnings-researcher, and testing skills.
  • 2026-03-26: Added packages/table/type-tests/table-plugin-contracts.ts to pin the public @platejs/table/react contract against any collapse.
  • 2026-03-26: Added platejs: workspace:^ back to packages/table/package.json devDependencies so the build graph includes the platejs package before emitting bundled table declarations.
  • 2026-03-26: Verified pnpm install, pnpm turbo build --filter=./packages/table, pnpm turbo typecheck --filter=./packages/table, isolated compile of the new type-test, and local pack inspection.
  • 2026-03-26: Reproduced the original broken any declarations by hiding packages/plate/dist and rebuilding table; then verified the manifest fix prevents that repro under the normal Turbo build path.
  • 2026-03-26: pnpm test:types hit a TypeScript 6.0.2 internal compiler Debug Failure in the repo-wide type-test lane, so full-lane verification remains blocked by that compiler crash.
  • 2026-03-26: Added platejs: workspace:^ back to every workspace package that declares a platejs peer dependency, then verified the full package build and typecheck lanes pass.
  • 2026-03-26: Added tooling/scripts/check-workspace-package-manifests.mjs and wired it into pnpm test:all so future manifest drift fails fast.
  • 2026-03-26: Collapsed the 42 patch changesets into one combined .changeset/table-peer-build-edge.md file.
  • 2026-03-26: Made tooling/config/test-suites.mjs CI-aware so pnpm test:slowest uses 90ms/test and 180ms/file hard-fail buckets in CI while preserving the stricter local limits and surfacing the old limits as CI warnings.
  • 2026-03-26: Verified pnpm lint:fix, CI=1 pnpm test:slowest -- --top 5, and a full pnpm check after the CI threshold split.