Files
ujsx/tasks/host-finalize-instance.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

1.7 KiB

id, name, status, depends_on, created, modified, scope, risk, impact, level
id name status depends_on created modified scope risk impact level
host-finalize-instance Add finalizeInstance to HostConfig pending
fiber-disposal
2026-05-18T16:22:57.323634873Z 2026-05-18T16:22:57.323635316Z single low component implementation

Description

Add the optional finalizeInstance?(instance: Instance, ctx: RootCtx): void method to the HostConfig interface. This method allows hosts to perform per-instance cleanup when an instance is removed (e.g., releasing GPU buffer slots, closing database connections, removing graphology nodes).

This is a backward-compatible change: the method is optional, so existing HostConfig implementations continue to work without modification. The reconciler calls finalizeInstance during disposeFiber after children are disposed but before the fiber's own state is cleared.

Acceptance Criteria

  • finalizeInstance?(instance: Instance, ctx: RootCtx): void added to HostConfig interface
  • Method is optional (existing hosts don't need to implement it)
  • Called by disposeFiber during fiber tree disposal
  • Called bottom-up: children's finalizeInstance before parent's
  • Updated in src/host/config.ts interface definition
  • TypeScript compiles (npm run build:tsc)
  • Existing tests pass (existing HostConfig implementations don't break)
  • New test: host implementing finalizeInstance receives calls during disposal

References

  • docs/architecture/lifecycle.md — Host Notification section, finalizeInstance interface
  • docs/architecture/host-config.md — Open Question 3 (should HostConfig include finalizeInstance)

Notes

To be filled by implementation agent

Summary

To be filled on completion