Expand description
APEX-MEM conflict resolution for cardinality-1 predicates.
When multiple head edges share (subject, canonical_relation) and the predicate has
cardinality = 1, this module selects one authoritative edge per the configured
ConflictStrategy:
Recency: picks the edge with the greatestvalid_from.Confidence: picks the edge with the highestconfidence.Llm: delegates to an LLM provider with a 500 ms hard timeout, falling back toRecency.
§Invariants
- The resolver is only invoked for cardinality-1 predicates; cardinality-n predicates pass all head edges through unchanged.
- The LLM strategy respects a 500 ms mandatory timeout and a per-turn budget cap; both
exhaustion paths fall back to
Recency. - Losing edges are optionally retained in
alternatives(disabled by default).
§Unique index vs conflict resolver
The partial unique index uq_graph_edges_active_head prevents same-target duplicates
for a cardinality-1 predicate (i.e., two rows for the exact same target entity cannot
both be active). The conflict resolver handles the orthogonal case: two head edges with
different targets for the same cardinality-1 predicate (e.g., works_at Acme vs
works_at Globex).
Structs§
- Apex
Metrics - Atomic counters for APEX-MEM Prometheus metrics.
- Conflict
Resolver - Conflict resolver for cardinality-1 predicate groups.
- Conflict
Result - Output of conflict resolution for a single
(subject, canonical_relation)group.
Enums§
- Conflict
Strategy - Conflict resolution strategy for cardinality-1 predicates.
Constants§
- SUPERSEDE_
DEPTH_ CAP - Maximum allowed depth when walking a
supersedeschain for cycle detection. Defined here as a named constant per critic nit #7.