feat: expose IdentityGraphService/RootDistanceIndex via a genealogy query endpoint (musehub#211)
IdentityGraphService/RootDistanceIndex/QuorumEngine (musehub/graph/) are a real, correct, well-tested in-memory engine for identity-DAG invariants -- I1 (no cycles), I2 (root-distance to a human), I3 (org quorum soundness). Backed by 66 references across 5 dedicated test files. None of it was ever wired into the live application: register_agent_identity() writes spawned_by as a plain string column and commits, with no production code path anywhere that builds the DAG from persisted data or exposes a genealogy query.
Scoped to the minimal slice that closes the ticket's core gap, per the ticket's own revised framing after its author's live-tested correction: spawned_by can only ever be set to the authenticated caller's own handle and is never mutable afterward, so classic cycles (I1) are structurally impossible via the real API regardless of whether the engine is wired in -- this is 'a correct query engine exists and is never exposed,' not 'cycles are currently possible.'
Added GET /api/identities/{handle}/genealogy: builds the full spawn graph from musehub_identities (every non-deleted identity as a node, every spawned_by as a GraphEdge), runs RootDistanceIndex.build() fresh per request (correctness over caching for this first cut), and returns root_distance + human_ancestors. Same visibility as GET /api/identities/{handle} itself -- optional auth, no special permission.
As a side effect, this also makes the ticket's flagged-but-unverified orphan scenario queryable: an agent whose spawn chain passes through a revoked (soft-deleted) operator now correctly reports root_distance=null, human_ancestors=[] -- detectable, even though automatic cascading/flagging on revocation itself stays out of scope for this fix (noted as follow-up).
Explicitly out of scope, per agreed MVP cut: QuorumEngine/org-quorum query surface (I3) is a separate concern; left for a future ticket.
Semantic Changes
15 symbols
Files Changed
+1
~1
1109 in snapshot
0 comments
muse hub commit comment sha256:1a3ef15ee7610ff3777347c20b1f89ac9988b93b0eccc32f2e365a927b46ed68 --body "your comment"
No comments yet. Be the first to start the discussion.