You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #58, per the L0 spec (docs/lynx-specialized-target-l0.md §3.4, §5; PR #59).
Kernel-extraction spike first: extract only the hook-cell module from universal-core.ts as a host-neutral kernel (hook cells, context, effect phasing, Suspense/Activity, keyed LIS over abstract handles), per the escape clause in docs/universal-renderer-architecture.md §13 — Lynx + Three are the required two-renderer evidence. Fallback criteria for a fresh core are recorded in the spec: if the extraction cannot keep the universal-* test surface green without behavioral drift.
Background core producing typed slot deltas natively (RUN/SET/REMOVE/MOVE/BRANCH) instead of UniversalHostCommand batches; no per-prop classify/encode/clone, no updates.classify double diffing.
Port the transport framing contract, not the encoding: version/generation framing, accepted-fault/ack split, teardown semantics; validation shrinks to header/type checks.
Exit gate (from #58): the behavioral surface of the current Lynx + relevant universal test suites passes on the new core (ported, not weakened); update_storm/select/swap wire gates hold at their floors by construction.
Design only — no code changed. All file:line citations are against claude/octane-issue-58-l3-direct-first-screen @ 2fe1446.
This settles #58 open question 1's real content: what the extracted kernel's
owner abstraction and injected-service seam must be so that (a) universal-core.ts
adopts it with zero behavioral drift, and (b) a Lynx-specialized core implements
the same interface without inheriting LogicalRecord, UniversalRootImpl, or
command staging.
0. The organizing principle
One rule generates every decision below:
The kernel owns everything that reads or writes an owner's hook cells and
update queues. The core owns everything that reads or writes ambient
dispatcher/scheduler state or host records. The seam between them is owner.root in one direction and plain kernel exports in the other.
This line is not arbitrary — it is where the code already sits. Every service docs/lynx-specialized-target-l0.md §5 items 2–4 name is already a method on UniversalRootImpl, reachable from every owner through the root field it
already carries (universal-core.ts:1064):
§5 service
already a method
line
owner scheduling
scheduleOwned
universal-core.ts:7748
transition scheduling
scheduleTransition
:7770
transition discard
discardTransitionBatch
:7889
microtask
__scheduleMicrotask
:6895
useId formatting
formatUniversalId
:7042
context fallback
readBridgeContext
:7030
So the "injected-service seam" is not a new object to allocate and thread — it
is a subset declaration of an object the core already has and the owner
already points at. That is the whole reason the adoption diff can be
non-behavioral.
A corollary that constrains the field set: the kernel never constructs an
owner.createOwnerRecord (:2140-2174) and draftOwner (:2176-2209) stay
in each core, so each core keeps its own object literal, its own field order,
and therefore its own hidden class. The kernel only reads and writes named
fields.
1. The owner interfaces
1.1 What the kernel actually touches
I counted field reads across the hook/queue/transition region
(universal-core.ts:4720-6350). On the committed record, exactly five fields
are touched: hooks (35 sites), updates (11), root (7), disposed (5), visibility (5). Nothing else — parent, children, identityPath, key, id, rangeKey, range, renderer, component*, effectOrder, mounted, contextValues, dirtyEpoch, isBoundary, canHandleSuspense, and the three boundary* fields have zero readers in that region.
// packages/octane/src/universal-kernel.ts/** The committed, cell-bearing owner. Five fields. Cores add their own. */exportinterfaceKernelOwner<Host=unknown,Hook=unknown,Batch=unknown>{/** The core's root object, narrowed to KernelHost by the core's binding. */readonlyroot: Host;readonlyhooks: Map<unknown,Hook>;readonlyupdates: Map<unknown,UniversalHookUpdateQueue<Batch>>;disposed: boolean;visibility: UniversalVisibility;}/** The in-flight draft. Nine fields. */exportinterfaceKernelDraft<Owner=unknown,Hook=unknown,Batch=unknown>{readonlyrecord: Owner;readonlyparent: KernelDraft<Owner,Hook,Batch>|null;hooks: Map<unknown,Hook>;clonedHooks: Set<unknown>;seenEffects: EffectHook<Owner>[];appliedUpdates: Map<unknown,AppliedUniversalHookUpdates<Batch>>;needsRender: boolean;visibility: UniversalVisibility;isBoundary: boolean;canHandleSuspense: boolean;}/** The narrow slice of the core's render attempt the kernel reads. */exportinterfaceKernelAttempt<Draft=unknown,Batch=unknown>{readonlyowners: readonlyDraft[];readonlytransitionRender: boolean;readonlytransitionBatches: ReadonlySet<Batch>;nextHookId: number;}
Generic plumbing is a typing detail, not a design one: the kernel writes its own
cells through the same owner.hooks.set(slot, hook as Hook) cast universal-core
already uses (:5158, :5464), because UniversalHook (:1052-1061) is a wider union than the kernel cells — it composes them with the renderer-facing ComponentMemoHook, which §5 keeps in the core.
1.2 Per-field justification
On KernelOwner:
root — the service holder. Every setter closure already captures record,
so reaching services through record.root costs zero extra closure slots.
This is the single most important field in the design; §2 explains why.
hooks — the cell map. cloneStateHook (:5057-5069), every hook body, enqueueUniversalHookUpdate's kind check (:4913), projectedStateValue
(:5071), visibleStateValue (:5090).
updates — the queue map. enqueueUniversalHookUpdate (:4911), applyUniversalHookUpdateQueue (:4978), hasUniversalUpdatesForAttempt
(:5040), the needsUrgentRebase check in both state setters (:5144, :5240), promoteUniversalTransitionBatch (:4827).
disposed — every setter's first line (:5125, :5196, :5416), scheduleOwner (:4942), promotion (:4824, :4865).
visibility — not optional, and not merely reconciler bookkeeping: the
parked-linked-draft machinery reads it on the record at :5219, :5309, :5345, and useDeferredValue reads it at :5686. A Lynx core implements
Activity/Suspense hiding, so it carries the same three-valued state.
parent — only for the linked-state parked-draft boundary walk
(:5314-5317), which needs isBoundary && canHandleSuspense on ancestors.
That is also the only reason those two flags are on the interface.
seenEffects — written by enqueueUniversalEffect (:5508).
appliedUpdates — written by applyUniversalHookUpdateQueue (:4988, :5027) and re-based by linked state (:5331-5337).
needsRender — the render-phase-update fast path (:5134, :5208, :5429).
visibility — useDeferredValue reads the draft's visibility separately
from the record's (:5686).
1.3 What stays core-private, and why
Field
Owner
Why it must not enter the kernel
range: LogicalRecord | null (:1084)
core
LogicalRecord (:938-956) is the universal host-record graph — props bag, events, lifecycles, localCallbacks, portal registration, collapsed templates. This is precisely the cost #58 §6 deletes.
rangeKey: symbol (:1076)
core
One Symbol() allocation per owner record (:2157). The Lynx core addresses by compile-time template/instance identity and drops it.
identityPath, key, component, componentRevision
core
The runtime-minted owner-identity model (:2254-2290). #58 L3 replaces it with compile-time template/slot identity. Freezing it into the kernel would import exactly what the roadmap deletes.
effectOrder (:1078)
core (for now)
Only two readers, both core-side: the memo bailout (:6286) and the commit-time effect diff (:10822-10885). §5's ordered blocker list does not include effect commit; see §6.1 below.
contextValues (:1085)
core (for now)
readOwnerContext (:2387-2412) needs two universal-only things: the attempt.scope record-parent walk for renderer regions (:2400-2408) and CURRENT_MEMO_CONTEXT_READS tracking for the memo context bailout (:2396, :6279-6290). Extracting it now would either drag renderer-region scoping into the kernel or add a host call on everyuseContext. Deferred; readBridgeContext is declared on KernelHost now so the interface is final.
Zero readers in the kernel region. dirtyEpoch in particular is the retained-subtree epoch (:7754-7760) — a universal reconciler optimization the Lynx core may not want.
Every DraftOwner claiming field (retainedChildren, claimedChildren, sequentialClaimCursor, childOwnerBuckets, childClaimCursors, childReplayOrdinals, replayPath, contextStable)
core
§4.
implicitSlot
core
Written only by resolveHookSlot (:4737) and reset by executeOwner (:2435), both of which stay per-core (§3).
1.4 What a Lynx owner then looks like
interfaceLynxOwnerRecordextendsKernelOwner<LynxBackgroundRoot,LynxHook,LynxBatch>{// kernel-visible: root, hooks, updates, disposed, visibilityparent: LynxOwnerRecord|null;children: LynxOwnerRecord[];template: number;// compile-time identity — not identityPath + rangeKeyinstance: number;// slot-delta address — not LogicalRecordslots: LynxSlotValues;// typed slot table — not a props bag or command batcheffectOrder: EffectHook<LynxOwnerRecord>[];}
No LogicalRecord, no UniversalRootImpl, no command staging, no per-owner Symbol, no identityPath array. That is the (b) half of the brief, discharged
by construction rather than by discipline.
2. The injected-service seam: one KernelHost, reached through owner.root
Decision: one host object per root, reached as owner.root, implemented
directly by the core's existing root class. Not per-function injection.
exportinterfaceKernelHost<Owner=unknown,Draft=unknown,Batch=unknown>{/** §5.2 — replaces the free `scheduleOwner` (`universal-core.ts:4941`); the * core keeps the profiling hop so the kernel ships no profiling branch. */scheduleOwner(owner: Owner,slot: unknown): void;/** §5.3 — already `UniversalRootImpl` methods, verbatim. */scheduleTransition(batch: Batch): void;discardTransitionBatch(batch: Batch): void;__scheduleMicrotask(callback: ()=>void): void;/** §5.3 — the ambient transition read (`:4874`). The depth counters * (`:1220-1227`) and `startTransition` (`:6161`) stay core-owned. */transitionBatchForUpdate(): Batch|null;/** Non-throwing; null outside render. Keeps `CURRENT_ATTEMPT` core-private * and lets a core choose its own record→draft lookup (see §6.6). */activeAttempt(): KernelAttempt<Draft,Batch>|null;/** §5.4 */formatUniversalId(index: number): string;/** §5.4 — root-scoped warm-memo cache, replacing the module-level * `UNIVERSAL_WARM_CACHES` WeakMap (`:5855-5858`). */warmCache: Map<unknown,KernelWarmEntry[]>|null;/** §5.4 — declared now so the interface is final; first *read* when the * context slice lands (§1.3). */readBridgeContext<T>(context: KernelContextKey<T>): T;}
Note the naming: __scheduleMicrotask and formatUniversalId are ugly for a
"kernel" interface, and I kept them anyway. The interface is deliberately named
after what UniversalRootImpl already exposes, so universal adoption is class UniversalRootImpl … implements KernelHost<…> with zero call-site
churn. Cosmetic renames are a separate, independently reviewable commit; doing
them inside the extraction would make a mechanical diff unreviewable.
Only three members are new work on the universal side: scheduleOwner (move the
free function's body at :4941-4951 onto the class), transitionBatchForUpdate
(delegate to :4874), and activeAttempt (return CURRENT_ATTEMPT).
2.1 Rejected alternatives
A — Module-level configureKernel(services) singleton. Cheapest possible
dispatch (module-local lets, monomorphic, zero loads). Rejected because it is a realm singleton and two universal-family cores demonstrably coexist in one
realm today: universal-dom-boundary.ts:1-21 imports hooks from both runtime.js and universal-core.js in a single module, and rendererRegion
(:1810) plus UniversalRendererRegionOwnerBridge (:1272) exist to nest them.
It also destroys test isolation.
B — Per-function injection (pass each service into each kernel function).
Works for render-time hook bodies, whose callers hold the owner anyway. Fails for
the setter closures, which are the hot path and escape the render frame. useState's setter (:5124-5153) currently calls six core functions; injecting
them per-closure adds up to six captured slots to every state hook in the
application. Reaching them through the already-captured record adds zero.
C — A separate services object hanging off the root. One extra pointer hop
per call and one extra allocation per root, to buy nothing: the six services are
already root methods.
D — Kernel base class that cores extend. Forces the kernel to own owner
construction, which is exactly what §0's "the kernel never constructs an owner"
rule forbids — it would put LogicalRecord-shaped fields back in reach and
convert today's fixed-shape object literals (:2147-2173) into a class
hierarchy.
2.2 Hot-path cost
.rulesync/rules/core-engineering.md makes megamorphic call sites and
object-shape churn release criteria, so, precisely:
Call-site shape count. In a Lynx background bundle exactly one core is
linked, so every owner.root.* site sees one hidden class — monomorphic,
identical to today's owner.root.scheduleOwned(owner) (:4950). In a web realm
with universal + a second universal-family core, two shapes — polymorphic,
inline-cacheable, still far from V8's 4-shape megamorphic threshold. Per-function
injection would not improve this; alternative A would, at the cost of
correctness.
Call frames on the setState path. Today: scheduleOwner(owner, slot)
(module-local) → owner.root.scheduleOwned(owner) = two frames. After: owner.root.scheduleOwner(owner, slot) → this.scheduleOwned(owner) = two
frames. No change.
Property loads added. The setter path gains at most two: record.root for activeAttempt() (replacing the CURRENT_ATTEMPT module read in findDraftOwner, :4963) and record.root for transitionBatchForUpdate()
(replacing the module-local call at :4874). On the common path — setState from
outside render — activeAttempt() returns null immediately, so the added work
is one load plus one monomorphic call against a path that already does a Map.get, array pushes, and a schedule.
Allocations added: zero. No wrapper objects, no per-call service bags, no
extra closure slots.
Object-shape churn: zero, by construction. Cores keep their own literals. UniversalRootImpl gains private warmCache: Map<…> | null = null — a
constructor-initialized field, so no runtime shape transition.
One incidental win to measure, not to claim.takeUniversalWarmValue
(:5868-5884) currently does UNIVERSAL_WARM_CACHES.get(root) — a WeakMap hash
lookup on every useMemo deps-miss (:5552). host.warmCache makes that a
property load. I am not claiming an improvement: gate it on benchmarks/async-waterfall and benchmarks/universal-leaf-update, and if the
signal is inside noise, the zero-risk fallback is a kernel-module WeakMap<KernelHost, Map> keyed by host, which needs no host member and no root
field.
Pre-existing hazards the kernel must not worsen.UniversalHookUpdateQueue
is an Array subtype carrying four optional own properties
(universal-kernel.ts:113-118) assigned post-construction (:4917-4938), and discardTransitionBatchdeletes queue.rebases (:7923). The kernel must not
add further optional fields to that shape.
3. Dispatcher globals stay per-core, with a kernel-owned algorithm
Decision: CURRENT_ATTEMPT, CURRENT_OWNER, CURRENT_LAZY_LEAF_OWNER, NEXT_HOOK_SLOT, UNIVERSAL_SLOT_STACK, and resolveHookSlot stay per-core
module state. The kernel owns only the pure slot-composition algorithm.
// kernel: the algorithm and the ABI contract, no stateexportfunctioncomposeSlotKey(prefix: string,stack: readonlyunknown[],own: unknown,): symbol;
Each core keeps let NEXT_HOOK_SLOT, const SLOT_STACK, and exports its own hookSlots / withSlot / resolveHookSlot, passing its own prefix.
3.1 Why
The precedent already exists and is load-bearing.runtime.ts has its own nextHookSlot (runtime.ts:336-341), its own slotStack (:5564), and its own resolveSlot with prefix '@octane:hook:' (:5590-5601), coexisting in one
realm with universal-core's NEXT_HOOK_SLOT (:1230), UNIVERSAL_SLOT_STACK
(:1238), and resolveHookSlot with prefix '@octane:universal-hook:'
(:4739). Two cores, two slot spaces, one realm, correct today.
Sharing them would be a correctness regression, not just a cost.
A withSlot from core A would be visible to core B's resolveHookSlot,
composing a wrapper path from another core into an unrelated hook's slot.
CURRENT_OWNER would become a cross-core singleton, so a universal root
nested inside a DOM boundary (universal-dom-boundary.ts) or a rendererRegion (:1810) would clobber the outer core's current owner.
And it would cost per hook. ESM live bindings are read-only across modules,
so a shared mutable CURRENT_OWNER needs accessor calls
(kernel.currentOwner() / kernel.setCurrentOwner(o)) — one call per hook plus
two per executeOwner frame, against today's direct module-slot reads at :4733, :4955, :2373.
3.2 Why the compiled hook-slot ABI keeps working
This is the part that makes the decision safe, and it needs no compiler change
at all.
Compiled modules import hookSlots / withSlot from their renderer
module, not from a fixed path: both names are in UNIVERSAL_COMPILER_RUNTIME_IMPORTS (compile-universal.js:3808, :3812),
and the module is renderer config data — module: '@octanejs/lynx/renderer' (packages/lynx/src/config.runtime.js:218),
which today is export * from 'octane/universal/native'
(packages/lynx/src/renderer.ts:15). The L2 cutover is that one re-export
line. A module compiled for target: 'lynx' and the same module compiled
for the universal target simply bind to different cores.
Most emitted slots never touch the global counter at all. A direct site in a
compiler-owned render scope emits a plain integer literal
(compile.js:18366). Only forceSymbol sites — custom hooks and callable
helpers that can share a caller's scope across modules — draw from hookSlots (compile.js:18361-18364).
Per-core counters are therefore safe under one invariant: a composed slot
path never mixes symbols from two cores. It cannot: a hook compiled against
core B needs core B's CURRENT_OWNER, which is null during core A's render, so
it throws at :4734-4736 before any slot is composed. Cross-core hook
composition is already unsupported — the counter split does not create that
constraint, it inherits it. §5, slice 6 pins it with a test.
Keep the prefixes distinct per core (composeSlotKey's first argument) so Symbol.for interning cannot alias two cores' paths even if a future change
makes them meet.
4. Owner claiming stays out of the kernel — confirmed
Confirmed: currentDraftOwner → activateLazyLeafOwner → claimChildOwner
does not move, now or later.
That chain (:4953-4960 → :2365-2385 → :2307-2317 → findClaimableChildRecord :2254-2290 → createOwnerRecord:2140-2174 → adoptChildOwner:2292-2305)
touches parent.record.children, identityPath, key, component, claimedChildren, sequentialClaimCursor, childOwnerBuckets, childClaimCursors, childReplayOrdinals, replayPath, attempt.owners, record.rangeKey, record.id, and record.renderer — the entire runtime owner
identity model. #58 L3 replaces exactly that model with compile-time
template/slot identity, so extracting it would freeze into the kernel the thing
the roadmap deletes.
The narrowest hook the kernel needs from the reconciler side is two calls, and
one of them is not a hook at all:
Nothing, at hook entry. Because each hook body's first two lines already
resolve the draft and the slot (:5115-5116, :5178-5179, :5405-5406, :5492-5493, :5536-5537, :5571-5572, :5610-5611, :6141-6142), the
seam is: that two-line prologue stays per-core; everything after it is
kernel. The kernel signature is kernelUseState(draft, slot, initial) — the
core has already claimed.
// universal-core.ts, after adoptionexportfunctionuseState<T>(initial: T|(()=>T),slot?: unknown){returnkernelUseState<T>(currentDraftOwner(),resolveHookSlot(slot),initial);}
host.activeAttempt(), inside setters and getters.findDraftOwner
(:4962-4969) answers "is there a live draft for this record?" from outside
the render frame. Making it a host-mediated read of the attempt (rather than a
kernel global) is what lets a Lynx core replace the O(rendered-owners) backward
scan of attempt.owners with a Map<record, draft> without touching the
kernel.
That is the whole reconciler-side surface. resolveHookSlot stays core-side with
it, which is also why implicitSlot is absent from KernelDraft (§1.3).
5. Migration map: §5 slices 2–5
Every guard below renders through a real universal root — createUniversalRoot(createObjectContainer(), createObjectDriver()) or the controlledObjectRoot() helper (universal-scheduling.test.ts:58-87) — per the #64 review requirement. Standalone helper assertions do not count as wiring
evidence. Each guard names the specific drift it fails on, so it has a credible
pre-change failure.
The existing behavioral suites (universal-scheduling, universal-activity, universal-retained-suspense, universal-event-scope, universal-renderer)
must pass unmodified at every slice; a test edit in those files during an
extraction slice is a drift signal, not a fix.
Slice 2 — owner abstraction (§5 item 1)
Land KernelOwner / KernelDraft / KernelAttempt as interfaces only. UniversalOwnerRecord (:1063), DraftOwner (:1135), and RenderAttempt
(:1102) gain extends; no function moves; nextUniversalId → nextHookId
(one compiler-checked rename, one reader at :5617). The whole slice is
type-level, so pnpm typecheck is the conformance gate.
New packages/octane/tests/universal-kernel-owner.test.ts:
Guard
Fails when
a render-phase setState re-runs the component once and schedules nothing (controlledObjectRoot().scheduled.length === 0)
needsRender / clonedHooks drift, or executeOwner's reset (:2434) stops clearing the drafted flag
three urgent updates coalesce into one flush while a functional updater observes every intermediate
queue ordering or applyUniversalHookUpdateQueue drift
an update queued after root.unmount() neither throws nor schedules
disposed drift
a linked-state cell inside a hidden Activity keeps its parked draft until the source generation changes
visibility drift on record and draft (:5219, :5309, :5345)
an effect behind a flipped condition unmounts on the right commit
hooks / seenEffects drift
a one-line source pin that universal-core.ts declares the extends/implements clauses
someone deletes the conformance declaration and the typecheck gate goes quiet
Slice 3 — scheduleOwner injection (§5 item 2)
Move :4941-4951 onto UniversalRootImpl.scheduleOwner; the kernel calls owner.root.scheduleOwner(owner, slot). The profiling hop and the dirtyEpoch
ancestor stamping (:7754-7760) stay core-side, so the kernel ships no
profiling branch into the Lynx bundle.
Guard
Fails when
in universal-kernel-owner.test.ts: N setStates across M owners in one tick schedule exactly one microtask on a controlled root
double-schedule or missed schedule through the new indirection
a setState on a deep child re-renders only that subtree while siblings are adopted
dirtyEpoch stamping got pulled through the seam
in the octane-profile vitest project: profiler.why(Component)[0].causes still contains the state cause with its hook name after a setState through a real root (profiling.test.ts shape; profiling.ts:363)
the profiling hop was lost when scheduleOwner moved behind the host
benchmarks/universal-leaf-updatesiblings-4000 / siblings-0 ratio holds
the extra property load became a scaling cost
Slice 4 — transition batches (§5 item 3)
Split by state ownership, not by topic. Kernel takes only the owner-touching
operations: stageTransitionUpdate (:4881-4902), enqueueHookUpdate
(:4904-4939), applyHookUpdateQueue (:4971-5037), hasUpdatesForAttempt
(:5039-5055), and the per-owner queue surgery inside discardTransitionBatch
(:7896-7925). Core keeps the ambient counters (:1220-1227), createUniversalTransitionBatch (:4765), tickUniversalTransitionCount
(:4779), settle (:4790), finish (:4800), promote (:4819), queuePromotion (:4849), and startTransition (:6161).
Promotion is 25 lines reading two kernel-owned fields; duplicating it in the
Lynx core is correct, not wasteful — #58 open question 4 says the new core
"should not inherit" the missing lane scheduler, so freezing today's promotion
policy into the kernel would be speculative generality.
specifically :840 "re-homes promotion when the first of multiple staged roots unmounts"
the queuePromotion fallback order (:4860-4871: first live staged owner's root, then the realm queueMicrotask, then Promise.resolve) changed
specifically :463 "does not eager-bail an urgent value that must rebase a queued transition"
needsUrgentRebase (:5144) lost sight of queue.batches across the seam
new: two roots in one realm — useTransition in root B observes root A's pending transition (today's behavior: UNIVERSAL_TRANSITION_PENDING_COUNT is module-level at :1225, read at :5710, notified through the module-level listener set at :5714)
the ambient counters became per-root instead of per-core-module — a plausible and silent seam mistake
Slice 5 — root services in hooks (§5 item 4)
formatUniversalId and readBridgeContext are already root methods; the work is warmCache moving from the module WeakMap (:5855-5858) to a root field, and useId reading host.formatUniversalId.
Guard
Fails when
two roots in one realm mint disjoint useId values; the same root's IDs are stable across re-render; an abandoned attempt reuses its ID (the invariant documented at :7043-7046)
the per-root nextUniversalId advance moved to the wrong side of accept
a useBatch warm plan starts a fetch exactly once and the real useMemo consumes that value; root A's warm entry is not consumable by root B
cache lifetime or keying drift in the WeakMap→field move
a universal root inside a DOM boundary reads the bridged context value, and the default when unbridged (universal-renderer-boundaries.test.ts shape; :7030-7036)
readBridgeContext drift, and the pre-registration for the context slice
Slice 6 — confirm the non-move (§5 item 5)
No code moves. One new guard pins the invariant that makes §3 safe:
Guard
Fails when
a component rendered through a universal root calls the same custom hook at two call sites and the two keep independent state (the forceSymbol / withSlot path, compile.js:18361-18364)
slot composition drift
a DOM component and a universal component, both using custom hooks, render in one realm with no state bleed
someone made NEXT_HOOK_SLOT or the slot stack a shared kernel singleton
6. Unresolved
Effect commit ordering and the keyed LIS reconciler are not in this
design. §5's boundary description names them, but §5's ordered blocker
list is items 1–5, all hook/scheduling. The commit-time effect diff
(:10810-10886) is entangled with draftedRecords, retainedOwnerRoots, and
parent-first/post-order owner walks. This interface must not preclude their
later extraction — but I have not verified that it doesn't. That verification
is the first thing the effect slice should do.
Context extraction is deferred and its two blockers are unsolved: the attempt.scope renderer-region walk (:2400-2408) and per-read CURRENT_MEMO_CONTEXT_READS tracking (:2396). Whether the Lynx core wants
the memo context bailout at all is open.
warmCache as a host field vs. a kernel WeakMap<host, …> is measurement-
gated, not decided by argument. Default to the field; fall back to the
WeakMap if async-waterfall / universal-leaf-update show nothing.
No measurement exists yet for the seam itself. Every cost claim in §2.2 is
a static count of loads, frames, and allocations. Per .rulesync/rules/core-engineering.md, the release criterion is the benchmark
pair, per slice: universal-leaf-update (setState scaling) and the lynx-tableupdate_storm / update10th / select gates.
Two-core co-residency is asserted safe but not exercised. The DOM +
universal case is real today (universal-dom-boundary.ts); universal + a
Lynx-specialized core in one realm is not, and the 2-shape polymorphism
argument in §2.2 is untested for it.
findDraftOwner's O(rendered-owners) backward scan (:4965-4967) is
inherited, not fixed.host.activeAttempt() is deliberately shaped so a
core can add a Map<record, draft> later. Doing it inside an extraction slice
would violate the zero-drift rule.
RenderAttempt.implicitSlot (:1111) appears dead — the only readers are owner.implicitSlot (:2435, :4737). Unrelated cleanup; flagged so it is
not mistaken for a kernel field.
Naming debt accepted deliberately:__scheduleMicrotask, formatUniversalId, and root (rather than host) in a shared kernel
interface. The alternative is a rename sweep inside a mechanical extraction,
which trades reviewability for cosmetics. If the rename is wanted, it should
be its own commit before slice 2.
L2 delta protocol: closure analysis and final opcode set
Design analysis for the §3.4 opcode set (docs/lynx-specialized-target-l0.md:141-171): is RUN / SET / REMOVE / MOVE / BRANCH + range framing closed and unambiguous over every structure Octane templates can express? Worked on the #58 stack head (claude/octane-issue-58-l3-direct-first-screen), against the L0 spec, the L0 prototype, and the current universal wire. Design only; no code changed.
Verdict: refuted as drafted — closed under the amendments below (A1–A6), none of which invents machinery the universal wire doesn't already ship. Each failure is an under-specification of something the current protocol already solves, so every amendment is a re-typing of a mechanism that exists today. After applying them, all six cases re-verify.
The lemma that does most of the work: today's wire is already structure-free and id-addressed, and it already carries every structure in this list. The command union (packages/octane/src/universal-core.ts:548-620) has no branch, key, range, boundary, or component notion. Ranges flatten to physical hosts before placement (universal-core.ts:4216-4233) and range records get ids that are never transported (universal-core.ts:9645). @if/@switch are background scope keys (universal-core.ts:3046-3064, claiming via materializeScoped, universal-core.ts:2632-2655); @try arms are keyed 'try'/'pending'/'catch' scopes plus visibility (universal-core.ts:3457-3476); Activity is a visibility state (universal-core.ts:3024-3044); keys never cross the wire (universal-core.ts:9695-9715). So closure reduces to: can the typed set name the four capabilities the flattened form needs — create a typed region, point-write a stable identity, place/detach by identity, flip visibility — at (template, instance, slot) granularity? The draft covers the first three and omits the fourth; its addressing is undefined where it matters. Cases below.
#
Case
§3.4 as drafted
After amendments
1
Nested @if/@switch inside keyed @for items
Broken — BRANCH(slot, …) lacks the instance coordinate; single-template arms only
Closed
2
Keyed reorder as LIS MOVEs
Ambiguous — "instance" undefined; positional reading is order-sensitive
Closed, unambiguous
3
@try swaps + Suspense retry
Broken — retained-hidden body + pending coexist; single-occupant BRANCH can't express it; no visibility op
Closed
4
@for @empty, nested keyed, Activity interleaved with SET
Broken for Activity (no visibility op); rest closed
Closed
5
Mixed eligibility / fallback plans
Open — spread-prop hosts have no slot encoding
Closed under either resolution (ban or escape ops); boundary never cross-addressed
Amendments (summary, details in the table at the end)
A1 — instance identity. An instance is named by a background-minted dense uint id per root, declared explicitly by the creating op (firstInstance), never reused within a generation. First-screen instances are numbered by creation ordinal, which is exactly the §3.6 adoption identity (docs/lynx-specialized-target-l0.md:182-193), so adoption seeds the id space. This is the existing discipline: hosts get dense nextId++ (universal-core.ts:9645,9757-9760), template mounts reserve dense id blocks and declare firstId on the wire (universal-core.ts:9610-9622, :571-580). Positional indices (the prototype's model) are rejected as the normative reading — case 2 shows the ambiguity.
A2 — anchors. Every dynamic child position compiles to an anchor slot; an anchor is addressed as (instance, anchorSlot) (plus a ROOT sentinel). The applier owns an ordered member list per anchor; before operands are member instance ids or END. RUN/MOVE/BRANCH/CLEAR address anchors. This replaces §3.4's un-anchored BRANCH(slot, …) and the prose-level "range is (anchorSlot, member list)" (docs/lynx-specialized-target-l0.md:157-161) with one addressing rule. Ranges themselves stay background-only, exactly as today.
A3 — SHOW(instance, visible|hidden). New opcode; the port of the existing visibility command (universal-core.ts:614-618, staged at :10214-10246). Without it, Activity and retained Suspense are inexpressible — both require the visibility capability today and throw when a driver lacks it (universal-core.ts:3026-3030, :3463-3467, :3493-3497; the Lynx driver declares it, packages/lynx/src/core/client-driver.ts:1331).
A4 — arm generality. A branch/boundary arm mount is an op sequence at an anchor, not necessarily one template: arms may have multiple roots, contain components, or (Suspense) coexist with a retained hidden sibling. BRANCH is demoted to an optional fused compression (≡ CLEAR + RUN), valid only for the single-template-arm special case.
A5 — sequential message semantics. Ops in a message apply strictly in order; every address must be defined at the point of its op; same-message references to just-created instances are required (nested mounts depend on them). This is today's apply model (packages/lynx/src/core/host-driver.ts:3863, membership checks against the staged sibling list at :3952-3958; batch phase order at universal-core.ts:10695-10706).
A6 — fallback escape (reserved). Hosts with dynamic prop names (propsSlot spreads) either get banned for .lynx.tsrx intrinsics or mount as single-host pseudo-templates (implicit child anchor + a reserved SETP(instance, name, value) op). Recommendation: ban, keep SETP reserved. Case 5.
Case 1 — nested @if/@switch inside keyed @for items
Fixture: @for (item of items; key item.id) { <li> @if (item.flag) { <b>{x}</b> } @else { <i>{y}</i> } </li> }. The L2 compiler splits templates at dynamic holes (docs/lynx-specialized-target-l0.md:104-106): T_item = li with slot 0 = branch anchor; T_then = b [slot 0: text]; T_else = i [slot 0: text].
Mount two items (a_list is the list anchor; item keys live only in the background, as today — universal-core.ts:9695-9715):
Commit that swaps the items and flips item 10's branch:
MOVE(a_list, 11, before=10) — LIS output: move one, not both
REMOVE(12) — 10's then-arm dies
RUN(T_else, (10,0), END, count=1, first=14, y₁)
Does instance addressing survive the move? Yes, by construction under A1/A2: instance 10's id is position-independent, and the anchor coordinate (10, 0) names a slot-table entry, not a location in any sibling order. Stronger: the MOVE and the two arm ops commute — ops on an anchor's member list are order-sensitive only against other ops on the same anchor. The background stays free to emit phase-grouped streams (today's batch is grouped: creates → … → removes → placements → visibility → destroys, universal-core.ts:10695-10706) without changing meaning.
What breaks in the draft: BRANCH(slot, templateId | none, values…) (docs/lynx-specialized-target-l0.md:157-158) carries no instance coordinate, so "slot 0 of whichT_item instance?" is unanswerable — branch anchors are per-instance the moment a branch sits inside a @for item. Second, "both arms are compile-time-known templates" is false in general: an arm containing a component (or multiple roots, or text holes mixed with hosts) is not a single template — the current compiler itself refuses to template-compile any plan containing component/if/switch/range nodes (packages/octane/src/compiler/compile-universal.js:3920-3941). Under A2+A4 the arm mount is a sequence at (10, 0) and the case closes. Nested @switch is identical: today its selector is just a different scope key (case index or 'default', universal-core.ts:3052-3064), and a swap is REMOVEs + creation ops at the same anchor.
Verdict: refutes the draft's BRANCH addressing and arm assumption; closed under A1/A2/A4.
Case 2 — keyed reorder as LIS MOVEs: addressing mid-sequence
The normative model to port is what planPlacements already does (universal-core.ts:10143-10163 over the LIS at :4241-4266): walk the new order left→right; LIS members ("stable") are never moved; every non-stable survivor emits MOVE(id, before = next stable id or END) (:10156); departing members were already removed (:10115-10121, removes precede placements in the batch, :10702-10703).
Walkthrough, [A B C] → [C B A] (ids, not positions): old positions of the new order = [2, 1, 0]; LIS = {A} (new index 2). Emission:
REMOVEs: none
MOVE(a, C, before=A) member list: [C A B]
MOVE(a, B, before=A) member list: [C B A] ✓
Unambiguity proof sketch. (i) Ids are position-independent, so the only order-sensitive binding is before → position. (ii) The emission discipline guarantees every before target is an LIS member or END; LIS members are never moved in the pass, and their relative order is already final (they are an increasing subsequence of the old order). (iii) Under sequential semantics (A5), consecutive inserts before the same stable target preserve emission order (insert-before-S lands immediately before S, after anything previously inserted before S) — the same resolution today's applier performs by looking before up in the current staged sibling list (host-driver.ts:3952-3958). By induction over the new order, the member list after the last op equals the new order. Fresh members interleave identically (RUN with the same before rule; consecutive same-anchor same-target runs coalesce into count > 1 exactly as mount-template-run staging does today, universal-core.ts:10032-10046). Items whose body has several roots move as consecutive per-instance MOVEs with the same before — order preserved by (iii).
The normative answer to "pre-move or post-move order": neither — order is never an operand. Addresses are ids; the id→position binding is resolved against the member list as of each op (A5); and the emitter discipline makes every before target order-invariant anyway. The question is only unanswerable under positional addressing, which is the strongest reason to reject it: the prototype addresses rows by mutable table index (benchmarks/lynx-table/prototype/lepus-root.js:209-240 — REMOVE splices the table at :221-222, SWAP swaps entries at :234-238), so the meaning of [MOVE 2 before 0, MOVE 1 before 0] depends on whether index 1 is read before or after the first op applied. That is fine for a hand-written fixture with one flat range and two slots per row (lepus-root.js:46-49) and disqualifying for a compiler target with nesting.
Normative ordering (two layers): applier contract = sequential definedness only (that is all validation enforces); emitter contract = per anchor, removes first, then placements in new order with before ∈ LIS-stable ∪ END. The LIS computation itself stays in the background kernel, where the L0 spec already puts it ("the keyed LIS reconciler over abstract instance handles", docs/lynx-specialized-target-l0.md:235-237); the survivor-identity and final-order guarantees are unchanged, and the swap wire gate holds by construction (a 2-swap is 1 MOVE).
Verdict: closed and unambiguous under A1/A5 + the stated emitter discipline; the draft was silent on all three.
Case 3 — @try/@pending/@catch swaps and Suspense retry
Current semantics to preserve (all in universal-core.ts): arms are keyed scopes 'try'/'pending'/'catch' (:3457-3476); a suspend over a committed body retains it — every host in the arm flips to suspense-hidden (:2756-2769) and the pending arm mounts alongside the retained one inside the same boundary range (retainCommittedTryArm, :2771-2791, composed as [...retained, ...pending] at :3461-3469 and :3489-3505); this path is gated on the visibility capability (:3463-3467). A suspend with no committed body discards the speculative draft and mounts pending only (:3507-3511). Wire ids cannot leak from abandoned attempts at all: host ids are minted during commit-side reconciliation (:9644-9648), which a suspended attempt never reaches — even speculative useId allocations are rolled back (:2649-2652).
Op sequences at boundary anchor a_B:
# mount; body suspends before first commit — body never existed on the wire
RUN(T_pending, a_B, END, count=1, first=20)
# resolve → retry commits the body
REMOVE(20)
RUN(T_body, a_B, END, count=1, first=21, …)
# later update suspends the committed body: retain + hide, pending alongside
SHOW(21, hidden) — per affected instance, descendants first
RUN(T_pending, a_B, END, count=1, first=22)
# retry succeeds; body re-render diffed against the retained records
SET(21, k, v′) — whatever actually changed
SHOW(21, visible)
REMOVE(22)
Instance lifetime across retry — the normative rules:
L1. Only committed state has wire lifetime. Command staging happens once per committed attempt (universal-core.ts:10695-10707); suspended/aborted attempts emit nothing and reuse nothing. "Instances already delta-addressed" can therefore only mean committed instances.
L2. An instance id is born by the message that RUNs it and dies in the message that REMOVEs it; ids are never reused within a generation (A1).
L3. Retained suspension does not end lifetimes: hide is SHOW, not REMOVE. Hidden instances remain fully addressable — the update-staging path never checks visibility; only refs and events gate on it (universal-core.ts:10752-10777, :10277-10293).
L4. The retry re-render reconciles against the retained records (the committed 'try' arm is re-claimed by key, :2773, :9695-9715), so surviving hosts keep their ids and every previously issued SET address stays valid; structural changes inside the retried body are ordinary case-1/2 op sequences against those live ids.
What breaks in the draft: "boundary swaps are BRANCH at the boundary's anchor" (docs/lynx-specialized-target-l0.md:159-161) models the boundary as a single-occupant slot — but the retained path is not a swap: hidden body and pending arm are simultaneous members of the anchor. And the draft has no visibility opcode at all, while the retained path is defined in terms of the visibility capability. Multi-member anchors (A2), arm-as-sequence (A4), and SHOW (A3) close it. @catch needs nothing extra: the error path does not retain (:3513-3528), so it is REMOVEs + creation ops, and reset() is background-only.
Verdict: refutes the draft (no SHOW, single-occupant BRANCH); closed under A2/A3/A4 with lifetimes L1–L4.
Case 4 — @for @empty (N→0→M), nested keyed ranges, Activity interleaved with SET
@empty. The empty arm is just another background scope ('for-empty', universal-core.ts:3431-3433; first-screen equivalent at packages/lynx/src/main-renderer.ts:871-878). N→0→M at anchor a_for:
No range identity is needed on the wire — matching today, where ranges are never transported (universal-core.ts:4216-4233, :9645). The draft's range framing is right about that; it just needs A2's anchor addressing to say where.
Nested keyed (@for in @for).T_outer = ul [slot 0: anchor]; inner items mount at (outerInstance, 0). Each anchor reorders independently with case-2 discipline; MOVEs on distinct anchors commute (A5); an outer MOVE carries the whole element subtree, and inner anchor coordinates are untouched because they are instance-relative, not position-relative. Closed by the case-1 argument; duplicate-key rejection stays a background throw (universal-core.ts:9704-9706), never a wire concern.
Activity interleaved with SETs. Activity is an owner whose subtree renders and updates while hidden (universal-core.ts:3024-3044 — the body executes regardless of mode at :3040-3042), and its wire form is visibility commands (:10214-10246). So the interleaving is literally the point:
SET(40, 2, "draft") — update inside a hidden subtree: legal
SHOW(40, hidden) — flip in the same or any commit
…
SET(40, 2, "draft 2") — still hidden, still addressable
SHOW(40, visible)
Normative rules: SET/RUN/MOVE/REMOVE are visibility-independent (matches today: only events and refs gate on visibility, :10277-10293, :10769-10777); within a message, hides run descendants-before-ancestors and reveals ancestors-before-descendants, preserving the attached-resource contract stated at universal-core.ts:10240-10241. A fresh mount inside a hidden region is RUN + SHOW(hidden) in the same message — atomicity (case 6) guarantees no intermediate paint, mirroring today's is-new hidden staging (:10220-10226).
One applier obligation surfaced here (not a wire question): empty-anchor insertion points. Adjacent anchors with no members between static siblings (<view>@if(a){…}@if(b){…}</view>) mean anchor k's END must resolve to "before the first member of the next non-empty anchor, else the next static sibling element, else parent end." The applier owns every member list, so this is a bounded local chain, needing no marker elements. Flagged in the not-proven list for cost, not correctness.
Verdict: @empty and nesting were already closed; Activity refutes the draft's missing visibility op; closed under A3/A5.
Case 5 — mixed eligibility: children under fallback-plan subtrees
Current split, for the record: a plan compiles to a create-function template only if every node is host/text/slot with static prop names — any component/if/switch/range node, propsSlot spread, or key/ref/children prop keeps the interpreted encoding (packages/octane/src/compiler/compile-universal.js:3920-3941, gate at :4051-4063); the main-thread first-screen interpreter for that encoding is renderPlanNode (packages/lynx/src/main-renderer.ts:757-810).
The decisive observation: the eligibility boundary does not exist on the wire, today or in L2. Interpreted plans are a background/first-screen encoding; by the time anything transports, the background core has interpreted them into the same id-addressed host commands as everything else — the command union simply has no plan notion (universal-core.ts:548-620). So "how does a delta stream address children under a fallback-plan subtree" decomposes:
Component / @if / @switch / @for plan nodes are never wire entities. Components are rendered through (their output is their own module's templates); directives compile to anchors in L2 (§3.4) and are background scope keys today (universal-core.ts:3046-3064). Dynamic component types (componentSlot, main-renderer.ts:769) resolve at render time and never transport. Children-as-renderable-prop is an anchor. Nothing here needs addressing across any boundary.
The genuine residue is hosts with dynamic prop names — propsSlot spreads (main-renderer.ts:800-801, ineligible at compile-universal.js:3932). A slot table cannot pre-bind a setter for a name it does not know. Today only main-thread render-only host spreads are rejected ("first-screen event and ref props must be statically named", compile-universal.js:3108); background-graph host spreads remain legal and ship prop bags.
Escape ops (reserved): an ineligible host mounts as a single-host pseudo-template — an ordinary instance id in the same space, an implicit child anchor, and a reserved SETP(instance, name, value) for named writes. This embeds today's create/update vocabulary pointwise. SETP is also where the one surviving recreate case lives: recreation is triggered only by removing a CSS scope, which the PAPI cannot express in place (packages/lynx/src/core/host-props.ts:106-107, :562, :686; classification at packages/lynx/src/core/client-driver.ts:1476). Compiled templates cannot hit it — their CSS scope is static structure (§3.1) — so SET never recreates; a pseudo-template applier handles it internally (rebuild from slot table + member lists), with no wire op.
Under either move, the boundary never needs cross-addressing: fallback hosts (if they exist) get ordinary instance ids, anchors inside them work identically, and a keyed list may mix template instances and pseudo-instances because MOVE/REMOVE/before see only ids. The choice changes the opcode table's size (drop SETP under the ban), not its closure.
Verdict: closed under A6 either way; the ban is recommended; the open policy choice is listed below as unproven.
Case 6 — commit atomicity and intra-message ordering
Today: one commit message carries one batch (universal-core.ts:656-659), versions are monotonic per commit (:10707), a prepared batch is rejected if superseded (host-driver.ts:4965-4968); commands within a batch are causally ordered and same-batch-referential — the apply loop walks them in order against staged state (host-driver.ts:3863), before targets must exist in the staged sibling list at that point (:3952-3958), and the batch's phase grouping (creates → updates → instance/event/callback ops → removes → placements → visibility → destroys, universal-core.ts:10695-10706) has placements routinely referencing same-batch creates.
Normative for L2:
Atomicity. One message = one commit = one applier pass = one flush; no observable intermediate state (the prototype already flushes once per message, lepus-root.js:245). Message versions are dense and monotonic per (root, generation); the supersession/ack/accepted-fault framing ports as contract, not encoding (this issue's framing bullet).
Ordering (MUST). Sequential operational semantics: op k addresses the state produced by ops 1..k−1. Every operand must be defined at its op — no forward references. Consequences: yes, a SET may reference an instance RUN created earlier in the same message; more importantly it must be able to, because nested mounts are RUN into an anchor of a same-message instance (case 1) and hidden-region mounts are RUN + SHOW(hidden) (case 4). An id is dead immediately after its REMOVE; referencing it later in the message is a protocol fault.
Ordering (SHOULD, emitter canon). Fold initial slot values into RUN (a same-message RUN+SET on one instance is legal but non-canonical); per anchor, removes before placements, placements in new order per case 2; hides descendants-first, reveals ancestors-first (case 4). None of this is needed by the applier for correctness — it keeps emission simple, diffable, and at the wire floor.
Verdict: defined; the draft's "one message per commit" stands, with sequential same-message referencing made normative.
Amended normative opcode set
Instance ids: dense uints per (root, generation), minted by creation ops in declared order; first-screen instances take their §3.6 creation ordinals, so adoption is the identity map into the id space (docs/lynx-specialized-target-l0.md:182-193; today's analogue: dense firstId blocks (universal-core.ts:9610-9622) and the first-tree adopt/repair decision (host-driver.ts:4926-4939), which §3.6 collapses to an index walk). Anchor = (instance, anchorSlot) or ROOT. Slot kinds are compile-time per template (§3.3): text | attr(name) | class | style(name) | event-site | anchor; stride(t) = count of value-bearing (non-anchor) slots. Event sites register once at create with instance-embedded tokens (§3.5) and never appear as delta ops; add/remove/hidden-gating of listeners becomes a background delivery decision (replacing today's event commands and their visibility gating, universal-core.ts:10263-10293).
Mint instances firstInstance … firstInstance+count−1 of template t; insert as consecutive members of anchor before before. Nested content arrives as subsequent ops targeting the new instances' anchors.
t < templateCount; count ≥ 1; values.length == count×stride(t); each value scalar and kind-compatible; firstInstance == next expected id (dense) and end within id range; anchor live and of kind anchor; before ∈ members(anchor) ∪ {END}. Mirrors today's run checks (host-driver.ts:3879-3909, :3952-3958).
SET
instance, slot, value
Point-write one non-anchor slot via its pre-bound setter. Visibility-independent. Never recreates (case 5).
instance live; slot < slotCount(template(instance)); kind(slot) ≠ anchor; value scalar and kind-compatible.
MOVE
anchor, instance, before
Reposition an existing member within its anchor (detach + insert-before). Emitted per case-2 discipline.
anchor live; instance live and ∈ members(anchor); before ∈ members(anchor) ∪ {END}; before ≠ instance.
REMOVE
instance
Detach and destroy the instance's physical subtree; its id and the ids of every instance in its member-list closure die immediately.
instance live. (Liveness clearing is O(subtree), the same order as the engine removal itself.)
SHOW
instance, state
Flip visibility of the instance's own template hosts (not nested members — the background emits per affected instance, preserving today's per-host emission and ordering contract, universal-core.ts:10214-10246).
instance live; state ∈ {0,1}.
CLEAR(optional)
anchor
≡ REMOVE of every member, last-to-first. Compression for N→0 and unmount-all (prototype precedent lepus-root.js:204-208).
anchor live.
SETP(reserved)
instance, name, value
Named prop write on a pseudo-template instance. Exists only if the dynamic-prop-name ban is not adopted (case 5).
instance live and pseudo-kind; name a string; value scalar.
BRANCH(optional fusion)
anchor, t | NONE, firstInstance, values[stride(t)]
≡ CLEAR(anchor); then, unless NONE, RUN(t, anchor, END, 1, firstInstance, values). Only for single-template arms; every other arm shape uses the general sequence (A4). Not required for closure.
As CLEAR + RUN(count=1).
Message header validation: protocol version constant; root/renderer identity; generation match (generation bump resets the id space and liveness state — fault/teardown port); commit version dense-monotonic with supersession rejection (host-driver.ts:4965-4968 semantics). Ops are self-delimiting via fixed scalar arity + declared counts.
Validation cost claim: every rule above is O(1) per op or per value with a liveness bitset + per-template slot metadata + member-index maps; total O(message length), zero recursive structural walks — because no structural values exist on the wire, only slot-typed scalars. This is the §3.4 validation goal (docs/lynx-specialized-target-l0.md:163-167) made concrete, versus today's unconditional recursive command/prop validation (packages/lynx/src/core/protocol.ts:1648; the outbound twin is dev-only by design, :1627-1640). With a binary typed encoding (flat numeric stream + string table, the prototype's shape), the scalar-type checks become free by construction and only arity/bounds/liveness remain.
Re-verification of all cases against the amended set: case 1 ✓ (A1 ids survive MOVE; A2 anchors name per-instance branches; A4 arms as sequences); case 2 ✓ (A1+A5 dissolve the pre/post question; emitter discipline proven convergent; SHOW/SETP don't touch member lists, and moving hidden instances — e.g. a retained-suspended item inside a reordered keyed list — is legal because MOVE is visibility-independent); case 3 ✓ (A2 multi-member anchors + A3 SHOW express retain-and-pend; L1–L4 lifetimes); case 4 ✓ (@empty = plain member turnover; A3 interleaving rules); case 5 ✓ (uniform id space; boundary invisible under ban or SETP); case 6 ✓ (A5 is the ordering contract; RUN→SET/RUN same-message references required and validated by definedness). The wire-floor gates hold by construction: update_storm/select are 1 SET per change, swap is 1 MOVE.
What I could not prove (and why)
The dynamic-prop-name policy (ban vs SETP). Closure holds under either, but the final table cannot be frozen without the decision. Today the constraint exists only for the main-thread render-only layer (compile-universal.js:3108); background-graph host spreads are legal and propsSlot merely falls back (:3932). This is an L1 compiler-policy call, not derivable from the L0 spec.
Portals. The universal wire places portal children under externally registered parent handles with force-move semantics (universal-core.ts:10122-10131, :10185-10212); the L0 spec never mentions portals. Anchors extend naturally (a portal target = an externally minted anchor id), but I cannot verify that against the Lynx portal/NodesRef surface from the spec alone. L4 item; until then cross-anchor MOVE stays out of the normative set.
Native lists. §3.7 defers them; componentAtIndex creates cells outside the message flow, so cell-local instance-id spaces (or a reserved id band) are assumed, not proven — and the lists-excluded-from-adoption divergence is explicitly revisited in L4 (docs/lynx-specialized-target-l0.md:195-200).
Fault/generation interplay. "Generation bump resets id space and liveness" is asserted to make validation total, but the L2 transport framing (accepted-fault split, teardown, replay) is a port-the-contract item per this issue; I cannot prove the reset rule against a design that does not exist yet.
Recreate-on-SET impossibility rests on CSS scope being static per compiled template (§3.1) — true for every slot kind defined here, since today's only recreate trigger is CSS-scope removal (host-props.ts:106-107, :562, :686). A future slot kind with create-only PAPI semantics would need the applier-internal rebuild path; unprovable for kinds that don't exist.
Scoped-commit anchoring equivalence. Today's scoped re-renders append before precomputed frame anchors so out-of-scope siblings survive (universal-core.ts:10170-10181). Bounded anchors subsume this by construction, but the equivalence for the memo-bailout/lane-scheduler scopes L2 intends to add (Roadmap: replace the universal-renderer target for Lynx with a Lynx-specialized compiler and renderer #58 open question 4) is asserted, not proven.
Empty-anchor resolution cost. The chained insertion-point lookup (case 4) is correct by construction but unmeasured on PrimJS; it belongs in the L3 slice benches before the applier shape is frozen.
L2 delta protocol: closure analysis and final opcode set
Design-only analysis against claude/octane-issue-58-l3-direct-first-screen
(head of #59→#63→#64→#65). No code changed.
Overall verdict: the §3.4 opcode set as written is NOT closed and NOT
unambiguous. Four independent breaks, three of them fatal to the draft as
literally specified:
RUN(templateId, anchorSlot, …) and BRANCH(slot, …) name a slot with no
instance. A slot index is per-template, so in a 10k-row list anchorSlot=3
names 10k distinct anchors. Every address must be a pair.
BRANCH cannot express @try retention, where the old arm and the pending
arm are both live at once (universal-core.ts:3468, :3505-3511), nor an
arm that is not exactly one template.
There is no visibility opcode at all, yet Activity and retained Suspense
are pure visibility transitions over instances whose identity does not change
(universal-core.ts:3033, :2756-2768).
The draft does not separate values from structure, which is the premise
the "header-only validation" claim rests on.
Everything else survives, and the amended six-opcode set in (b) is closed and
unambiguous over every structure I could construct, with the four gaps in (c).
§0 — The five facts the whole analysis rests on
Stating these first, because every verdict below is a corollary.
F1. Ranges are logical, and placement is over the flattened physical list. LogicalRecord.kind is 'range' | 'host' | 'portal' (universal-core.ts:938-940). physicalRecords/physicalDrafts flatten every range to its host descendants
(universal-core.ts:4216-4232), and planPlacements runs per physical parent
over that flattened list (universal-core.ts:10166-10190). So @if arms, @for items, @try arms and component outputs have no physical container.
F2. A template has exactly one physical root. UniversalHostTemplateShapeNode.parent is documented as "Earlier shape-node
index, or -1 for the template's one physical root"
(universal-core.ts:485-489), and eligibility requires plan.root.kind === 'host'
(compile-universal.js:4055). So an instance handle can denote its root node
without ambiguity.
F3. Every directive already compiles to a slot hole.@for, @if, @switch, @try, Activity, component calls and bare dynamic expressions all
route through addDynamicAst, which emits {kind:'slot', slot}
(compile-universal.js:3048-3052, called at :3215 Activity, :3265 component, :3518@for, :3538@if, :3566@switch, :3582@try, :3611
expression). lynxTemplateEligible accepts kind === 'slot'
(compile-universal.js:3930). A template containing an @if is eligible
today — this is stronger than the L0 spec assumes, and it is what makes Case 5
provable without a compiler change.
F4. Placement anchors are identities, and they are provably immobile. planPlacements emits before: newPhysical[nextStable].id
(universal-core.ts:10156) where nextStable indexes an LIS-stable survivor
(universal-core.ts:10143, stableUniversalPlacementPositions at :4239).
Stable entries are never emitted as insert/move (universal-core.ts:10144-10152)
and always have sources[i] !== -1, i.e. they pre-existed this commit. The
out-of-scope fallback endAnchor is "the first physical host that follows the
scope … Untouched siblings cannot move during a scoped commit"
(universal-core.ts:8438-8463).
F5. Commits are transactional on the background side and validate-then-apply
on the main side. A suspending attempt is discarded and emits nothing
(universal-core.ts:8362-8366, :8386-8390). On the main thread, failure
before the first mutation is a rejection; after mutationStarted the message
is accepted and the fault is terminal, never rolled back
(main-thread.ts:2190-2202, host-driver.ts:3465, :4979).
(a) Verdict per case
Case 1 — nested @if/@switch inside keyed @for items
Verdict: addressing survives, but only after amendment A1. The draft's BRANCH(slot, …) / RUN(…, anchorSlot, …) form is refuted here.
Separately: closed but not compact — this shape falls off the RUN path
entirely today.
Source:
@for (const r of rows; key r.id) {
<view class={cls(r)}>
<text class="label">{r.label as string}</text>
@if (r.open) { <text class="detail">{r.detail as string}</text> }
@else { <view class="chip"/> }
</view>
}
The item plan root is a host; its children are a text host and a slot node
(F3). lynxTemplateEligible → true, so a create function is emitted
(compile-universal.js:4054-4056). Slot kinds come out as ['p:class', 'c', 'c'] today — and that second 'c' is the bug: lynxTemplateSlotKinds marks a text hole and a renderable slot hole with
the same kind 'c' (compile-universal.js:3944-3951). One is a scalar the
protocol writes with SET; the other is a child range the protocol fills with RUN. Conflating them makes the opcode-to-slot-kind dispatch undecidable.
Arm identity: @if claims its owner with key 1|0
(universal-core.ts:3050) and @switch with the case index or 'default'
(universal-core.ts:3064). A different key ⇒ a different owner record ⇒ a
different rangeKey symbol (universal-core.ts:2157, :2517) ⇒ sameRecordShape fails (universal-core.ts:4068-4074) ⇒ an arm swap is a
teardown + create, never an in-place mutation.
v1 — three rows a,b,c, all shut. Chrome is instance 1 with a rows range at
slot sR.
RUN T_ROW, (1,sR), END, F=2, N=3, ["row","alpha","row","beta","row","gamma"]
RUN T_SHUT, (2,s3), END, F=5, N=1, []
RUN T_SHUT, (3,s3), END, F=6, N=1, []
RUN T_SHUT, (4,s3), END, F=7, N=1, []
v2 — reorder to c,a,band open row b in the same commit.
Keyed matching holds the row instances at 2=a, 3=b, 4=c (the item key becomes
the owner key at universal-core.ts:3418, and the owner's rangeKey becomes the
record key, so the reconciler's keyed branch re-claims it, universal-core.ts:9695-9714). newPhysical = [4,2,3], sources = [2,0,1],
LIS = {1,2} ⇒ stable = instances 2 and 3.
REMOVE 6, 1 # old else-arm of row b
MOVE 4, (1,sR), before=(2,s0) # only non-stable row
RUN T_OPEN, (3,s3), END, F=8, N=1, ["…detail…"]
Three things to read off this:
The branch site is (3, s3) — instance-qualified. Under the draft's BRANCH(slot=3, …) this message is unwritable: slot 3 names one anchor per
row. A1 is mandatory, not cosmetic.
Instance 4 moving does not renumber, re-slot or re-address anything. Handles
are allocated once and never reused (universal-core.ts:6599, :9645, :9758).
The anchor (2,s0) is an LIS survivor, so by F4 nothing later in this message
moves it.
Compactness break.RUN coalescing requires the collapsed template program,
and universalHostTemplateShape encodes a slot node as a #text shape node
(universal-core.ts:4285); prepareCollapsedTemplateValues then demands string | number | bigint for that binding (universal-core.ts:3966-3972). A universalIf(...) object fails, dense === null, and the list drops off the
compact path (universal-core.ts:3328). So today a keyed list whose item body
contains any directive mounts item-by-item. Amendment A6 (r as a distinct
slot kind) is what unblocks it; A10 (RUN_EACH) is what makes the nested arms
one op instead of N.
Case 2 — keyed reorder as LIS MOVEs
Verdict: closed and unambiguous. Neither pre- nor post-move order: addresses
are identities, and anchors are position-invariant across the whole message.
Worked example, [a,b,c,d,e] (instances 1..5) → [c,a,e,b,d]:
oldPhysical a b c d e positions a→0 b→1 c→2 d→3 e→4
newPhysical c a e b d sources = [2,0,4,1,3]
reordered 0 < 2 → LIS over sources → indices {1,3,4} = a,b,d stable
Walk (universal-core.ts:10145-10163), nextStable starts at 0, advances past
non-stable entries:
i
node
stable?
emitted
0
c
no
MOVE 3, (P,sR), before=(1,s0) — anchor = newPhysical[1] = a
1
a
yes
skipped; nextStable → 3
2
e
no
MOVE 5, (P,sR), before=(2,s0) — anchor = newPhysical[3] = b
3
b
yes
skipped; nextStable → 4
4
d
yes
skipped
Apply sequentially from [a,b,c,d,e]: move c before a → [c,a,b,d,e]; move e
before b → [c,a,e,b,d]. ✓
Normative ordering (the answer to "pre- or post-move order?"):
R1 (determinism). Ops apply in array order; each observes every earlier
op's effect. The applier has no reordering freedom. This alone makes the
stream unambiguous regardless of anchor choice.
R2 (anchor stability — emitter obligation). Every before names a node
that is live at that point and is not the target of any later structural op
in the same message. planPlacements satisfies R2 by construction: anchors
are LIS-stable survivors (never emitted as move/insert, universal-core.ts:10144-10152)
or the out-of-scope endAnchor (universal-core.ts:8442-8463). Under R2 the
pre/post question dissolves — the anchor occupies the same position at every
point in the message, so "pre-move order" and "post-move order" agree on it.
R1 is what the validator enforces; R2 is a background-side invariant proven by
construction, not checkable cheaply on the main thread. Say both, enforce R1.
Refutation of the prototype's index model.lepus-root.js addresses by
array index and mutates a parallel array as it applies: OP_REMOVE does rowViews.splice(at, 1) (:221) and OP_SWAP swaps rowViews[a]/[b]
(:225-240). That is deterministic, but it is the wrong model for L2:
it forces the background to simulate the main thread's array mutations
op-by-op, when the reconciler natively produces identity anchors (F4);
splice is O(n), so clearing or removing N rows is O(N²) on the main thread;
an index cannot be validated — there is no live/parent table to check it
against — so a background/main desync is silent, whereas live[I] and parent[I] catch an identity desync in O(1) (V8/V11).
OP_SWAP is also not general: [a,b,c,d,e] → [c,a,e,b,d] is not a
transposition and has no OP_SWAP encoding at all.
Case 3 — @try/@pending/@catch, and instance lifetime across retry
Verdict: BRANCH REFUTED. Retained Suspense keeps two arms live
simultaneously. Closed after A3 (delete BRANCH) + A4 (add VIS).
@try claims a boundary owner (universal-core.ts:3454); each arm is a scoped
owner keyed 'try' | 'pending' | 'catch' (universal-core.ts:3485, :3468, :3521). The load-bearing path is retention: when a committed body
re-suspends, retainCommittedTryArm rebuilds the committed records as a
blueprint (blueprintFromLogical, universal-core.ts:2770-2790), marks them suspense-hidden (:2756-2768), and the boundary returns [...retained, ...pending] (:3468-3469, :3505-3511). Both arms are children
of the boundary range at once.
Panel = instance 1 with a boundary range at sB.
v1 — body commits two rows:
RUN T_ROW, (1,sB), END, F=2, N=2, ["row","alpha","row","beta"]
v2 — an update re-suspends the body. The retained arm keeps its records, so
instances 2 and 3 are untouched; the pending arm mounts alongside them:
RUN T_PENDING, (1,sB), END, F=4, N=1, []
VIS 2, hidden
VIS 3, hidden
v3 — the thenable resolves and the body renders. The 'try' owner is
re-claimed by key (findClaimableChildRecord, universal-core.ts:2254-2288), blueprintFromLogical preserved record.key (:2743), so sameRecordShape
matches and the same instance handles come back. The 'pending' owner is
never claimed, so it is removed:
SET 2, s2, "alpha (loaded)"
SET 3, s2, "beta (loaded)"
REMOVE 4, 1
VIS 2, visible
VIS 3, visible
Instance lifetime, normatively:
transition
lifetime
body → pending with a committed body and visibility capability
body instances survive, hidden; pending instances are new
body → pending with no committed body (!owner.record.mounted, :2771)
body never existed; pending instances live for the suspended span
pending → body (retry)
retained body instances resume with the same handles; pending instances are removed
body → catch, and reset() → body
no survival — 'catch' is a different owner key (:3521, :3476-3480), so both directions are teardown + create
pending === null
throw propagates to an outer boundary (:3460, :3508); nothing commits
transition render that suspends
if (currentAttempt().transitionRender) throw error (:3493) — no retention, attempt discarded, no message
The last two rows are the important safety property: a retry never produces a
partial delta stream. By F5 a suspending attempt emits no batch at all, so
there is no state in which some instances of a subtree were delta-addressed and
others were not. Retry therefore cannot observe a half-addressed subtree.
Why BRANCH dies here: it is single-arm by construction. Row 1 of the table has
two arms live at once; rows 4–5 need the whole thing to not commit. BRANCH is
also unnecessary — every arm swap is exactly REMOVE(old members) + RUN(new
members) into the same range site, which the amended set already expresses.
Case 4 — @empty, nested keyed ranges, Activity flips interleaved with SETs
Verdict: closed. @empty needs no opcode. Nested keyed ranges are closed but
cost-linear in physical nodes. Activity needs A4 and A5.
(a) @for/@empty, N→0→M. Empty selects a different owner: materializeScoped(CURRENT_OWNER!, [...path,'for-empty'], null, list.empty)
(universal-core.ts:3431-3433; compact path :3193) versus [...path,'for']
for the populated case (:3418). Different identity ⇒ full swap.
N→0: CLEAR (Ip,sRows) # exclusive range → one op, N handles freed
RUN T_EMPTY, (Ip,sRows), END, F, 1, []
0→M: REMOVE F, 1
RUN T_ROW, (Ip,sRows), END, F', M, values…
Without an exclusive range slot, CLEAR degrades to REMOVE I0, N when the ids
are a contiguous run (they are, immediately after a RUN) or to N REMOVEs
once removals have fragmented the id space. CLEAR is exactly the prototype's OP_CLEAR (lepus-root.js:204-209) made addressable.
An empty range needs no anchor node. Its physical parent is a real host node
held in the instance's slot table, and before is either a live instance or a
static anchor slot of the same instance. So zero-member ranges cost zero nodes —
worth stating, because the obvious alternative (a marker node per range) would
add one PAPI node per directive site per instance.
(b) Nested keyed @for inside keyed @for. With no wrapper host — @for(g of groups; key g.id) { @for(r of g.rows; key r.id) { <row/> } } — F1
says both range levels flatten, so the physical parent's child list is every row
of every group, and planPlacements runs LIS over that whole list
(universal-core.ts:10131-10163). Reordering two groups emits one MOVE per
row of every moved group, not one per group.
Unambiguous (all addresses are identities), but the cost is O(rows moved). This
is not fixable in the protocol: the Element PAPI exposes only single-node __InsertElementBefore (lepus-root.js:26), so there is no bulk sibling move to
lower a range move onto. Adding a wrapper host per group makes the group one
instance and the move one op. I record the cliff rather than paper over it.
(c) Activity flips interleaved with SETs. Activity claims its owner with key null (universal-core.ts:3033), so a mode flip preserves owner, records and
instance handles; only owner.visibility changes (:3034-3038). The body
still renders while hidden (:3038-3040), so hidden subtrees keep emitting SETs.
Interleaving is fixed by the phase order: updates precede visibilityCommands
in the batch (universal-core.ts:10695-10706), and hides walk post-order while
reveals walk pre-order (:10240-10245).
SET 9, s1, "next" # applied while still visible
VIS 9, hidden
SET 9, s1, "next" # applied before the reveal → no flash of stale content
VIS 9, visible
Two applier obligations the draft misses:
A5 — hidden is reserved and applier-composed. The driver computes effectiveHidden = visible ? authoredHidden : true
(host-driver.ts:1500-1502, applied at :5471-5479). If hidden were an
ordinary p: slot, SET I, sHidden, false would write PAPI directly and
un-hide a suspense-hidden or activity-hidden instance. SET on the authored hidden slot must update the stored authored value and let the applier
re-derive.
A4' — VIS owns event lifecycle.VIS hidden removes native events and
main-thread refs; VIS visible reinstalls them from the stored table
(host-driver.ts:5471-5490). So §3.5's "registration happens once inside the
create function" is true only between visibility transitions, and the wire
must carry no event ops for a flip — the applier reconstructs them.
VIS is per instance, not per node. Visibility is uniform across a template
instance: hosts inherit CURRENT_OWNER.visibility, and every directive that can
introduce a new visibility scope is itself a slot hole (F3), hence a separate
instance. That is strictly better than the universal path, which emits one visibility command per host (universal-core.ts:10216-10238): hiding a
1000-node Activity subtree is O(instances), not O(nodes).
Case 5 — mixed eligibility: does a delta stream ever cross-address a fallback subtree?
Verdict: proven — the boundary never needs cross-addressing, and this holds
under today's compiler with no amendment.
The premise in the task ("the compiler falls back to interpreted plans for
component/if/switch plan nodes") describes lynxTemplateEligible's doc comment
(compile-universal.js:3920-3927), but the compiler never emitsif, switch, component or range plan nodes — I grepped for conditionSlot / valueSlot / kind: 'if' in packages/octane/src/compiler/ and found nothing.
Those renderPlanNode arms (main-renderer.ts:768-797) and materializeNode arms (universal-core.ts:3632-3665) are defensive. Every
directive becomes {kind:'slot'} (F3), and slots are eligible
(compile-universal.js:3930).
So the actual ineligibility set is much smaller: a spread props program
(propsSlot), a key/ref/children prop or binding, an event-shaped static
prop name, or a plan whose root is not a host
(compile-universal.js:3928-3941, :4055).
Theorem (boundary closure). Let instances(n) be the instance handles
allocated for subtree n. Then:
instances(n) ∩ instances(m) = ∅ for disjoint subtrees — handles come from
one monotonic counter, never reused (universal-core.ts:6599, :9645, :9758).
Every address the wire can form is (I, s) with s ∈ slots(template(I)), and slots is a compile-time property of exactly one template. So an address is
resolvable without knowing anything about the enclosing or enclosed
encoding.
The only addresses that cross a boundary are a RUN/MOVE's (parentInstance, parentSlot) and its before anchor. Both are ordinary (I,s) pairs: the parent slot has kind r in the outer instance's table;
the anchor is either END, an instance root (I,0), or a static anchor slot
of the outer instance.
Therefore eligible-vs-interpreted is purely a codegen choice — RUN T with
a real template versus RUN T_degenerate for a single host the compiler could
not lower — and never an addressing distinction. ∎
Concretely: <view class="card"><text>{title}</text>{<Widget/>}</view> compiles
to one eligible template with slots [p:class?, t:title, r:hole]; the widget's
output is instantiated into (cardInstance, sHole). The card's slot table never
names a widget node; the widget's never names a card node.
The converse direction — an eligible template nested inside an ineligible plan —
is the same statement read upward: the ineligible host is a degenerate one-node
instance, and the template is RUN into (thatInstance, s0).
This also disposes of §3.6's ordinal alignment for the mixed case. Create order
inside a template create function is pre-order — env.h, then props/bindings,
then children, then env.a(parent, node)
(compile-universal.js:3967-4027) — and the background allocates ids in reconcileChildren pre-order (universal-core.ts:9645, :9758, reserveCollapsedTemplateIds at :9610-9622). env.s holes do not advance
the template's node numbering (compile-universal.js:3981-3986, main-renderer.ts:735-737), so hole content is numbered in its own instance
space and a template's ordinals are invariant under hole content.
Case 6 — commit atomicity and ordering
Verdict: ops within a message ARE required to be causally ordered; a SET
MAY reference an instance created by an earlier RUN in the same message;
atomicity is validate-then-apply with a terminal accepted-fault, not rollback.
Evidence:
One message = one commit = one version; batch.version must equal the
envelope version (protocol.ts:1315-1327), and the envelope carries protocol/renderer/root/version (protocol.ts:613-625, :1693-1720). Version is recorded as record.acceptedVersion = message.version
(main-thread.ts:2201).
Today's batch is already phase-ordered, not free-form: creates, updates, ensure-public-instance, event, lifecycle, local-callback, removes, placements, visibility, destroys
(universal-core.ts:10695-10706). Creates precede updates, so a SET
referencing a same-message creation is already the status quo.
Ids are pre-allocated by the background during reconcile, and mount-template-run ships firstId with a dense stride, coalescing only when previous.firstId + previous.count * stride === collapsed.firstId
(universal-core.ts:10037-10047). So the background knows every handle before
it writes the message — a same-message SET after RUN is trivially
expressible.
Atomicity is two-tier. Failure during preparation rejects with nothing
applied; once mutationStarted the message is accepted and a fault is
terminal (main-thread.ts:2190-2202, host-driver.ts:3465, :4979).
Consequence: all addressing validation must complete before the first PAPI
call. The specialized applier therefore needs two passes over the flat op
array — a pure scan over live/template/parent tables with no PAPI and no
allocation, then a check-free apply pass. Two flat passes are still far below
today's recursive per-command walk (protocol.ts:1315-1327 → assertCommand).
By F5, a suspending or fallback-triggering attempt emits no message, so
there is no partial-commit state to reason about.
Normative phase order for the amended set (RUN fuses create+attach, so it must
follow removal, which the universal order does not need):
phase
ops
P1
SET on instances live before the message
P2
REMOVE, CLEAR
P3
RUN, MOVE — per physical parent, in final-order index order
P4
SET on instances created in P3 (legal; normally empty, since RUN carries initial values)
P5
VIS hidden (descendant instances first), then VIS visible (ancestor instances first)
Moving RUN after REMOVE is safe: a RUN's anchor is a desired, non-removed
node by F4, and a REMOVE's target is identity-addressed, so no RUN can
invalidate it.
(b) The amended normative opcode set
Address space
term
definition
instanceI
1 ≤ I < 2^31, allocated by the background, dense, monotonic, never reused. Denotes a template instantiation and, structurally, its one physical root (F2). I = 0 is the END / container sentinel.
templateT
0 ≤ T < templateCount, index into the module's compile-time table. A host the compiler cannot lower is a degenerate template: one node, slotCount = 1.
slot(I, s)
0 ≤ s < slotCount(template(I)). Compiler-assigned, stable across rebuilds (§3.3 discipline).
anchor
END (append into the range's parent node), or a slot address whose kind is n or a.
Slot kinds (replaces the current two-valued 'c' | 'p:…' | 'e:…')
kind
holds
addressed by
n
the instance's physical root node; slot 0, always present
MOVE, REMOVE, anchors
t
a text/content scalar
SET
p:<name>
attribute / style / class-list write
SET
e:<name>
event token
SET
r
a range site: the parent node ref for one hole, plus an exclusive flag when the hole owns all of that node's children
RUN, CLEAR
a
a static node that can serve as a before anchor (a template node immediately following a hole)
anchors
A6 is the load-bearing amendment here: lynxTemplateSlotKinds currently
assigns 'c' to both a text hole and a renderable slot hole
(compile-universal.js:3944-3951). Splitting t from r is what makes the
opcode/slot dispatch total.
Opcodes
op
operands
meaning
RUN
T, Ip, sp, Ib, sb, F, N, values…
Instantiate TN times into range site (Ip,sp), inserted before anchor (Ib,sb) (Ib = 0 ⇒ END), assigning handles F … F+N-1. values.length = N × dynSlots(T). Generalizes mount-template-run (universal-core.ts:572-580, :10046-10061).
SET
I, s, v
One slot write. The setter is selected by the compile-time kind of (template(I), s); no per-prop classification, no prop-bag diff. v is a scalar.
REMOVE
I, N
Detach and destroy instances I … I+N-1 (a contiguous handle run; N = 1 for the general case).
CLEAR
Ip, sp
Detach and destroy every member of range site (Ip,sp). Valid only when (template(Ip), sp) is kind r with the compile-time exclusive flag. This is the prototype's OP_CLEAR (lepus-root.js:204-209).
MOVE
I, Ip, sp, Ib, sb
Reposition instance I into range site (Ip,sp) before anchor (Ib,sb). The parent may differ from I's current parent — portal retargeting emits exactly that (universal-core.ts:10122-10131, :10185-10199).
VIS
I, state
hidden or visible for the whole instance. Applier composes with the authored hidden slot (A5) and owns event teardown/reinstall (A4').
Six opcodes. Deleted from the draft: BRANCH (Case 3; derivable as REMOVE+RUN). Never added: RECREATE — the universal path's recreate
(universal-core.ts:591-595, classified at :10112-10135) fires on Lynx only
when a CSS scope is removed ("The public PAPI has no operation that removes a
previously applied CSS ID", host-props.ts:106-107, :562, :686). A
template's CSS scope is baked into its create function, so an instance can never
change scope; a scope change is a different template, i.e. REMOVE+RUN.
Amendments, indexed
#
amendment
forced by
A1
Every address is instance-qualified: (I, s), never a bare slot.
Delete BRANCH. Arm swaps are REMOVE + RUN into the same range site.
Case 3
A4
Add VIS(I, state), per instance, with the hide-post-order / reveal-pre-order rule (universal-core.ts:10240-10245).
Cases 3, 4
A4'
VIS owns native-event teardown/reinstall (host-driver.ts:5471-5490); the wire carries no event ops for a flip.
Case 4
A5
hidden is a reserved, applier-composed slot: effectiveHidden = visible ? authoredHidden : true (host-driver.ts:1500-1502).
Case 4
A6
Split slot kind c into t (scalar) and r (range site); add a (static anchor) and n (root).
Cases 1, 4, 5
A7
Split the id space: physical instance handles dense and contiguous; logical ranges get no wire identity. Interleaving them breaks RUN coalescing — this is exactly what compactLogicalRangeIds guards today (universal-core.ts:9556-9565, :10037-10047).
Cases 1, 2
A8
Values are scalars only — string, number, boolean, null; all structure travels as ops. This is the premise the header-only validation claim rests on.
validation
A9
Normative phase order P1–P5 plus rules R1 (determinism) and R2 (anchor stability).
Cases 2, 6
A10(optional, compactness)
RUN_EACH T, Ip0, N, sp, F, values… — one instance of T into slot sp of each of instances Ip0 … Ip0+N-1. Restores one-op nested instantiation for the uniform Case 1 shape. Closure does not depend on it.
Case 1
A11
Event tokens embed the instance handle, not application data. The prototype's 's:' + rowId (lepus-root.js:81, :87) works only where items have a natural key; <site>:<instance> works for every event site, including inside @if arms, and survives reorder for free.
§3.5
Applier-side state (replaces LynxHandleEntry)
Four dense typed arrays indexed by instance handle:
Uint16Array template[] # which template each instance is
Uint8Array live[] # liveness, for V8
Int32Array parentSlot[] # packed (Ip,sp), for V11 and CLEAR
Int32Array nextSibling[] # intrusive member list per range site
plus one node-ref array per instance covering only its slot table (§3.3). That
makes CLEAR O(members) with no allocation and before-parent validation O(1),
and it deletes the per-node ack state, dual snapshots, lazy facades and
generation tracking that #58 lists as owner 6
(client-driver.ts:76-95).
Header-only validation rules
All of V1–V14 run in the prepare pass, before any PAPI mutation (forced by
F5 / main-thread.ts:2190-2202). Single forward scan, O(ops), no recursion, no
allocation, no structural walk of any value.
V12 id space: F === nextFreeInstance. This one integer compare replaces
the entire per-node handle/ack machinery, and it makes "a SET referencing
an instance created by a laterRUN" unrepresentable rather than merely
illegal.
V13 values: one typeof per value ∈ {string, number, boolean} or null.
No key enumeration, no recursion — this is the whole of A8's payoff, against
today's recursive assertCommand walk (protocol.ts:1315-1327).
V14 terminal: after the scan, nextFreeInstance === header.nextInstance.
A cheap end-to-end checksum on the shared id space.
V8/V11/V12 read tables that the message itself mutates, so the prepare pass
shadow-applies structural effects (live, parentSlot, nextFree) without
touching PAPI — the same discipline prepareLynxHostBatch already uses when it
stages a shadow child list (host-driver.ts:4593-4597).
(c) What I could NOT prove
1. Native lists. §3.7 assumes a list cell body is a template that componentAtIndex instantiates directly. But cell instances are minted by the
platform on demand, outside any message, so V12's dense-id invariant cannot
hold — the main thread's nextFreeInstance would advance without a RUN.
This is not hypothetical: native lists are excluded from adoption today
(host-driver.ts:3239) and the L3 direct first screen declines them
(main-thread.ts:1906). Closure needs either a reserved id sub-space for
platform-minted cells or a recycling-callback ack, and I could not settle which
without the recycling contract. Carry to L4.
2. Lane-scheduled sub-commit batching (#58 open question 4). The
one-message-one-commit-one-version rule (Case 6) and V12 (dense, in-order handle
allocation) are both stated against today's per-commit model. If a lane
scheduler later interleaves two commits, handles would be allocated out of order
across messages and V12's F === nextFreeInstance would fail. The op stream is
self-delimiting, so framing survives; the id-space invariant does not, and
I could not construct a variant that keeps V12's O(1) check under out-of-order
lanes. Anything weaker than V12 puts the per-node ack machinery back.
3. Adoption ordinal matching (§3.6) versus today's comparison. I can show
the ordinal walk is no weaker than today's: adoption is already whole-tree
all-or-nothing — any mismatch repairs the entire first screen
(host-driver.ts:3239, :3253, :3258). What I could not prove is that a
pure index walk detects everything the current field-by-field comparison
detects: two distinct templates with equal node counts at the same ordinal
compare equal under an index walk alone. The fix is cheap (compare templateId
per instance during the walk) but it is not in the current capture — L1's
capture is the plan-path snapshot and records no template identity. Recommend
adding templateId to the capture before L3's adoption slice lands.
4. Range moves as a unit. Case 4(b): a keyed range with no wrapper host
costs one MOVE per physical member, because the Element PAPI has only
single-node __InsertElementBefore. A MOVE_RUN I, N, … over a contiguous
handle run would collapse the common case, but handle runs fragment after the
first interior removal, and I could not prove a useful bound on how long they
stay contiguous under real edit sequences. Left out of the normative set.
Two smaller things I want on the record rather than asserted:
memo bailout. Doesn't exist yet. What I can prove is that today's
retained subtrees stay movable — physicalDrafts reads physicalRecords(draft.record.children) for retained === true
(universal-core.ts:4227-4229) — so a bailout that reuses the retained-draft
mechanism inherits movability. A bailout implemented differently would need
re-checking against Case 2.
Portals. A portal ancestor makes scopePhysicalPlacement return null
and forces a full-root render (universal-core.ts:8447, :8411-8417). UniversalHostParent admits an opaque target handle
(universal-core.ts:405), but on Lynx a portal target resolves to an accepted
host of the same root (client-driver.ts:1367), so it is an ordinary
instance and (Ip,sp) covers it. I verified the address form; I did not
verify the scoped-commit fallback carries over unchanged.
One-line summary
RUN/SET/REMOVE/MOVE survive with instance-qualified addressing; BRANCH
does not survive at all; VIS must be added; the c slot kind must split into t and r; and the "header-only validation" claim is true only once values are
restricted to scalars and all structure moves into ops.
Activity
Huxpro commentedon Aug 18, 2026
L2 kernel: final owner/service interface design
Design only — no code changed. All
file:linecitations are againstclaude/octane-issue-58-l3-direct-first-screen@2fe1446.This settles #58 open question 1's real content: what the extracted kernel's
owner abstraction and injected-service seam must be so that (a)
universal-core.tsadopts it with zero behavioral drift, and (b) a Lynx-specialized core implements
the same interface without inheriting
LogicalRecord,UniversalRootImpl, orcommand staging.
0. The organizing principle
One rule generates every decision below:
This line is not arbitrary — it is where the code already sits. Every service
docs/lynx-specialized-target-l0.md§5 items 2–4 name is already a method onUniversalRootImpl, reachable from every owner through therootfield italready carries (
universal-core.ts:1064):scheduleOwneduniversal-core.ts:7748scheduleTransition:7770discardTransitionBatch:7889__scheduleMicrotask:6895useIdformattingformatUniversalId:7042readBridgeContext:7030So the "injected-service seam" is not a new object to allocate and thread — it
is a subset declaration of an object the core already has and the owner
already points at. That is the whole reason the adoption diff can be
non-behavioral.
A corollary that constrains the field set: the kernel never constructs an
owner.
createOwnerRecord(:2140-2174) anddraftOwner(:2176-2209) stayin each core, so each core keeps its own object literal, its own field order,
and therefore its own hidden class. The kernel only reads and writes named
fields.
1. The owner interfaces
1.1 What the kernel actually touches
I counted field reads across the hook/queue/transition region
(
universal-core.ts:4720-6350). On the committed record, exactly five fieldsare touched:
hooks(35 sites),updates(11),root(7),disposed(5),visibility(5). Nothing else —parent,children,identityPath,key,id,rangeKey,range,renderer,component*,effectOrder,mounted,contextValues,dirtyEpoch,isBoundary,canHandleSuspense, and the threeboundary*fields have zero readers in that region.Generic plumbing is a typing detail, not a design one: the kernel writes its own
cells through the same
owner.hooks.set(slot, hook as Hook)cast universal-corealready uses (
:5158,:5464), becauseUniversalHook(:1052-1061) is awider union than the kernel cells — it composes them with the renderer-facing
ComponentMemoHook, which §5 keeps in the core.1.2 Per-field justification
On
KernelOwner:root— the service holder. Every setter closure already capturesrecord,so reaching services through
record.rootcosts zero extra closure slots.This is the single most important field in the design; §2 explains why.
hooks— the cell map.cloneStateHook(:5057-5069), every hook body,enqueueUniversalHookUpdate's kind check (:4913),projectedStateValue(
:5071),visibleStateValue(:5090).updates— the queue map.enqueueUniversalHookUpdate(:4911),applyUniversalHookUpdateQueue(:4978),hasUniversalUpdatesForAttempt(
:5040), theneedsUrgentRebasecheck in both state setters (:5144,:5240),promoteUniversalTransitionBatch(:4827).disposed— every setter's first line (:5125,:5196,:5416),scheduleOwner(:4942), promotion (:4824,:4865).visibility— not optional, and not merely reconciler bookkeeping: theparked-linked-draft machinery reads it on the record at
:5219,:5309,:5345, anduseDeferredValuereads it at:5686. A Lynx core implementsActivity/Suspense hiding, so it carries the same three-valued state.
On
KernelDraft:record,hooks,clonedHooks— the copy-on-write draft protocol(
:5060-5063,:5271-5274,:5421-5424,:5590-5593).parent— only for the linked-state parked-draft boundary walk(
:5314-5317), which needsisBoundary && canHandleSuspenseon ancestors.That is also the only reason those two flags are on the interface.
seenEffects— written byenqueueUniversalEffect(:5508).appliedUpdates— written byapplyUniversalHookUpdateQueue(:4988,:5027) and re-based by linked state (:5331-5337).needsRender— the render-phase-update fast path (:5134,:5208,:5429).visibility—useDeferredValuereads the draft's visibility separatelyfrom the record's (
:5686).1.3 What stays core-private, and why
range: LogicalRecord | null(:1084)LogicalRecord(:938-956) is the universal host-record graph — props bag, events, lifecycles, localCallbacks, portal registration, collapsed templates. This is precisely the cost #58 §6 deletes.rangeKey: symbol(:1076)Symbol()allocation per owner record (:2157). The Lynx core addresses by compile-time template/instance identity and drops it.identityPath,key,component,componentRevision:2254-2290). #58 L3 replaces it with compile-time template/slot identity. Freezing it into the kernel would import exactly what the roadmap deletes.effectOrder(:1078)memobailout (:6286) and the commit-time effect diff (:10822-10885). §5's ordered blocker list does not include effect commit; see §6.1 below.contextValues(:1085)readOwnerContext(:2387-2412) needs two universal-only things: theattempt.scoperecord-parent walk for renderer regions (:2400-2408) andCURRENT_MEMO_CONTEXT_READStracking for thememocontext bailout (:2396,:6279-6290). Extracting it now would either drag renderer-region scoping into the kernel or add a host call on everyuseContext. Deferred;readBridgeContextis declared onKernelHostnow so the interface is final.mounted,dirtyEpoch,children,parent(record),renderer,id,isBoundary/canHandleSuspense(record),boundaryError/hasBoundaryError/boundaryThenabledirtyEpochin particular is the retained-subtree epoch (:7754-7760) — a universal reconciler optimization the Lynx core may not want.DraftOwnerclaiming field (retainedChildren,claimedChildren,sequentialClaimCursor,childOwnerBuckets,childClaimCursors,childReplayOrdinals,replayPath,contextStable)implicitSlotresolveHookSlot(:4737) and reset byexecuteOwner(:2435), both of which stay per-core (§3).1.4 What a Lynx owner then looks like
No
LogicalRecord, noUniversalRootImpl, no command staging, no per-ownerSymbol, noidentityPatharray. That is the (b) half of the brief, dischargedby construction rather than by discipline.
2. The injected-service seam: one
KernelHost, reached throughowner.rootDecision: one host object per root, reached as
owner.root, implementeddirectly by the core's existing root class. Not per-function injection.
Note the naming:
__scheduleMicrotaskandformatUniversalIdare ugly for a"kernel" interface, and I kept them anyway. The interface is deliberately named
after what
UniversalRootImplalready exposes, so universal adoption isclass UniversalRootImpl … implements KernelHost<…>with zero call-sitechurn. Cosmetic renames are a separate, independently reviewable commit; doing
them inside the extraction would make a mechanical diff unreviewable.
Only three members are new work on the universal side:
scheduleOwner(move thefree function's body at
:4941-4951onto the class),transitionBatchForUpdate(delegate to
:4874), andactiveAttempt(returnCURRENT_ATTEMPT).2.1 Rejected alternatives
A — Module-level
configureKernel(services)singleton. Cheapest possibledispatch (module-local
lets, monomorphic, zero loads). Rejected because it is arealm singleton and two universal-family cores demonstrably coexist in one
realm today:
universal-dom-boundary.ts:1-21imports hooks from bothruntime.jsanduniversal-core.jsin a single module, andrendererRegion(
:1810) plusUniversalRendererRegionOwnerBridge(:1272) exist to nest them.It also destroys test isolation.
B — Per-function injection (pass each service into each kernel function).
Works for render-time hook bodies, whose callers hold the owner anyway. Fails for
the setter closures, which are the hot path and escape the render frame.
useState's setter (:5124-5153) currently calls six core functions; injectingthem per-closure adds up to six captured slots to every state hook in the
application. Reaching them through the already-captured
recordadds zero.C — A separate
servicesobject hanging off the root. One extra pointer hopper call and one extra allocation per root, to buy nothing: the six services are
already root methods.
D — Kernel base class that cores extend. Forces the kernel to own owner
construction, which is exactly what §0's "the kernel never constructs an owner"
rule forbids — it would put
LogicalRecord-shaped fields back in reach andconvert today's fixed-shape object literals (
:2147-2173) into a classhierarchy.
2.2 Hot-path cost
.rulesync/rules/core-engineering.mdmakes megamorphic call sites andobject-shape churn release criteria, so, precisely:
Call-site shape count. In a Lynx background bundle exactly one core is
linked, so every
owner.root.*site sees one hidden class — monomorphic,identical to today's
owner.root.scheduleOwned(owner)(:4950). In a web realmwith universal + a second universal-family core, two shapes — polymorphic,
inline-cacheable, still far from V8's 4-shape megamorphic threshold. Per-function
injection would not improve this; alternative A would, at the cost of
correctness.
Call frames on the setState path. Today:
scheduleOwner(owner, slot)(module-local) →
owner.root.scheduleOwned(owner)= two frames. After:owner.root.scheduleOwner(owner, slot)→this.scheduleOwned(owner)= twoframes. No change.
Property loads added. The setter path gains at most two:
record.rootforactiveAttempt()(replacing theCURRENT_ATTEMPTmodule read infindDraftOwner,:4963) andrecord.rootfortransitionBatchForUpdate()(replacing the module-local call at
:4874). On the common path — setState fromoutside render —
activeAttempt()returnsnullimmediately, so the added workis one load plus one monomorphic call against a path that already does a
Map.get, array pushes, and a schedule.Allocations added: zero. No wrapper objects, no per-call service bags, no
extra closure slots.
Object-shape churn: zero, by construction. Cores keep their own literals.
UniversalRootImplgainsprivate warmCache: Map<…> | null = null— aconstructor-initialized field, so no runtime shape transition.
One incidental win to measure, not to claim.
takeUniversalWarmValue(
:5868-5884) currently doesUNIVERSAL_WARM_CACHES.get(root)— a WeakMap hashlookup on every
useMemodeps-miss (:5552).host.warmCachemakes that aproperty load. I am not claiming an improvement: gate it on
benchmarks/async-waterfallandbenchmarks/universal-leaf-update, and if thesignal is inside noise, the zero-risk fallback is a kernel-module
WeakMap<KernelHost, Map>keyed by host, which needs no host member and no rootfield.
Pre-existing hazards the kernel must not worsen.
UniversalHookUpdateQueueis an
Arraysubtype carrying four optional own properties(
universal-kernel.ts:113-118) assigned post-construction (:4917-4938), anddiscardTransitionBatchdeletesqueue.rebases(:7923). The kernel must notadd further optional fields to that shape.
3. Dispatcher globals stay per-core, with a kernel-owned algorithm
Decision:
CURRENT_ATTEMPT,CURRENT_OWNER,CURRENT_LAZY_LEAF_OWNER,NEXT_HOOK_SLOT,UNIVERSAL_SLOT_STACK, andresolveHookSlotstay per-coremodule state. The kernel owns only the pure slot-composition algorithm.
Each core keeps
let NEXT_HOOK_SLOT,const SLOT_STACK, and exports its ownhookSlots/withSlot/resolveHookSlot, passing its own prefix.3.1 Why
The precedent already exists and is load-bearing.
runtime.tshas its ownnextHookSlot(runtime.ts:336-341), its ownslotStack(:5564), and its ownresolveSlotwith prefix'@octane:hook:'(:5590-5601), coexisting in onerealm with universal-core's
NEXT_HOOK_SLOT(:1230),UNIVERSAL_SLOT_STACK(
:1238), andresolveHookSlotwith prefix'@octane:universal-hook:'(
:4739). Two cores, two slot spaces, one realm, correct today.Sharing them would be a correctness regression, not just a cost.
withSlotfrom core A would be visible to core B'sresolveHookSlot,composing a wrapper path from another core into an unrelated hook's slot.
CURRENT_OWNERwould become a cross-core singleton, so a universal rootnested inside a DOM boundary (
universal-dom-boundary.ts) or arendererRegion(:1810) would clobber the outer core's current owner.And it would cost per hook. ESM live bindings are read-only across modules,
so a shared mutable
CURRENT_OWNERneeds accessor calls(
kernel.currentOwner()/kernel.setCurrentOwner(o)) — one call per hook plustwo per
executeOwnerframe, against today's direct module-slot reads at:4733,:4955,:2373.3.2 Why the compiled hook-slot ABI keeps working
This is the part that makes the decision safe, and it needs no compiler change
at all.
hookSlots/withSlotfrom their renderermodule, not from a fixed path: both names are in
UNIVERSAL_COMPILER_RUNTIME_IMPORTS(compile-universal.js:3808,:3812),and the module is renderer config data —
module: '@octanejs/lynx/renderer'(packages/lynx/src/config.runtime.js:218),which today is
export * from 'octane/universal/native'(
packages/lynx/src/renderer.ts:15). The L2 cutover is that one re-exportline. A module compiled for
target: 'lynx'and the same module compiledfor the universal target simply bind to different cores.
compiler-owned render scope emits a plain integer literal
(
compile.js:18366). OnlyforceSymbolsites — custom hooks and callablehelpers that can share a caller's scope across modules — draw from
hookSlots(compile.js:18361-18364).path never mixes symbols from two cores. It cannot: a hook compiled against
core B needs core B's
CURRENT_OWNER, which is null during core A's render, soit throws at
:4734-4736before any slot is composed. Cross-core hookcomposition is already unsupported — the counter split does not create that
constraint, it inherits it. §5, slice 6 pins it with a test.
composeSlotKey's first argument) soSymbol.forinterning cannot alias two cores' paths even if a future changemakes them meet.
4. Owner claiming stays out of the kernel — confirmed
Confirmed:
currentDraftOwner→activateLazyLeafOwner→claimChildOwnerdoes not move, now or later.
That chain (
:4953-4960→:2365-2385→:2307-2317→findClaimableChildRecord:2254-2290→createOwnerRecord:2140-2174→adoptChildOwner:2292-2305)touches
parent.record.children,identityPath,key,component,claimedChildren,sequentialClaimCursor,childOwnerBuckets,childClaimCursors,childReplayOrdinals,replayPath,attempt.owners,record.rangeKey,record.id, andrecord.renderer— the entire runtime owneridentity model. #58 L3 replaces exactly that model with compile-time
template/slot identity, so extracting it would freeze into the kernel the thing
the roadmap deletes.
The narrowest hook the kernel needs from the reconciler side is two calls, and
one of them is not a hook at all:
Nothing, at hook entry. Because each hook body's first two lines already
resolve the draft and the slot (
:5115-5116,:5178-5179,:5405-5406,:5492-5493,:5536-5537,:5571-5572,:5610-5611,:6141-6142), theseam is: that two-line prologue stays per-core; everything after it is
kernel. The kernel signature is
kernelUseState(draft, slot, initial)— thecore has already claimed.
host.activeAttempt(), inside setters and getters.findDraftOwner(
:4962-4969) answers "is there a live draft for this record?" from outsidethe render frame. Making it a host-mediated read of the attempt (rather than a
kernel global) is what lets a Lynx core replace the O(rendered-owners) backward
scan of
attempt.ownerswith aMap<record, draft>without touching thekernel.
That is the whole reconciler-side surface.
resolveHookSlotstays core-side withit, which is also why
implicitSlotis absent fromKernelDraft(§1.3).5. Migration map: §5 slices 2–5
Every guard below renders through a real universal root —
createUniversalRoot(createObjectContainer(), createObjectDriver())or thecontrolledObjectRoot()helper (universal-scheduling.test.ts:58-87) — per the#64 review requirement. Standalone helper assertions do not count as wiring
evidence. Each guard names the specific drift it fails on, so it has a credible
pre-change failure.
The existing behavioral suites (
universal-scheduling,universal-activity,universal-retained-suspense,universal-event-scope,universal-renderer)must pass unmodified at every slice; a test edit in those files during an
extraction slice is a drift signal, not a fix.
Slice 2 — owner abstraction (§5 item 1)
Land
KernelOwner/KernelDraft/KernelAttemptas interfaces only.UniversalOwnerRecord(:1063),DraftOwner(:1135), andRenderAttempt(
:1102) gainextends; no function moves;nextUniversalId→nextHookId(one compiler-checked rename, one reader at
:5617). The whole slice istype-level, so
pnpm typecheckis the conformance gate.New
packages/octane/tests/universal-kernel-owner.test.ts:setStatere-runs the component once and schedules nothing (controlledObjectRoot().scheduled.length === 0)needsRender/clonedHooksdrift, orexecuteOwner's reset (:2434) stops clearing the drafted flagapplyUniversalHookUpdateQueuedriftroot.unmount()neither throws nor schedulesdisposeddriftActivitykeeps its parked draft until the source generation changesvisibilitydrift on record and draft (:5219,:5309,:5345)hooks/seenEffectsdriftuniversal-core.tsdeclares theextends/implementsclausesSlice 3 —
scheduleOwnerinjection (§5 item 2)Move
:4941-4951ontoUniversalRootImpl.scheduleOwner; the kernel callsowner.root.scheduleOwner(owner, slot). The profiling hop and thedirtyEpochancestor stamping (
:7754-7760) stay core-side, so the kernel ships noprofiling branch into the Lynx bundle.
universal-kernel-owner.test.ts: N setStates across M owners in one tick schedule exactly one microtask on a controlled rootdirtyEpochstamping got pulled through the seamoctane-profilevitest project:profiler.why(Component)[0].causesstill contains thestatecause with its hook name after a setState through a real root (profiling.test.tsshape;profiling.ts:363)scheduleOwnermoved behind the hostbenchmarks/universal-leaf-updatesiblings-4000 / siblings-0ratio holdsSlice 4 — transition batches (§5 item 3)
Split by state ownership, not by topic. Kernel takes only the owner-touching
operations:
stageTransitionUpdate(:4881-4902),enqueueHookUpdate(
:4904-4939),applyHookUpdateQueue(:4971-5037),hasUpdatesForAttempt(
:5039-5055), and the per-owner queue surgery insidediscardTransitionBatch(
:7896-7925). Core keeps the ambient counters (:1220-1227),createUniversalTransitionBatch(:4765),tickUniversalTransitionCount(
:4779),settle(:4790),finish(:4800),promote(:4819),queuePromotion(:4849), andstartTransition(:6161).Promotion is 25 lines reading two kernel-owned fields; duplicating it in the
Lynx core is correct, not wasteful — #58 open question 4 says the new core
"should not inherit" the missing lane scheduler, so freezing today's promotion
policy into the kernel would be speculative generality.
universal transition schedulingdescribe (31 tests,universal-scheduling.test.ts:178-1160) passes unmodified:840"re-homes promotion when the first of multiple staged roots unmounts"queuePromotionfallback order (:4860-4871: first live staged owner's root, then the realmqueueMicrotask, thenPromise.resolve) changed:463"does not eager-bail an urgent value that must rebase a queued transition"needsUrgentRebase(:5144) lost sight ofqueue.batchesacross the seamuseTransitionin root B observes root A's pending transition (today's behavior:UNIVERSAL_TRANSITION_PENDING_COUNTis module-level at:1225, read at:5710, notified through the module-level listener set at:5714)Slice 5 — root services in hooks (§5 item 4)
formatUniversalIdandreadBridgeContextare already root methods; the work iswarmCachemoving from the module WeakMap (:5855-5858) to a root field, anduseIdreadinghost.formatUniversalId.useIdvalues; the same root's IDs are stable across re-render; an abandoned attempt reuses its ID (the invariant documented at:7043-7046)nextUniversalIdadvance moved to the wrong side of acceptuseBatchwarm plan starts a fetch exactly once and the realuseMemoconsumes that value; root A's warm entry is not consumable by root Buniversal-renderer-boundaries.test.tsshape;:7030-7036)readBridgeContextdrift, and the pre-registration for the context sliceSlice 6 — confirm the non-move (§5 item 5)
No code moves. One new guard pins the invariant that makes §3 safe:
forceSymbol/withSlotpath,compile.js:18361-18364)NEXT_HOOK_SLOTor the slot stack a shared kernel singleton6. Unresolved
design. §5's boundary description names them, but §5's ordered blocker
list is items 1–5, all hook/scheduling. The commit-time effect diff
(
:10810-10886) is entangled withdraftedRecords,retainedOwnerRoots, andparent-first/post-order owner walks. This interface must not preclude their
later extraction — but I have not verified that it doesn't. That verification
is the first thing the effect slice should do.
attempt.scoperenderer-region walk (:2400-2408) and per-readCURRENT_MEMO_CONTEXT_READStracking (:2396). Whether the Lynx core wantsthe
memocontext bailout at all is open.warmCacheas a host field vs. a kernelWeakMap<host, …>is measurement-gated, not decided by argument. Default to the field; fall back to the
WeakMap if
async-waterfall/universal-leaf-updateshow nothing.a static count of loads, frames, and allocations. Per
.rulesync/rules/core-engineering.md, the release criterion is the benchmarkpair, per slice:
universal-leaf-update(setState scaling) and thelynx-tableupdate_storm/update10th/selectgates.universal case is real today (
universal-dom-boundary.ts); universal + aLynx-specialized core in one realm is not, and the 2-shape polymorphism
argument in §2.2 is untested for it.
findDraftOwner's O(rendered-owners) backward scan (:4965-4967) isinherited, not fixed.
host.activeAttempt()is deliberately shaped so acore can add a
Map<record, draft>later. Doing it inside an extraction slicewould violate the zero-drift rule.
RenderAttempt.implicitSlot(:1111) appears dead — the only readers areowner.implicitSlot(:2435,:4737). Unrelated cleanup; flagged so it isnot mistaken for a kernel field.
__scheduleMicrotask,formatUniversalId, androot(rather thanhost) in a shared kernelinterface. The alternative is a rename sweep inside a mechanical extraction,
which trades reviewability for cosmetics. If the rename is wanted, it should
be its own commit before slice 2.
Generated by Claude Code
Huxpro commentedon Aug 18, 2026
L2 delta protocol: closure analysis and final opcode set
Design analysis for the §3.4 opcode set (
docs/lynx-specialized-target-l0.md:141-171): isRUN/SET/REMOVE/MOVE/BRANCH+ range framing closed and unambiguous over every structure Octane templates can express? Worked on the #58 stack head (claude/octane-issue-58-l3-direct-first-screen), against the L0 spec, the L0 prototype, and the current universal wire. Design only; no code changed.Verdict: refuted as drafted — closed under the amendments below (A1–A6), none of which invents machinery the universal wire doesn't already ship. Each failure is an under-specification of something the current protocol already solves, so every amendment is a re-typing of a mechanism that exists today. After applying them, all six cases re-verify.
The lemma that does most of the work: today's wire is already structure-free and id-addressed, and it already carries every structure in this list. The command union (
packages/octane/src/universal-core.ts:548-620) has no branch, key, range, boundary, or component notion. Ranges flatten to physical hosts before placement (universal-core.ts:4216-4233) and range records get ids that are never transported (universal-core.ts:9645).@if/@switchare background scope keys (universal-core.ts:3046-3064, claiming viamaterializeScoped,universal-core.ts:2632-2655);@tryarms are keyed'try'/'pending'/'catch'scopes plus visibility (universal-core.ts:3457-3476); Activity is a visibility state (universal-core.ts:3024-3044); keys never cross the wire (universal-core.ts:9695-9715). So closure reduces to: can the typed set name the four capabilities the flattened form needs — create a typed region, point-write a stable identity, place/detach by identity, flip visibility — at (template, instance, slot) granularity? The draft covers the first three and omits the fourth; its addressing is undefined where it matters. Cases below.@if/@switchinside keyed@foritemsBRANCH(slot, …)lacks the instance coordinate; single-template arms onlyMOVEs@tryswaps + Suspense retryBRANCHcan't express it; no visibility op@for @empty, nested keyed, Activity interleaved withSETAmendments (summary, details in the table at the end)
firstInstance), never reused within a generation. First-screen instances are numbered by creation ordinal, which is exactly the §3.6 adoption identity (docs/lynx-specialized-target-l0.md:182-193), so adoption seeds the id space. This is the existing discipline: hosts get densenextId++(universal-core.ts:9645,9757-9760), template mounts reserve dense id blocks and declarefirstIdon the wire (universal-core.ts:9610-9622,:571-580). Positional indices (the prototype's model) are rejected as the normative reading — case 2 shows the ambiguity.(instance, anchorSlot)(plus a ROOT sentinel). The applier owns an ordered member list per anchor;beforeoperands are member instance ids orEND.RUN/MOVE/BRANCH/CLEARaddress anchors. This replaces §3.4's un-anchoredBRANCH(slot, …)and the prose-level "range is (anchorSlot, member list)" (docs/lynx-specialized-target-l0.md:157-161) with one addressing rule. Ranges themselves stay background-only, exactly as today.SHOW(instance, visible|hidden). New opcode; the port of the existingvisibilitycommand (universal-core.ts:614-618, staged at:10214-10246). Without it, Activity and retained Suspense are inexpressible — both require the visibility capability today and throw when a driver lacks it (universal-core.ts:3026-3030,:3463-3467,:3493-3497; the Lynx driver declares it,packages/lynx/src/core/client-driver.ts:1331).BRANCHis demoted to an optional fused compression (≡CLEAR+RUN), valid only for the single-template-arm special case.packages/lynx/src/core/host-driver.ts:3863, membership checks against the staged sibling list at:3952-3958; batch phase order atuniversal-core.ts:10695-10706).propsSlotspreads) either get banned for.lynx.tsrxintrinsics or mount as single-host pseudo-templates (implicit child anchor + a reservedSETP(instance, name, value)op). Recommendation: ban, keepSETPreserved. Case 5.Case 1 — nested
@if/@switchinside keyed@foritemsFixture:
@for (item of items; key item.id) { <li> @if (item.flag) { <b>{x}</b> } @else { <i>{y}</i> } </li> }. The L2 compiler splits templates at dynamic holes (docs/lynx-specialized-target-l0.md:104-106):T_item=liwith slot 0 = branch anchor;T_then=b[slot 0: text];T_else=i[slot 0: text].Mount two items (
a_listis the list anchor; item keys live only in the background, as today —universal-core.ts:9695-9715):Commit that swaps the items and flips item 10's branch:
Does instance addressing survive the move? Yes, by construction under A1/A2: instance 10's id is position-independent, and the anchor coordinate
(10, 0)names a slot-table entry, not a location in any sibling order. Stronger: theMOVEand the two arm ops commute — ops on an anchor's member list are order-sensitive only against other ops on the same anchor. The background stays free to emit phase-grouped streams (today's batch is grouped: creates → … → removes → placements → visibility → destroys,universal-core.ts:10695-10706) without changing meaning.What breaks in the draft:
BRANCH(slot, templateId | none, values…)(docs/lynx-specialized-target-l0.md:157-158) carries no instance coordinate, so "slot 0 of whichT_iteminstance?" is unanswerable — branch anchors are per-instance the moment a branch sits inside a@foritem. Second, "both arms are compile-time-known templates" is false in general: an arm containing a component (or multiple roots, or text holes mixed with hosts) is not a single template — the current compiler itself refuses to template-compile any plan containing component/if/switch/range nodes (packages/octane/src/compiler/compile-universal.js:3920-3941). Under A2+A4 the arm mount is a sequence at(10, 0)and the case closes. Nested@switchis identical: today its selector is just a different scope key (case index or'default',universal-core.ts:3052-3064), and a swap isREMOVEs + creation ops at the same anchor.Verdict: refutes the draft's
BRANCHaddressing and arm assumption; closed under A1/A2/A4.Case 2 — keyed reorder as LIS
MOVEs: addressing mid-sequenceThe normative model to port is what
planPlacementsalready does (universal-core.ts:10143-10163over the LIS at:4241-4266): walk the new order left→right; LIS members ("stable") are never moved; every non-stable survivor emitsMOVE(id, before = next stable id or END)(:10156); departing members were already removed (:10115-10121, removes precede placements in the batch,:10702-10703).Walkthrough,
[A B C] → [C B A](ids, not positions): old positions of the new order =[2, 1, 0]; LIS ={A}(new index 2). Emission:Unambiguity proof sketch. (i) Ids are position-independent, so the only order-sensitive binding is
before→ position. (ii) The emission discipline guarantees everybeforetarget is an LIS member orEND; LIS members are never moved in the pass, and their relative order is already final (they are an increasing subsequence of the old order). (iii) Under sequential semantics (A5), consecutive inserts before the same stable target preserve emission order (insert-before-S lands immediately before S, after anything previously inserted before S) — the same resolution today's applier performs by lookingbeforeup in the current staged sibling list (host-driver.ts:3952-3958). By induction over the new order, the member list after the last op equals the new order. Fresh members interleave identically (RUNwith the samebeforerule; consecutive same-anchor same-target runs coalesce intocount > 1exactly asmount-template-runstaging does today,universal-core.ts:10032-10046). Items whose body has several roots move as consecutive per-instanceMOVEs with the samebefore— order preserved by (iii).The normative answer to "pre-move or post-move order": neither — order is never an operand. Addresses are ids; the id→position binding is resolved against the member list as of each op (A5); and the emitter discipline makes every
beforetarget order-invariant anyway. The question is only unanswerable under positional addressing, which is the strongest reason to reject it: the prototype addresses rows by mutable table index (benchmarks/lynx-table/prototype/lepus-root.js:209-240—REMOVEsplices the table at:221-222,SWAPswaps entries at:234-238), so the meaning of[MOVE 2 before 0, MOVE 1 before 0]depends on whether index 1 is read before or after the first op applied. That is fine for a hand-written fixture with one flat range and two slots per row (lepus-root.js:46-49) and disqualifying for a compiler target with nesting.Normative ordering (two layers): applier contract = sequential definedness only (that is all validation enforces); emitter contract = per anchor, removes first, then placements in new order with
before ∈ LIS-stable ∪ END. The LIS computation itself stays in the background kernel, where the L0 spec already puts it ("the keyed LIS reconciler over abstract instance handles",docs/lynx-specialized-target-l0.md:235-237); the survivor-identity and final-order guarantees are unchanged, and theswapwire gate holds by construction (a 2-swap is 1MOVE).Verdict: closed and unambiguous under A1/A5 + the stated emitter discipline; the draft was silent on all three.
Case 3 —
@try/@pending/@catchswaps and Suspense retryCurrent semantics to preserve (all in
universal-core.ts): arms are keyed scopes'try'/'pending'/'catch'(:3457-3476); a suspend over a committed body retains it — every host in the arm flips tosuspense-hidden(:2756-2769) and the pending arm mounts alongside the retained one inside the same boundary range (retainCommittedTryArm,:2771-2791, composed as[...retained, ...pending]at:3461-3469and:3489-3505); this path is gated on the visibility capability (:3463-3467). A suspend with no committed body discards the speculative draft and mounts pending only (:3507-3511). Wire ids cannot leak from abandoned attempts at all: host ids are minted during commit-side reconciliation (:9644-9648), which a suspended attempt never reaches — even speculativeuseIdallocations are rolled back (:2649-2652).Op sequences at boundary anchor
a_B:Instance lifetime across retry — the normative rules:
universal-core.ts:10695-10707); suspended/aborted attempts emit nothing and reuse nothing. "Instances already delta-addressed" can therefore only mean committed instances.RUNs it and dies in the message thatREMOVEs it; ids are never reused within a generation (A1).SHOW, notREMOVE. Hidden instances remain fully addressable — the update-staging path never checks visibility; only refs and events gate on it (universal-core.ts:10752-10777,:10277-10293).'try'arm is re-claimed by key,:2773,:9695-9715), so surviving hosts keep their ids and every previously issuedSETaddress stays valid; structural changes inside the retried body are ordinary case-1/2 op sequences against those live ids.What breaks in the draft: "boundary swaps are
BRANCHat the boundary's anchor" (docs/lynx-specialized-target-l0.md:159-161) models the boundary as a single-occupant slot — but the retained path is not a swap: hidden body and pending arm are simultaneous members of the anchor. And the draft has no visibility opcode at all, while the retained path is defined in terms of the visibility capability. Multi-member anchors (A2), arm-as-sequence (A4), andSHOW(A3) close it.@catchneeds nothing extra: the error path does not retain (:3513-3528), so it isREMOVEs + creation ops, andreset()is background-only.Verdict: refutes the draft (no
SHOW, single-occupantBRANCH); closed under A2/A3/A4 with lifetimes L1–L4.Case 4 —
@for @empty(N→0→M), nested keyed ranges, Activity interleaved withSET@empty. The empty arm is just another background scope ('for-empty',universal-core.ts:3431-3433; first-screen equivalent atpackages/lynx/src/main-renderer.ts:871-878). N→0→M at anchora_for:No range identity is needed on the wire — matching today, where ranges are never transported (
universal-core.ts:4216-4233,:9645). The draft's range framing is right about that; it just needs A2's anchor addressing to say where.Nested keyed (
@forin@for).T_outer=ul[slot 0: anchor]; inner items mount at(outerInstance, 0). Each anchor reorders independently with case-2 discipline;MOVEs on distinct anchors commute (A5); an outerMOVEcarries the whole element subtree, and inner anchor coordinates are untouched because they are instance-relative, not position-relative. Closed by the case-1 argument; duplicate-key rejection stays a background throw (universal-core.ts:9704-9706), never a wire concern.Activity interleaved with
SETs. Activity is an owner whose subtree renders and updates while hidden (universal-core.ts:3024-3044— the body executes regardless of mode at:3040-3042), and its wire form is visibility commands (:10214-10246). So the interleaving is literally the point:Normative rules:
SET/RUN/MOVE/REMOVEare visibility-independent (matches today: only events and refs gate on visibility,:10277-10293,:10769-10777); within a message, hides run descendants-before-ancestors and reveals ancestors-before-descendants, preserving the attached-resource contract stated atuniversal-core.ts:10240-10241. A fresh mount inside a hidden region isRUN+SHOW(hidden)in the same message — atomicity (case 6) guarantees no intermediate paint, mirroring today's is-new hidden staging (:10220-10226).One applier obligation surfaced here (not a wire question): empty-anchor insertion points. Adjacent anchors with no members between static siblings (
<view>@if(a){…}@if(b){…}</view>) mean anchor k'sENDmust resolve to "before the first member of the next non-empty anchor, else the next static sibling element, else parent end." The applier owns every member list, so this is a bounded local chain, needing no marker elements. Flagged in the not-proven list for cost, not correctness.Verdict:
@emptyand nesting were already closed; Activity refutes the draft's missing visibility op; closed under A3/A5.Case 5 — mixed eligibility: children under fallback-plan subtrees
Current split, for the record: a plan compiles to a create-function template only if every node is host/text/slot with static prop names — any component/if/switch/range node,
propsSlotspread, orkey/ref/childrenprop keeps the interpreted encoding (packages/octane/src/compiler/compile-universal.js:3920-3941, gate at:4051-4063); the main-thread first-screen interpreter for that encoding isrenderPlanNode(packages/lynx/src/main-renderer.ts:757-810).The decisive observation: the eligibility boundary does not exist on the wire, today or in L2. Interpreted plans are a background/first-screen encoding; by the time anything transports, the background core has interpreted them into the same id-addressed host commands as everything else — the command union simply has no plan notion (
universal-core.ts:548-620). So "how does a delta stream address children under a fallback-plan subtree" decomposes:@if/@switch/@forplan nodes are never wire entities. Components are rendered through (their output is their own module's templates); directives compile to anchors in L2 (§3.4) and are background scope keys today (universal-core.ts:3046-3064). Dynamic component types (componentSlot,main-renderer.ts:769) resolve at render time and never transport. Children-as-renderable-prop is an anchor. Nothing here needs addressing across any boundary.propsSlotspreads (main-renderer.ts:800-801, ineligible atcompile-universal.js:3932). A slot table cannot pre-bind a setter for a name it does not know. Today only main-thread render-only host spreads are rejected ("first-screen event and ref props must be statically named",compile-universal.js:3108); background-graph host spreads remain legal and ship prop bags.Two closing moves, either sufficient:
.lynx.tsrxintrinsics (extend the:3108constraint from the render-only layer to the target), making eligibility total over hosts. Recommended: it matches the "statically-named host props" discipline Roadmap: replace the universal-renderer target for Lynx with a Lynx-specialized compiler and renderer #58 already names, and it is the only option that deletes prop-bag machinery entirely.SETP(instance, name, value)for named writes. This embeds today'screate/updatevocabulary pointwise.SETPis also where the one survivingrecreatecase lives: recreation is triggered only by removing a CSS scope, which the PAPI cannot express in place (packages/lynx/src/core/host-props.ts:106-107,:562,:686; classification atpackages/lynx/src/core/client-driver.ts:1476). Compiled templates cannot hit it — their CSS scope is static structure (§3.1) — soSETnever recreates; a pseudo-template applier handles it internally (rebuild from slot table + member lists), with no wire op.Under either move, the boundary never needs cross-addressing: fallback hosts (if they exist) get ordinary instance ids, anchors inside them work identically, and a keyed list may mix template instances and pseudo-instances because
MOVE/REMOVE/beforesee only ids. The choice changes the opcode table's size (dropSETPunder the ban), not its closure.Verdict: closed under A6 either way; the ban is recommended; the open policy choice is listed below as unproven.
Case 6 — commit atomicity and intra-message ordering
Today: one commit message carries one batch (
universal-core.ts:656-659), versions are monotonic per commit (:10707), a prepared batch is rejected if superseded (host-driver.ts:4965-4968); commands within a batch are causally ordered and same-batch-referential — the apply loop walks them in order against staged state (host-driver.ts:3863),beforetargets must exist in the staged sibling list at that point (:3952-3958), and the batch's phase grouping (creates → updates → instance/event/callback ops → removes → placements → visibility → destroys,universal-core.ts:10695-10706) has placements routinely referencing same-batch creates.Normative for L2:
lepus-root.js:245). Message versions are dense and monotonic per (root, generation); the supersession/ack/accepted-fault framing ports as contract, not encoding (this issue's framing bullet).SETmay reference an instanceRUNcreated earlier in the same message; more importantly it must be able to, because nested mounts areRUNinto an anchor of a same-message instance (case 1) and hidden-region mounts areRUN+SHOW(hidden)(case 4). An id is dead immediately after itsREMOVE; referencing it later in the message is a protocol fault.RUN(a same-messageRUN+SETon one instance is legal but non-canonical); per anchor, removes before placements, placements in new order per case 2; hides descendants-first, reveals ancestors-first (case 4). None of this is needed by the applier for correctness — it keeps emission simple, diffable, and at the wire floor.Verdict: defined; the draft's "one message per commit" stands, with sequential same-message referencing made normative.
Amended normative opcode set
Instance ids: dense uints per (root, generation), minted by creation ops in declared order; first-screen instances take their §3.6 creation ordinals, so adoption is the identity map into the id space (
docs/lynx-specialized-target-l0.md:182-193; today's analogue: densefirstIdblocks (universal-core.ts:9610-9622) and the first-tree adopt/repair decision (host-driver.ts:4926-4939), which §3.6 collapses to an index walk). Anchor =(instance, anchorSlot)orROOT. Slot kinds are compile-time per template (§3.3):text | attr(name) | class | style(name) | event-site | anchor;stride(t)= count of value-bearing (non-anchor) slots. Event sites register once at create with instance-embedded tokens (§3.5) and never appear as delta ops; add/remove/hidden-gating of listeners becomes a background delivery decision (replacing today'seventcommands and their visibility gating,universal-core.ts:10263-10293).RUNt, anchor, before, count, firstInstance, values[count×stride(t)]firstInstance … firstInstance+count−1of templatet; insert as consecutive members ofanchorbeforebefore. Nested content arrives as subsequent ops targeting the new instances' anchors.t < templateCount;count ≥ 1;values.length == count×stride(t); each value scalar and kind-compatible;firstInstance == next expected id(dense) and end within id range;anchorlive and of kind anchor;before ∈ members(anchor) ∪ {END}. Mirrors today's run checks (host-driver.ts:3879-3909,:3952-3958).SETinstance, slot, valueinstancelive;slot < slotCount(template(instance));kind(slot) ≠ anchor; value scalar and kind-compatible.MOVEanchor, instance, beforeanchorlive;instancelive and∈ members(anchor);before ∈ members(anchor) ∪ {END};before ≠ instance.REMOVEinstanceinstancelive. (Liveness clearing is O(subtree), the same order as the engine removal itself.)SHOWinstance, stateuniversal-core.ts:10214-10246).instancelive;state ∈ {0,1}.CLEAR(optional)anchorREMOVEof every member, last-to-first. Compression for N→0 and unmount-all (prototype precedentlepus-root.js:204-208).anchorlive.SETP(reserved)instance, name, valueinstancelive and pseudo-kind;namea string; value scalar.BRANCH(optional fusion)anchor, t | NONE, firstInstance, values[stride(t)]CLEAR(anchor); then, unlessNONE,RUN(t, anchor, END, 1, firstInstance, values). Only for single-template arms; every other arm shape uses the general sequence (A4). Not required for closure.CLEAR+RUN(count=1).Message header validation: protocol version constant; root/renderer identity; generation match (generation bump resets the id space and liveness state — fault/teardown port); commit version dense-monotonic with supersession rejection (
host-driver.ts:4965-4968semantics). Ops are self-delimiting via fixed scalar arity + declared counts.Validation cost claim: every rule above is O(1) per op or per value with a liveness bitset + per-template slot metadata + member-index maps; total O(message length), zero recursive structural walks — because no structural values exist on the wire, only slot-typed scalars. This is the §3.4 validation goal (
docs/lynx-specialized-target-l0.md:163-167) made concrete, versus today's unconditional recursive command/prop validation (packages/lynx/src/core/protocol.ts:1648; the outbound twin is dev-only by design,:1627-1640). With a binary typed encoding (flat numeric stream + string table, the prototype's shape), the scalar-type checks become free by construction and only arity/bounds/liveness remain.Re-verification of all cases against the amended set: case 1 ✓ (A1 ids survive
MOVE; A2 anchors name per-instance branches; A4 arms as sequences); case 2 ✓ (A1+A5 dissolve the pre/post question; emitter discipline proven convergent;SHOW/SETPdon't touch member lists, and moving hidden instances — e.g. a retained-suspended item inside a reordered keyed list — is legal becauseMOVEis visibility-independent); case 3 ✓ (A2 multi-member anchors + A3SHOWexpress retain-and-pend; L1–L4 lifetimes); case 4 ✓ (@empty= plain member turnover; A3 interleaving rules); case 5 ✓ (uniform id space; boundary invisible under ban orSETP); case 6 ✓ (A5 is the ordering contract;RUN→SET/RUNsame-message references required and validated by definedness). The wire-floor gates hold by construction:update_storm/selectare 1SETper change,swapis 1MOVE.What I could not prove (and why)
SETP). Closure holds under either, but the final table cannot be frozen without the decision. Today the constraint exists only for the main-thread render-only layer (compile-universal.js:3108); background-graph host spreads are legal andpropsSlotmerely falls back (:3932). This is an L1 compiler-policy call, not derivable from the L0 spec.universal-core.ts:10122-10131,:10185-10212); the L0 spec never mentions portals. Anchors extend naturally (a portal target = an externally minted anchor id), but I cannot verify that against the Lynx portal/NodesRefsurface from the spec alone. L4 item; until then cross-anchorMOVEstays out of the normative set.componentAtIndexcreates cells outside the message flow, so cell-local instance-id spaces (or a reserved id band) are assumed, not proven — and the lists-excluded-from-adoption divergence is explicitly revisited in L4 (docs/lynx-specialized-target-l0.md:195-200).SETimpossibility rests on CSS scope being static per compiled template (§3.1) — true for every slot kind defined here, since today's only recreate trigger is CSS-scope removal (host-props.ts:106-107,:562,:686). A future slot kind with create-only PAPI semantics would need the applier-internal rebuild path; unprovable for kinds that don't exist.universal-core.ts:10170-10181). Bounded anchors subsume this by construction, but the equivalence for the memo-bailout/lane-scheduler scopes L2 intends to add (Roadmap: replace the universal-renderer target for Lynx with a Lynx-specialized compiler and renderer #58 open question 4) is asserted, not proven.Generated by Claude Code
Huxpro commentedon Aug 18, 2026
L2 delta protocol: closure analysis and final opcode set
Design-only analysis against
claude/octane-issue-58-l3-direct-first-screen(head of #59→#63→#64→#65). No code changed.
Overall verdict: the §3.4 opcode set as written is NOT closed and NOT
unambiguous. Four independent breaks, three of them fatal to the draft as
literally specified:
RUN(templateId, anchorSlot, …)andBRANCH(slot, …)name a slot with noinstance. A slot index is per-template, so in a 10k-row list
anchorSlot=3names 10k distinct anchors. Every address must be a pair.
BRANCHcannot express@tryretention, where the old arm and the pendingarm are both live at once (
universal-core.ts:3468,:3505-3511), nor anarm that is not exactly one template.
are pure visibility transitions over instances whose identity does not change
(
universal-core.ts:3033,:2756-2768).the "header-only validation" claim rests on.
Everything else survives, and the amended six-opcode set in (b) is closed and
unambiguous over every structure I could construct, with the four gaps in (c).
§0 — The five facts the whole analysis rests on
Stating these first, because every verdict below is a corollary.
F1. Ranges are logical, and placement is over the flattened physical list.
LogicalRecord.kindis'range' | 'host' | 'portal'(universal-core.ts:938-940).physicalRecords/physicalDraftsflatten every range to its host descendants(
universal-core.ts:4216-4232), andplanPlacementsruns per physical parentover that flattened list (
universal-core.ts:10166-10190). So@ifarms,@foritems,@tryarms and component outputs have no physical container.F2. A template has exactly one physical root.
UniversalHostTemplateShapeNode.parentis documented as "Earlier shape-nodeindex, or -1 for the template's one physical root"
(
universal-core.ts:485-489), and eligibility requiresplan.root.kind === 'host'(
compile-universal.js:4055). So an instance handle can denote its root nodewithout ambiguity.
F3. Every directive already compiles to a
slothole.@for,@if,@switch,@try,Activity, component calls and bare dynamic expressions allroute through
addDynamicAst, which emits{kind:'slot', slot}(
compile-universal.js:3048-3052, called at:3215Activity,:3265component,:3518@for,:3538@if,:3566@switch,:3582@try,:3611expression).
lynxTemplateEligibleacceptskind === 'slot'(
compile-universal.js:3930). A template containing an@ifis eligibletoday — this is stronger than the L0 spec assumes, and it is what makes Case 5
provable without a compiler change.
F4. Placement anchors are identities, and they are provably immobile.
planPlacementsemitsbefore: newPhysical[nextStable].id(
universal-core.ts:10156) wherenextStableindexes an LIS-stable survivor(
universal-core.ts:10143,stableUniversalPlacementPositionsat:4239).Stable entries are never emitted as
insert/move(universal-core.ts:10144-10152)and always have
sources[i] !== -1, i.e. they pre-existed this commit. Theout-of-scope fallback
endAnchoris "the first physical host that follows thescope … Untouched siblings cannot move during a scoped commit"
(
universal-core.ts:8438-8463).F5. Commits are transactional on the background side and validate-then-apply
on the main side. A suspending attempt is discarded and emits nothing
(
universal-core.ts:8362-8366,:8386-8390). On the main thread, failurebefore the first mutation is a rejection; after
mutationStartedthe messageis accepted and the fault is terminal, never rolled back
(
main-thread.ts:2190-2202,host-driver.ts:3465,:4979).(a) Verdict per case
Case 1 — nested
@if/@switchinside keyed@foritemsVerdict: addressing survives, but only after amendment A1. The draft's
BRANCH(slot, …)/RUN(…, anchorSlot, …)form is refuted here.Separately: closed but not compact — this shape falls off the
RUNpathentirely today.
Source:
The item plan root is a host; its children are a text host and a slot node
(F3).
lynxTemplateEligible→ true, so a create function is emitted(
compile-universal.js:4054-4056). Slot kinds come out as['p:class', 'c', 'c']today — and that second'c'is the bug:lynxTemplateSlotKindsmarks atexthole and a renderableslothole withthe same kind
'c'(compile-universal.js:3944-3951). One is a scalar theprotocol writes with
SET; the other is a child range the protocol fills withRUN. Conflating them makes the opcode-to-slot-kind dispatch undecidable.Arm identity:
@ifclaims its owner with key1|0(
universal-core.ts:3050) and@switchwith the case index or'default'(
universal-core.ts:3064). A different key ⇒ a different owner record ⇒ adifferent
rangeKeysymbol (universal-core.ts:2157,:2517) ⇒sameRecordShapefails (universal-core.ts:4068-4074) ⇒ an arm swap is ateardown + create, never an in-place mutation.
Amended template table (§(b) slot kinds):
v1 — three rows a,b,c, all shut. Chrome is instance 1 with a rows range at
slot
sR.v2 — reorder to
c,a,band open rowbin the same commit.Keyed matching holds the row instances at 2=a, 3=b, 4=c (the item key becomes
the owner key at
universal-core.ts:3418, and the owner'srangeKeybecomes therecord key, so the reconciler's keyed branch re-claims it,
universal-core.ts:9695-9714).newPhysical = [4,2,3],sources = [2,0,1],LIS =
{1,2}⇒ stable = instances 2 and 3.Three things to read off this:
(3, s3)— instance-qualified. Under the draft'sBRANCH(slot=3, …)this message is unwritable: slot 3 names one anchor perrow. A1 is mandatory, not cosmetic.
4moving does not renumber, re-slot or re-address anything. Handlesare allocated once and never reused (
universal-core.ts:6599,:9645,:9758).(2,s0)is an LIS survivor, so by F4 nothing later in this messagemoves it.
Compactness break.
RUNcoalescing requires the collapsed template program,and
universalHostTemplateShapeencodes aslotnode as a#textshape node(
universal-core.ts:4285);prepareCollapsedTemplateValuesthen demandsstring | number | bigintfor that binding (universal-core.ts:3966-3972). AuniversalIf(...)object fails,dense === null, and the list drops off thecompact path (
universal-core.ts:3328). So today a keyed list whose item bodycontains any directive mounts item-by-item. Amendment A6 (
ras a distinctslot kind) is what unblocks it; A10 (
RUN_EACH) is what makes the nested armsone op instead of N.
Case 2 — keyed reorder as LIS
MOVEsVerdict: closed and unambiguous. Neither pre- nor post-move order: addresses
are identities, and anchors are position-invariant across the whole message.
Worked example,
[a,b,c,d,e](instances 1..5) →[c,a,e,b,d]:Walk (
universal-core.ts:10145-10163),nextStablestarts at 0, advances pastnon-stable entries:
MOVE 3, (P,sR), before=(1,s0)— anchor =newPhysical[1]= anextStable→ 3MOVE 5, (P,sR), before=(2,s0)— anchor =newPhysical[3]= bnextStable→ 4Apply sequentially from
[a,b,c,d,e]: move c before a →[c,a,b,d,e]; move ebefore b →
[c,a,e,b,d]. ✓Normative ordering (the answer to "pre- or post-move order?"):
op's effect. The applier has no reordering freedom. This alone makes the
stream unambiguous regardless of anchor choice.
beforenames a nodethat is live at that point and is not the target of any later structural op
in the same message.
planPlacementssatisfies R2 by construction: anchorsare LIS-stable survivors (never emitted as move/insert,
universal-core.ts:10144-10152)or the out-of-scope
endAnchor(universal-core.ts:8442-8463). Under R2 thepre/post question dissolves — the anchor occupies the same position at every
point in the message, so "pre-move order" and "post-move order" agree on it.
R1 is what the validator enforces; R2 is a background-side invariant proven by
construction, not checkable cheaply on the main thread. Say both, enforce R1.
Refutation of the prototype's index model.
lepus-root.jsaddresses byarray index and mutates a parallel array as it applies:
OP_REMOVEdoesrowViews.splice(at, 1)(:221) andOP_SWAPswapsrowViews[a]/[b](
:225-240). That is deterministic, but it is the wrong model for L2:op-by-op, when the reconciler natively produces identity anchors (F4);
spliceis O(n), so clearing or removing N rows is O(N²) on the main thread;against — so a background/main desync is silent, whereas
live[I]andparent[I]catch an identity desync in O(1) (V8/V11).OP_SWAPis also not general:[a,b,c,d,e] → [c,a,e,b,d]is not atransposition and has no
OP_SWAPencoding at all.Case 3 —
@try/@pending/@catch, and instance lifetime across retryVerdict:
BRANCHREFUTED. Retained Suspense keeps two arms livesimultaneously. Closed after A3 (delete
BRANCH) + A4 (addVIS).@tryclaims a boundary owner (universal-core.ts:3454); each arm is a scopedowner keyed
'try' | 'pending' | 'catch'(universal-core.ts:3485,:3468,:3521). The load-bearing path is retention: when a committed bodyre-suspends,
retainCommittedTryArmrebuilds the committed records as ablueprint (
blueprintFromLogical,universal-core.ts:2770-2790), marks themsuspense-hidden(:2756-2768), and the boundary returns[...retained, ...pending](:3468-3469,:3505-3511). Both arms are childrenof the boundary range at once.
Panel = instance 1 with a boundary range at
sB.v1 — body commits two rows:
v2 — an update re-suspends the body. The retained arm keeps its records, so
instances 2 and 3 are untouched; the pending arm mounts alongside them:
v3 — the thenable resolves and the body renders. The
'try'owner isre-claimed by key (
findClaimableChildRecord,universal-core.ts:2254-2288),blueprintFromLogicalpreservedrecord.key(:2743), sosameRecordShapematches and the same instance handles come back. The
'pending'owner isnever claimed, so it is removed:
Instance lifetime, normatively:
visibilitycapability!owner.record.mounted,:2771)reset()→ body'catch'is a different owner key (:3521,:3476-3480), so both directions are teardown + createpending === nullthrowpropagates to an outer boundary (:3460,:3508); nothing commitsif (currentAttempt().transitionRender) throw error(:3493) — no retention, attempt discarded, no messageThe last two rows are the important safety property: a retry never produces a
partial delta stream. By F5 a suspending attempt emits no batch at all, so
there is no state in which some instances of a subtree were delta-addressed and
others were not. Retry therefore cannot observe a half-addressed subtree.
Why
BRANCHdies here: it is single-arm by construction. Row 1 of the table hastwo arms live at once; rows 4–5 need the whole thing to not commit.
BRANCHisalso unnecessary — every arm swap is exactly
REMOVE(old members) +RUN(newmembers) into the same range site, which the amended set already expresses.
Case 4 —
@empty, nested keyed ranges, Activity flips interleaved with SETsVerdict: closed.
@emptyneeds no opcode. Nested keyed ranges are closed butcost-linear in physical nodes. Activity needs A4 and A5.
(a)
@for/@empty, N→0→M. Empty selects a different owner:materializeScoped(CURRENT_OWNER!, [...path,'for-empty'], null, list.empty)(
universal-core.ts:3431-3433; compact path:3193) versus[...path,'for']for the populated case (
:3418). Different identity ⇒ full swap.Without an exclusive range slot,
CLEARdegrades toREMOVE I0, Nwhen the idsare a contiguous run (they are, immediately after a
RUN) or to NREMOVEsonce removals have fragmented the id space.
CLEARis exactly the prototype'sOP_CLEAR(lepus-root.js:204-209) made addressable.An empty range needs no anchor node. Its physical parent is a real host node
held in the instance's slot table, and
beforeis either a live instance or astatic anchor slot of the same instance. So zero-member ranges cost zero nodes —
worth stating, because the obvious alternative (a marker node per range) would
add one PAPI node per directive site per instance.
(b) Nested keyed
@forinside keyed@for. With no wrapper host —@for(g of groups; key g.id) { @for(r of g.rows; key r.id) { <row/> } }— F1says both range levels flatten, so the physical parent's child list is every row
of every group, and
planPlacementsruns LIS over that whole list(
universal-core.ts:10131-10163). Reordering two groups emits oneMOVEperrow of every moved group, not one per group.
Unambiguous (all addresses are identities), but the cost is O(rows moved). This
is not fixable in the protocol: the Element PAPI exposes only single-node
__InsertElementBefore(lepus-root.js:26), so there is no bulk sibling move tolower a range move onto. Adding a wrapper host per group makes the group one
instance and the move one op. I record the cliff rather than paper over it.
(c) Activity flips interleaved with SETs. Activity claims its owner with key
null(universal-core.ts:3033), so a mode flip preserves owner, records andinstance handles; only
owner.visibilitychanges (:3034-3038). The bodystill renders while hidden (
:3038-3040), so hidden subtrees keep emittingSETs.Interleaving is fixed by the phase order:
updatesprecedevisibilityCommandsin the batch (
universal-core.ts:10695-10706), and hides walk post-order whilereveals walk pre-order (
:10240-10245).Two applier obligations the draft misses:
hiddenis reserved and applier-composed. The driver computeseffectiveHidden = visible ? authoredHidden : true(
host-driver.ts:1500-1502, applied at:5471-5479). Ifhiddenwere anordinary
p:slot,SET I, sHidden, falsewould write PAPI directly andun-hide a suspense-hidden or activity-hidden instance.
SETon the authoredhiddenslot must update the stored authored value and let the applierre-derive.
VISowns event lifecycle.VIS hiddenremoves native events andmain-thread refs;
VIS visiblereinstalls them from the stored table(
host-driver.ts:5471-5490). So §3.5's "registration happens once inside thecreate function" is true only between visibility transitions, and the wire
must carry no event ops for a flip — the applier reconstructs them.
VISis per instance, not per node. Visibility is uniform across a templateinstance: hosts inherit
CURRENT_OWNER.visibility, and every directive that canintroduce a new visibility scope is itself a slot hole (F3), hence a separate
instance. That is strictly better than the universal path, which emits one
visibilitycommand per host (universal-core.ts:10216-10238): hiding a1000-node Activity subtree is O(instances), not O(nodes).
Case 5 — mixed eligibility: does a delta stream ever cross-address a fallback subtree?
Verdict: proven — the boundary never needs cross-addressing, and this holds
under today's compiler with no amendment.
The premise in the task ("the compiler falls back to interpreted plans for
component/if/switch plan nodes") describes
lynxTemplateEligible's doc comment(
compile-universal.js:3920-3927), but the compiler never emitsif,switch,componentorrangeplan nodes — I grepped forconditionSlot/valueSlot/kind: 'if'inpackages/octane/src/compiler/and found nothing.Those
renderPlanNodearms (main-renderer.ts:768-797) andmaterializeNodearms (universal-core.ts:3632-3665) are defensive. Everydirective becomes
{kind:'slot'}(F3), and slots are eligible(
compile-universal.js:3930).So the actual ineligibility set is much smaller: a spread props program
(
propsSlot), akey/ref/childrenprop or binding, an event-shaped staticprop name, or a plan whose root is not a host
(
compile-universal.js:3928-3941,:4055).Theorem (boundary closure). Let
instances(n)be the instance handlesallocated for subtree
n. Then:instances(n) ∩ instances(m) = ∅for disjoint subtrees — handles come fromone monotonic counter, never reused (
universal-core.ts:6599,:9645,:9758).(I, s)withs ∈ slots(template(I)), andslotsis a compile-time property of exactly one template. So an address isresolvable without knowing anything about the enclosing or enclosed
encoding.
RUN/MOVE's(parentInstance, parentSlot)and itsbeforeanchor. Both are ordinary(I,s)pairs: the parent slot has kindrin the outer instance's table;the anchor is either
END, an instance root(I,0), or a static anchor slotof the outer instance.
Therefore eligible-vs-interpreted is purely a codegen choice —
RUN Twitha real template versus
RUN T_degeneratefor a single host the compiler couldnot lower — and never an addressing distinction. ∎
Concretely:
<view class="card"><text>{title}</text>{<Widget/>}</view>compilesto one eligible template with slots
[p:class?, t:title, r:hole]; the widget'soutput is instantiated into
(cardInstance, sHole). The card's slot table nevernames a widget node; the widget's never names a card node.
The converse direction — an eligible template nested inside an ineligible plan —
is the same statement read upward: the ineligible host is a degenerate one-node
instance, and the template is
RUNinto(thatInstance, s0).This also disposes of §3.6's ordinal alignment for the mixed case. Create order
inside a template create function is pre-order —
env.h, then props/bindings,then children, then
env.a(parent, node)(
compile-universal.js:3967-4027) — and the background allocates ids inreconcileChildrenpre-order (universal-core.ts:9645,:9758,reserveCollapsedTemplateIdsat:9610-9622).env.sholes do not advancethe template's node numbering (
compile-universal.js:3981-3986,main-renderer.ts:735-737), so hole content is numbered in its own instancespace and a template's ordinals are invariant under hole content.
Case 6 — commit atomicity and ordering
Verdict: ops within a message ARE required to be causally ordered; a
SETMAY reference an instance created by an earlier
RUNin the same message;atomicity is validate-then-apply with a terminal accepted-fault, not rollback.
Evidence:
version;batch.versionmust equal theenvelope
version(protocol.ts:1315-1327), and the envelope carriesprotocol/renderer/root/version(protocol.ts:613-625,:1693-1720). Version is recorded asrecord.acceptedVersion = message.version(
main-thread.ts:2201).creates,updates,ensure-public-instance,event,lifecycle,local-callback,removes,placements,visibility,destroys(
universal-core.ts:10695-10706). Creates precede updates, so aSETreferencing a same-message creation is already the status quo.
mount-template-runshipsfirstIdwith a dense stride, coalescing only whenprevious.firstId + previous.count * stride === collapsed.firstId(
universal-core.ts:10037-10047). So the background knows every handle beforeit writes the message — a same-message
SETafterRUNis triviallyexpressible.
applied; once
mutationStartedthe message is accepted and a fault isterminal (
main-thread.ts:2190-2202,host-driver.ts:3465,:4979).Consequence: all addressing validation must complete before the first PAPI
call. The specialized applier therefore needs two passes over the flat op
array — a pure scan over
live/template/parenttables with no PAPI and noallocation, then a check-free apply pass. Two flat passes are still far below
today's recursive per-command walk (
protocol.ts:1315-1327→assertCommand).there is no partial-commit state to reason about.
Normative phase order for the amended set (
RUNfuses create+attach, so it mustfollow removal, which the universal order does not need):
SETon instances live before the messageREMOVE,CLEARRUN,MOVE— per physical parent, in final-order index orderSETon instances created in P3 (legal; normally empty, sinceRUNcarries initial values)VIS hidden(descendant instances first), thenVIS visible(ancestor instances first)Moving
RUNafterREMOVEis safe: aRUN's anchor is a desired, non-removednode by F4, and a
REMOVE's target is identity-addressed, so noRUNcaninvalidate it.
(b) The amended normative opcode set
Address space
I1 ≤ I < 2^31, allocated by the background, dense, monotonic, never reused. Denotes a template instantiation and, structurally, its one physical root (F2).I = 0is theEND/ container sentinel.T0 ≤ T < templateCount, index into the module's compile-time table. A host the compiler cannot lower is a degenerate template: one node,slotCount = 1.(I, s)0 ≤ s < slotCount(template(I)). Compiler-assigned, stable across rebuilds (§3.3 discipline).END(append into the range's parent node), or a slot address whose kind isnora.Slot kinds (replaces the current two-valued
'c' | 'p:…' | 'e:…')nMOVE,REMOVE, anchorstSETp:<name>SETe:<name>SETrexclusiveflag when the hole owns all of that node's childrenRUN,CLEARabeforeanchor (a template node immediately following a hole)A6 is the load-bearing amendment here:
lynxTemplateSlotKindscurrentlyassigns
'c'to both atexthole and a renderableslothole(
compile-universal.js:3944-3951). Splittingtfromris what makes theopcode/slot dispatch total.
Opcodes
RUNT, Ip, sp, Ib, sb, F, N, values…TNtimes into range site(Ip,sp), inserted before anchor(Ib,sb)(Ib = 0⇒END), assigning handlesF … F+N-1.values.length = N × dynSlots(T). Generalizesmount-template-run(universal-core.ts:572-580,:10046-10061).SETI, s, v(template(I), s); no per-prop classification, no prop-bag diff.vis a scalar.REMOVEI, NI … I+N-1(a contiguous handle run;N = 1for the general case).CLEARIp, sp(Ip,sp). Valid only when(template(Ip), sp)is kindrwith the compile-timeexclusiveflag. This is the prototype'sOP_CLEAR(lepus-root.js:204-209).MOVEI, Ip, sp, Ib, sbIinto range site(Ip,sp)before anchor(Ib,sb). The parent may differ fromI's current parent — portal retargeting emits exactly that (universal-core.ts:10122-10131,:10185-10199).VISI, statehiddenorvisiblefor the whole instance. Applier composes with the authoredhiddenslot (A5) and owns event teardown/reinstall (A4').Six opcodes. Deleted from the draft:
BRANCH(Case 3; derivable asREMOVE+RUN). Never added:RECREATE— the universal path'srecreate(
universal-core.ts:591-595, classified at:10112-10135) fires on Lynx onlywhen a CSS scope is removed ("The public PAPI has no operation that removes a
previously applied CSS ID",
host-props.ts:106-107,:562,:686). Atemplate's CSS scope is baked into its create function, so an instance can never
change scope; a scope change is a different template, i.e.
REMOVE+RUN.Amendments, indexed
(I, s), never a bare slot.RUNcarries(parentInstance, parentSlot, anchor, firstInstance)— restoremount-template-run's framing (universal-core.ts:572-580).BRANCH. Arm swaps areREMOVE+RUNinto the same range site.VIS(I, state), per instance, with the hide-post-order / reveal-pre-order rule (universal-core.ts:10240-10245).VISowns native-event teardown/reinstall (host-driver.ts:5471-5490); the wire carries no event ops for a flip.hiddenis a reserved, applier-composed slot:effectiveHidden = visible ? authoredHidden : true(host-driver.ts:1500-1502).cintot(scalar) andr(range site); adda(static anchor) andn(root).RUNcoalescing — this is exactly whatcompactLogicalRangeIdsguards today (universal-core.ts:9556-9565,:10037-10047).string,number,boolean,null; all structure travels as ops. This is the premise the header-only validation claim rests on.RUN_EACH T, Ip0, N, sp, F, values…— one instance ofTinto slotspof each of instancesIp0 … Ip0+N-1. Restores one-op nested instantiation for the uniform Case 1 shape. Closure does not depend on it.'s:' + rowId(lepus-root.js:81,:87) works only where items have a natural key;<site>:<instance>works for every event site, including inside@ifarms, and survives reorder for free.Applier-side state (replaces
LynxHandleEntry)Four dense typed arrays indexed by instance handle:
plus one node-ref array per instance covering only its slot table (§3.3). That
makes
CLEARO(members) with no allocation andbefore-parent validation O(1),and it deletes the per-node ack state, dual snapshots, lazy facades and
generation tracking that #58 lists as owner 6
(
client-driver.ts:76-95).Header-only validation rules
All of V1–V14 run in the prepare pass, before any PAPI mutation (forced by
F5 /
main-thread.ts:2190-2202). Single forward scan, O(ops), no recursion, noallocation, no structural walk of any value.
Envelope, O(1):
protocol === LYNX_DELTA_PROTOCOL_VERSION, exact (mirrorsprotocol.ts:613-618).renderer === 'lynx';rootis a positive safe integer matching thecontainer (
protocol.ts:621-624).versionis a positive safe integer and> acceptedVersion(monotonic;
main-thread.ts:2201).opCountmatches the op array length;nextInstance ≥ instanceCount.Per op, O(1) each:
1 ≤ opcode ≤ OP_MAX— dense table dispatch; anything else rejects(the prototype throws,
lepus-root.js:242).i + arity(op) ≤ n.RUN:0 ≤ T < templateCount;N ≥ 1;i + header + N × dynSlots(T) ≤ n.1 ≤ I < instanceCountandlive[I].0 ≤ s < slotCount(template[I]).SETrequires kindt | p: | e:;RUN/CLEARparent slot requires kind
r;CLEARadditionally requires theexclusiveflag; an anchor slot requires kind
n | a.Ib === 0(END) orlive[Ib] ∧ parentSlot[Ib] === (Ip,sp).F === nextFreeInstance. This one integer compare replacesthe entire per-node handle/ack machinery, and it makes "a
SETreferencingan instance created by a later
RUN" unrepresentable rather than merelyillegal.
typeofper value ∈{string, number, boolean}ornull.No key enumeration, no recursion — this is the whole of A8's payoff, against
today's recursive
assertCommandwalk (protocol.ts:1315-1327).nextFreeInstance === header.nextInstance.A cheap end-to-end checksum on the shared id space.
V8/V11/V12 read tables that the message itself mutates, so the prepare pass
shadow-applies structural effects (
live,parentSlot,nextFree) withouttouching PAPI — the same discipline
prepareLynxHostBatchalready uses when itstages a shadow child list (
host-driver.ts:4593-4597).(c) What I could NOT prove
1. Native lists. §3.7 assumes a list cell body is a template that
componentAtIndexinstantiates directly. But cell instances are minted by theplatform on demand, outside any message, so V12's dense-id invariant cannot
hold — the main thread's
nextFreeInstancewould advance without aRUN.This is not hypothetical: native lists are excluded from adoption today
(
host-driver.ts:3239) and the L3 direct first screen declines them(
main-thread.ts:1906). Closure needs either a reserved id sub-space forplatform-minted cells or a recycling-callback ack, and I could not settle which
without the recycling contract. Carry to L4.
2. Lane-scheduled sub-commit batching (#58 open question 4). The
one-message-one-commit-one-version rule (Case 6) and V12 (dense, in-order handle
allocation) are both stated against today's per-commit model. If a lane
scheduler later interleaves two commits, handles would be allocated out of order
across messages and V12's
F === nextFreeInstancewould fail. The op stream isself-delimiting, so framing survives; the id-space invariant does not, and
I could not construct a variant that keeps V12's O(1) check under out-of-order
lanes. Anything weaker than V12 puts the per-node ack machinery back.
3. Adoption ordinal matching (§3.6) versus today's comparison. I can show
the ordinal walk is no weaker than today's: adoption is already whole-tree
all-or-nothing — any mismatch repairs the entire first screen
(
host-driver.ts:3239,:3253,:3258). What I could not prove is that apure index walk detects everything the current field-by-field comparison
detects: two distinct templates with equal node counts at the same ordinal
compare equal under an index walk alone. The fix is cheap (compare
templateIdper instance during the walk) but it is not in the current capture — L1's
capture is the plan-path snapshot and records no template identity. Recommend
adding
templateIdto the capture before L3's adoption slice lands.4. Range moves as a unit. Case 4(b): a keyed range with no wrapper host
costs one
MOVEper physical member, because the Element PAPI has onlysingle-node
__InsertElementBefore. AMOVE_RUN I, N, …over a contiguoushandle run would collapse the common case, but handle runs fragment after the
first interior removal, and I could not prove a useful bound on how long they
stay contiguous under real edit sequences. Left out of the normative set.
Two smaller things I want on the record rather than asserted:
memobailout. Doesn't exist yet. What I can prove is that today'sretained subtrees stay movable —
physicalDraftsreadsphysicalRecords(draft.record.children)forretained === true(
universal-core.ts:4227-4229) — so a bailout that reuses the retained-draftmechanism inherits movability. A bailout implemented differently would need
re-checking against Case 2.
scopePhysicalPlacementreturnnulland forces a full-root render (
universal-core.ts:8447,:8411-8417).UniversalHostParentadmits an opaque target handle(
universal-core.ts:405), but on Lynx a portal target resolves to an acceptedhost of the same root (
client-driver.ts:1367), so it is an ordinaryinstance and
(Ip,sp)covers it. I verified the address form; I did notverify the scoped-commit fallback carries over unchanged.
One-line summary
RUN/SET/REMOVE/MOVEsurvive with instance-qualified addressing;BRANCHdoes not survive at all;
VISmust be added; thecslot kind must split intotandr; and the "header-only validation" claim is true only once values arerestricted to scalars and all structure moves into ops.
Generated by Claude Code