One-shot maintenance op that scrubs dangling link references from the graph and deletes orphaned tags/intents.
Earlier versions of the DETS persistence layer dropped node rows on delete but left back-references intact in surviving rows, so reloading produced a graph with edges pointing at missing IDs. This module repairs that drift by walking every node, intersecting each link MapSet with the live ID set, re-applying the cleaned nodes, and removing routing nodes (tags/intents) that have no surviving children.
Summary
Functions
Walks every node, drops link IDs that no longer correspond to a live node, reapplies the cleaned nodes, then deletes any tag/intent left without children.
Functions
@spec repair(keyword()) :: {:ok, %{ checked: non_neg_integer(), repaired_nodes: non_neg_integer(), dangling_refs: non_neg_integer(), orphans_deleted: non_neg_integer(), orphan_ids: [String.t()] }, {module(), term()}} | {:error, term()}
Walks every node, drops link IDs that no longer correspond to a live node, reapplies the cleaned nodes, then deletes any tag/intent left without children.
Options
:backend-{module, state}tuple (required)
Returns {:ok, summary, {backend_mod, new_state}} where summary is a map
with :checked, :repaired_nodes, :dangling_refs, :orphans_deleted,
and :orphan_ids.