Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/vouch/recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import yaml

from .context import _RETRACTED_CLAIM_STATUSES
from .models import PageStatus
from .storage import KBStore

DEFAULT_ENABLED = True
Expand Down Expand Up @@ -58,7 +59,10 @@ def build_digest(store: KBStore, *, max_chars: int = DEFAULT_MAX_CHARS) -> str:
c for c in store.list_claims()
if c.status not in _RETRACTED_CLAIM_STATUSES
]
pages = store.list_pages()
pages = [
p for p in store.list_pages()
if p.status != PageStatus.ARCHIVED
]
if not claims and not pages:
return ""

Expand Down
14 changes: 13 additions & 1 deletion tests/test_recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) == ""

Expand Down
Loading