Repository navigation
Add nodes.updateNode to the host API and resolve subtype viewers through isA - #3622
Conversation
Review round 1 (pragmatic-code-reviewer, medium depth) — verdict: APPROVE, no blockersSummary: small, additive change that follows ADR-082 section 3.6 and existing patterns; version bump consistent across the Rust constant, Rust test, TS constant and snapshot. Suggested improvements
Nits: single-pass grouping in 🤖 Generated with Claude Code |
Address-review (round 1)
Re-review not needed: only the runtime pick, a comment, and doc text changed, all covered by the above. 🤖 Generated with Claude Code |
|
Merge queue: #3622 was taken out of the queue — the merge gate failed on it, on top of main. Reproduce by merging or rebasing |
4125e54 to
2a71483
Compare
|
Merge-gate fix (head The gate's frontend stage failed on Fix: the tabs now derive from the collection the viewer already loads ( Checks
No re-review is needed: the change is mechanical, reading the same value from the viewer's own loaded node. 🤖 Generated with Claude Code |
…ugh isA The nodes facade of the host API gains updateNode, which ADR-082 §3.6 lists, delegating to the shared node store's update path. Viewer and viewer-tab resolution fall back through a type's extends chain, nearest first, so a subtype opens in its parent's viewer with its tabs; an exact registration still wins. The extension API goes from 2.2 to 2.3. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An untyped extension could pass nodeType or version through the compile-time only narrowing; the facade now forwards content and properties alone. The pane-content comment says a late viewer registration is not picked up. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The viewer read its node's type from SharedNodeStore without pinning it, which the pin-reachability guard rejects. The collection it already loads carries the real node type, so the tabs derive from that instead. The subtype tab test now stubs the collection service with a subtype node. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2a71483 to
e8280f9
Compare
Part of #3414. Two leftovers from the umbrella's progress comment, both frontend only.
Summary
nodes.updateNode(id, changes)on the host API'snodesfacade (ADR-082 section 3.6).changesis{ content?, properties? }(typeExtensionNodeChanges). It delegates tosharedNodeStore.updateNode, the app's own update path, attributed to aviewersource with idextension-api.getNodeshows the change at once and the store saves it in the background. It returns nothing: it does not wait for the save or report a failed one, and a node the store does not hold is left alone and logged.isAfallback for subtype viewers.pane-content.sveltenow resolves the viewer through the type'sextendschain (resolveViewerFallback, built on the existingtypeChain): the exact type first, then ancestors nearest first, and an exact registration wins.UiExtensionRegistry.viewerTabsForfollows the same chain, andcollection-node-viewer.svelteasks for the tabs of the node's real type instead of the literalcollection, so a subtype ofcollectiongets its own tabs and then collection's.Extension API
Minor bump, 2.2 to 2.3:
nodes.updateNodeand theExtensionNodeChangestype are new, optional additions to the host API. Nothing is removed or retyped. Changed:EXTENSION_API_VERSIONinapp-lib/src/extensions/mod.rsandsrc/lib/plugins/ui-extensions.ts; the pinned fixture test is nowextension_api_version_is_two_three; the surface snapshot is re-recorded.scripts/check-extension-api-version.tspasses.Viewer-tab resolution also changes behaviour for extensions: a tab registered for a type now shows on the viewers of its subtypes. This is additive, so it is covered by the same minor bump.
Tests
viewer-node-type.test.ts: parent's viewer for a subtype without one, nearest ancestor, own registration wins, no viewer anywhere.ui-extensions.test.ts: tabs include ancestors', subtype's own first regardless of priority.collection-node-viewer-extensions.test.ts: aboardnode extendingcollectionshowsContents, its own tab, then collection's.extension-api-facades.svelte.test.ts:updateNodegoes through the store with the extension source and a reactivegetNoderead sees it; an unknown node is left alone.Mutation-checked, each caught: viewer-tab lookup by exact type only (3 tests fail), ancestors before the subtype (2), reversed chain in the viewer lookup (2), no fallback (2), skipping the type's own viewer (1),
updateNodeas a no-op (1), wrong update source (1), collection viewer asking for the literalcollection(1). Not covered: the one-line wiring ofresolveViewerFallbackinpane-content.svelte, because that component is not mounted in tests; the function itself is covered.Documentation
Companion docs PR updates
architecture/extension-points.md(removes the two "not built yet" items, documentsupdateNode, the fallback and 2.3): https://github.com/NodeSpaceAI/nodespace-docs/pull/108🤖 Generated with Claude Code