DrivineCollectorTraceStore

class DrivineCollectorTraceStore(persistenceManager: <Error class: unknown class>) : CollectorTraceStore, CollectorTraceQuery

Drivine / Neo4j CollectorTraceStore: persists the multi-signal collector's inspectable decision trace as plain property-bag nodes, so a graph deployment keeps it durable and queryable instead of losing it to a process restart (the in-memory store's tradeoff).

Graph model — every trace node carries both runId and contextId so deleteTracesForContext can erase a context's rows in one pass per label, and every write MERGEs on a natural key so a replayed run updates in place instead of duplicating:

  • (:CollectorTraceRun {runId, contextId, createdAt}) — written by recordRunContext; every other write MATCHes this node to copy its contextId, so contextId is single-sourced here rather than threaded through every record call.

  • (:CollectorCandidateEdge {id, runId, contextId, anchorId, memberId, aggregateScore, vetoed}) with id = "runId|anchorId|memberId", plus one child (:CollectorSignalScore {id, runId, contextId, signal, score, weight, veto, explanation, evidenceRef})-[:SCORED]->(:CollectorCandidateEdge) per signal so per-signal detail stays queryable.

  • (:CollectorComponent {id, runId, contextId, componentId, memberIds}) with id = "runId|componentId".

  • (:CollectorDecision {id, runId, contextId, componentId, survivorId, action, createdAt}) with id = "runId|componentId", plus one child (:CollectorRetired {id, runId, contextId, propositionId, priorStatus, foldedGrounding, foldedProvenanceRefs, foldedSourceIds, foldedProvenanceEvidenceKeys}) -[:RETIRED_IN]->(:CollectorDecision) per retired proposition, so a reversal has everything a merging sweep folded onto the survivor.

Every write is a single UNWIND $rows AS r ... round trip (see com.embabel.dice.storage.CollectorTraceRowMappers for the flattening); no APOC, no GDS. Query methods are corrupt-row-tolerant: a row that fails to map is logged and skipped rather than failing the whole read.

Constructors

Link copied to clipboard
constructor(persistenceManager: <Error class: unknown class>)

Functions

Link copied to clipboard
open override fun deleteTracesForContext(contextId: <Error class: unknown class>)

Erasure hook: deleting a context's data must cascade to its trace rows.

Link copied to clipboard
open override fun findDecisionForProposition(propositionId: String): CollectorDecision?

Finds the decision that retired or preserved propositionId, whichever side of the merge it was on.

Link copied to clipboard
open override fun findDecisionRetiring(propositionId: String): CollectorDecision?

The newest decision that retired propositionId. Never one where it only survived.

Link copied to clipboard
open override fun findDecisionsByRun(runId: String): List<CollectorDecision>

Rehydrates every decision recorded under runId, each with its retired members nested — one round trip.

Link copied to clipboard
open override fun findEdgesByRun(runId: String): List<CollectorCandidateEdge>

Rehydrates every edge recorded under runId, each with its signals nested.

Link copied to clipboard

The undo-record for one retired member of a collapse: its prior status and exactly the grounding/provenance/source ids a merging sweep folded onto its survivor from it. Looks up the CollectorDecision that retired retiredId via findDecisionRetiring and picks out its entry.

Link copied to clipboard
open override fun recordCandidateEdges(runId: String, edges: List<CollectorCandidateEdge>)
Link copied to clipboard
open override fun recordComponents(runId: String, components: List<CollectorComponent>)
Link copied to clipboard
open override fun recordDecision(runId: String, decision: CollectorDecision)
Link copied to clipboard
open override fun recordRunContext(runId: String, contextId: <Error class: unknown class>)

Registers which context a run belongs to, so deleteTracesForContext can find and clear that run's rows later. Call this once per run, e.g. before recording its first edge.