Skip to content

fix(design-sync): complete the Preact value-import surface so the registry can bundle#775

Open
rickylabs wants to merge 1 commit into
feat/beta10-integrationfrom
fix/design-sync-preact-compat
Open

fix(design-sync): complete the Preact value-import surface so the registry can bundle#775
rickylabs wants to merge 1 commit into
feat/beta10-integrationfrom
fix/design-sync-preact-compat

Conversation

@rickylabs

Copy link
Copy Markdown
Owner

Summary

deno task design:sync could not bundle the current fresh-ui registry at all. This fixes the converter and makes the failure mode loud.

The bug

The registry gained an mcp-ui-widget island that imports h from preact as a value. The converter rewrites registry preact imports onto a synthetic __ds/preact-compat.ts shim — and that shim had no h export, so the emitted package could not bundle:

conversion errors:
  ! mcp-ui-widget: unmapped preact value import "h" in islands/McpUiWidget.tsx
error: No matching export in "__ds/preact-compat.ts" for import "h"

What changed

  1. The shim, not the symptom. The compat shim now covers the Preact value surface the registry actually imports — not a special case for h.
  2. Loud failure. An unmapped value import now fails inside convertUnits naming unit, file, and symbol — before deno bundle is reached. A bundler error is a worse diagnostic than the converter's own.
  3. Regression tests for both the positive path (a value import converts and bundles) and the negative path (an unmappable symbol fails with a useful message).

A defect caught in review, worth recording

The slice also improved the idempotence tree-hash separator — a genuine improvement — but wrote literal NUL bytes into mod.ts instead of the \0 escape. Git then classified a TypeScript file as binary (Bin 6321 -> 6236).

Every gate was green while that landed: deno check, lint, fmt, the unit tests, parity, all six trap checks, and the idempotence gate — because the hash is self-consistent, so idempotence structurally cannot see it, and the TS parser tolerates NUL inside a template literal. Only reading the diff caught it. Fixed to `${p}\0${c}\0` — identical runtime semantics (the idempotence hash is unchanged, which is the proof), plain-text source, reviewable diff.

Validation

  • deno task design:sync checkPASS: parity green, idempotence PASS (f0714aeb10ab), all six trap checks present, 184-file bundle.
  • Two pre-existing WARNs, unrelated to this fix: theme-toggle weak props; mcp-ui-widget predicted blank (requires src/theme).
  • deno check / lint / fmt clean over tools/design-sync.

Why it matters

This unblocked the beta.10 dashboard work: the NS One design system has since been re-synced with 184 files from today's real registry, so Claude Design generates against current components rather than a stale snapshot.

⚠️ CI note (see #774)

ci.yml only triggers on PRs into main, so check-test and quality do not run on this PR. The green ticks here cover surface-diff + code-quality only. The gates above were run locally; the first honest CI verdict for this wave is the feat/beta10-integrationmain PR.

Harness

Codex slice, reviewed by the orchestrator (opposite family) — the diff was read, not the verdict trusted. Run dir: .llm/runs/beta10--orchestrator/, slice design-sync-preact-compat. Not self-certified.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HTiQfrNFCVhjQFqbLKm5xo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant