diff --git a/CHANGELOG.md b/CHANGELOG.md index bb2ec56..fd9be8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,11 @@ All notable changes to vouch are documented here. Format follows - console Dashboard view: 12-month activity calendar, last-30-days bars, hour-of-week heatmap, top actors and event mix, driven by `kb.activity`. +### Fixed +- `vouch digest --limit` now caps the followups-due section like the + pending, decisions, and stale sections — it previously returned every + due followup regardless of the limit, contradicting the `--limit` help. + ## [1.2.2] — 2026-07-07 ### Packaging diff --git a/src/vouch/digest.py b/src/vouch/digest.py index e5c279a..d7bae66 100644 --- a/src/vouch/digest.py +++ b/src/vouch/digest.py @@ -197,7 +197,7 @@ def build( if str(p.metadata.get("followup_status", "")) not in _CLOSED_FOLLOWUP_STATUSES ), key=lambda r: r.due_at, - ) + )[:limit] m = compute(store, since=since, stale_after_days=stale_after_days, now=now) diff --git a/tests/test_digest.py b/tests/test_digest.py index f5cc70d..4d3eae4 100644 --- a/tests/test_digest.py +++ b/tests/test_digest.py @@ -146,6 +146,24 @@ def test_build_limit_caps_sections(store: KBStore) -> None: assert len(d.decisions) <= 1 +def test_build_limit_caps_followups(tmp_path: Path) -> None: + # --limit documents that it caps every section including followups; seed + # more due-open followups than the limit and confirm the list is bounded + # like pending/decisions/stale rather than returned whole. + s = KBStore.init(tmp_path) + for i in range(5): + due = (NOW - timedelta(days=i + 1)).date().isoformat() + s.put_page( + Page( + id=f"fu-{i}", title=f"followup {i}", type="followup", + status=PageStatus.ACTIVE, + metadata={"due_at": due, "followup_status": "open"}, + ) + ) + d = digest_mod.build(s, limit=3, now=NOW) + assert len(d.followups_due) == 3 + + def test_digest_is_read_only(store: KBStore) -> None: audit_before = (store.kb_dir / "audit.log.jsonl").read_text(encoding="utf-8") files_before = sorted(p.name for p in (store.kb_dir / "proposed").glob("*"))