@kudzujs/core 0.8.61 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/MIGRATION_ROADMAP.md +37 -1
  2. package/PERFORMANCE.md +79 -1
  3. package/README.md +2 -2
  4. package/RELEASES.md +58 -0
  5. package/bin/kudzu.mjs +10 -1
  6. package/docs/next-architecture/0.9-baseline.md +1199 -0
  7. package/docs/next-architecture/0.9-benchmark-contracts.md +507 -0
  8. package/docs/next-architecture/0.9-component-property-contract.md +89 -0
  9. package/docs/next-architecture/0.9-compression-ledger.md +227 -0
  10. package/docs/next-architecture/0.9-final-proof-audit.md +176 -0
  11. package/docs/next-architecture/0.9-implementation-plan.md +1819 -0
  12. package/docs/next-architecture/0.9-resource-lifecycle.md +118 -0
  13. package/docs/next-architecture/0.9-semantic-compression.md +384 -0
  14. package/docs/next-architecture/README.md +16 -12
  15. package/docs/next-architecture/compiler-current-architecture.md +7 -7
  16. package/docs/next-architecture/large-application-ai-native-roadmap.md +6 -4
  17. package/docs/next-architecture/versioning.md +3 -2
  18. package/framework/README.md +3 -1
  19. package/framework/binding-runtime.js +4 -4
  20. package/framework/build.mjs +135 -30
  21. package/framework/compiler/ast-helpers.mjs +5 -0
  22. package/framework/compiler/browser-signal-passes.mjs +2 -7
  23. package/framework/compiler/collection-analysis.mjs +4 -0
  24. package/framework/compiler/descriptor-session.mjs +36 -12
  25. package/framework/compiler/effect-analysis.mjs +28 -8
  26. package/framework/compiler/effect-codegen.mjs +79 -36
  27. package/framework/compiler/effect-private-ref-pass.mjs +4 -8
  28. package/framework/compiler/handler-lowering.mjs +12 -7
  29. package/framework/compiler/ir/module-ir.mjs +26 -4
  30. package/framework/compiler/list-runtime-codegen.mjs +4 -2
  31. package/framework/compiler/optimize/command-specialization.mjs +4 -7
  32. package/framework/compiler/outside-click-pass.mjs +79 -0
  33. package/framework/compiler/react-migration-pass.mjs +27 -1
  34. package/framework/compiler/route-artifact-report.mjs +4 -3
  35. package/framework/compiler/route-build-record.mjs +12 -0
  36. package/framework/compiler/route-capability-planner.mjs +3 -3
  37. package/framework/compiler/route-ir.mjs +27 -11
  38. package/framework/compiler/runtime-codegen.mjs +2 -2
  39. package/framework/compiler/source-compiler.mjs +407 -74
  40. package/framework/core.d.ts +1 -0
  41. package/framework/core.mjs +18 -5
  42. package/framework/dependency-runtime.js +1 -1
  43. package/framework/effect-runtime.js +2 -2
  44. package/framework/list-runtime.js +67 -24
  45. package/framework/native-runtime.js +12 -9
  46. package/framework/runtime.js +1 -1
  47. package/framework/serialization.js +13 -6
  48. package/framework/shared-runtime.js +14 -12
  49. package/package.json +1 -1
@@ -0,0 +1,118 @@
1
+ # Kudzu 0.9 Resource Lifecycle Matrix
2
+
3
+ ## Status
4
+
5
+ This is the evidence ledger for `0.9.0-04 / Session 04A`. It inventories the
6
+ resource-shaped fixtures present at revision `98508ff` before any 04B test or
7
+ semantic change.
8
+
9
+ Current conclusion: every represented lifetime fits existing `EffectIR`,
10
+ effect-invocation-private values, and document/layout/route/conditional/keyed
11
+ ownership. No fixture proves a cross-owner lifetime or authorizes `ResourceIR`.
12
+
13
+ ## Lifecycle Matrix
14
+
15
+ | Fixture/family | Acquire | Dependencies | Owner | Invalidation and exact cleanup | Late completion | BFCache | Static exclusion / evidence |
16
+ |---|---|---|---|---|---|---|---|
17
+ | [`worker-effects`](../../test/fixtures/worker-effects) | Route effect creates a chart, module Worker, and message/error listeners. The Worker owns a 10 ms interval. | `[]`; route release/remount replaces the complete graph. | `/dash/dashboard` route inside a retained navigation layout. | Route disposal invalidates the effect, sets authored `active = false`, removes both listeners, calls `worker.terminate()`, and calls `chart.dispose()`. | Required Chrome manually invokes a removed message callback after cleanup and verifies no detached-canvas update. Thirty mount/dispose cycles balance starts, terminations, adds, and removes. | No focused persisted hide/restore journey. | Real and fake Worker Chrome journeys pass. `/dash/static` has zero JS; `/dash/plain` excludes the dashboard effect; unreachable Workers emit no graph. |
18
+ | [`goal-c-route-websocket`](../../test/fixtures/goal-c-route-websocket) | Dependency effect creates `new WebSocket(room)` and open/error listeners. | `[room]`; `general` cleanup precedes `support` setup. | Route effect inside a retained navigation layout. | Generation and ref identity invalidate the old invocation; cleanup increments generation, removes listeners, clears the matching ref, and closes once. Route release and final disposal use the same path. | Required Chrome invokes stale callbacks after dependency replacement and route release; neither can update status or recreate the route. | Non-persisted disposal is executable; persisted restore is not part of this fixture. | Node fake and required-Chrome journeys pass; `/static` is script-free. The graph is 15,872 raw / 7,163 aggregate gzip JS bytes. |
19
+ | [`goal-c-e2b-terminal`](../../test/fixtures/goal-c-e2b-terminal) | Mount effect starts async `openTerminal()` and installs pagehide/pageshow listeners. | `[]`; fresh mount reacquires. | Route/effect invocation. | `active` and generation reject old acquisition. Cleanup removes listeners, closes the current handle, and clears the ref. Non-persisted pagehide also invalidates and closes. | Required Chrome resolves acquisition after disposal and proves the late handle closes once without changing status. | Synthetic persisted hide retains the accepted handle and persisted show resumes once; non-persisted hide closes once and repeated disposal is inert. | Two required-Chrome scenarios pass; `/static` is script-free. The graph is 2,634 raw / 1,495 aggregate gzip JS bytes. |
20
+ | [`parameterized-debounce-hook`](../../test/fixtures/parameterized-debounce-hook) and direct debounce in [`react-vite-app`](../../test/fixtures/react-vite-app) | Dependency effect schedules one timeout. | Primitive source state; every change replaces the invocation. | Conditional child. | Prior token invalidates before direct `clearTimeout`; conditional removal releases setter authority and cleanup cancels pending work. | Chrome proves latest-only commit, unmount cancellation, and fresh remount. | No focused lifecycle event. | Static siblings have zero JS and no timer runtime. |
21
+ | Private callback timers in [`react-vite-app`](../../test/fixtures/react-vite-app) | Returned action clears the previous handle and assigns a literal-delay timeout; empty-dependency effect owns final cleanup. | Handler-driven replacement. | Conditional custom-hook owner. | Compiler-owned private timer state is cleared on replacement and unmount; owner invalidation blocks late setters. | Chrome proves replacement, latest-only firing, removal cancellation, and fresh remount. | No focused lifecycle event. | Static sibling has zero JS; no timer runtime. |
22
+ | [`memos-outline-migration`](../../test/fixtures/memos-outline-migration) | Scroll/resize listeners schedule one coalesced animation frame. | `[]`; event-driven scheduling. | Document/page effect. | Non-persisted disposal removes both listeners and cancels the pending frame. Post-disposal resize schedules nothing. | Fake scheduler proves pending-frame cancellation; saved callback is not manually invoked. | Non-persisted hide only. | Required Chrome passes; `/static` has zero JS. |
23
+ | [`colonni-blog-migration`](../../test/fixtures/colonni-blog-migration) canvas | Effect acquires canvas context, recursive frame loop, `IntersectionObserver`, keyboard listener, and canvas click listener. | `[]`; route mount owns one graph. | Locale route/document effect. | Cleanup cancels the frame, disconnects the observer, and removes both listeners. Post-disposal events and frame flush draw nothing. | Listener/frame silence is executable; a saved observer callback is not manually invoked. | Non-persisted hide only. | Required Chrome passes; `/static` has zero JS and no canvas runtime. |
24
+ | [`outside-click-hook`](../../test/fixtures/outside-click-hook) | Conditional dropdown adds one document `mousedown` listener. | Authored `[ref, callback]`, normalized to proven stable scope. | Conditional dropdown. | Removal invalidates ref/setter ownership and removes the same listener; remount installs one fresh listener. | Chrome proves removal and remount behavior; removed callback is not manually invoked. | No focused lifecycle event. | Required Chrome passes; `/static` has zero JS and no listener runtime. |
25
+ | [`calcom-media-query-migration`](../../test/fixtures/calcom-media-query-migration) | Two static `matchMedia()` subscriptions add matching `change` listeners. | `[]`; media changes invoke state setters. | Document/page effects. | Non-persisted disposal removes both matching listeners and invalidates setter authority. Post-disposal media changes are ignored. | Required Chrome dispatches changes after disposal and observes no update. | Non-persisted hide only. | False static snapshots preserve complete HTML; `/static` has zero JS and no external-store runtime. |
26
+ | [`navigation`](../../test/fixtures/navigation) interval and EventTarget listeners | Layout starts a telemetry interval/EventTarget; routes subscribe chart/product listeners. | Layout and route effects use `[]`; navigation changes owners. | Shared layout plus independently released routes. | Route listeners dispose on departure while layout telemetry persists. Non-persisted pagehide releases route before layout and reaches `clearInterval`; cleanup is idempotent. | Chrome proves no chart updates while unmounted, no duplicate listeners, and stale async/native writes cannot revive departed/disposed owners. | Synthetic persisted pagehide retains ownership; non-persisted hide disposes in route-layout order. No genuine browser BFCache traversal. | Outside route remains zero-capability; repeated navigation ownership passes in Chrome. |
27
+ | [`effect-package`](../../test/fixtures/effect-package) | Route effect reads bundled `typescript` during setup; it does not acquire a handle. | `[]`. | Route effect. | Non-persisted disposal executes one package-backed cleanup assignment exactly once; no resource close/destroy exists. | Not applicable. | Persisted restore remains untested. | Required Chrome executes setup and cleanup. Package code exists only in interactive effect ESM, `/static` has zero JS, and the graph is 3,562,795 raw / 1,025,300 aggregate gzip JS bytes. |
28
+
29
+ ## Cross-Cutting Evidence
30
+
31
+ Existing generic ownership already proves behavior beyond individual resource
32
+ fixtures:
33
+
34
+ - [`conditional-effects`](../../test/fixtures/conditional-effects) and
35
+ [`keyed-effects`](../../test/fixtures/keyed-effects) prove dependency
36
+ replacement, stale setter rejection, conditional/keyed release, and fresh
37
+ remount.
38
+ - [`navigation-owned-effects`](../../test/fixtures/navigation-owned-effects)
39
+ combines dependency, conditional, keyed, route, layout, persisted hide, final
40
+ disposal, and late completion ownership.
41
+ - [`tanstack-query-migration`](../../test/fixtures/tanstack-query-migration)
42
+ proves a delayed superseded response cannot overwrite the current invocation.
43
+ - [`effect-cleanup`](../../test/fixtures/effect-cleanup) proves persisted hide
44
+ retention, non-persisted cleanup, repeated-disposal idempotence, and cleanup
45
+ failure isolation in generated effect ESM.
46
+
47
+ These fixtures prove the ownership machinery. They do not turn promises,
48
+ queries, or arbitrary event targets into resource primitives.
49
+
50
+ ## Recognition Inventory
51
+
52
+ | Pairing proof | Current compiler owner | 04A finding |
53
+ |---|---|---|
54
+ | Timeout schedule/cancel | Generic effect analysis, parameterized debounce normalization, custom-hook timer normalization | Same runtime lifecycle, different validated source reachability. Review in 04C only if extraction deletes code and preserves diagnostics. |
55
+ | Animation schedule/cancel | `effect-private-ref-pass.mjs` and `validateEffectOwnedBrowserResources()` | Repeated lexical proof exists, but accepted source shapes differ. |
56
+ | Listener add/remove | Outside-click and media-query adapters; ordinary authored effects | Adapter-specific pairs are exact. Ordinary listeners rely on effect ownership and browser tests rather than a generic pair language. |
57
+ | Observer observe/disconnect | `validateEffectOwnedBrowserResources()` | One focused generic proof; no second identical compiler pass yet. |
58
+ | Handle close/terminate/dispose | Authored effect cleanup | Worker, socket, and terminal implementation details remain in route-owned handler ESM. |
59
+ | Async generation invalidation | Authored guards plus effect token authority | Existing effect ownership blocks stale writes without a scheduler or resource registry. |
60
+
61
+ ## Evidence Gaps For 04B
62
+
63
+ 1. Exercise cleanup for an actual route-owned package-created handle when a real
64
+ fixture exists; the current package fixture now executes package-backed cleanup
65
+ but still acquires no handle.
66
+ 2. Distinguish synthetic persisted lifecycle events from a genuine browser BFCache
67
+ traversal; current evidence does not claim the latter.
68
+
69
+ These are test and evidence gaps. They do not authorize `ResourceIR`, a resource
70
+ registry, or a shared browser runtime.
71
+
72
+ ## Session 04B Closure
73
+
74
+ Session 04B closes the executable gaps that current fixtures can honestly prove:
75
+
76
+ - terminal normal acquisition, persisted resume, non-persisted discard, repeated
77
+ disposal, and late-resolution close run in two fresh Chrome profiles;
78
+ - WebSocket dependency replacement, stale callback suppression, enhanced route
79
+ release, retained layout identity, remount, and final disposal run in one Chrome
80
+ journey;
81
+ - package-backed setup and cleanup execute in Chrome while the static sibling
82
+ remains package- and script-free;
83
+ - terminal, WebSocket, and package graphs have exact raw/gzip records above.
84
+
85
+ The package fixture is not relabeled as a resource: it creates no package handle.
86
+ A real package-created handle and genuine browser BFCache traversal remain evidence
87
+ gaps rather than reasons to add framework machinery.
88
+
89
+ ## Sessions 04C-04E Decision
90
+
91
+ Four compiler locations implemented the same inclusive AST ancestry walk. Session
92
+ 04C extracts only `isNodeWithin(node, root)` into `ast-helpers.mjs` and reuses it
93
+ from effect-private refs, generic effect resource validation, media-query
94
+ normalization, and command-helper recursion checks.
95
+
96
+ ```text
97
+ Changed compiler files net LOC: -12
98
+ Core semantic file-set delta: -3
99
+ Semantic passes: +0 / -0
100
+ Runtime concepts: +0
101
+ Browser bytes: +0
102
+ ```
103
+
104
+ No listener, timer, frame, observer, close/terminate, or generation abstraction
105
+ was extracted. Those recognizers prove different authored graphs and own different
106
+ diagnostics; a configurable generic matcher would add rather than remove semantic
107
+ machinery.
108
+
109
+ Session 04D finds zero qualifying cross-owner fixtures. The closest case is the
110
+ navigation telemetry graph: its interval/EventTarget belongs to one layout effect,
111
+ while each chart listener belongs to one route effect. Each acquire and cleanup
112
+ obligation already has one exact owner. Existing terminal, WebSocket, Worker,
113
+ canvas, timer, observer, media, and package fixtures are likewise invocation
114
+ private.
115
+
116
+ Session 04E therefore closes with expected outcome A: existing `EffectIR` is
117
+ sufficient. No `ResourceIR`, registry, subscription runtime, public API, or browser
118
+ capability was added.
@@ -0,0 +1,384 @@
1
+ # Kudzu 0.9.0 Semantic Compression Plan
2
+
3
+ ## Status And Authority
4
+
5
+ This is the completed execution record after `0.8.62`. Every release gate in this document is satisfied by `0.9.0`; follow-on model-driven delivery work remains separately gated for 1.0.
6
+
7
+ The executable session-by-session decomposition, current implementation seams, benchmark restoration work, report templates, and release procedure are maintained in [`0.9-implementation-plan.md`](./0.9-implementation-plan.md). This document remains authoritative for direction, order, and release gates; the detailed plan is authoritative for execution within each ordered item.
8
+
9
+ Read documents in this order before 0.9 work:
10
+
11
+ 1. [`MIGRATION_ROADMAP.md`](../../MIGRATION_ROADMAP.md) for product invariants and feature selection.
12
+ 2. This document for the active 0.9 scope and work order.
13
+ 3. [`0.9-implementation-plan.md`](./0.9-implementation-plan.md) for executable session packets and evidence.
14
+ 4. [`compiler-current-architecture.md`](./compiler-current-architecture.md) for current owners and data flow.
15
+ 5. [`performance-gates.md`](./performance-gates.md) for required measurements.
16
+ 6. [`large-application-ai-native-roadmap.md`](./large-application-ai-native-roadmap.md) for the completed foundation and longer-term work.
17
+
18
+ If these documents conflict, preserve the stricter runtime, ownership, performance, and fail-closed boundary and update the documents before implementation.
19
+
20
+ ## Mission
21
+
22
+ Kudzu 0.9.0 makes more realistic React-shaped programs reducible to the existing semantic model without making the browser heavier.
23
+
24
+ ```text
25
+ React and ecosystem source
26
+ -> migration and internal normalization
27
+ -> narrow canonical Kudzu source
28
+ -> small deterministic semantic compiler
29
+ -> complete HTML + minimum route capability ESM
30
+ ```
31
+
32
+ The compiler proves ownership, state transitions, dependencies, resources, ranges, and DOM effects. It does not interpret arbitrary JavaScript.
33
+
34
+ The 0.9 success shape is:
35
+
36
+ ```text
37
+ fixture coverage increases
38
+ Semantic Kernel concepts unchanged
39
+ core semantic pass count unchanged or lower
40
+ core compiler LOC unchanged or lower
41
+ browser JavaScript unchanged or lower
42
+ interaction latency unchanged or lower
43
+ ```
44
+
45
+ Internal improvement alone is insufficient for `0.9.0`. The milestone must prove Kudzu's architectural advantage against matched React and representative competing-framework applications under the cross-framework gate below.
46
+
47
+ ## Non-Negotiable Invariants
48
+
49
+ 1. Runtime performance and existing benchmark strengths are preserved before compatibility grows.
50
+ 2. Static routes emit complete HTML and zero JavaScript.
51
+ 3. Interactive routes emit only capabilities proven necessary for that route or explicit layout lifetime.
52
+ 4. React, hydration, a VDOM, retained browser components, generic rerendering, and generic client runtimes remain forbidden.
53
+ 5. Native HTML and browser APIs are preferred when they preserve behavior and accessibility.
54
+ 6. Package-specific knowledge ends at normalization or an internal adapter boundary.
55
+ 7. Unsupported semantics fail with a source location and an actionable migration path. There is no generic fallback.
56
+ 8. Build-known work stays at build time. Compatibility work must not transfer compiler cost to the browser.
57
+ 9. Native document navigation remains the default. `0.9.0` does not add a universal SPA router.
58
+ 10. New support begins with a real application or a reduced executable fixture derived from one.
59
+
60
+ ## Semantic Kernel Boundary
61
+
62
+ The stable conceptual vocabulary for 0.9 is:
63
+
64
+ ```text
65
+ Value
66
+ State
67
+ Derived
68
+ Operation
69
+ Event
70
+ Effect
71
+ Resource
72
+ Range
73
+ Navigation
74
+ Ownership
75
+ ```
76
+
77
+ These are semantic concepts, not a requirement to create ten public IR record types. Current records already cover much of the kernel:
78
+
79
+ | Concept | Current representation | 0.9 direction |
80
+ |---|---|---|
81
+ | Value and State | `SignalIR`, state slots, serializable captures | Keep direct and ownership-scoped. |
82
+ | Derived | Existing tagged `DerivedIR` collection and expression records | Generalize pure multi-state dependency and result use; do not add syntax-specific derived records. |
83
+ | Operation | Command `HandlerIR`, `SharedActionIR`, native handler ESM | Normalize proven equivalent transitions into existing structured operations. |
84
+ | Event | Route events and owned native handlers | Keep route and DOM-owner scoped. |
85
+ | Effect | `EffectIR` and existing setup/cleanup codegen | Preserve invalidation, dependency comparison, and exact cleanup. |
86
+ | Resource | Effect-owned lifecycle and invocation-private closures | Generalize lifecycle proof first; `ResourceIR` is not pre-approved. |
87
+ | Range | Existing route, conditional, keyed, and navigation ownership | Reuse existing ownership; do not add generic range or virtualization machinery without evidence. |
88
+ | Navigation | Native links plus explicit route-group capability | Keep native by default. |
89
+ | Ownership | `OwnerRef`, component/keyed/route/layout identities | Make ownership edges more explicit and less syntax-dependent. |
90
+
91
+ Before adding a semantic primitive:
92
+
93
+ ```text
94
+ one fixture -> normalization or specialization
95
+ two unrelated fixtures -> document the repeated semantics
96
+ three or more real fixtures -> architecture review may consider a primitive
97
+ ```
98
+
99
+ Even at the third fixture, prefer an existing record or a stricter adapter. Fixture count permits a review; it does not authorize a new primitive.
100
+
101
+ ## 0.9 Scope
102
+
103
+ ### In Scope
104
+
105
+ - Stronger pure `Derived` semantics for realistic multi-state application logic.
106
+ - Package-neutral shared state and action semantics reused by more than one source model.
107
+ - Resource lifetime proof based on acquire, dependencies, owner, invalidation, and cleanup.
108
+ - Stronger compile-time component ownership, object/structural prop specialization, and property-level dependencies.
109
+ - Consolidation or deletion of syntax-specific analysis after it lowers to existing semantics.
110
+ - Exact complexity, output, build, and browser accounting for every slice.
111
+ - Actionable diagnostics for the supported boundary and nearby unsafe forms.
112
+
113
+ ### Explicitly Deferred
114
+
115
+ - The public `kudzu normalize` command belongs to 0.10. Internal deterministic normalization remains allowed in 0.9.
116
+ - `kudzu explain`, `kudzu check --json`, `kudzu fix`, and `kudzu migrate --analyze` belong to 0.11 unless a small internal inspection tool is required to validate 0.9.
117
+ - Broad ecosystem adapters belong to 0.12. A 0.9 fixture may add only the narrow adapter needed to prove package-neutral semantics.
118
+ - Semantic IR freeze belongs to 1.0.
119
+ - Public store, query, form, resource, adapter, or router APIs are not part of 0.9.
120
+ - Generic `ResourceIR`, generic `RangeIR`, virtualization, optimistic transactions, arbitrary callback graphs, and arbitrary JavaScript evaluation remain unapproved.
121
+
122
+ ## Feature Decision Ladder
123
+
124
+ Every proposed 0.9 slice must stop at the first applicable step:
125
+
126
+ 1. Use native HTML or a native browser API.
127
+ 2. Lower to the existing Semantic Kernel and current IR records.
128
+ 3. Normalize deterministically into supported canonical source.
129
+ 4. Add a package-specific internal adapter whose output is package-neutral.
130
+ 5. Request an architecture review only after at least three unrelated real fixtures prove one missing semantic concept.
131
+ 6. Otherwise reject with an actionable diagnostic.
132
+
133
+ A generic browser runtime is not a step in this ladder.
134
+
135
+ If one ecosystem feature requires changes in three or more unrelated core compiler subsystems, stop. Record the proposed producer/consumer edges and perform an architecture review before editing those subsystems.
136
+
137
+ ## Ordered Work Queue
138
+
139
+ Only one item may be active. Complete its evidence and update this document before starting the next item. A semantic slice without a real failing fixture remains blocked rather than becoming speculative framework work.
140
+
141
+ ### 0.9.0-01: Freeze The Baseline
142
+
143
+ **Status:** complete; Sessions 01A through 01G are signed off in [`0.9-baseline.md`](./0.9-baseline.md) and [`0.9-benchmark-contracts.md`](./0.9-benchmark-contracts.md).
144
+
145
+ Record the current `0.8.62` baseline before changing semantics:
146
+
147
+ - map every normalization pass to the canonical concept or diagnostic it produces;
148
+ - count focused normalization passes and core semantic compiler LOC using a documented, repeatable file set;
149
+ - record ModuleIR concepts and browser runtime concepts;
150
+ - record standard test count, representative deploy files, raw/gzip JavaScript, and static-route zero-JavaScript output;
151
+ - record current build measurements for the maintained source-scale fixture and available 100, 1,000, and 10,000 route catalog fixtures;
152
+ - record the current matched React + Vite, Vue, Svelte, and Astro benchmark revisions, supported scenarios, known behavior gaps, and results;
153
+ - record unavailable benchmark sizes as gaps instead of fabricating results or adding an unmeasured cache.
154
+
155
+ **Deliverable:** add a dated baseline section to this document with commands, environment, file set, raw results or links to `PERFORMANCE.md`, and known gaps.
156
+
157
+ **Done when:** `npm run check` and `npm test` pass, the baseline is reproducible, and no production source or output changed.
158
+
159
+ ### 0.9.0-02: Strengthen Derived
160
+
161
+ **Dependency:** 0.9.0-01 and at least one real failing fixture with multi-state pure derived logic.
162
+
163
+ **Status:** complete; Sessions 02A through 02I are signed off for the Medusa Product Actions and Mercury Agent Profit Sharing reductions. Medusa proves selected binding/effect fields, while Mercury reuses the same calculation identity for scalar bindings and an adjustable keyed array field. The closure adds no semantic primitive, pass, runtime concept, normalization rule, or adapter.
164
+
165
+ Target semantics:
166
+
167
+ ```text
168
+ explicit State/Static dependencies
169
+ -> pure deterministic computation
170
+ -> one Derived identity
171
+ -> property-level Binding/Effect/List consumers
172
+ ```
173
+
174
+ Prefer extending the existing tagged `DerivedIR` evaluator and dependency edges. Do not add `.find()`-specific, commerce-specific, or component-specific runtime behavior.
175
+
176
+ Required evidence:
177
+
178
+ - at least two unrelated fixture shapes use the same derived representation before the milestone closes;
179
+ - multiple primitive state inputs and serializable static captures are explicit;
180
+ - unchanged selected results do not trigger unrelated effect work;
181
+ - deterministic object/primitive result fields update known DOM targets directly;
182
+ - impure calls, dynamic fields, mutation, cycles, opaque captures, and nondeterministic results fail closed;
183
+ - static siblings and build-folded derived values add zero JavaScript.
184
+
185
+ ### 0.9.0-03: Unify Shared State And Actions
186
+
187
+ **Dependency:** 0.9.0-02 and a real fixture exposing duplicated Context/Zustand/other source handling.
188
+
189
+ **Status:** complete; Sessions 03A through 03G are signed off. Equivalent Context and Zustand-shaped carts now produce package-neutral shared-state/action records and generic handler edges while preserving byte-identical deploy output, layout ownership, same-turn updates, navigation, effect cleanup, and zero-JavaScript static siblings. No semantic primitive, ModuleIR kind, pass, runtime concept, or normalization entry was added.
190
+
191
+ Make package-neutral `SharedStateIR` and `SharedActionIR` authoritative before generic handler, dependency, and ownership consumers. Context and Zustand-shaped source should differ at the compatibility boundary, not in browser state machinery.
192
+
193
+ Required evidence:
194
+
195
+ - at least two unrelated source models lower to the same generic operation and dependency consumers;
196
+ - direct same-turn state semantics, layout lifetime, navigation persistence, and cleanup remain unchanged;
197
+ - no generic store, subscription runtime, Context tree, or public adapter API is emitted;
198
+ - hidden or dynamically addressed store behavior remains rejected.
199
+
200
+ ### 0.9.0-04: Generalize Resource Ownership
201
+
202
+ **Dependency:** 0.9.0-03 and a fixture that cannot be represented by the current effect-private closure model.
203
+
204
+ **Status:** complete; Sessions 04A through 04E are signed off. Existing `EffectIR` represents every maintained resource fixture, required-Chrome evidence now covers the identified executable gaps, and one shared ancestry helper removes 12 lines of duplicate lexical proof. Zero fixtures qualify for `ResourceIR`; no resource primitive, pass, runtime concept, public API, or browser bytes were added.
205
+
206
+ First attempt to express the fixture as existing `EffectIR` plus explicit ownership and cleanup validation:
207
+
208
+ ```text
209
+ Acquire
210
+ Dependencies
211
+ Owner
212
+ Invalidation
213
+ Cleanup
214
+ ```
215
+
216
+ WebSocket, Worker, observers, timers, animation frames, canvas, and SDK instances are examples, not separate semantic primitives. Understand lifetime, not library internals.
217
+
218
+ Required evidence:
219
+
220
+ - exact acquire/replacement/cleanup behavior is proven under dependency change, owner release, navigation, and late async completion;
221
+ - direct browser-only package imports remain route-owned and absent from static siblings;
222
+ - package or resource implementation details do not enter generic runtime code;
223
+ - `ResourceIR` is considered only under the three-fixture rule when existing `EffectIR` ownership cannot represent the shared lifetime.
224
+
225
+ If no qualifying fixture exists, close this item by recording that existing effect ownership remains sufficient. Do not invent ResourceIR to complete the milestone.
226
+
227
+ ### 0.9.0-05: Strengthen Component Ownership And Dependencies
228
+
229
+ **Dependency:** 0.9.0-04 and a real fixture that currently requires component flattening or artificial primitive-state decomposition.
230
+
231
+ **Status:** complete. WorkLedger revision `3d8bf2130ec1d7698bff07fb00726b2bb94d20d4` authorizes one direct object-state prop whose direct static fields feed bindings, a selected effect dependency, and a keyed collection. ComponentAnalysis records source SignalIR/property/consumer links; existing BindingIR, expression DerivedIR, EffectIR, and binding-backed KeyedBlockIR consumers preserve repeated and conditional ownership. Dynamic paths, aliases, and mutation fail closed. No ModuleIR kind, pass, runtime concept, callback extension, cache, or browser component was added.
232
+
233
+ Improve compile-time specialization of immutable object props, stable semantic callback operations, repeated components, and property-level dependency propagation. Components remain an authoring abstraction and disappear from browser output.
234
+
235
+ Required evidence:
236
+
237
+ - retained component boundaries compile to HTML, existing state/operation edges, and owned effects without browser component instances;
238
+ - repeated and conditional owners remain independent and clean up exactly once;
239
+ - prop dependency analysis subscribes only to proven source state;
240
+ - arbitrary callbacks, dynamic prop spreads, opaque mutation, and unproven ownership still fail closed;
241
+ - specialization caching is added only if a maintained benchmark proves repeated semantic analysis is material.
242
+
243
+ ### 0.9.0-06: Delete Duplication And Close The Milestone
244
+
245
+ **Status:** complete. A nine-candidate ledger selects two independent deletions that remove 32 core semantic lines. Source diagnostics remain stable, all focused/full/package/browser gates pass, maintained 100/1,000/10,000-product scaling emits byte-identical output, and the final architecture review records zero new concepts, IR kinds, passes, normalization entries, runtime concepts, public APIs, or browser bytes.
246
+
247
+ **Dependency:** prior items complete or explicitly closed for lack of evidence.
248
+
249
+ - remove obsolete syntax-specific branches made redundant by canonical semantic lowering;
250
+ - consolidate passes only where ownership and diagnostics remain clear;
251
+ - compare the final semantic-core LOC and pass count with 0.9.0-01;
252
+ - run maintained build scaling at 100, 1,000, and 10,000 routes where fixtures exist;
253
+ - run browser and output gates for every affected capability family;
254
+ - publish no performance claim without the protocol and raw evidence in `PERFORMANCE.md`.
255
+
256
+ This item must not add compatibility solely to improve the fixture count.
257
+
258
+ ### 0.9.0-07: Final Cross-Framework Proof
259
+
260
+ **Status:** complete. Local benchmark source remains ignored by policy. Native C1 reaches the 0 B route/session JavaScript floor across five targets, and the C2/C5 stateful, Worker, navigation, ownership, static-exclusion, resilience, and uniform metric matrices pass behavior acceptance. The final 21-profile C2 medians pass: row filter is faster than Vue, while row restore and search restore are within 3.5% and 1.8% of their nearest comparators. Flattened generated commerce input plus one-shot plan streaming, release, and staged HTML spooling makes Kudzu 2.5%/5.5% faster than Astro cold/warm at 10,000 products and cuts peak RSS 71.0% to 542,484 KiB, 11.4% below Astro. Model-driven AI delivery remains a 1.0 gate. See [`0.9-final-proof-audit.md`](./0.9-final-proof-audit.md).
261
+
262
+ **Dependency:** 0.9.0-01 through 0.9.0-06 complete or explicitly evidence-closed, and the maintained comparison harness restored.
263
+
264
+ Run the complete pinned content, stateful, commerce-scale, and resource comparison matrix defined in the detailed implementation plan. Behavior and accessibility acceptance must pass before timing. Record initial and session JavaScript, interaction and navigation readiness, event latency, CPU, heap, failure resilience, and 100/1,000/10,000-route build scaling with raw samples and exact framework revisions.
265
+
266
+ Any material primary-metric loss blocks `0.9.0`. Do not hide a loss in a weighted score, omit failed comparator runs, or replace application proof with a synthetic microbenchmark.
267
+
268
+ ## Per-Slice Contract
269
+
270
+ Before implementation, write the following in the PR or active work note:
271
+
272
+ ```text
273
+ Authorizing fixture:
274
+ First unsupported source location:
275
+ Canonical semantic reduction:
276
+ Existing IR producer:
277
+ Existing IR consumers:
278
+ Owner and release boundary:
279
+ Nearby rejected forms:
280
+ Expected browser capability delta:
281
+ ```
282
+
283
+ After implementation, report:
284
+
285
+ ```text
286
+ Semantic primitives added:
287
+ Core compiler passes added/removed:
288
+ Core compiler LOC delta:
289
+ Runtime concepts added:
290
+ Browser raw/gzip byte delta:
291
+ Normalization rules added/removed:
292
+ Adapter rules added/removed:
293
+ Positive/negative fixtures added:
294
+ Build and browser benchmark delta:
295
+ ```
296
+
297
+ The expected result for an ecosystem-facing slice is normally:
298
+
299
+ ```text
300
+ Semantic primitives +0
301
+ Core passes +0 or fewer
302
+ Runtime concepts +0
303
+ Normalization/adapter +N
304
+ Fixtures +N
305
+ ```
306
+
307
+ ## Test And Performance Gates
308
+
309
+ Every semantic slice must:
310
+
311
+ - add the smallest focused positive and negative fixture that proves the boundary;
312
+ - preserve complete HTML and zero JavaScript for a static sibling;
313
+ - prove direct DOM behavior, identity, dependency comparison, cleanup, invalidation, and remount where affected;
314
+ - compare representative ModuleIR, RouteIR, capability signatures, emitted file lists, and raw/gzip bytes;
315
+ - run `npm run check` and `npm test`;
316
+ - run package smoke when package output changes;
317
+ - apply [`performance-gates.md`](./performance-gates.md);
318
+ - use `kudzu-based-bench` as an architectural gate when the affected scenario exists there, while recording its exact revision and commands.
319
+
320
+ Test JS-disabled, delayed-JS, missing-chunk, slow-network, and slow-CPU behavior when the feature changes progressive enhancement or loading. Do not claim coverage for a scenario that is not automated or manually recorded.
321
+
322
+ ## Cross-Framework Proof Gate
323
+
324
+ `0.9.0` must demonstrate that Kudzu produces a better user-facing result for the same application behavior, not merely that its internal architecture is smaller.
325
+
326
+ The maintained comparison set is:
327
+
328
+ 1. React + Vite as the primary migration and authoring baseline.
329
+ 2. Vue and Svelte as representative client/compiler framework baselines.
330
+ 3. Astro as a representative HTML-first/static framework baseline.
331
+ 4. Next.js, Nuxt, SvelteKit, or another production framework when the tested scenario depends on a capability absent from the smaller baseline.
332
+
333
+ Every result must pin framework versions and compare the same:
334
+
335
+ - rendered content and route count;
336
+ - user-visible behavior and data;
337
+ - accessibility semantics and keyboard journeys;
338
+ - production mode, compression, cache state, and hosting assumptions;
339
+ - browser, hardware, network, CPU, and measurement protocol;
340
+ - successful acceptance tests before performance is counted.
341
+
342
+ Kudzu qualifies for `0.9.0` only when the maintained matched suite shows:
343
+
344
+ - strictly lower initial and total-session browser JavaScript than every applicable comparator;
345
+ - no hydration and stronger JS-disabled, delayed-JS, and missing-chunk behavior;
346
+ - interaction readiness, event latency, and navigation latency that are fastest or statistically tied for fastest under the recorded protocol;
347
+ - no material CPU or memory loss on the same journeys;
348
+ - no remaining material 100, 1,000, or 10,000-route build-scaling weakness against the best applicable static-output comparator;
349
+ - complete HTML and feature parity rather than benchmark-only omission;
350
+ - the advantage persists across at least one content application and one stateful interactive application, not only microbenchmarks.
351
+
352
+ A material loss blocks `0.9.0` until it is fixed, the benchmark is shown to be invalid, or the compared capability is explicitly removed from the release claim. Results may not be combined into a weighted score that hides a primary-metric loss. Raw samples, failures, output bytes, and limitations must be published in `PERFORMANCE.md`.
353
+
354
+ ## 0.9.0 Release Gate
355
+
356
+ `0.9.0` is ready only when:
357
+
358
+ - 0.9.0-01 through 0.9.0-07 are complete or explicitly closed with evidence that no semantic change is needed;
359
+ - realistic multi-state Derived behavior is represented by existing kernel concepts;
360
+ - shared-state package syntax is contained at compatibility boundaries;
361
+ - resource-heavy fixtures use explicit, proven ownership without a generic resource runtime;
362
+ - component abstraction coverage improves without retained browser components;
363
+ - final core semantic pass count and measured core compiler LOC are no higher than the recorded baseline, unless an explicit architecture review documents why a small increase is necessary and what duplication was removed;
364
+ - unchanged benchmark scenarios show no material runtime, browser-byte, interaction-readiness, session-transfer, or build-scaling regression;
365
+ - the Cross-Framework Proof Gate passes against the pinned maintained comparison set;
366
+ - all static-route and progressive-enhancement guarantees remain intact;
367
+ - diagnostics describe every newly supported boundary and nearby rejection;
368
+ - `npm run check`, `npm test`, package smoke, required browser journeys, and release verification pass;
369
+ - `package.json`, `create-kudzu`, README, architecture mapping, performance records, and release notes are updated together only for the actual release.
370
+
371
+ ## Session Resume Protocol
372
+
373
+ At the start of every new implementation session:
374
+
375
+ 1. Read the required documents listed above.
376
+ 2. Inspect `package.json`, `git status`, and the current work item status here.
377
+ 3. Select only the first incomplete queue item whose dependencies and fixture evidence exist.
378
+ 4. Reproduce the fixture failure before changing compiler code.
379
+ 5. Fill in the per-slice contract and choose the first valid feature-decision step.
380
+ 6. Implement the smallest semantic reduction; do not broaden neighboring syntax.
381
+ 7. Run focused checks, `npm run check`, `npm test`, output comparison, and affected benchmarks.
382
+ 8. Update this document with completion evidence and the next exact item. Update release records only for a real release.
383
+
384
+ If the required fixture or benchmark is absent, document the gap and stop that slice. Do not replace evidence with speculative infrastructure.
@@ -1,6 +1,6 @@
1
1
  # Kudzu Architecture Continuation
2
2
 
3
- This directory is the continuation packet after `0.8.15`. Planned versions remain plans until package metadata and release records mark them complete.
3
+ This directory is the compiler continuation packet. Planned versions remain plans until package metadata and release records mark them complete.
4
4
 
5
5
  The top-level [`GOAL_A.md`](../../GOAL_A.md) and [`GOAL_B.md`](../../GOAL_B.md) are historical completed capability records. Do not overwrite or reinterpret them. The Goal A/B/C/D names in this directory refer to the next architecture discussion:
6
6
 
@@ -11,7 +11,7 @@ The top-level [`GOAL_A.md`](../../GOAL_A.md) and [`GOAL_B.md`](../../GOAL_B.md)
11
11
  | C: state/resource model | Research only | Reduced fixtures expose a limitation |
12
12
  | D: routing compatibility | Current behavior preserved | Revisit only with migration evidence and invariant review |
13
13
 
14
- The active post-`0.8.61` implementation sequence is [`large-application-ai-native-roadmap.md`](./large-application-ai-native-roadmap.md). P0.12 validation, property-level object-state dependencies, direct three-boundary callback/ref ownership, direct primitive, plain-object, array-prop, keyed-item draft state initialization, matching array-draft setter effects, parameterized primitive debounce hooks, repeated direct leaf-handler callback use, direct child callback fan-out, collision-free and private Context action setters, package-neutral shared-state/action IR, browser-only package imports and private mutable refs in owned effects, route/layout CSS closure, structural per-route capability/chunk reporting, signature-keyed runtime families, incremental source and affected-route development builds, measured route-entry output optimization, and the plain TypeScript source-scale fast path are complete. ResourceIR remains research for cross-owner transports and subscriptions; range ownership, virtualization, and optimistic transactions still require independent fixtures. The plan orders compiler semantic generalization, large-application foundations, compatibility boundaries, AI tooling, and production validation without changing the invariants below.
14
+ The completed `0.9.0` milestone is recorded in [`0.9-semantic-compression.md`](./0.9-semantic-compression.md) and [`0.9-implementation-plan.md`](./0.9-implementation-plan.md). It freezes the `0.8.62` baseline, then closes evidence-backed work on Derived, shared state/actions, resource ownership, component ownership, pass reduction, and final cross-framework proof. [`large-application-ai-native-roadmap.md`](./large-application-ai-native-roadmap.md) remains the completed foundation and longer-term plan. Model-driven delivery is separately gated for 1.0. ResourceIR remains unapproved; range ownership, virtualization, optimistic transactions, public adapters, and generic runtimes still require independent evidence and architecture review.
15
15
 
16
16
  ## Required Invariants
17
17
 
@@ -25,19 +25,23 @@ The active post-`0.8.61` implementation sequence is [`large-application-ai-nativ
25
25
 
26
26
  ## Reading Order
27
27
 
28
- 1. [`compiler-current-architecture.md`](./compiler-current-architecture.md): exact current responsibilities and data flow.
29
- 2. [`large-application-ai-native-roadmap.md`](./large-application-ai-native-roadmap.md): active direction, priorities, PR queue, and completion evidence.
30
- 3. [`goal-a-compiler-foundation.md`](./goal-a-compiler-foundation.md): completed extraction and generator foundation.
31
- 4. [`versioning.md`](./versioning.md): completed patch sequence and future sequencing rules.
32
- 5. [`performance-gates.md`](./performance-gates.md): output, build, and browser gates.
33
- 6. [`goal-b-optimization-benchmarks.md`](./goal-b-optimization-benchmarks.md): active measurements, retained optimizations, and continuation rules.
34
- 7. [`goal-c-state-resource-research.md`](./goal-c-state-resource-research.md): research boundary only.
35
- 8. [`goal-d-routing-compatibility-decisions.md`](./goal-d-routing-compatibility-decisions.md): routing and islands decisions.
28
+ 1. [`0.9-semantic-compression.md`](./0.9-semantic-compression.md): completed scope, evidence, and release gates.
29
+ 2. [`0.9-implementation-plan.md`](./0.9-implementation-plan.md): detailed session packets, benchmark plan, reports, and release procedure.
30
+ 3. [`0.9-baseline.md`](./0.9-baseline.md): dated architecture, pass, IR, runtime-concept, LOC, and test baseline.
31
+ 4. [`0.9-benchmark-contracts.md`](./0.9-benchmark-contracts.md): frozen matched-content, stateful, commerce, scale, resource, and anti-gaming contracts.
32
+ 5. [`compiler-current-architecture.md`](./compiler-current-architecture.md): exact current responsibilities and data flow.
33
+ 6. [`performance-gates.md`](./performance-gates.md): output, build, and browser gates.
34
+ 7. [`large-application-ai-native-roadmap.md`](./large-application-ai-native-roadmap.md): completed foundation, longer-term direction, and completion evidence.
35
+ 8. [`goal-a-compiler-foundation.md`](./goal-a-compiler-foundation.md): completed extraction and generator foundation.
36
+ 9. [`versioning.md`](./versioning.md): completed patch sequence and future sequencing rules.
37
+ 10. [`goal-b-optimization-benchmarks.md`](./goal-b-optimization-benchmarks.md): active measurements, retained optimizations, and continuation rules.
38
+ 11. [`goal-c-state-resource-research.md`](./goal-c-state-resource-research.md): research boundary only.
39
+ 12. [`goal-d-routing-compatibility-decisions.md`](./goal-d-routing-compatibility-decisions.md): routing and islands decisions.
36
40
 
37
41
  ## Resume Checklist
38
42
 
39
- - [ ] Read [`MIGRATION_ROADMAP.md`](../../MIGRATION_ROADMAP.md) and this directory before planning migration work.
40
- - [ ] Follow the PR dependency order in [`large-application-ai-native-roadmap.md`](./large-application-ai-native-roadmap.md); update it before broadening or reordering a patch.
43
+ - [ ] Read [`MIGRATION_ROADMAP.md`](../../MIGRATION_ROADMAP.md), [`0.9-semantic-compression.md`](./0.9-semantic-compression.md), and [`0.9-implementation-plan.md`](./0.9-implementation-plan.md) before planning migration work.
44
+ - [ ] Follow the first evidence-ready incomplete item in the 0.9 ordered queue; update it before broadening or reordering a patch.
41
45
  - [ ] Confirm `package.json` still reports the actual current version; never infer release status from this plan.
42
46
  - [ ] Inspect the worktree and preserve unrelated or uncommitted changes.
43
47
  - [ ] Start later architecture work only by an explicit decision from the completed Goal A baseline.
@@ -1,6 +1,6 @@
1
1
  # Current Compiler Architecture
2
2
 
3
- This maps the current `0.8.61` architecture, built on the completed `0.8.23` Goal A compiler foundation. File and function names are the stable references; line numbers are intentionally omitted because later work may still move code.
3
+ This maps the current `0.9.0` architecture, built on the completed `0.8.23` Goal A compiler foundation. File and function names are the stable references; line numbers are intentionally omitted because later work may still move code.
4
4
 
5
5
  ## Responsibility Map
6
6
 
@@ -13,19 +13,19 @@ This maps the current `0.8.61` architecture, built on the completed `0.8.23` Goa
13
13
  | Reachability/import resolution | [`framework/compiler/source-compiler.mjs`](../../framework/compiler/source-compiler.mjs), `reachableSourceFiles()`; [`framework/compiler/source-graph.mjs`](../../framework/compiler/source-graph.mjs), `ordinaryRuntimeDependencies()`, `resolveSourceImport()` | Starts from page entries, follows relative runtime imports/re-exports and validated Worker references, excludes unreachable migration source, and fails unresolved ordinary edges or dynamic imports at the importer source location before code generation. |
14
14
  | Ordered normalization | [`framework/compiler/normalization-pipeline.mjs`](../../framework/compiler/normalization-pipeline.mjs), `applyNormalizationPasses()`; [`framework/compiler/source-compiler.mjs`](../../framework/compiler/source-compiler.mjs), `normalizeCompilerSource()` | Applies migration/resource passes in order and repairs TypeScript parent pointers after every structural change. Imported source uses the same pipeline. |
15
15
  | Focused normalization passes | [`framework/compiler/`](../../framework/compiler/) | React, Router, browser signals, animation-frame refs, custom-hook timers, Zustand, and render control each validate and lower a narrow source shape. |
16
- | Shared AST/scope helpers | [`framework/compiler/ast-helpers.mjs`](../../framework/compiler/ast-helpers.mjs) | Binding, scope, reference, effect-return, and source-location analysis. |
16
+ | Shared AST/scope helpers | [`framework/compiler/ast-helpers.mjs`](../../framework/compiler/ast-helpers.mjs) | Binding, scope, reference, inclusive ancestry, effect-return, and source-location analysis. |
17
17
  | Source-local binding index | [`framework/compiler/analysis/binding-index.mjs`](../../framework/compiler/analysis/binding-index.mjs) | After normalization, assigns deterministic lexical slots and classifies local, parameter, import, capture, global, and unresolved references. Native handler, effect, binding, list evaluator, optimized-command, and effect-resource consumers use complete index-owned AST; synthesized expressions retain the existing fallback. |
18
- | Pure collection language | [`framework/compiler/collection-analysis.mjs`](../../framework/compiler/collection-analysis.mjs) | Analyzes collection roots/selectors and serializes the allowed pure expression language used by lists and derived dependencies. |
19
- | Main semantic analysis | [`framework/compiler/source-compiler.mjs`](../../framework/compiler/source-compiler.mjs), `createKudzuTransformer()` | Produces transformed source plus explicit component, shared-state/action, handler, binding, derived, keyed, and effect ownership results. Zustand package syntax is resolved by its adapter before generic shared-state consumers. |
20
- | Component ownership analysis | [`framework/compiler/analysis/component-analysis.mjs`](../../framework/compiler/analysis/component-analysis.mjs) | Produces ComponentAnalysis v2 with ordered JSON-safe owner and specialization slots for state, setters, props, refs, IDs, direct SignalIR links, structural OwnerRefs, source-local SiteIds, and source provenance. Three direct callback/ref component boundaries specialize into the same parent signal and intrinsic ownership; Context action-private setters may remain compiler-only and receive collision-free consumer-local aliases; AST identity remains private to its source-local session. |
18
+ | Pure collection language | [`framework/compiler/collection-analysis.mjs`](../../framework/compiler/collection-analysis.mjs) | Analyzes collection roots/selectors, including one direct array field of a proven object-state component prop, and serializes the allowed pure expression language used by lists and derived dependencies. |
19
+ | Main semantic analysis | [`framework/compiler/source-compiler.mjs`](../../framework/compiler/source-compiler.mjs), `createKudzuTransformer()` | Produces transformed source plus explicit component, shared-state/action, handler, binding, derived, keyed, and effect ownership results. Zustand package syntax and reduced Context actions resolve to package-neutral shared-state/action records before generic consumers. |
20
+ | Component ownership analysis | [`framework/compiler/analysis/component-analysis.mjs`](../../framework/compiler/analysis/component-analysis.mjs) | Produces ComponentAnalysis v2 with ordered JSON-safe owner and specialization slots for state, setters, props, refs, IDs, direct SignalIR links, direct static property/consumer links, structural OwnerRefs, source-local SiteIds, and source provenance. Three direct callback/ref component boundaries specialize into the same parent signal and intrinsic ownership; Context action-private setters may remain compiler-only and receive collision-free consumer-local aliases; AST identity remains private to its source-local session. |
21
21
  | Per-source descriptor registration | [`framework/compiler/descriptor-session.mjs`](../../framework/compiler/descriptor-session.mjs), `createSemanticArtifact()`, `createDescriptorSession()` | Keeps AST descriptors private during analysis, then finalizes ModuleIR v2 with deterministic SymbolRef, SharedStateIR, SharedActionIR, SignalIR, HandlerIR, BindingIR, DerivedIR, EffectIR, KeyedBlockIR, and ImportIR slots. One fail-closed boundary validates every source-local and component ownership edge before build-module generation. |
22
22
  | Route artifact graph | [`framework/compiler/route-build-record.mjs`](../../framework/compiler/route-build-record.mjs), `createRouteBuildRecord()`, `planRouteArtifacts()`; [`framework/compiler/route-artifact-report.mjs`](../../framework/compiler/route-artifact-report.mjs), `createRouteArtifactReport()` | Validates each rendered route's RouteIR, capabilities, entry paths, styles, and exact handler/effect references. Handler and Worker esbuild metafiles project transitive output edges back through those records into deterministic per-route capability signatures and runtime requirements plus emitted handler, Worker, stylesheet, and shared-chunk closure. |
23
23
  | Route contract validation | [`framework/compiler/route-ir.mjs`](../../framework/compiler/route-ir.mjs), `assertRouteIR()` | Fails before artifact selection for invalid state/parameter identity, commands, native/effect captures and dependencies, reactive descriptors, conditions, keyed-list identity/ownership, marker fields, or JSON safety. Immutable in-memory contracts validate once by identity. |
24
24
  | Command IR and codegen | [`framework/compiler/optimize/command-specialization.mjs`](../../framework/compiler/optimize/command-specialization.mjs), [`framework/compiler/ir/module-ir.mjs`](../../framework/compiler/ir/module-ir.mjs), [`framework/compiler/codegen/command-codegen.mjs`](../../framework/compiler/codegen/command-codegen.mjs) | Direct commands use the existing fast path; proven immutable state aliases and one-call local helpers specialize to the same JSON-safe command ModuleIR. Recursion, escape, mutation, and dynamic helper dispatch fail explicitly, while unrelated handlers retain native ESM. Codegen emits the existing `__kBehavior` AST and command ABI. |
25
25
  | Source compilation | [`framework/compiler/source-compiler.mjs`](../../framework/compiler/source-compiler.mjs), `compileSource()` | Runs TypeScript with the Kudzu transformer, rejects surviving React/Router references, and returns a JSON-safe project-relative build module, component analysis, ModuleIR, optional handler module, and imported assets without filesystem writes. |
26
- | Handler/evaluator lowering | [`framework/compiler/handler-lowering.mjs`](../../framework/compiler/handler-lowering.mjs) | Completes source-local callback, package-neutral shared-action, binding, and list AST rewriting and diagnostics before the JSON-safe IR boundary. |
26
+ | Handler/evaluator lowering | [`framework/compiler/handler-lowering.mjs`](../../framework/compiler/handler-lowering.mjs) | Completes source-local callback, package-neutral Context/Zustand shared-action, binding, and list AST rewriting and diagnostics before the JSON-safe IR boundary. Provider/store implementation AST remains transient and final handlers retain shared-action edges. |
27
27
  | Handler module codegen | [`framework/compiler/handler-codegen.mjs`](../../framework/compiler/handler-codegen.mjs) | Renders finalized ordered imports and concatenates generated module-export source without TypeScript AST or semantic discovery. |
28
- | Effect analysis | [`framework/compiler/effect-analysis.mjs`](../../framework/compiler/effect-analysis.mjs) | Classifies ordered signal, ordinary object-property DerivedIR, and keyed-item dependencies and validates cleanup-owned browser resources before EffectIR registration. Object sources keep one signal subscription while the existing tagged evaluator and `Object.is` compare the selected primitive value. |
28
+ | Effect analysis | [`framework/compiler/effect-analysis.mjs`](../../framework/compiler/effect-analysis.mjs) | Classifies ordered signal, ordinary or specialized object-property DerivedIR, and keyed-item dependencies and validates cleanup-owned browser resources before EffectIR registration. Object sources keep one signal subscription while the existing tagged evaluator and `Object.is` compare the selected primitive or authorized array value. |
29
29
  | Worker graph | [`framework/compiler/worker-compiler.mjs`](../../framework/compiler/worker-compiler.mjs) | Returns functional Worker rewrite results and JSON-safe EffectIR edges, validates relative graphs, emits content-hashed ESM, and resolves placeholders only for rendered effects. |
30
30
  | Shared path conversion | [`framework/compiler/path-helpers.mjs`](../../framework/compiler/path-helpers.mjs) | Converts project-relative module, browser, asset, and base paths for build and development serving. |
31
31
  | Build-time JSX execution | [`framework/core.mjs`](../../framework/core.mjs), `renderPage()` | Executes compiled pages/layouts, allocates deterministic route/layout ownership IDs, emits complete HTML, and returns RouteIR v1 plus capability facts and exact retained handler references. |