Repository navigation
Implement List and Kanban views for QueryNodeViewer (closes #1921) - #1984
Conversation
Only the Table view was implemented; List and Kanban switched the tab and showed a "coming soon" placeholder. This adds both, plus the group-by picker and drag-to-change-value Kanban needs. - list-view.svelte — one row per result showing the node title (title_template → content → "Untitled"), reads each node from sharedNodeStore for cross-pane reactivity, paginated at PAGE_SIZE=25 like TableView, row click opens the node. - kanban-view.svelte — groups results into columns by a selected enum field (enum-only: its core/user values give both the column set and labels). Cards show titles and read from the store so they move reactively; a null/unknown value lands in an "Unassigned" column. Drag a card between columns, or use the per-card keyboard-accessible "Move to" select, to write the column's value onto the node. Dropping into the same column is a no-op; the optimistic store write rolls the card back on a rejected persist. Empty state when the schema has no enum field. - kanban-grouping.ts — pure, DOM-free helpers (eligible fields, enum columns, group-value read mirroring table-row's resolution order, write-shape that writes back to where the value is read from — properties[field] for the common user-defined-schema case, matching generic-schema-form — and column bucketing). 16 unit tests. - query-node-viewer.svelte — render List/Kanban/Table by activeView; delete the viewComingSoon state, the coming-soon branch, and its now-dead CSS. Group-by selection and last view persist per query node via QueryPreferencesService and restore on reopen. Note: enum fields on user-defined schema types (the common Kanban case) write to properties[field]; core namespaced typed fields mirror their read location — worth an on-device confirm for a core type like task.status. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <[email protected]>
Principal-Engineer Code Review — PR #1984 (closes #1921)Review Type: Initial (no prior reviews/comments on the PR). Framework: Pragmatic Quality — rigorous, velocity-aware. The core of this feature — List + Kanban over user-defined schema types — is well-structured, correctly reactive, and the extracted grouping logic is cleanly unit-tested. The findings below concern edge paths (core-typed fields), an error-surfacing mechanism that doesn't fire on the realistic failure, unbounded card rendering, and a test gap the issue explicitly called out. Requirements Check (14 acceptance criteria)
Findings🟡 Important — Core-typed enum fields can move optimistically but silently fail to persist
The common, in-scope path (user-defined schema → 🟡 Important — The in-view
|
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: REQUEST CHANGES (posted as comment — GitHub blocks self-approval). Findings in the review comment above.
…ence Addresses pragmatic-code-review findings on PR #1984: - 🟡 Removed the dead per-view moveError banner + synchronous try/catch. A rejected persist is async, so the banner never fired; the shared store already rolls the value back (returning the card to its column) and raises its global conflict notification — the same fire-and-forget path generic-schema-form uses. Kanban now relies on that, so error surfacing is honest and centralized. - 🟡 Documented resolveFieldWrite's persistence guarantee: user-defined schema fields write to properties[field] (property changes always persist) and core typed enums (status/priority/…) persist via their registered type updater; grouping a core type by a non-standard top-level enum field is out of scope. - Deferred to #1985 (with reviewer's assent): bounding large boards (pagination/virtualization) and browser-based drag-and-drop tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <[email protected]>
/address-review summaryAddressed the review in commit that follows the initial one.
Helper suite still green (16/16); Re-Review DecisionDecision: RE-REVIEW NEEDED (base verdict was REQUEST CHANGES). The two 🟡 correctness items are resolved (one by removing dead code, one by verifying + documenting the persistence guarantee), and the two scale/test items are deferred to #1985 with rationale. Requesting a re-review of the new commit to confirm the resolutions before merge. |
Principal-Engineer Code Review — PR #1984 (closes #1921)Review Type: Re-Review — delta only ( Previous Review SummaryBase verdict: REQUEST CHANGES. Recommendations: 4 → Addressed in code: 2 · Deferred to #1985: 2 · New issues from the delta: 0. The follow-up commit is a clean, honest resolution: it deletes a misleading error path rather than papering over it, and it verifies (not just asserts) the persistence guarantee against the store's actual Per-finding verdicts✅ Resolved —
|
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as comment — GitHub blocks self-approval). Both correctness findings resolved (moveError dead-code removed; persistence guarantee verified against the store's shouldPersist gate + documented); pagination + browser-DnD-tests deferred to #1985. No new issues in the delta. Findings above.
…ility bugs A third review pass (independent verification, executed rather than just read-through) found several more real bugs: - resyncNodeFromServer's identity-race guard compared object references, assuming nodes are always replaced wholesale. Several pre-existing success-handler paths in this file mutate the node object in place and then re-set the same reference, which the reference check couldn't see. Switched to a value snapshot (JSON.stringify before/after the fetch), correct regardless of how a concurrent writer applies its change. - moveCard's onPersistError reverted to its own locally-read `from`, which can itself be an unconfirmed intermediate value from an earlier move in the same chain: two rapid moves of the same card that both fail settled on a value neither the server nor any write ever actually confirmed. Added chain-origin tracking (cleared via a new onPersistSuccess hook on UpdateOptions) so a chain of failures always reverts to the true pre-chain value, not an intermediate one. - resyncNodeFromServer's skip-guard silently dropped decideRemoteUpdate's notifyConflict signal (setNode's equivalent guard raises it) and hardcoded hasPending: false even for its own queued follow-up call, where the self-referential-race justification for that doesn't apply (the follow-up fires after the triggering write's own bookkeeping has already settled). Added the notification (deduped, so existing callers that already notify unconditionally don't double up) and made hasPending real for the follow-up path specifically. - eligibleGroupByFields (kanban-grouping.ts, pre-existing from #1984) now excludes an enum field whose values include the UNASSIGNED sentinel, which would otherwise collide with the genuinely-unset bucket. readGroupValue and resolveFieldWrite's top-level/properties precedence now match exactly, fixing a case where a shadowing field name (e.g. "status" on a user-defined type) could write to properties but read from a stale top-level slot, making the board silently ignore its own writes. - Minor: isFocused now calls focusManager.isNodeEditing() instead of reimplementing the same check inline. Several lower-reach findings from the same pass (batch-routing dropping the new callbacks, a pre-existing pendingUpdates leak for skipPersistence writes, fire-and-forget queued-resync semantics, an omitted shouldSkipStaleAiChatUpdate check) are pre-existing infrastructure or narrow edge cases outside this PR's contained scope — filed as follow-ups on core#2068 rather than expanding this diff further. Co-Authored-By: Claude <[email protected]>
* Cap Kanban column rendering and cover drag-and-drop with browser tests kanban-view.svelte bucketed and rendered every matching node per column (a card plus a full-options <select> each) with no bound, unlike List/Table's PAGE_SIZE=25 pagination. Each column now renders at most a batch of cards (matching PAGE_SIZE) with a "+N more" control that grows the visible count — never shrinks it, so an on-screen card can't vanish mid-drag. True virtualization was considered and rejected: this view's drag source is the rendered DOM node itself (native HTML5 drag-and-drop), which is incompatible with windowed/virtualized lists unmounting off-screen rows. The reveal-count arithmetic is extracted into kanban-grouping.ts and unit-tested; the click-driven reveal is covered by a new Happy-DOM component test. Add src/tests/browser/kanban-dnd.test.ts (Chromium) covering what Happy-DOM can't drive: real DragEvent/DataTransfer drag-and-drop against the mounted component, the keyboard "Move to" alternative, the same-column no-op, and the rollback path — using the real sharedNodeStore singleton with only the daemon RPC boundary mocked. Writing the rollback test surfaced a real bug in sharedNodeStore.updateNode: on a non-OCC persist failure, rollbackUpdate() only rewinds bookkeeping (metrics, version counter, pending-update list) and never restores the optimistically-applied field values, since NodeUpdate carries no previous-value snapshot. A rejected write left the local node permanently diverged from the server. Fixed by resyncing from the server on non-OCC failure, reusing the store's existing resyncNodeFromServer (the same fallback the OCC-conflict path already uses a few lines above). Added regression tests to shared-node-store.test.ts, each verified to fail on the prior code and pass on the fix. Co-Authored-By: Claude <[email protected]> * Address review: identity-stable cap, resync skip-while-editing guard Review round 1 on PR #2066 found two real bugs beyond the original diff: 1. The non-OCC resync path (added in the first commit) writes via resyncNodeFromServer(), which bypasses the skip-while-editing guard setNode() enforces. A debounced content persist failing for an unrelated reason while the user kept typing would silently overwrite their in-progress edit with stale server content. Fixed by applying the same decideRemoteUpdate guard resyncNodeFromServer() now uses for every caller (including the pre-existing OCC-conflict fallback). Deliberately isFocused-only, not hasPending: hasPending is self-referential when read from inside the very write's own failure handler (the failing operation still occupies its "executing" slot), which is racy and would defeat the recovery path for its most common case. 2. The per-column cap sliced by array position (`ids.slice(0, n)`), so a card joining a column ahead of an already-visible one in result order could push that card out from under itself — including, in the sharpest case, a card mid-drag. Replaced with an identity-stable revealed-id set (growRevealed in kanban-grouping.ts): a column under one batch always shows everything (a card just moved in must appear immediately, not wait behind a click), and moveCard explicitly reveals whatever this view just placed into a column regardless of that column's cap. Also: resyncNodeFromServer's idempotency guard now queues one follow-up for a caller that arrives while a resync is already in flight, instead of silently dropping it — two failures for the same node landing close together no longer leaves the second one's divergence uncorrected. Filed a follow-up issue for the one remaining related gap out of this PR's contained scope: the OCC-conflict direct-hydration branch (a sibling of resyncNodeFromServer, not touched by this PR) has the same guard-free write path and needs the identical fix. Co-Authored-By: Claude <[email protected]> * Address review round 2: scope Kanban's rollback to a local revert A second review pass found that the general resyncNodeFromServer-based non-OCC rollback (added in the previous commit) had three real races of its own: a failed node create left a permanent phantom node (server has nothing to return); the guard's hasPending had no way to tell a second, genuinely different in-flight write for the same node apart from the failing write's own not-yet-cleared bookkeeping, so it could clobber that write; and a resync skipped for an actively-edited node had no retry, so the divergence could persist indefinitely. All three trace back to the same root cause: a whole-node server resync is the wrong grain of correction for "one write, to one field, failed." Replaced with `onPersistError`, an opt-in per-call callback on UpdateOptions that lets the caller who made a specific write apply its own narrowly-scoped correction. Kanban's moveCard uses it to revert just the group-by field back to its pre-move value, guarded by a check that the field still holds exactly the value this move set (protects against stomping a newer move to the same card that landed before this one's failure was known). No server round-trip, no skip-while-editing guard needed, no interaction with node creation. resyncNodeFromServer itself is now only the OCC-conflict fallback (its original, narrower use before the previous commit). Hardened it further: an identity check bails if a different write landed for the node while the fetch was in flight (the same clobber class, without the self-referential hasPending race), and the guard-skip branch now marks the node persisted, matching setNode's equivalent branch. Also: removed GitHub issue numbers from code comments introduced by the previous commit, per repo convention. Co-Authored-By: Claude <[email protected]> * Address review round 3: fix identity-race, chained-revert, and eligibility bugs A third review pass (independent verification, executed rather than just read-through) found several more real bugs: - resyncNodeFromServer's identity-race guard compared object references, assuming nodes are always replaced wholesale. Several pre-existing success-handler paths in this file mutate the node object in place and then re-set the same reference, which the reference check couldn't see. Switched to a value snapshot (JSON.stringify before/after the fetch), correct regardless of how a concurrent writer applies its change. - moveCard's onPersistError reverted to its own locally-read `from`, which can itself be an unconfirmed intermediate value from an earlier move in the same chain: two rapid moves of the same card that both fail settled on a value neither the server nor any write ever actually confirmed. Added chain-origin tracking (cleared via a new onPersistSuccess hook on UpdateOptions) so a chain of failures always reverts to the true pre-chain value, not an intermediate one. - resyncNodeFromServer's skip-guard silently dropped decideRemoteUpdate's notifyConflict signal (setNode's equivalent guard raises it) and hardcoded hasPending: false even for its own queued follow-up call, where the self-referential-race justification for that doesn't apply (the follow-up fires after the triggering write's own bookkeeping has already settled). Added the notification (deduped, so existing callers that already notify unconditionally don't double up) and made hasPending real for the follow-up path specifically. - eligibleGroupByFields (kanban-grouping.ts, pre-existing from #1984) now excludes an enum field whose values include the UNASSIGNED sentinel, which would otherwise collide with the genuinely-unset bucket. readGroupValue and resolveFieldWrite's top-level/properties precedence now match exactly, fixing a case where a shadowing field name (e.g. "status" on a user-defined type) could write to properties but read from a stale top-level slot, making the board silently ignore its own writes. - Minor: isFocused now calls focusManager.isNodeEditing() instead of reimplementing the same check inline. Several lower-reach findings from the same pass (batch-routing dropping the new callbacks, a pre-existing pendingUpdates leak for skipPersistence writes, fire-and-forget queued-resync semantics, an omitted shouldSkipStaleAiChatUpdate check) are pre-existing infrastructure or narrow edge cases outside this PR's contained scope — filed as follow-ups on core#2068 rather than expanding this diff further. Co-Authored-By: Claude <[email protected]> * Address review round 4: chainOrigin null-origin and cross-field bugs A fourth review pass, executing the code rather than just reading it, found two real bugs in round 3's chain-origin revert tracking: - chainOrigin.get(chainKey) ?? from treated a genuinely-stored `null` origin (a card that started in the "Unassigned" column) the same as "nothing recorded", falling back to `from` — an intermediate, unconfirmed value for a chain of 2+ moves — instead of the true Unassigned origin. Switched to an explicit chainOrigin.has() check. - chainOrigin was keyed only by node id, not by (id, field). Switching the "Group by" picker mid-chain and moving the same card again let a later move for a different field inherit — and on failure, write — an origin value that belonged to an earlier field, corrupting one field's value with another's vocabulary. Keyed by `${id}:${field}` instead. The null-origin fix has a regression test verified to fail without it and pass with it. The cross-field key fix does not: PersistenceCoordinator serializes writes per node (not per field), so a later move for a different field can never actually observe an earlier field's still-live chainOrigin entry in practice — attempting to construct that interleaving in a test surfaced no reachable failure and, forcing an unrealistic promise-rejection order to try, corrupted shared test state instead. Kept as a defense-in-depth correctness fix (a composite key is strictly more correct than a shared one, at no cost) without a dedicated regression test, since none can be constructed against the current architecture. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Summary
QueryNodeViewerrendered three view tabs (List / Table / Kanban) but only Table worked — List and Kanban switched the tab and showed a "coming soon" placeholder. This implements both, plus the enum group-by picker and drag-to-change-value that Kanban needs.Changes
list-view.svelte(new) — one row per result showing the node title (title_template→content→ "Untitled"), reads each node fromsharedNodeStorefor cross-pane reactivity, paginated atPAGE_SIZE = 25like TableView, row click opens the node via the existingonRowClick.kanban-view.svelte(new) — groups results into columns by a selected enum field (enum-only: itscoreValues/userValuesgive both the column set and the display labels). Cards show titles and read from the store so they move reactively; a null/unrecognized value lands in an "Unassigned" column. Move a card by drag or via the per-card keyboard-accessible "Move to"<select>; dropping into the same column is a no-op; the optimistic store write rolls the card back on a rejected persist. Explanatory empty state when the schema has no enum field.kanban-grouping.ts(new) — pure, DOM-free helpers: eligible-field detection, enum columns, group-value read (mirrorstable-row's camelCase→snake→propertiesresolution), write-shape (writes back to where the value reads from —properties[field]for the common user-defined-schema case, matchinggeneric-schema-form), and column bucketing. 16 unit tests.query-node-viewer.svelte— render List/Kanban/Table byactiveView; delete theviewComingSoonstate, the coming-soon branch, and its now-dead CSS.Group-by selection and last view persist per query node via
QueryPreferencesServiceand restore on reopen.Acceptance criteria — all met
List (row-per-title, opens node, cross-pane reactive) · Kanban (columns per enum value, titled cards open node, Unassigned bucket) · group-by picker (eligible fields, persists per query node) · reopen restores view + group-by · empty state when no enum field · drag updates + persists the value · card reflects new column after store update · same-column drop = no write · failed update returns the card (store rollback) + surfaces error · coming-soon/
viewComingSoondeleted · keyboard-accessible move alternative.Note for review
Enum fields on user-defined schema types (the common Kanban case) write to
properties[field]— validated againstgeneric-schema-form's write path. Core namespaced typed fields (e.g.task.statusunder thetasknamespace) mirror their read location; that path is worth an on-device confirm for a core type. Card movement is consistent for all types because the write targets the same place the value is read from.Testing
New helper suite green (16/16). Full frontend suite green (184 files / 4342 tests, +16).
quality:fixclean (0/0). Full pre-push gate (test:all + cargo build + Tauri-seam e2e) green.🤖 Generated with Claude Code