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).
42 lines
1.7 KiB
Markdown
42 lines
1.7 KiB
Markdown
---
|
|
id: host-finalize-instance
|
|
name: Add finalizeInstance to HostConfig
|
|
status: pending
|
|
depends_on: [fiber-disposal]
|
|
created: 2026-05-18T16:22:57.323634873Z
|
|
modified: 2026-05-18T16:22:57.323635316Z
|
|
scope: single
|
|
risk: low
|
|
impact: component
|
|
level: 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 |