Skip to content
Tools/Edges/repair_dangling_edges

repair_dangling_edges

Inspect or drop edges whose source or target node fails to resolve. Each is classified `expected` (cross-product, sibling not loaded; keep), `suspect` (cross-product, missing product-id annotation), or `corrupt` (broken endpoint on a non-cross edge). Defaults to `dry_run: true`. Pass `dry_run: false` plus `drop: ["suspect", "corrupt"]` to remove.

Edgesatomic-with-rollback. Classification runs against the live document before any mutation; with `dry_run: false`, the drop set is computed up-front and applied in a single index rebuild.

Arguments

dry_runbooleanoptional

When true (default), returns the classification report without mutating. When false, drops edges matching `drop`.

droparrayoptional

Classes of dangling edge to drop. Only honoured when dry_run is false. Omit to no-op.

Returns

Shape
{ dry_run, report, dropped?, remaining? }
report is the pre-action classification.
With dry_run: false, dropped is the count of edges removed and remaining is the post-action report.

Examples

Live call against the Notion example graph.

Output

{
  "dry_run": true,
  "report": {
    "total": 0,
    "by_class": {
      "expected": 0,
      "suspect": 0,
      "corrupt": 0
    },
    "edges": []
  }
}

Warnings

Dropping `corrupt` edges is irreversible. The integrity stamp is re-computed on next save; a subsequent reload won't bring them back.