fix(search): exclude retracted claims and archived pages - #584
fix(search): exclude retracted claims and archived pages#584kurosawareiji7007-hub wants to merge 1 commit into
Conversation
kb.context already drops ARCHIVED/SUPERSEDED/REDACTED claims; kb.search did not, so lifecycle controls leaked on the detail-search surface. Fixes vouchdev#581 Co-authored-by: Cursor <cursoragent@cursor.com>
Walkthrough
ChangesSearch lifecycle filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
ready for review — regression in |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/test_context.py (1)
175-207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winexercise
SUPERSEDEDandREDACTEDtoo.This test only transitions a claim to archived. Parameterize or add cases for the other retracted statuses so a regression affecting only those statuses cannot pass while violating the stated lifecycle contract.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_context.py` around lines 175 - 207, The test_search_kb_excludes_retracted_claims coverage only verifies ARCHIVED claims. Extend it to exercise SUPERSEDED and REDACTED claim transitions as well, using parameterized cases or separate cases while preserving the existing assertions that live claims/pages remain searchable and retracted claims do not.src/vouch/context.py (1)
522-523: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuekeep code comments lowercase.
Start the added comment with lowercase prose.
As per path instructions, “use lowercase prose in comments and review notes.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/vouch/context.py` around lines 522 - 523, Update the added comment near the status-filtering search logic so its prose starts with lowercase text, while preserving the existing wording and behavior.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/vouch/context.py`:
- Around line 522-525: Update the retrieval flow around filter_hits and
_filter_live_hits so candidate collection continues beyond the backend’s
fetch_limit before lifecycle filtering, allowing retracted or archived hits to
be replaced by later live candidates. Reuse the shared
storage/proposals/lifecycle path rather than duplicating filtering logic, and
preserve the requested limit in the final live results.
---
Nitpick comments:
In `@src/vouch/context.py`:
- Around line 522-523: Update the added comment near the status-filtering search
logic so its prose starts with lowercase text, while preserving the existing
wording and behavior.
In `@tests/test_context.py`:
- Around line 175-207: The test_search_kb_excludes_retracted_claims coverage
only verifies ARCHIVED claims. Extend it to exercise SUPERSEDED and REDACTED
claim transitions as well, using parameterized cases or separate cases while
preserving the existing assertions that live claims/pages remain searchable and
retracted claims do not.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3c0e0470-8afe-4a5f-910f-3bcda06062ae
📒 Files selected for processing (3)
CHANGELOG.mdsrc/vouch/context.pytests/test_context.py
| # Scope first without a limit so status filtering can refill the window — | ||
| # otherwise a page of retracted hits would leave search under-filled. | ||
| scoped = filter_hits(store, hits, viewer, limit=None) | ||
| live = _filter_live_hits(store, scoped, limit=limit) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
retrieve candidates beyond the pre-lifecycle window.
hits is already capped at fetch_limit by every backend before this filtering runs. Removing the filter_hits limit cannot replace retracted or archived candidates that never entered hits; if those consume the fetched window, later live results are still omitted. paginate candidates or enforce lifecycle state before backend limiting.
As per path instructions, “use the shared underlying storage/proposals/lifecycle code path rather than duplicating filtering logic.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/vouch/context.py` around lines 522 - 525, Update the retrieval flow
around filter_hits and _filter_live_hits so candidate collection continues
beyond the backend’s fetch_limit before lifecycle filtering, allowing retracted
or archived hits to be replaced by later live candidates. Reuse the shared
storage/proposals/lifecycle path rather than duplicating filtering logic, and
preserve the requested limit in the final live results.
Source: Path instructions
what changed
search_kb(the sharedkb.searchpath) now drops retracted claims and archived pages after scope filtering, matchingkb.context.why
#78taught context to honour archive/supersede/redact. search never got the same filter, so agents callingkb.searchafter recall could still retrieve retracted knowledge.validation
Fixes #581
Summary by CodeRabbit