Skip to content

Fix schema seeding, cross-pane reactivity, and add TaskNode type safety - #678

Merged
malibio merged 8 commits into
mainfrom
feature/fix-schema-seeding-and-property-reactivity
Nov 28, 2025
Merged

malibio merged 8 commits into
mainfrom
feature/fix-schema-seeding-and-property-reactivity

Conversation

@malibio

@malibio malibio commented Nov 28, 2025 •

Copy link
Copy Markdown
Collaborator

Summary

  • Fix schema seeding to use camelCase field names
  • Fix slash command reactivity (missing structureTree and placeholder reset)
  • Fix cross-pane task status reactivity via sharedNodeStore
  • Add type-safe TaskNode interface with helpers
  • Fix SchemaPropertyForm not showing on page refresh for persisted tabs

Commits

  1. fix: schema seeding camelCase - Use dueDate, startedAt, completedAt instead of snake_case
  2. fix: slash command reactivity - Add missing reactiveStructureTree.addChild() and resetPlaceholderId() calls
  3. fix: TaskNode cross-pane reactivity - Switch from nodeData to sharedNodeStore for status derivation
  4. feat: TaskNode type interface - Add TaskNode, TaskStatus, TaskPriority types with helpers
  5. fix: user-extensible types - TaskStatus allows user-defined values beyond core statuses
  6. fix: SchemaPropertyForm on refresh - Add viewedNodeCache to trigger reactivity after async load

Test Plan

  • All 1493 tests passing
  • Quality checks pass (eslint, svelte-check)
  • Manual: Create task, change status in Pane 2, verify Pane 1 updates
  • Manual: Refresh page with task tab open, verify SchemaPropertyForm shows
  • Manual: Test slash commands create nodes properly

Related

🤖 Generated with Claude Code

malibio and others added 2 commits November 28, 2025 10:34
PR #672 added camelCase serde attributes to Rust models but missed updating
the browser dev mode seeding script (init-schemas-via-proxy.ts), causing
schema fields like coreValues and userValues to not be deserialized properly.

Changes:
- is_core → isCore (all 7 schema definitions)
- core_values → coreValues (task schema enum fields)
- user_values → userValues (task schema enum fields)
- due_date → dueDate, started_at → startedAt, completed_at → completedAt
- Status values: UPPERCASE → lowercase (per Issue #670)

This aligns the browser seeding script with:
- Rust seed_core_schemas() which uses camelCase in json!() macro
- Identifier naming conventions: JSON uses camelCase

Verified: Task priority dropdown now shows Low/Medium/High options.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Root cause: When slash commands converted placeholders to typed nodes,
the on:slashCommandSelected handlers were missing two critical calls
that existed in the on:contentChange handler:
- reactiveStructureTree.addChild() - triggers visibleNodesFromStores update
- resetPlaceholderId() - allows template to re-render with real node

Without these calls, the node was correctly persisted to the database
but the UI didn't update to reflect the new nodeType (e.g., task nodes
rendered as text nodes with blue bullets instead of checkboxes).

Also fixed variable shadowing in taskStateChanged handlers where
destructured `nodeId` from event.detail shadowed the outer `nodeId` prop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
malibio and others added 4 commits November 28, 2025 11:14
- TaskNode now derives status from sharedNodeStore instead of nodeData
- Enables cross-pane synchronization when task status changes in one pane
- Uses schema properties (properties.task.status) as primary source
- Falls back to content-based task syntax for backward compatibility
- Cleaned up outdated LIVE SELECT comments in reactive-node-data.svelte.ts

Root cause: TaskNode used nodeData store (Tauri events) while
SchemaPropertyForm updated sharedNodeStore, causing stores to be
out of sync for in-memory property updates.

Related: Issue #679 documents broader store consolidation plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Create TaskNode type extending Node (matches CodeBlockNode pattern)
- Add TaskStatus and TaskPriority types matching schema
- Add type guard isTaskNode() and typed accessors:
  - getTaskStatus(), setTaskStatus()
  - getTaskPriority(), setTaskPriority()
  - getTaskDueDate(), setTaskDueDate()
- Add TaskNodeHelpers with isCompleted(), isActive(), isPending()
- Update task-node.svelte to use type-safe helpers instead of
  manual property access with 'as' casts

This brings TaskNode in line with other typed node variants
(CodeBlockNode, QuoteBlockNode, OrderedListNode).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add CoreTaskStatus and CoreTaskPriority for protected values
- TaskStatus/TaskPriority now accept string for user-defined values
- Add isCoreStatus() and isCorePriority() type guards
- Update display name helpers to format user-defined values
  (capitalizes words, replaces underscores with spaces)

Schema supports extensible: true on enums, so types must allow
user-defined values beyond the core set.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Root cause: sharedNodeStore uses plain Map (not $state), so $derived
doesn't re-evaluate when nodes are loaded asynchronously. On page
refresh with persisted tabs, the viewer renders before node data loads.

Fix: Add viewedNodeCache $state variable that gets updated after
loadChildrenForParent completes, triggering reactivity for the
SchemaPropertyForm condition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio malibio changed the title Fix schema seeding camelCase and slash command reactivity Fix schema seeding, cross-pane reactivity, and add TaskNode type safety Nov 28, 2025
@malibio

malibio commented Nov 28, 2025

Copy link
Copy Markdown
Collaborator Author

Code Review Report

Review Type: Initial Review
PR: #678 - Fix schema seeding, cross-pane reactivity, and add TaskNode type safety
Branch: feature/fix-schema-seeding-and-property-reactivity

Requirements Check

This PR is a multi-fix PR without a linked issue. It addresses six distinct problems as described in the PR summary:

  • Fix schema seeding to use camelCase field names (isCore, coreValues, userValues, dueDate, startedAt, completedAt)
  • Fix status values to lowercase per Issue Schema and Hub-Spoke Architecture Cleanup with Status Value Unification #670 (open, in_progress, done, cancelled)
  • Fix slash command reactivity (missing reactiveStructureTree.addChild() and resetPlaceholderId() calls)
  • Fix TaskNode cross-pane reactivity via sharedNodeStore
  • Add type-safe TaskNode interface with helpers
  • Make TaskStatus and TaskPriority user-extensible
  • Fix SchemaPropertyForm not showing on page refresh for persisted tabs

Code Review Findings

Critical [Blocker] Code Inconsistency: Status Case Mismatch

📁 packages/desktop-app/src/lib/design/components/base-node-viewer.svelte:1436-1453 and 1605-1622

Issue: The taskStateChanged event handlers use UPPERCASE status values ('OPEN', 'IN_PROGRESS', 'DONE') but the schema seeding was updated to use lowercase values ('open', 'in_progress', 'done', 'cancelled').

Current code (two locations):

on:taskStateChanged={(e) => {
  const { nodeId: eventNodeId, state } = e.detail;

  // Map UI state to schema enum value
  let schemaStatus: string;
  switch (state) {
    case 'pending':
      schemaStatus = 'OPEN';        // Should be 'open'
      break;
    case 'inProgress':
      schemaStatus = 'IN_PROGRESS'; // Should be 'in_progress'
      break;
    case 'completed':
      schemaStatus = 'DONE';        // Should be 'done'
      break;
    default:
      schemaStatus = 'OPEN';        // Should be 'open'
  }

  updateSchemaField(eventNodeId, 'status', schemaStatus);
}}

Impact: When clicking on task checkboxes to change status, the schema property will be set to 'OPEN' instead of 'open', causing a mismatch with the schema definition and potentially breaking status-based queries/filters.

Recommendation:

switch (state) {
  case 'pending':
    schemaStatus = 'open';
    break;
  case 'inProgress':
    schemaStatus = 'in_progress';
    break;
  case 'completed':
    schemaStatus = 'done';
    break;
  default:
    schemaStatus = 'open';
}

Engineering Principle: Data consistency - schema enum values must match across all layers (seeding, reading, writing) to prevent data integrity issues and ensure queries work correctly.


Suggestion [Improvement] Code Duplication: Repeated taskStateChanged Handler Logic

📁 packages/desktop-app/src/lib/design/components/base-node-viewer.svelte:1433-1454 and 1605-1626

The exact same taskStateChanged handler logic appears twice in the file (once for plugin nodes, once for fallback BaseNode). This creates maintenance burden and increases the risk of inconsistencies.

Recommendation: Extract the status mapping logic into a helper function:

function mapNodeStateToSchemaStatus(state: string): string {
  switch (state) {
    case 'pending':
      return 'open';
    case 'inProgress':
      return 'in_progress';
    case 'completed':
      return 'done';
    default:
      return 'open';
  }
}

Then use in both handlers:

on:taskStateChanged={(e) => {
  const { nodeId: eventNodeId, state } = e.detail;
  updateSchemaField(eventNodeId, 'status', mapNodeStateToSchemaStatus(state));
}}

Engineering Principle: DRY (Don't Repeat Yourself) - duplicated logic should be extracted to a single source of truth to reduce maintenance burden and prevent divergence.


Suggestion [Improvement] Type Safety Enhancement: Consider Using TaskStatus Type

📁 packages/desktop-app/src/lib/design/components/base-node-viewer.svelte:1437

The schemaStatus variable is typed as string but should leverage the new TaskStatus type from task-node.ts for better type safety.

Current code:

let schemaStatus: string;

Recommendation:

import type { TaskStatus } from '$lib/types/task-node';
// ...
let schemaStatus: TaskStatus;

Engineering Principle: Type safety - leverage existing type definitions to catch errors at compile time rather than runtime.


Nit [Polish] Import Cleanup in task-node.svelte

📁 packages/desktop-app/src/lib/design/components/task-node.svelte:24

The TaskStatus type is imported but only used as a type annotation in the helper function. Consider using import type for better tree-shaking clarity.

Current code:

import { isTaskNode, getTaskStatus, type TaskStatus } from '$lib/types/task-node';

This is already correct! The type keyword is used for TaskStatus. No change needed.


Positive [Approval]: Excellent Type-Safe Task Node Design

📁 packages/desktop-app/src/lib/types/task-node.ts

The new task-node.ts file demonstrates excellent design:

  1. Type Safety: Proper type guards (isTaskNode), typed accessors, and immutable update patterns
  2. Extensibility: CoreTaskStatus | string allows user-defined values while maintaining type safety for core values
  3. Documentation: Comprehensive JSDoc comments with examples
  4. Immutable Updates: setTaskStatus, setTaskPriority, etc. return new objects rather than mutating
  5. Helper Namespace: TaskNodeHelpers provides convenient grouped access to all helpers
  6. Display Names: Smart formatting for both core and user-defined values

This is a model for how to add type safety to other node types in the future.


Positive [Approval]: Cross-Pane Reactivity Fix

📁 packages/desktop-app/src/lib/design/components/task-node.svelte:48-56

The switch from nodeData to sharedNodeStore as the single source of truth for cross-pane reactivity is the correct architectural approach. The commit message clearly documents the root cause and the workaround nature of the fix (with Issue #679 tracking the broader consolidation).


Positive [Approval]: viewedNodeCache Reactivity Fix

📁 packages/desktop-app/src/lib/design/components/base-node-viewer.svelte:134-138

The addition of viewedNodeCache as a $state variable to trigger reactivity after async data load is a clean workaround for the sharedNodeStore's non-reactive Map. The fallback chain (viewedNodeCache ?? sharedNodeStore.getNode()) ensures correctness while enabling reactivity.


Summary

Category Critical Important Suggestions
Code Quality 1 1 1
Security 0 0 0
Performance 0 0 0
Testing 0 0 0

Tests: All 1493 tests passing. Manual testing checklist provided in PR.


Recommendation

REQUEST CHANGES

The status case mismatch between schema seeding (lowercase) and taskStateChanged handlers (UPPERCASE) is a functional bug that will cause data inconsistencies. This must be fixed before merge.

After fixing the UPPERCASE -> lowercase status values in base-node-viewer.svelte (lines 1436-1453 and 1605-1626), this PR provides valuable improvements:

  • Type-safe TaskNode interface
  • Cross-pane reactivity fixes
  • Schema seeding corrections
  • SchemaPropertyForm reactivity fix

The code quality is generally high with good documentation and proper architectural decisions.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See code review comment for details. Critical issue: Status case mismatch in taskStateChanged handlers (UPPERCASE vs lowercase) must be fixed.

Address code review findings from PR #678:

- 🔴 Critical: Fixed status case mismatch - handlers now use lowercase
  values ('open', 'in_progress', 'done') matching schema seeding
- 🟡 Important: Extracted duplicated status mapping logic into
  mapNodeStateToSchemaStatus() helper function (DRY principle)

Skipped recommendations:
- 🟢 Using TaskStatus type: The schemaStatus variable is immediately
  passed to updateSchemaField() which expects a string. Adding the
  type would require additional type assertions with marginal benefit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Nov 28, 2025

Copy link
Copy Markdown
Collaborator Author

Review Feedback Addressed ✅

Changes Made

Severity Item Status
🔴 Critical Status case mismatch (UPPERCASE → lowercase) ✅ Fixed
🟡 Important Extract duplicated status mapping logic (DRY) ✅ Fixed
🟢 Suggestion Use TaskStatus type ⏭️ Skipped

Implementation Details

  1. Added mapNodeStateToSchemaStatus() helper function - Centralizes the UI state → schema status mapping logic, eliminating duplication
  2. Updated both taskStateChanged handlers - Now use the helper function with correct lowercase values ('open', 'in_progress', 'done')

Skipped Recommendation

Using TaskStatus type for schemaStatus variable: Skipped because the variable is immediately passed to updateSchemaField() which expects a generic string. Adding the import and type assertion would add complexity with marginal benefit.

Verification

  • ✅ All 1493 tests passing
  • ✅ Quality checks (ESLint, svelte-check, Rust) passing
  • ✅ No new lint errors or warnings

Commit

0ed089b - fix: Use lowercase status values in taskStateChanged handlers

Add type safety to status mapping function by using CoreTaskStatus
return type instead of plain string. This catches typos at compile
time and documents that only core status values are returned.

Addresses reviewer suggestion from PR #678 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit 86f9e63 into main Nov 28, 2025
@malibio
malibio deleted the feature/fix-schema-seeding-and-property-reactivity branch November 28, 2025 11:40
malibio added a commit that referenced this pull request Feb 4, 2026
…ty (#678)

* Fix: Use camelCase for JSON schema fields in browser dev seeding script

PR #672 added camelCase serde attributes to Rust models but missed updating
the browser dev mode seeding script (init-schemas-via-proxy.ts), causing
schema fields like coreValues and userValues to not be deserialized properly.

Changes:
- is_core → isCore (all 7 schema definitions)
- core_values → coreValues (task schema enum fields)
- user_values → userValues (task schema enum fields)
- due_date → dueDate, started_at → startedAt, completed_at → completedAt
- Status values: UPPERCASE → lowercase (per Issue #670)

This aligns the browser seeding script with:
- Rust seed_core_schemas() which uses camelCase in json!() macro
- Identifier naming conventions: JSON uses camelCase

Verified: Task priority dropdown now shows Low/Medium/High options.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Add missing reactivity calls in slashCommandSelected handlers

Root cause: When slash commands converted placeholders to typed nodes,
the on:slashCommandSelected handlers were missing two critical calls
that existed in the on:contentChange handler:
- reactiveStructureTree.addChild() - triggers visibleNodesFromStores update
- resetPlaceholderId() - allows template to re-render with real node

Without these calls, the node was correctly persisted to the database
but the UI didn't update to reflect the new nodeType (e.g., task nodes
rendered as text nodes with blue bullets instead of checkboxes).

Also fixed variable shadowing in taskStateChanged handlers where
destructured `nodeId` from event.detail shadowed the outer `nodeId` prop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: TaskNode cross-pane reactivity via sharedNodeStore

- TaskNode now derives status from sharedNodeStore instead of nodeData
- Enables cross-pane synchronization when task status changes in one pane
- Uses schema properties (properties.task.status) as primary source
- Falls back to content-based task syntax for backward compatibility
- Cleaned up outdated LIVE SELECT comments in reactive-node-data.svelte.ts

Root cause: TaskNode used nodeData store (Tauri events) while
SchemaPropertyForm updated sharedNodeStore, causing stores to be
out of sync for in-memory property updates.

Related: Issue #679 documents broader store consolidation plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* feat: add type-safe TaskNode interface with helpers

- Create TaskNode type extending Node (matches CodeBlockNode pattern)
- Add TaskStatus and TaskPriority types matching schema
- Add type guard isTaskNode() and typed accessors:
  - getTaskStatus(), setTaskStatus()
  - getTaskPriority(), setTaskPriority()
  - getTaskDueDate(), setTaskDueDate()
- Add TaskNodeHelpers with isCompleted(), isActive(), isPending()
- Update task-node.svelte to use type-safe helpers instead of
  manual property access with 'as' casts

This brings TaskNode in line with other typed node variants
(CodeBlockNode, QuoteBlockNode, OrderedListNode).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: make TaskStatus and TaskPriority user-extensible

- Add CoreTaskStatus and CoreTaskPriority for protected values
- TaskStatus/TaskPriority now accept string for user-defined values
- Add isCoreStatus() and isCorePriority() type guards
- Update display name helpers to format user-defined values
  (capitalizes words, replaces underscores with spaces)

Schema supports extensible: true on enums, so types must allow
user-defined values beyond the core set.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: SchemaPropertyForm not showing on page refresh for persisted tabs

Root cause: sharedNodeStore uses plain Map (not $state), so $derived
doesn't re-evaluate when nodes are loaded asynchronously. On page
refresh with persisted tabs, the viewer renders before node data loads.

Fix: Add viewedNodeCache $state variable that gets updated after
loadChildrenForParent completes, triggering reactivity for the
SchemaPropertyForm condition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Use lowercase status values in taskStateChanged handlers

Address code review findings from PR #678:

- 🔴 Critical: Fixed status case mismatch - handlers now use lowercase
  values ('open', 'in_progress', 'done') matching schema seeding
- 🟡 Important: Extracted duplicated status mapping logic into
  mapNodeStateToSchemaStatus() helper function (DRY principle)

Skipped recommendations:
- 🟢 Using TaskStatus type: The schemaStatus variable is immediately
  passed to updateSchemaField() which expects a string. Adding the
  type would require additional type assertions with marginal benefit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: Use CoreTaskStatus type for mapNodeStateToSchemaStatus

Add type safety to status mapping function by using CoreTaskStatus
return type instead of plain string. This catches typos at compile
time and documents that only core status values are returned.

Addresses reviewer suggestion from PR #678 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
…ty (#678)

* Fix: Use camelCase for JSON schema fields in browser dev seeding script

PR #672 added camelCase serde attributes to Rust models but missed updating
the browser dev mode seeding script (init-schemas-via-proxy.ts), causing
schema fields like coreValues and userValues to not be deserialized properly.

Changes:
- is_core → isCore (all 7 schema definitions)
- core_values → coreValues (task schema enum fields)
- user_values → userValues (task schema enum fields)
- due_date → dueDate, started_at → startedAt, completed_at → completedAt
- Status values: UPPERCASE → lowercase (per Issue #670)

This aligns the browser seeding script with:
- Rust seed_core_schemas() which uses camelCase in json!() macro
- Identifier naming conventions: JSON uses camelCase

Verified: Task priority dropdown now shows Low/Medium/High options.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Add missing reactivity calls in slashCommandSelected handlers

Root cause: When slash commands converted placeholders to typed nodes,
the on:slashCommandSelected handlers were missing two critical calls
that existed in the on:contentChange handler:
- reactiveStructureTree.addChild() - triggers visibleNodesFromStores update
- resetPlaceholderId() - allows template to re-render with real node

Without these calls, the node was correctly persisted to the database
but the UI didn't update to reflect the new nodeType (e.g., task nodes
rendered as text nodes with blue bullets instead of checkboxes).

Also fixed variable shadowing in taskStateChanged handlers where
destructured `nodeId` from event.detail shadowed the outer `nodeId` prop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: TaskNode cross-pane reactivity via sharedNodeStore

- TaskNode now derives status from sharedNodeStore instead of nodeData
- Enables cross-pane synchronization when task status changes in one pane
- Uses schema properties (properties.task.status) as primary source
- Falls back to content-based task syntax for backward compatibility
- Cleaned up outdated LIVE SELECT comments in reactive-node-data.svelte.ts

Root cause: TaskNode used nodeData store (Tauri events) while
SchemaPropertyForm updated sharedNodeStore, causing stores to be
out of sync for in-memory property updates.

Related: Issue #679 documents broader store consolidation plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* feat: add type-safe TaskNode interface with helpers

- Create TaskNode type extending Node (matches CodeBlockNode pattern)
- Add TaskStatus and TaskPriority types matching schema
- Add type guard isTaskNode() and typed accessors:
  - getTaskStatus(), setTaskStatus()
  - getTaskPriority(), setTaskPriority()
  - getTaskDueDate(), setTaskDueDate()
- Add TaskNodeHelpers with isCompleted(), isActive(), isPending()
- Update task-node.svelte to use type-safe helpers instead of
  manual property access with 'as' casts

This brings TaskNode in line with other typed node variants
(CodeBlockNode, QuoteBlockNode, OrderedListNode).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: make TaskStatus and TaskPriority user-extensible

- Add CoreTaskStatus and CoreTaskPriority for protected values
- TaskStatus/TaskPriority now accept string for user-defined values
- Add isCoreStatus() and isCorePriority() type guards
- Update display name helpers to format user-defined values
  (capitalizes words, replaces underscores with spaces)

Schema supports extensible: true on enums, so types must allow
user-defined values beyond the core set.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: SchemaPropertyForm not showing on page refresh for persisted tabs

Root cause: sharedNodeStore uses plain Map (not $state), so $derived
doesn't re-evaluate when nodes are loaded asynchronously. On page
refresh with persisted tabs, the viewer renders before node data loads.

Fix: Add viewedNodeCache $state variable that gets updated after
loadChildrenForParent completes, triggering reactivity for the
SchemaPropertyForm condition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Use lowercase status values in taskStateChanged handlers

Address code review findings from PR #678:

- 🔴 Critical: Fixed status case mismatch - handlers now use lowercase
  values ('open', 'in_progress', 'done') matching schema seeding
- 🟡 Important: Extracted duplicated status mapping logic into
  mapNodeStateToSchemaStatus() helper function (DRY principle)

Skipped recommendations:
- 🟢 Using TaskStatus type: The schemaStatus variable is immediately
  passed to updateSchemaField() which expects a string. Adding the
  type would require additional type assertions with marginal benefit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: Use CoreTaskStatus type for mapNodeStateToSchemaStatus

Add type safety to status mapping function by using CoreTaskStatus
return type instead of plain string. This catches typos at compile
time and documents that only core status values are returned.

Addresses reviewer suggestion from PR #678 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
…ty (#678)

* Fix: Use camelCase for JSON schema fields in browser dev seeding script

PR #672 added camelCase serde attributes to Rust models but missed updating
the browser dev mode seeding script (init-schemas-via-proxy.ts), causing
schema fields like coreValues and userValues to not be deserialized properly.

Changes:
- is_core → isCore (all 7 schema definitions)
- core_values → coreValues (task schema enum fields)
- user_values → userValues (task schema enum fields)
- due_date → dueDate, started_at → startedAt, completed_at → completedAt
- Status values: UPPERCASE → lowercase (per Issue #670)

This aligns the browser seeding script with:
- Rust seed_core_schemas() which uses camelCase in json!() macro
- Identifier naming conventions: JSON uses camelCase

Verified: Task priority dropdown now shows Low/Medium/High options.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Add missing reactivity calls in slashCommandSelected handlers

Root cause: When slash commands converted placeholders to typed nodes,
the on:slashCommandSelected handlers were missing two critical calls
that existed in the on:contentChange handler:
- reactiveStructureTree.addChild() - triggers visibleNodesFromStores update
- resetPlaceholderId() - allows template to re-render with real node

Without these calls, the node was correctly persisted to the database
but the UI didn't update to reflect the new nodeType (e.g., task nodes
rendered as text nodes with blue bullets instead of checkboxes).

Also fixed variable shadowing in taskStateChanged handlers where
destructured `nodeId` from event.detail shadowed the outer `nodeId` prop.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: TaskNode cross-pane reactivity via sharedNodeStore

- TaskNode now derives status from sharedNodeStore instead of nodeData
- Enables cross-pane synchronization when task status changes in one pane
- Uses schema properties (properties.task.status) as primary source
- Falls back to content-based task syntax for backward compatibility
- Cleaned up outdated LIVE SELECT comments in reactive-node-data.svelte.ts

Root cause: TaskNode used nodeData store (Tauri events) while
SchemaPropertyForm updated sharedNodeStore, causing stores to be
out of sync for in-memory property updates.

Related: Issue #679 documents broader store consolidation plan

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* feat: add type-safe TaskNode interface with helpers

- Create TaskNode type extending Node (matches CodeBlockNode pattern)
- Add TaskStatus and TaskPriority types matching schema
- Add type guard isTaskNode() and typed accessors:
  - getTaskStatus(), setTaskStatus()
  - getTaskPriority(), setTaskPriority()
  - getTaskDueDate(), setTaskDueDate()
- Add TaskNodeHelpers with isCompleted(), isActive(), isPending()
- Update task-node.svelte to use type-safe helpers instead of
  manual property access with 'as' casts

This brings TaskNode in line with other typed node variants
(CodeBlockNode, QuoteBlockNode, OrderedListNode).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: make TaskStatus and TaskPriority user-extensible

- Add CoreTaskStatus and CoreTaskPriority for protected values
- TaskStatus/TaskPriority now accept string for user-defined values
- Add isCoreStatus() and isCorePriority() type guards
- Update display name helpers to format user-defined values
  (capitalizes words, replaces underscores with spaces)

Schema supports extensible: true on enums, so types must allow
user-defined values beyond the core set.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: SchemaPropertyForm not showing on page refresh for persisted tabs

Root cause: sharedNodeStore uses plain Map (not $state), so $derived
doesn't re-evaluate when nodes are loaded asynchronously. On page
refresh with persisted tabs, the viewer renders before node data loads.

Fix: Add viewedNodeCache $state variable that gets updated after
loadChildrenForParent completes, triggering reactivity for the
SchemaPropertyForm condition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* fix: Use lowercase status values in taskStateChanged handlers

Address code review findings from PR #678:

- 🔴 Critical: Fixed status case mismatch - handlers now use lowercase
  values ('open', 'in_progress', 'done') matching schema seeding
- 🟡 Important: Extracted duplicated status mapping logic into
  mapNodeStateToSchemaStatus() helper function (DRY principle)

Skipped recommendations:
- 🟢 Using TaskStatus type: The schemaStatus variable is immediately
  passed to updateSchemaField() which expects a string. Adding the
  type would require additional type assertions with marginal benefit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* refactor: Use CoreTaskStatus type for mapNodeStateToSchemaStatus

Add type safety to status mapping function by using CoreTaskStatus
return type instead of plain string. This catches typos at compile
time and documents that only core status values are returned.

Addresses reviewer suggestion from PR #678 code review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant