Skip to content
Closed
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: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ All notable changes to vouch are documented here. Format follows
artifact the caller could not already retrieve, and it touches no write path.

### Fixed
- **`kb.list_pages` / `vouch pages` no longer list archived pages** (#728):
`filter_pages` (shared by MCP, JSONL, and the CLI) had no
`PageStatus.ARCHIVED` gate, so retired pages stayed in the agent-facing
live listing — and MCP/CLI payloads omit `status`, so an archived page
looked identical to a live one. Default is now live-set only
(`include_archived=False`); pass `include_archived=True` to opt back in.
- **`extract` no longer fractures file paths/URLs into auto-approved
garbage claims** (#702): the sentence segmenter only skipped a `.` as a
boundary when it was flanked by digits on both sides (decimals/versions
Expand Down
8 changes: 7 additions & 1 deletion src/vouch/page_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from typing import Any

from .models import Page
from .models import Page, PageStatus


def filter_pages(
Expand All @@ -27,15 +27,21 @@ def filter_pages(
equals: dict[str, str] | None = None,
before: dict[str, str] | None = None,
after: dict[str, str] | None = None,
include_archived: bool = False,
) -> list[Page]:
"""Return the pages matching every given predicate.

kind: exact match on `Page.type`.
equals: frontmatter field == value (string-compared).
before / after: inclusive bounds — value <= / >= the given bound.
include_archived: when False (default), drop ``PageStatus.ARCHIVED``
pages so agent-facing listings (`kb.list_pages`, `vouch pages`) match
the live-set convention used by search/wiki/neighbors/digest (#728).
"""
out: list[Page] = []
for page in pages:
if not include_archived and page.status is PageStatus.ARCHIVED:
continue
if kind is not None and page.type != kind:
continue
meta = page.metadata
Expand Down
9 changes: 9 additions & 0 deletions tests/test_page_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ def test_filter_numeric_bounds() -> None:
assert [p.id for p in hits] == ["p5", "p30"]


def test_filter_excludes_archived_by_default() -> None:
pages = [
_page("live"),
Page(id="dead", title="dead", type="concept", status=PageStatus.ARCHIVED),
]
assert [p.id for p in filter_pages(pages)] == ["live"]
assert [p.id for p in filter_pages(pages, include_archived=True)] == ["live", "dead"]


def test_parse_kv() -> None:
assert parse_kv(("a=1", "b=x=y")) == {"a": "1", "b": "x=y"}
with pytest.raises(ValueError):
Expand Down
Loading