Skip to content

fix(search): exclude retracted claims and archived pages - #584

Merged
plind-junior merged 2 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/search-exclude-retracted
Jul 29, 2026
Merged

fix(search): exclude retracted claims and archived pages#584
plind-junior merged 2 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/search-exclude-retracted

Conversation

@kurosawareiji7007-hub

@kurosawareiji7007-hub kurosawareiji7007-hub commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

what changed

search_kb (the shared kb.search path) now drops retracted claims and archived pages after scope filtering, matching kb.context.

why

#78 taught context to honour archive/supersede/redact. search never got the same filter, so agents calling kb.search after recall could still retrieve retracted knowledge.

validation

python -m pytest tests/test_context.py::test_search_kb_excludes_retracted_claims -q
python -m ruff check src/vouch/context.py tests/test_context.py
python -m mypy src/vouch/context.py

Fixes #581

Summary by CodeRabbit

  • Bug Fixes
    • Knowledge base detail-search now excludes retracted claims and archived pages (including archived, superseded, and redacted items).
    • “Live” results are prioritized so retracted/archived top matches won’t cause the returned list to be underfilled.
  • Tests
    • Added regression coverage to verify lifecycle filtering across each retracted status and to ensure the result limit is correctly refilled after filtering.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@plind-junior, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b571e3e-49d2-449a-b40c-e5d1a1e22d6b

📥 Commits

Reviewing files that changed from the base of the PR and between 5742d10 and e483236.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/vouch/context.py
  • tests/test_context.py

Walkthrough

search_kb now over-fetches candidates, filters retracted claims and archived pages, and applies the requested result limit afterward. Regression tests cover lifecycle statuses and result-limit refilling, with the behavior documented in the changelog.

Changes

Search lifecycle filtering

Layer / File(s) Summary
Filter search results for live artifacts
src/vouch/context.py
search_kb over-fetches candidates, applies viewer scoping without consuming the limit, removes retracted claims and archived pages, ignores missing artifacts, and enforces the final limit.
Validate lifecycle filtering
tests/test_context.py, CHANGELOG.md
Tests cover archived, superseded, and redacted claims, archived pages, limit refilling, and the documented fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: dripsmvcp

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: search now excludes retracted claims and archived pages.
Linked Issues check ✅ Passed search_kb now filters retracted claims and archived pages after scoping, and regression tests cover the requested lifecycle cases.
Out of Scope Changes check ✅ Passed The changes stay focused on search lifecycle filtering and refill behavior, with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation tests tests and fixtures size: S 50-199 changed non-doc lines labels Jul 29, 2026
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

ready for review — regression in tests/test_context.py::test_search_kb_excludes_retracted_claims. please consider label bug if accurate.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
tests/test_context.py (1)

175-207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

exercise SUPERSEDED and REDACTED too.

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 value

keep 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe8fb5 and d0cd394.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/vouch/context.py
  • tests/test_context.py

Comment thread src/vouch/context.py Outdated
kurosawareiji7007-hub added a commit to kurosawareiji7007-hub/vouch that referenced this pull request Jul 29, 2026
address coderabbit on vouchdev#584: backends now pull a candidate pool so
retracted top-hits cannot starve the requested limit; tests cover
superseded/redacted and the refill case; comments stay lowercase.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

addressed coderabbit feedback:

  • over-fetch a candidate pool before lifecycle filtering so retracted top-hits cannot under-fill limit
  • parameterized coverage for archived / superseded / redacted
  • lowercase comment prose

ready for re-review.

kb.context already drops ARCHIVED/SUPERSEDED/REDACTED claims; kb.search
did not, so lifecycle controls leaked on the detail-search surface.
backends over-fetch a candidate pool before that filter so retracted
top-hits cannot starve the requested result limit.

Fixes vouchdev#581
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the fix/search-exclude-retracted branch from 5742d10 to ee3c528 Compare July 29, 2026 12:55
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

rewrote commit history to remove the Co-authored-by: Cursor trailer (repo contributing guide forbids ai attribution trailers).

@plind-junior
plind-junior merged commit be43b22 into vouchdev:test Jul 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs documentation, specs, examples, and repo guidance retrieval context, search, synthesis, and evaluation size: S 50-199 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants