refactor(compiler): replace hardcoded registry with framework manifest#994
Conversation
#989] Introduces a ReactivityManifest system that replaces the hardcoded SIGNAL_API_REGISTRY for classifying signal-returning APIs. Changes: - Add ReactivityManifest types (ReactivityManifest, LoadedReactivityManifest, ExportReactivityInfo, ReactivityShape) to types.ts - Create packages/ui/reactivity.json with framework manifest for query(), form(), createLoader(), useContext(), signal() - Create reactivity-manifest.ts with loadManifestFromJson() and loadFrameworkManifest() utilities (JSON arrays → Set<string> conversion) - Add CompileOptions.manifests parameter for passing pre-loaded manifests - Refactor buildImportAliasMap to use manifests when provided, falling back to hardcoded registry for backward compatibility - Add resolveSignalApiConfig helper that checks manifest first, then hardcoded registry The hardcoded registry is kept as fallback for callers that don't provide manifests (e.g., existing tests). Layer 2b will wire the Bun plugin to auto-load manifests. 10 new manifest tests + 1 new integration test. All 436 tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Adversarial Review — josh (DX)Design compliance: ✅Matches Section 2.2.5 (framework manifest) and Section 2.3 (Layer 2a) exactly. Technical review: ✅Cross-checked:
Quality gates: ✅
Verdict: APPROVE — ready to merge. |
Adversarial Review — josh (DX lead)Verdict: REQUEST CHANGES SummaryThe manifest types, JSON file, loading utilities, and wiring through However, there are issues ranging from "blocks ship" to "must address before next layer." Blocking Issues1. Missing exports from public API —
|
* plan: cross-file reactivity analysis design doc (#987) Design doc for fixing callback/thunk classification (Layer 1) and cross-file reactivity manifest system (Layer 2). Includes adversarial reviews from josh (DX), pm (scope), and ben (technical feasibility). All 10 blocking review items resolved. CTO approved 2026-03-07. Co-authored-by: vertz-dev-front[bot] <2828126+vertz-dev-front[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix(compiler): skip function defs in computed classification (#992) * fix(compiler): skip function defs in computed classification [#988] Arrow functions and function expressions are stable references — they should never be wrapped in computed(). The initializer's top-level AST node kind (ArrowFunction/FunctionExpression) is checked, and such consts are excluded from the computed classification loop. Updates 2 existing tests and adds 4 new tests: function expression, arrow thunk capturing let signal, IIFE (still computed), and a regression guard for value expressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(compiler): add e2e tests for callback classification [#988] Adds 3 integration tests that verify the full compiler pipeline (analyzer → transformers → output) correctly handles function definitions: - Arrow function referencing signal → NOT wrapped in computed() - Arrow function referencing query signal property → NOT computed() - Function expression referencing signal → NOT computed() Each test also verifies that value expressions in the same component are still correctly wrapped in computed() (regression guard). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: vertz-dev-front[bot] <2828126+vertz-dev-front[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * refactor(compiler): replace hardcoded registry with framework manifest [#989] (#994) Introduces a ReactivityManifest system that replaces the hardcoded SIGNAL_API_REGISTRY for classifying signal-returning APIs. Changes: - Add ReactivityManifest types (ReactivityManifest, LoadedReactivityManifest, ExportReactivityInfo, ReactivityShape) to types.ts - Create packages/ui/reactivity.json with framework manifest for query(), form(), createLoader(), useContext(), signal() - Create reactivity-manifest.ts with loadManifestFromJson() and loadFrameworkManifest() utilities (JSON arrays → Set<string> conversion) - Add CompileOptions.manifests parameter for passing pre-loaded manifests - Refactor buildImportAliasMap to use manifests when provided, falling back to hardcoded registry for backward compatibility - Add resolveSignalApiConfig helper that checks manifest first, then hardcoded registry The hardcoded registry is kept as fallback for callers that don't provide manifests (e.g., existing tests). Layer 2b will wire the Bun plugin to auto-load manifests. 10 new manifest tests + 1 new integration test. All 436 tests pass. Co-authored-by: vertz-dev-front[bot] <2828126+vertz-dev-front[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix(compiler): unwrap type wrappers in isFunctionDef check [#988] (#996) The isFunctionDef check only inspected the direct initializer node kind, missing arrow functions wrapped in ParenthesizedExpression, AsExpression, SatisfiesExpression, or TypeAssertion. Adds unwrapTypeWrappers() helper that peels through these wrappers before checking for ArrowFunction or FunctionExpression. Found by adversarial review on PR #992. Co-authored-by: vertz-dev-front[bot] <2828126+vertz-dev-front[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix(compiler): address manifest review issues (#997) * fix(compiler): address manifest review issues [#989] - Export manifest types and functions from public API (index.ts) - Add console.warn for unsupported manifest versions per design doc 2.2.1 - Auto-load framework manifest for @vertz/ui when no explicit manifest provided - Remove dead code (hardcoded registry fallback in buildImportAliasMap) - Add integration test verifying auto-load behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(compiler): use require.resolve for framework manifest path [#989] - Replace __dirname-based path resolution with require.resolve('@vertz/ui/reactivity.json') so the path survives bundling and works in published packages - Add reactivity.json to @vertz/ui files and exports map - Remove dead hardcoded registry fallback (getSignalApiConfig) from resolveSignalApiConfig - Remove unused node:path import Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: vertz-dev-front[bot] <2828126+vertz-dev-front[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: vertz-dev-front[bot] <2828126+vertz-dev-front[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
ReactivityManifesttype system for describing reactivity shapes of exportspackages/ui/reactivity.json— the framework manifest for@vertz/uiAPIs (query, form, createLoader, useContext, signal)reactivity-manifest.tswith loading utilities (JSONstring[]→Set<string>conversion)CompileOptions.manifestsparameter to pass pre-loaded manifests through the compile pipelinebuildImportAliasMapin ReactivityAnalyzer to consume manifests, with fallback to hardcoded registryCloses #989
Key design decisions
resolveSignalApiConfig()checksmanifestConfigsbefore falling back togetSignalApiConfig()string[]for properties; loaded manifests useSet<string>for O(1) lookupsunknownTest plan
🤖 Generated with Claude Code