feat(ingest): extend edge substrate with SUPPORTS + SUPERSEDES (#999) - #1002
Conversation
Both writers already exist deferred: SUPPORTS = the relationship detector's existing REFINES verdict (unwritten), SUPERSEDES = dedup's cluster write-path (deferred behind #197). #999 activates both behind the existing default-off AELFRICE_AUTO_RELATIONSHIPS gate, mirroring how #988 activated the CONTRADICTS writer. Deterministic, stdlib-only; keeps the #605/#897 narrow-surface decision intact.
The detector already computes a REFINES verdict (same-subject + agreeing-modality) but #988 only wrote CONTRADICTS. Add write_supports_edges, the agreement counterpart: emit one symmetric SUPPORTS edge per REFINES pair, idempotent, write-gated by max_edges_per_belief, deterministic in audit pair order. EDGE_SUPPORTS already exists in models.py. Not yet wired into ingest (next commit).
Activate the dedup write-path documented at dedup.py:160 and deferred behind the #197 bench gate: within each near-duplicate cluster the oldest member is the SUPERSEDES target and every newer member emits a directional member->oldest edge. Idempotent, write-gated by a dedup-local max_edges_per_belief (no import of relationship_detector, which imports dedup), deterministic in cluster/member order. EDGE_SUPERSEDES already exists in models.py. Not yet wired into ingest.
… gate (#999) Extend the #988 default-off ingest block to run all three semantic-edge writers in fixed order (CONTRADICTS -> SUPPORTS -> SUPERSEDES) behind the same is_auto_relationship_detection_enabled() flag. Flag off → branch never entered, ingest byte-identical to today. Completes #999: the HRR-expand lane substrate now carries 3 edge classes, not 1.
Reviewer's GuideExtends the ingest-time auto relationship substrate so, when the existing AELFRICE_AUTO_RELATIONSHIPS gate is enabled, it now also emits SUPPORTS edges from existing REFINES verdicts and SUPERSEDES edges from dedup near-duplicate clusters, with deterministic, idempotent writers plus tests and a design doc. Sequence diagram for ingest-time CONTRADICTS/SUPPORTS/SUPERSEDES edge writingsequenceDiagram
participant Ingest as _ingest_turn_ids
participant RelationshipDetector
participant Dedup
participant MemoryStore
Ingest->>MemoryStore: insert_turn_beliefs()
Ingest->>Ingest: [inserted > 0]
alt [auto relationships enabled]
Ingest->>RelationshipDetector: is_auto_relationship_detection_enabled()
alt [True]
Ingest->>RelationshipDetector: write_semantic_edges(store)
Ingest->>RelationshipDetector: write_supports_edges(store)
Ingest->>Dedup: write_supersedes_edges(store)
else [False]
Ingest->>Ingest: skip edge writers
end
else [inserted == 0]
Ingest->>Ingest: skip audit and edge writers
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds two new semantic edge writers— ChangesSUPPORTS and SUPERSEDES edge substrate expansion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR-size soft capThis PR is over the advisory size threshold:
Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The per-belief write cap is now defined separately in
relationship_detectoranddedup(DEFAULT_MAX_EDGES_PER_BELIEF); consider centralizing this value (e.g., in a shared config/module that avoids circular imports) so the cap cannot silently diverge between SUPPORTS and SUPERSEDES writers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The per-belief write cap is now defined separately in `relationship_detector` and `dedup` (`DEFAULT_MAX_EDGES_PER_BELIEF`); consider centralizing this value (e.g., in a shared config/module that avoids circular imports) so the cap cannot silently diverge between SUPPORTS and SUPERSEDES writers.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[claim:review:idnn:2026-06-23T18:10:12Z] |
|
merge-train: merged 6839b3c → |
|
Review: APPROVE Verified against
CI fully green (pytest 3.12/3.13, bench-smoke, all gates). FF-clean on main, 4 atomic signed commits. Discretion grep clean. Tests cover label discrimination, idempotency, determinism, write-gate, and ingest on/off wiring. Adding |
|
[release:review:idnn:2026-06-23T18:12:52Z] |
|
merge-train: merged 6839b3c → |
What
Extends the deterministic ingest edge substrate beyond CONTRADICTS-only
(#988) to also emit SUPPORTS and SUPERSEDES edges, so the
HRR-expand lane (#981/PR #997) traverses a graph with three edge classes
instead of one. Closes #999. Unblocks #1001 (the
+HRR-expandablation).Spec:
docs/design/feature-edge-type-expansion.md.Key finding — both writers already existed, deferred
No new detector was needed:
REFINESverdict(same-subject + agreeing modality) but feat(ingest): build the semantic-edge substrate via deterministic relationship-detection at ingest (default-off) — the real LoCoMo lever; reframes #981/#977 #988 wrote CONTRADICTS only.
write_supports_edgesturns the existing REFINES verdict into asymmetric SUPPORTS edge.
EDGE_SUPPORTSalready inmodels.py.dedup_auditalready clusters near-duplicates anddocumented the write-path ("oldest member is the SUPERSEDES target",
dedup.py:160) deferred behind the Deduplication module (dedup) — v2.0 evaluation #197 bench gate.write_supersedes_edgesactivates it: each newer cluster member → oldest, directional.
EDGE_SUPERSEDESalready inmodels.py.Both run behind the existing default-off
AELFRICE_AUTO_RELATIONSHIPSgate, exactly as #988 activated the CONTRADICTS writer. Flag off → ingest
byte-identical to today. Keeps the #605/#897 determinism + narrow-surface
decision intact (stdlib-only, no LLM, no embedding, no default flip).
Properties (both writers)
max_edges_per_belief(Exp-48 coverage-dilution guard),pre-existing edges count toward the per-belief budget across re-runs.
Commits (atomic)
docs(design)— spec memofeat(ingest)— SUPPORTS writer (REFINES→SUPPORTS) + testsfeat(ingest)— SUPERSEDES writer (dedup clusters) + testsfeat(ingest)— wire both into the auto-detect gate + testsTests
16 new tests (SUPPORTS writer, SUPERSEDES writer, ingest on/off wiring),
each covering write / scope / idempotency / write-gate / determinism.
Full suite: 5393 passed, 66 skipped, 75 xfailed.
Out of scope
Closes #999.
Summary by Sourcery
Extend ingest-time automatic relationship detection to emit SUPPORTS and SUPERSEDES edges alongside existing CONTRADICTS edges, based on existing deterministic audits and deduplication, while preserving default-off gating and determinism.
New Features:
Documentation:
Tests:
Summary by CodeRabbit
New Features
AELFRICE_AUTO_RELATIONSHIPSfeature flag.Tests