feat(wiki): port upstream knowledge quality improvements
setup / install-leaves-tree-clean (push) Waiting to run

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:
Codex
2026-11-07 21:49:41 +00:00
parent 82890606aa
commit e943bb329e
17 changed files with 437 additions and 29 deletions
+28
View File
@@ -83,3 +83,31 @@ def test_staging_cli_conflict_keeps_reviewed_and_live_files(tmp_path, capsys):
]) == 9
assert live.read_text() == "Concurrent live update"
assert staged.read_text() == "Reviewed proposal"
@pytest.mark.parametrize("shape", ["dict", "list"])
def test_source_coverage_accepts_local_archive_metadata_and_preserves_manifest(tmp_path, shape):
page = tmp_path / "concepts/a.md"
page.parent.mkdir()
page.write_text("---\ntitle: A\n---\n")
entries = [
{"path": "original.pdf", "archive_path": "_sources/archive/a.pdf",
"pages_produced": ["concepts/a.md"], "bjd_part_numbers": ["BJD-123"]},
{"path": "lost.pdf", "pages_updated": ["concepts/deleted.md"]},
{"path": "legacy.pdf", "pages_created": 2},
]
manifest = tmp_path / ".manifest.json"
manifest.write_text(json.dumps({"sources": {e["path"]: e for e in entries} if shape == "dict" else entries}))
before = manifest.read_bytes()
report = lint_vault(tmp_path, require_trust_ledger=False)
assert report["findings"]["uncovered_sources"] == [
{"source": "lost.pdf", "issue": "pages_missing", "missing": ["concepts/deleted.md"]}
]
assert manifest.read_bytes() == before
def test_lint_cli_exposes_source_coverage_in_json_and_strict_exit(tmp_path, capsys):
(tmp_path / ".manifest.json").write_text(json.dumps({"sources": {"lost.pdf": {"pages_produced": []}}}))
assert main(["lint", str(tmp_path), "--json", "--strict"]) == 1
report = json.loads(capsys.readouterr().out)
assert report["stats"]["findings"]["uncovered_sources"] == 1