Repository navigation
Frontend dead-code cleanup: vestigial conflict/validation members + dead OptimisticOperationManager (C1b re-audit residue) - #1278
Conversation
…ecated stubs (closes #1277) Delete `validateNodeReferences` (deprecated stub), `ensureAncestorChainPersisted` (no-op), the pre-C5 client-side conflict subsystem (`detectConflict`, `handleConflict`, `setConflictResolver`/`getConflictResolver`, `conflictResolver` field, `createDefaultResolver`), and `OptimisticOperationManager` (only imported by its own test; inline rollback already works). Remove `Conflict`/`ConflictResolver`/`ConflictResolution` types and `skipConflictDetection` option from `UpdateOptions` — the daemon is authoritative for OCC verdicts (ADR-026 C5 amendment); `conflictNotifications` and the live OCC path in `updateNode`/`updateTaskNode` are untouched. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Code Review SummaryThis is a well-executed dead-code removal. The PR deletes ~1,400 lines and adds ~23, a healthy ratio for a cleanup task. All primary acceptance criteria from issue #1277 are met: the client-side conflict subsystem, The stated risk in the issue — that FindingsImprovement —
|
| Criterion | Status |
|---|---|
All five vestigial members + tests deleted; no @deprecated tags remain in the store |
Done |
optimistic-operation-manager.svelte.ts + its test deleted |
Done |
Confirmed no production caller passes previousVersion to updateNode |
Verified |
conflictNotifications and daemon-OCC conflict path untouched |
Verified |
Doc path + OOM claim fixed in frontend-state-and-persistence.md |
Deferred to separate doc/ PR in nodespace-docs (correct per issue scope) |
No lint suppression; bun run test and bun run check green |
Verified: 3,833 tests pass, svelte-check 0 errors |
Verdict: Approve with one recommended follow-up. The conflictCount dead-field is a CLAUDE.md rule violation worth cleaning up in a single-line follow-up (can be done before merge or as an immediate follow-on). The core cleanup is correct, complete, and safe to merge.
conflictCount in StoreMetrics was always zero after handleConflict was deleted in the prior commit. Remove the field from the type and its three initializer sites. Fix the previousVersion comment to describe its actual purpose (rollback) rather than the deleted conflict-detection use. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The vi.mock addition during rebase conflict resolution caused the OCC integration tests to fail — vi.fn().mockResolvedValue(undefined) on updateNode in the factory intercepted the vi.spyOn rejection setup, breaking the test's ability to simulate VERSION_CONFLICT responses. Main's version of this file already had moveChildrenToParent in its mock (added by #1278's dead-code cleanup). Restoring that version fixes 3 failing OCC integration tests. Co-Authored-By: Claude <[email protected]>
… (all-or-nothing) (#1276) * C3c: Atomic child-transfer-on-split — single MoveChildrenToParent RPC (closes #1275) Replaces the N per-child MoveNode RPCs with a single all-or-nothing MoveChildrenToParent RPC that re-parents an ordered set of children in one database transaction. OCC failures now roll back the entire batch rather than leaving partial state. Changes span all five layers: - proto: new MoveChildrenToParent RPC + ChildMove/request/response messages - core: SqliteStore::move_children_to_parent (single txn, delete+insert per edge) + NodeService::move_children_to_parent (up-front OCC pre-validation on all children, delegates atomic edge swap, bumps versions, emits RelationshipUpdated) - daemon: gRPC handler using existing service_error_to_status pipeline - tauri: move_children_to_parent command registered in lib.rs - frontend: BackendAdapter interface + TauriAdapter + HttpAdapter + MockAdapter; createNode child-transfer branch issues exactly one moveChildrenToParent call instead of N moveNode calls; on failure the #656 child-transfer-failure notification is preserved verbatim Tests: 4 new Rust unit tests (success, all-or-nothing, non-container guard, order preservation); 1 new daemon OCC mapping test; frontend test updated to spy on moveChildrenToParent and assert single-RPC + rollback + #656 notification. All 3867 frontend + 881 Rust tests pass. Co-Authored-By: Claude <[email protected]> * Address review: fix order chaining, add in-transaction OCC + cycle guard, tighten test Three review findings addressed: 1. Fractional order chaining bug (sqlite_store.rs): was computing orders with arbitrary prev=i*1000.0 instead of the previously assigned order. Now accumulates iteratively with orders.last().copied() as prev, producing correct sequential fractional values (e.g. [1.0, 2.0, 3.0]). 2. TOCTOU + missing cycle check (node_service/mod.rs): - Store method now accepts (child_id, expected_version) pairs and validates version inside the transaction using a version-gated DELETE + SELECT changes() — any mid-flight concurrent bump is caught inside the txn. - Added is_descendant() cycle guard in the service pre-validation loop, matching move_node's guards exactly as specified by the issue. 3. Frontend "exactly once" assertion (reactive-node-service.test.ts): Changed toBeGreaterThan(callsBefore) → toBe(callsBefore + 1) to enforce the acceptance criterion that exactly one RPC is issued, not merely ≥1. Skipped: HttpAdapter dev-proxy route (no server-side handlers exist for any route — consistent with project pattern); ADR-026/031 amendment (separate nodespace-docs doc/ branch, cross-linked via PR description). Co-Authored-By: Claude <[email protected]> * Address review: root-node guard, actionable error ID, store-layer atomicity tests Three re-review findings addressed: 1. Root-node false positive (node_service/mod.rs): added is_root_node() guard in the pre-validation loop so root nodes get HierarchyViolation instead of a spurious VersionConflict from the in-transaction changes()=0 path. Root nodes have no has_child edge so the version-gated DELETE would always return 0 rows. 2. Actionable conflict node ID (node_service/mod.rs): the VERSION_CONFLICT error re-mapping now parses the node ID out of the store's error string ("VERSION_CONFLICT: node '<id>' ...") using strip_prefix + split, so the resulting NodeServiceError::VersionConflict carries the actual offending node ID instead of "batch-child". 3. Store-layer atomicity tests (sqlite_store.rs): two new #[tokio::test] tests: - test_move_children_to_parent_store_rejects_stale_version: calls the store directly (bypassing service pre-validation) with a stale version token; asserts VERSION_CONFLICT error + child1 still under original parent (rollback). - test_move_children_to_parent_store_success_and_order: asserts correct strictly- increasing orders and all children move to new_parent on success. All 3867 frontend + 17 browser + 883 Rust tests pass (883 = +2 new store tests). Co-Authored-By: Claude <[email protected]> * Fix: remove spurious vi.mock from conflict-notification test The vi.mock addition during rebase conflict resolution caused the OCC integration tests to fail — vi.fn().mockResolvedValue(undefined) on updateNode in the factory intercepted the vi.spyOn rejection setup, breaking the test's ability to simulate VERSION_CONFLICT responses. Main's version of this file already had moveChildrenToParent in its mock (added by #1278's dead-code cleanup). Restoring that version fixes 3 failing OCC integration tests. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
…ead OptimisticOperationManager (C1b re-audit residue) (#1278) * Dead-code cleanup: remove client-side conflict subsystem + OOM + deprecated stubs (closes #1277) Delete `validateNodeReferences` (deprecated stub), `ensureAncestorChainPersisted` (no-op), the pre-C5 client-side conflict subsystem (`detectConflict`, `handleConflict`, `setConflictResolver`/`getConflictResolver`, `conflictResolver` field, `createDefaultResolver`), and `OptimisticOperationManager` (only imported by its own test; inline rollback already works). Remove `Conflict`/`ConflictResolver`/`ConflictResolution` types and `skipConflictDetection` option from `UpdateOptions` — the daemon is authoritative for OCC verdicts (ADR-026 C5 amendment); `conflictNotifications` and the live OCC path in `updateNode`/`updateTaskNode` are untouched. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Remove dead conflictCount metric and fix previousVersion comment conflictCount in StoreMetrics was always zero after handleConflict was deleted in the prior commit. Remove the field from the type and its three initializer sites. Fix the previousVersion comment to describe its actual purpose (rollback) rather than the deleted conflict-detection use. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
… (all-or-nothing) (#1276) * C3c: Atomic child-transfer-on-split — single MoveChildrenToParent RPC (closes #1275) Replaces the N per-child MoveNode RPCs with a single all-or-nothing MoveChildrenToParent RPC that re-parents an ordered set of children in one database transaction. OCC failures now roll back the entire batch rather than leaving partial state. Changes span all five layers: - proto: new MoveChildrenToParent RPC + ChildMove/request/response messages - core: SqliteStore::move_children_to_parent (single txn, delete+insert per edge) + NodeService::move_children_to_parent (up-front OCC pre-validation on all children, delegates atomic edge swap, bumps versions, emits RelationshipUpdated) - daemon: gRPC handler using existing service_error_to_status pipeline - tauri: move_children_to_parent command registered in lib.rs - frontend: BackendAdapter interface + TauriAdapter + HttpAdapter + MockAdapter; createNode child-transfer branch issues exactly one moveChildrenToParent call instead of N moveNode calls; on failure the #656 child-transfer-failure notification is preserved verbatim Tests: 4 new Rust unit tests (success, all-or-nothing, non-container guard, order preservation); 1 new daemon OCC mapping test; frontend test updated to spy on moveChildrenToParent and assert single-RPC + rollback + #656 notification. All 3867 frontend + 881 Rust tests pass. Co-Authored-By: Claude <[email protected]> * Address review: fix order chaining, add in-transaction OCC + cycle guard, tighten test Three review findings addressed: 1. Fractional order chaining bug (sqlite_store.rs): was computing orders with arbitrary prev=i*1000.0 instead of the previously assigned order. Now accumulates iteratively with orders.last().copied() as prev, producing correct sequential fractional values (e.g. [1.0, 2.0, 3.0]). 2. TOCTOU + missing cycle check (node_service/mod.rs): - Store method now accepts (child_id, expected_version) pairs and validates version inside the transaction using a version-gated DELETE + SELECT changes() — any mid-flight concurrent bump is caught inside the txn. - Added is_descendant() cycle guard in the service pre-validation loop, matching move_node's guards exactly as specified by the issue. 3. Frontend "exactly once" assertion (reactive-node-service.test.ts): Changed toBeGreaterThan(callsBefore) → toBe(callsBefore + 1) to enforce the acceptance criterion that exactly one RPC is issued, not merely ≥1. Skipped: HttpAdapter dev-proxy route (no server-side handlers exist for any route — consistent with project pattern); ADR-026/031 amendment (separate nodespace-docs doc/ branch, cross-linked via PR description). Co-Authored-By: Claude <[email protected]> * Address review: root-node guard, actionable error ID, store-layer atomicity tests Three re-review findings addressed: 1. Root-node false positive (node_service/mod.rs): added is_root_node() guard in the pre-validation loop so root nodes get HierarchyViolation instead of a spurious VersionConflict from the in-transaction changes()=0 path. Root nodes have no has_child edge so the version-gated DELETE would always return 0 rows. 2. Actionable conflict node ID (node_service/mod.rs): the VERSION_CONFLICT error re-mapping now parses the node ID out of the store's error string ("VERSION_CONFLICT: node '<id>' ...") using strip_prefix + split, so the resulting NodeServiceError::VersionConflict carries the actual offending node ID instead of "batch-child". 3. Store-layer atomicity tests (sqlite_store.rs): two new #[tokio::test] tests: - test_move_children_to_parent_store_rejects_stale_version: calls the store directly (bypassing service pre-validation) with a stale version token; asserts VERSION_CONFLICT error + child1 still under original parent (rollback). - test_move_children_to_parent_store_success_and_order: asserts correct strictly- increasing orders and all children move to new_parent on success. All 3867 frontend + 17 browser + 883 Rust tests pass (883 = +2 new store tests). Co-Authored-By: Claude <[email protected]> * Fix: remove spurious vi.mock from conflict-notification test The vi.mock addition during rebase conflict resolution caused the OCC integration tests to fail — vi.fn().mockResolvedValue(undefined) on updateNode in the factory intercepted the vi.spyOn rejection setup, breaking the test's ability to simulate VERSION_CONFLICT responses. Main's version of this file already had moveChildrenToParent in its mock (added by #1278's dead-code cleanup). Restoring that version fixes 3 failing OCC integration tests. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
Closes #1277