Skip to content

[C6][C28][C63] infra: website consumes the committed dist via a tsconfig alias + hand-written type shim — three engine copies coexist #22

Description

@GFier

From the 2026-07-06 codebase audit (docs/audits/codebase-audit-2026-07-06.md, in-repo). Finding IDs are stable — cite them in fixes.

Severity: Critical (C6) + High (C28) + Medium (C63) · Status: CONFIRMED (independently re-verified; self-reference mechanism PLAUSIBLE)

Problem

The demo site never consumes packages/*/src:

  1. All six examples import @elastica → tsconfig path alias → ../dist/elastica-react.mjs, the committed minified artifact (website/tsconfig.json:47-48).
  2. Types come from website/lib/utils/elastica.d.ts — a 247-line hand-written ambient module duplicating the generated dist/react/*.d.ts and already drifting (C28): it erases boxes nullability (example-1.tsx:81 compiles only because of that erasure — against real types it's a TS error and a runtime crash when an element unmounts mid-frame), misses ElementData.shape, and misses several exports. Nothing checks the shim against the real types; it rots silently on every API change.
  3. dist/elastica-react.mjs imports @darkroom.engineering/elastica, which exists in no node_modules — resolution most plausibly works via Node package self-reference through the root package.json name+exports (fingerprint evidence: the local-dist-only typo calculatecCollisions appears in the built .next chunks).
  4. bun.lock additionally resolves packages/react's "*" peer to the npm-published 0.0.14 — a third, 14-versions-stale engine copy linked under packages/react/node_modules/ (where IDE go-to-definition can land).
  5. C63: the library externalizes hamo 0.6.46 while website code imports hamo 1.0.0-dev.7 — two hamo implementations ship in one client bundle.

Failure scenario

Contributor fixes a collision bug in packages/engine/src/, runs bun run dev:website, reloads — behavior unchanged; nothing anywhere says you must bun run build first. Four sources of truth for one API (src, dist, shim, readme) connected only by human discipline.

Direction

Make the website depend on the workspace packages by name (bun links them natively; Next transpiles workspace deps); delete the alias and the shim; let exports.types do its job. Or, at minimum: wire dev:website to run engine/react watch builds concurrently and document the dist pipeline. (Audit design tension 3; open question 19: if the website must run standalone, the ../dist alias can't survive at all.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditFinding from a codebase auditcriticalCritical severityinfraRepo tooling, CI, packaging

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions