Skip to content

Complete before_sibling_id removal - use has_child edge ordering #614

Closed

Description

@malibio

Problem

The codebase has an incomplete migration from before_sibling_id field-based sibling ordering to has_child edge-based ordering. The schema explicitly states ordering should live in edges, but code still references the old field.

Evidence

  1. Schema comment (schema.surql:35):

    -- NO beforeSiblingId - structure lives in has_child edges!
  2. No field definition - before_sibling_id is not defined in the SCHEMAFULL node table, but code still writes to it.

  3. Failing tests - Multiple tests fail because they expect before_sibling_id to work:

    • test_reorder_siblings - expects before_sibling_id to be Some(child1_id) but gets None
    • test_sibling_chain_ordering
    • Various markdown/MCP tests that depend on sibling ordering

Affected Code

Key files with before_sibling_id usage:

  • packages/core/src/db/surreal_store.rs - SurrealNode struct and queries
  • packages/core/src/services/node_service.rs - reorder_siblings and related functions

Expected Behavior

Sibling ordering should be determined by the order field on has_child edges:

DEFINE FIELD IF NOT EXISTS order ON TABLE has_child TYPE float ASSERT $value != NONE;

Acceptance Criteria

  • Remove before_sibling_id field from SurrealNode struct
  • Update all queries that reference before_sibling_id
  • Implement reorder_siblings using has_child edge order field
  • Update tests to use edge-based ordering
  • All sibling ordering tests pass

Related

Activity

  1. added
    bug
    on Nov 22, 2025
  2. self-assigned this
    on Nov 22, 2025
  3. added 5 commits that reference this issue on Nov 22, 2025
    12e8ebf
    522ccfb
    3f8ee60
    3b9130a
    b2b9740
  4. added 6 commits that reference this issue on Nov 22, 2025
    aee6845
    35653fa
    e2fad34
    4f4a4c8
    e2cf6da
    880fcef
  5. added 6 commits that reference this issue on Feb 4, 2026
    2df29bb
    9e6e118
    c823375
    dde69f2
    dc48cfe
    52206bd
  6. added 2 commits that reference this issue on Feb 26, 2026
    1a209f7
    dbb7a93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions