decompose reconciler roadmap into 20 implementation tasks across 5 phases

Tasks follow the architecture spec phases:
- Phase 0: key field on UElement (2 tasks + review)
- Phase 1: reactive-host bridge / fiber tree (4 tasks + review)
- Phase 2: key-based children reconciliation (3 tasks + review)
- Phase 3: unmount & dispose support (4 tasks)
- Phase 4: TypeBox value optimizations (4 tasks)

Validated with taskgraph CLI: no cycles, 15 parallel generations,
3 high-risk tasks identified (signal-driven-updates, commit-mutations,
fiber-disposal).
This commit is contained in:
2026-05-18 16:26:52 +00:00
parent 8cd4091afc
commit c9c32a6aa6
20 changed files with 993 additions and 0 deletions

56
tasks/commit-mutations.md Normal file
View File

@@ -0,0 +1,56 @@
---
id: commit-mutations
name: Commit insert/move/remove effects in tree order
status: pending
depends_on: [lis-move-detection]
created: 2026-05-18T16:22:57.246628537Z
modified: 2026-05-18T16:22:57.246628975Z
scope: moderate
risk: high
impact: phase
level: implementation
---
# Description
Implement the commit phase that applies all pending effects (insert, move, remove, update) to the host in the correct order. This is where fiber effects become host mutations.
The commit order matters for host correctness:
1. **Removes** — reverse order (children before parents, bottom-up)
2. **Inserts + Moves** — left-to-right using `insertBefore` or `appendChild`
3. **Updates** — top-down (parent before child, so parent state is consistent)
This task also creates new fibers for inserted children (via `mountNode`-style recursive creation) and updates the fiber tree structure after commit.
`commitMutations` is called after the reconciliation algorithm has classified all changes and queued effects on fibers. It walks the fiber tree and applies effects in the specified order.
## Acceptance Criteria
- [ ] `commitMutations(rootFiber, ctx)` function implemented in `src/host/reconcile.ts`
- [ ] Removes committed in reverse order (children before parents)
- [ ] `host.removeChild(parent, child, ctx)` called for each removal
- [ ] Inserts committed left-to-right, using `host.appendChild` or `host.insertBefore`
- [ ] New fibers created for inserted children, linked into parent's children array
- [ ] Moves committed left-to-right using `host.insertBefore(parent, child, before, ctx)`
- [ ] Updates committed top-down (parent before child) via `host.commitUpdate`
- [ ] Fiber tree is updated after commit: new children added, removed children pruned, moved children reordered
- [ ] Order guarantee: removes → inserts/moves → updates
- [ ] Existing tests pass
- [ ] New test: adding a child calls `host.appendChild`
- [ ] New test: removing a child calls `host.removeChild`
- [ ] New test: reordering children calls `host.insertBefore` for moved children
- [ ] New test: mixed add+remove+update operations apply in correct order
- [ ] New test: `insertBefore` falls back to `appendChild` if `before` is null
## References
- docs/architecture/reconciler.md — Step 3 (commit order), Step 4 (Commit Effects), Effect Types
- docs/architecture/host-config.md — insertBefore, removeChild, appendChild
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion