Repository navigation
Add the nodeTypes and treeItemActions extension contribution kinds (extension API 2.2) - #3619
Conversation
Pragmatic code review (round 1)Review Type: Initial Review (medium depth). Scope: the "Frontend contribution kinds" section of #3414, plus the #3409 host-API reconcile items in the same files. Checked against ADR-082 §2.1, §3.2–§3.4, §3.6, §8 and §9, and the CLAUDE.md Pro / Sync Boundary section. Local verification: the 10 directly affected Vitest files ( Requirements Check
Code Review Findings1. 🟡 Important (non-blocking): the
2. 🟢 Suggestion: with per-item
3. 🟢 Follow-up (out of scope, pre-existing; for the remaining #3414 work)
4. 🟢 Nit: stale Rust test name
What's good
RecommendationAPPROVE. Nothing blocks the merge. Finding 1 needs a one-line ADR amendment tracked alongside the Docs item. Findings 2–4 are optional polish or follow-ups. |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review round 1: APPROVE (posted as a comment because GitHub blocks self-review). Full findings in the review comment above.
Address review (round 1)Commit c86c3d1 handles round 1 (verdict APPROVE, 4 findings). Addressed
Skipped
Checks:
Re-Review DecisionDecision: RE-REVIEW NEEDED Rationale: The change is small and tested. It does change the documented failure-logging rule (ADR-082 §3.4) of a versioned contribution kind, so a short round 2 on c86c3d1 confirms it. |
Pragmatic code review (round 2)Review Type: Re-Review (medium depth). Scope: only commit c86c3d1, "Address review: log a tree-item action's failing when() once per item". Checked against ADR-082 §3.2 and §3.4, and against the round-1 findings and the round-1 address-review. Local verification: I ran
Vitest runs each file with its own module state ( Previous Review SummaryRound 1 made 4 recommendations. 2 were addressed and 2 were skipped, and both skips are justified. This round found 1 new 🟡 issue (non-blocking) and 1 🟢 nit.
Code Review FindingsA. 🟡 Important (non-blocking): the per-item rule now differs from ADR-082 §3.4's text, so the deferred ADR amendment must cover §3.4 as well as §3.2
B. 🟢 Nit (no action needed):
What's good
RecommendationAPPROVE. Nothing blocks the merge. Finding A comes down to adding §3.4 to the ADR amendment already planned for #3414's Docs item, plus a one-line PR-body tweak. Finding B needs no action. |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review round 2: APPROVE (posted as a comment because GitHub blocks self-review). Full findings in the review comment above.
Address review (round 2)Commit 05beed9 handles round 2 (verdict APPROVE, 1 🟡 and 1 🟢). Addressed
Follow-ups recorded in the PR body: the §3.2 amendment (for #3414's Docs item), and an Checks:
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The change implements round 2's own option (b) as specified, and only |
- nodeTypes: registering an extension registers each PluginDefinition
with the plugin registry, after every contribution list has been read;
unregistering removes the types it still owns. A core type, or a type
another extension already added, is dropped and logged.
- The schema-plugin loader neither replaces nor removes a type an
extension registered.
- treeItemActions: TreeItemActionsOutlet renders each collection-tree
item's actions in its row with { nodeId, nodeType }, revealed on hover
or focus. when(item) is asked per item; failures follow ADR-082 §3.4.
Optimistic items get no actions.
- CollectionItem carries nodeType.
- Host API exports NodeTypeContribution, TreeItemActionContribution,
TreeItemActionProps, PluginDefinition, NodeComponent and
NodeComponentProps; the surface hash follows the plugin and
node-component types the API reaches.
- The fixture extension adds a collection subtype and tree-item actions
whose action opens an app-shell-modal contribution.
Part of #3414
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ns kinds A minor bump: two new optional contribution kinds and new host-API type exports. The Rust and TypeScript constants move together, and the host-API surface snapshot is re-recorded. Part of #3414 Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A tree-item action's when(item) failure is tracked by contribution and item, so a predicate that fails for some items and not others no longer re-arms its warning on every sibling that returns normally. - Rename the Rust version test to match the 2.2 value it asserts. Part of #3414 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A tree-item action's when(item) is tracked as the set of items it threw for. It is logged when that set goes from empty to non-empty and armed again once every item has returned normally, which keeps ADR-082 §3.4's "logged once per contribution until it next returns normally" for a predicate asked about many items. Contributions asked about no item keep their behaviour. Part of #3414 Co-Authored-By: Claude Opus 5.5 <[email protected]>
05beed9 to
b6c6896
Compare
Part of #3414 (the "Frontend contribution kinds" section, plus the host-API reconcile items in the same files).
What changes
nodeTypes. An extension'snodeTypes: [{ plugin }]registers eachPluginDefinitionwith core'spluginRegistrywhen the extension registers. The type's lazy node component, viewer, schema form and slash commands then resolve like any plugin type's. Unregistering the extension removes the types it registered.database-settings) is dropped and logged. So is a type another extension already registered, where the first registration is kept.treeItemActions. A newTreeItemActionsOutletrenders each item's actions inside its row in the navigation panel's collection tree (all three levels), with props{ nodeId, nodeType }.CollectionItemnow carriesnodeType, so a subtype collection passes its own type.when(item)is asked once per item, inside a derivation.when()hides the action. It is logged once per contribution, and again only after it has returned normally for every item it threw for, so a predicate that fails on some rows doesn't log on every re-evaluation. A rejectedload(), or a component that throws, empties only that action's outlet.Fixture extension. It now covers both kinds: a
collectionsubtype with a lazy node component, and tree-item actions for every §3.4 failure row. Its action opens anitem-modalapp-shell-modalcontribution for the clicked item, the flow ADR-082's permissions example uses. The fixture names no product.Host API reconcile (ADR-082 §3.6).
@nodespace/extension-apinow exports thepluginRegistryregistration types a node-type contribution needs:NodeTypeContribution,PluginDefinition,NodeComponent,NodeComponentProps. It also exportsTreeItemActionContributionandTreeItemActionProps.plugins/types.ts,types/node-viewers.ts). A change toPluginDefinitiontherefore needs a version bump, as ADR-082 §8 versions the node-type contribution.A decision to confirm
ADR-082 §3.2 sketches
TreeItemActionContribution = Contribution<{ nodeId; nodeType }>, whosewhentakes no arguments. The worked example needswhen()to decide per item ("a lock button when the signed-in user has a role that may edit that collection's permissions"), sowhenreceives the item:when?: (item: TreeItemActionProps) => boolean. A zero-argument predicate still type-checks. If the ADR should spell this out, that is a one-line amendment to §3.2 (flagged for #3414's Docs item). §3.4's failure rule is kept as written.Follow-up (pre-existing, from review)
Viewer resolution and
viewerTabsFormatch the node type exactly, so acollectionsubtype opens inBaseNodeViewerwithoutcollection's viewer tabs. This belongs to the typed-subtype work: fall back throughisA.Not changed here (remaining §3.6 gap)
§3.6 lists
nodes.updateNode. Thenodesfacade from #3409 still hasgetNode,fetchNodeandcreateNodeonly. It isn't a contribution kind, so it is left for the remaining #3414 work.Extension API
EXTENSION_API_VERSION 2.1 → 2.2, a minor bump: two new optional contribution kinds (
nodeTypes,treeItemActions) and new exports. Rust (app-lib/src/extensions/mod.rs, its fixture test) and TypeScript move together, and the surface snapshot is re-recorded. Release notes: "Extension API 2.2:nodeTypesandtreeItemActionscontribution kinds; the host API exports the plugin registration types."Documentation
architecture/extension-points.mdis Pro rebuild (after core release): finish core's extension points for typed subtypes, edge fields and Pro UI (ADR-082) #3414's Docs item, written separately.Tests
New and changed Vitest tests:
plugins/ui-extensions.test.ts:when()not evaluated by lookups;getActiveTreeItemActions:when(item)gets the item, per-item visibility, priority, throw hidden with warn-once and re-arm.plugins/tree-item-actions-outlet.test.ts:{ nodeId, nodeType }, per-itemwhen, reactivity, priority order;when, a rejectedload, and a throwing component each leave the sibling rendering.components/navigation-sidebar-tree-item-actions.test.ts:when(item)false for one item, an optimistic item gets none until confirmed;app-shell-modalcontribution for the clicked item, and the modal closes.plugins/extension-node-types.test.ts:NodeComponentLoader(the viewer's loader) resolves the extension's lazy component, which renders with node props; the type is gone after unregister; core'scollectionplugin can't be replaced.plugins/schema-plugin-loader.test.ts: register, delete and switch (with and without the type) keep the extension's plugin; after unregister the schema registers it as usual.stores/collections.test.ts:buildCollectionsTreecarriesnodeTypeat every level.extension-api/extension-api-surface.test.ts: the hash coversPluginDefinition,NodeTypeConfigandNodeComponentProps, resolves a name declared twice to the plugin types' declaration, and skips unreachable plugin types.Mutation check: 27 source mutations, each run against its targeted tests, and all 27 were killed. 23 come from the first pass, and 4 more from review rounds, covering the failing-item set's re-arm and warn rules. They cover:
when()not given the item,when()ignored, and warn re-arm;nodeTypein the tree builder;Runs:
bun run --cwd packages/desktop-app testoversrc/tests/{plugins,extension-api,stores,components,services,build}: 229 files, 3670 tests passed.quality:fix: eslint, design tokens, svelte-check, 0 errors and 0 warnings.scripts/check-pro-boundary.ts: clean.cargo clippy -p nodespace-app-lib --all-targets -- -D warnings: passed (run under the machine slot).Not verified in a running app. The hover reveal is a CSS rule (
:hover/:focus-within), and happy-dom doesn't apply component CSS, so no test observes it. The app wasn't launched on this shared machine, because starting the daemon loads a model.🤖 Generated with Claude Code