Skip to content

Frontend: Send flat properties directly (remove nested type wrapper) #515

Closed

Description

@malibio

Frontend: Send Flat Properties Directly

Summary

Remove the legacy nested property format from frontend requests. Frontend should send flat properties directly to match the graph-native architecture.

Background

Issue #511 introduced graph-native architecture where type-specific properties are stored in separate tables (e.g., task table) and linked via data field.

Current workaround (packages/core/src/db/surreal_store.rs:218-258): Backend unwraps nested properties for backward compatibility, but this is temporary.

Problem

Current frontend behavior (nested - LEGACY):

{
  "content": "Buy milk",
  "nodeType": "task",
  "properties": {
    "task": {
      "status": "OPEN",
      "priority": "HIGH"
    }
  }
}

Expected flat format (graph-native):

{
  "content": "Buy milk",
  "nodeType": "task",
  "properties": {
    "status": "OPEN",
    "priority": "HIGH"
  }
}

Issues with nested format:

  1. Inconsistent with database (backend stores properties flat in task table)
  2. Unnecessary coupling (frontend duplicates type name in properties object)
  3. Backend workaround required (performance cost)
  4. Violates DRY (nodeType field already specifies the type)

Proposed Solution

Phase 1: Update Frontend Property Serialization

  1. Locate property serialization in frontend codebase
  2. Update serialization logic to send flat properties
  3. Key files to check:
    • src/lib/services/backend-adapter.ts
    • src/lib/design/components/base-node.svelte
    • src/lib/design/components/task-node.svelte

Phase 2: Remove Backend Unwrapping

Once frontend sends flat properties:

  1. Remove unwrap_legacy_property_format() function
  2. Remove calls to unwrapper in create_node() and update_node()
  3. Update tests to use flat property format

Phase 3: Add Validation

Backend should reject nested format with clear error messages.

Testing Strategy

  1. Frontend tests: Verify task creation/updates send flat properties
  2. Integration tests: Create/update tasks, verify properties saved correctly
  3. Regression testing: Create task via slash command, edit properties

Acceptance Criteria

  • Frontend sends flat properties
  • No nested type wrapper format
  • Backend unwrap_legacy_property_format() function removed
  • Backend validation rejects nested format
  • All tests pass
  • No regression in task creation/editing

Timeline

Target completion: 2025-12-15 (aligns with Issue #514 deprecation timeline)

Related Issues

References

  • Backend workaround: packages/core/src/db/surreal_store.rs:218-258
  • Backend usage: packages/core/src/db/surreal_store.rs:841, 1013

Activity

  1. malibio commented on Nov 16, 2025

    @malibio
    CollaboratorAuthor

    Closed in commit 015dfa8. Removed legacy property format handling instead of deprecating (pre-release cleanup). Frontend already sends flat properties after graph refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions