fix: exclude speculative phantoms from retention promotion (#1132) - #1133
Conversation
find_promotable_snapshots drives the corroboration-based promotion of snapshot beliefs to retention_class='fact'. Phantoms ingest with retention_class='snapshot' (wonder_ingest), so a phantom corroborated >=3x across >=2 sessions was eligible for this count-driven promotion -- the exact trigger shape the ratified #229 rule rejects on the origin axis. Add 'AND origin != speculative' so phantom durability, like phantom trust promotion, advances only through explicit acknowledgment (aelf validate / lock-match #550). Retention and origin remain orthogonal axes; neither promotes a speculative belief on a corroboration count alone. Regression tests: a speculative-origin snapshot with a qualifying corroboration profile is excluded from find_promotable_snapshots and left untouched end-to-end by promote_retention.
Reviewer's GuideThis PR tightens the retention promotion logic so that corroboration-driven promotion from Sequence diagram for doctor.promote_retention excluding speculative-origin phantomssequenceDiagram
actor User
participant Doctor
participant Store
User ->> Doctor: promote_retention(min_corroborations, min_sessions)
Doctor ->> Store: find_promotable_snapshots(min_corroborations, min_sessions)
Store -->> Doctor: promotable_beliefs_non_speculative
Doctor ->> Doctor: [for each promotable belief, set retention_class to fact]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughSnapshot retention promotion now excludes speculative-origin beliefs through an additional SQL predicate. Tests add configurable belief construction and verify speculative phantom beliefs are neither selected nor promoted or given promotion feedback. ChangesRetention promotion filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
merge-train: merged 1e06c11 → |
What
Excludes speculative-origin phantoms from the corroboration-driven retention
promotion (
find_promotable_snapshots→doctor.promote_retention).Refs #1132 (Q1). The issue stays open; the promotion-opportunity detector (Q2)
lands in a follow-up PR and closes it.
Why
find_promotable_snapshotspromotes anyretention_class='snapshot'belief with≥3 corroborations across ≥2 distinct sessions (no inbound CONTRADICTS) to
retention_class='fact'. Phantoms ingest withretention_class='snapshot'(
wonder_ingest,wonder/lifecycle.py), and the query filtered onretention_classbut not on origin. So a phantom corroborated ≥3×/≥2 sessionswas eligible for a count-driven flip to durable
factretention — the exacttrigger shape the ratified #229 rule (
v2_phantom_promotion_trigger.md) rejectson the origin axis ("promote on N feedback / retrieval-count … These are
non-triggers").
retention_class (durability policy) and origin (trust label) are orthogonal
axes, so this was not a logical contradiction with #229 — but it let a
speculative belief advance on a corroboration count alone via a different axis,
which is against the spirit of the ratified rule and was undocumented at the
intersection. In practice it is manual-opt-in (
aelf doctor --promote-retention,nothing auto-invokes it) so it has almost certainly never fired, but the guard
is correct and cheap.
Change
store.find_promotable_snapshots: addAND b.origin != ?(bound to
ORIGIN_SPECULATIVE), matching the existing parameterized-originidiom in
store.py. Docstring updated to state the guard and its R&D: phantom promotion — origin path is 0-by-design (#229); retention path reaches speculative rows on a count trigger #1132/[v2.0] Phantom promotion-trigger rule — three rejected naive triggers, need a benchmarked rule #229rationale.
test_doctor_promote_retention.py):test_promotable_excludes_speculative_origin_phantoms— a phantom with aqualifying corroboration profile (N=3 / 3 sessions / no CONTRADICTS) is
excluded; contrast-documented against the existing
test_promotable_returns_qualifying_belief(identical profile, non-speculativeorigin, IS promotable).
test_promote_retention_leaves_phantom_untouched— end-to-end:promote_retentionfinds 0 candidates and leaves the phantom'sretention_class='snapshot'with noretention_promotionfeedback row.Both new tests were confirmed to fail without the one-line guard and pass with
it. Retention/origin orthogonality is preserved for every non-speculative origin.
Summary by Sourcery
Exclude speculative-origin phantoms from corroboration-based retention promotion and ensure they cannot be auto-upgraded from snapshot to fact.
Bug Fixes:
Tests:
Summary by CodeRabbit
Bug Fixes
Tests