feat(wiki): port upstream knowledge quality improvements
setup / install-leaves-tree-clean (push) Successful in 18s
setup / install-leaves-tree-clean (push) Successful in 18s
Selectively port source coverage and redirect lint, ignore-aware provenance, staging and trust checks from upstream 055d720. Preserve local archive metadata and adapt source-date and defuddle skill guidance. Keep the existing skills directory, file index and MCP interfaces. Record per-module upstream baselines and exclusions without migrating vault data or changing services. Validation: 625 tests passed; git diff --check passed.
This commit is contained in:
@@ -86,6 +86,7 @@ def test_reviewed_ledger_is_authoritative_instead_of_reclassifying_sources(tmp_p
|
||||
"score_mismatches": 0,
|
||||
"missing_pages": 0,
|
||||
"errors": 0,
|
||||
"ignored_entries": 0,
|
||||
}
|
||||
assert {item["page"] for item in report["reviewed"]} == {
|
||||
"concepts/alpha.md",
|
||||
@@ -881,3 +882,50 @@ def test_required_trust_ledger_fails_closed_when_missing(tmp_path: Path) -> None
|
||||
|
||||
strict_report = lint_vault(vault, require_trust_ledger=True, strict_trust=True)
|
||||
assert strict_report["status"] == "fail"
|
||||
|
||||
|
||||
def _reviewed_then_ignored(tmp_path: Path) -> Path:
|
||||
vault = tmp_path / "vault"
|
||||
_page(vault, "concepts/alpha.md")
|
||||
_page(vault, "private/hidden.md")
|
||||
_write_ledger(vault)
|
||||
(vault / ".okignore").write_text("private/\n", encoding="utf-8")
|
||||
return vault
|
||||
|
||||
|
||||
def test_check_counts_a_reviewed_page_ignored_later_without_naming_it(tmp_path: Path) -> None:
|
||||
vault = _reviewed_then_ignored(tmp_path)
|
||||
|
||||
report = check_trust_ledger(vault)
|
||||
|
||||
# Still a warning: a page leaving the review gate has to stay visible.
|
||||
assert report["status"] == "warn"
|
||||
assert report["ignored_entries"] == 1
|
||||
assert report["counts"]["ignored_entries"] == 1
|
||||
assert report["missing_pages"] == []
|
||||
assert "hidden" not in json.dumps(report)
|
||||
|
||||
|
||||
def test_a_deleted_page_is_still_reported_missing_by_name(tmp_path: Path) -> None:
|
||||
vault = _reviewed_then_ignored(tmp_path)
|
||||
(vault / "concepts" / "alpha.md").unlink()
|
||||
|
||||
report = check_trust_ledger(vault)
|
||||
|
||||
assert report["missing_pages"] == [{"page": "concepts/alpha.md", "reason": "reviewed_page_missing"}]
|
||||
assert report["ignored_entries"] == 1
|
||||
|
||||
|
||||
def test_partial_review_prunes_ignored_entries_without_changing_other_reviews(tmp_path):
|
||||
vault = _reviewed_then_ignored(tmp_path)
|
||||
ledger_path = vault / "_meta/trust-ledger.json"
|
||||
before = json.loads(ledger_path.read_text())
|
||||
updated = update_trust_ledger(
|
||||
vault, ledger_path, reviewed_at="2026-11-07T00:00:00Z",
|
||||
page_paths=["concepts/alpha.md"],
|
||||
)
|
||||
assert updated["removed_ignored"] == 1
|
||||
assert set(updated["pages"]) == {"concepts/alpha.md"}
|
||||
assert updated["pages"]["concepts/alpha.md"]["material_fingerprint"] == before["pages"]["concepts/alpha.md"]["material_fingerprint"]
|
||||
write_trust_ledger(ledger_path, updated)
|
||||
assert check_trust_ledger(vault)["ignored_entries"] == 0
|
||||
|
||||
Reference in New Issue
Block a user