From ba805814ec30265d3e4d2bb0de4abf95221628ab Mon Sep 17 00:00:00 2001 From: Steve-too Date: Wed, 15 Jul 2026 20:57:57 +0000 Subject: [PATCH] fix(recall): ignore archived page titles --- src/vouch/recall.py | 9 +++++++-- tests/test_recall.py | 14 +++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/vouch/recall.py b/src/vouch/recall.py index b05b0581..de0eb7f0 100644 --- a/src/vouch/recall.py +++ b/src/vouch/recall.py @@ -17,6 +17,7 @@ import yaml from .context import _RETRACTED_CLAIM_STATUSES +from .models import PageStatus from .scoping import ViewerContext, is_visible, viewer_from from .storage import KBStore @@ -79,10 +80,14 @@ def build_digest( viewer = viewer_from(config_path=store.config_path) live = [c for c in store.list_claims() if c.status not in _RETRACTED_CLAIM_STATUSES] all_pages = store.list_pages() + active_pages = [p for p in all_pages if p.status != PageStatus.ARCHIVED] claims = [c for c in live if is_visible(c.scope, viewer)] - pages = [p for p in all_pages if is_visible(p.scope, viewer)] + pages = [ + p for p in active_pages + if is_visible(p.scope, viewer) + ] if stats is not None: - stats["hidden"] = (len(live) - len(claims)) + (len(all_pages) - len(pages)) + stats["hidden"] = (len(live) - len(claims)) + (len(active_pages) - len(pages)) if not claims and not pages: return "" diff --git a/tests/test_recall.py b/tests/test_recall.py index a08a02ce..d2aaca40 100644 --- a/tests/test_recall.py +++ b/tests/test_recall.py @@ -7,7 +7,7 @@ import pytest from vouch import recall -from vouch.models import ClaimStatus +from vouch.models import ClaimStatus, PageStatus from vouch.proposals import approve, propose_claim, propose_page from vouch.storage import KBStore, _starter_config @@ -47,6 +47,18 @@ def test_digest_excludes_retracted_claims(store: KBStore) -> None: assert "archived fact" not in d +def test_digest_excludes_archived_pages(store: KBStore) -> None: + _approve_page(store, "live design") + archived = _approve_page(store, "obsolete design") + archived.status = PageStatus.ARCHIVED + store.update_page(archived) + + d = recall.build_digest(store) + + assert "live design" in d + assert "obsolete design" not in d + + def test_empty_kb_digest_is_empty(store: KBStore) -> None: assert recall.build_digest(store) == ""