Files
ujsx/tasks/commit-mutations.md
glm-5.1 c9c32a6aa6 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).
2026-05-18 16:26:52 +00:00

2.4 KiB

id, name, status, depends_on, created, modified, scope, risk, impact, level
id name status depends_on created modified scope risk impact level
commit-mutations Commit insert/move/remove effects in tree order pending
lis-move-detection
2026-05-18T16:22:57.246628537Z 2026-05-18T16:22:57.246628975Z moderate high phase 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