feat(source): report most-cited and orphan sources#450
Conversation
reads the source-to-claim direction the existing surfaces don't. `vouch lint` flags dangling citations and `vouch stats` reports the coverage rate; neither surfaces a source that is registered and on disk yet cited by nothing. `vouch source usage` lists most-cited sources — resolving both direct citations and citations made through an evidence span — and orphan sources that no claim cites and no page references, so a reviewer can prune dead provenance or mine it for the claim it should back. a source a page references but no claim cites is left out of both counts. strictly a viewport: composes store.list_sources / list_claims / list_pages / list_evidence, writes nothing, logs no audit event. cli-only, no kb.* method surface. adds src/vouch/source_usage.py and tests/test_source_usage.py (14 tests).
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
this has drifted into conflict with what it adds is if it's useful i'll rebase onto current for what it's worth, three unsolicited ~400-line features opened the same day was probably the wrong shape to lead with — #490/#491 is closer to what i should be sending. |
|
closing this myself rather than leave the question above hanging — no need to answer it. three unsolicited ~400-line features opened the same day was the wrong thing to lead with, and rebasing all three onto sending smaller issue-linked changes instead — #490 / #491 is the shape. |
what
vouch source usage— a read-only report over the source→claim direction theexisting surfaces don't cover.
vouch lintflags dangling citations (a claim pointing at a source thatisn't there) and
vouch statsreports the citation coverage rate. neitheranswers the inverse: which registered sources back a real claim, and which
back nothing. sources aren't listable at all today.
the command lists:
resolving both citation paths vouch allows (a claim naming the source id
directly, or naming an evidence span that points into it — the same dual
path
stats.citation_summaryalready honours).referenced by no page. dead provenance: safe to prune, or a prompt to mine
the material for the claim it should support.
a source a page references but no claim cites is left out of both counts —
neither cited nor orphaned, only in
sources_total.why
closes the source-side blind spot in the citation invariant. an operator
curating a KB can spot load-bearing provenance and prune cruft in one glance,
or from cron via
--format json/--format markdown.surface
strictly a viewport. composes
store.list_sources,list_claims,list_pages,list_evidence; writes nothing, logs no audit event, and nevertouches a proposal — nothing here for the review gate to gate. cli-only, so no
new
kb.*method (the four-site method surface andtest_capabilitiesareuntouched). no storage, model, migration, or on-disk-layout change — an
existing
.vouch/reads unchanged.src/vouch/source_usage.py— new module: purebuild()plus text / markdown/ json renderers with a stable
to_dict()json contractsrc/vouch/cli.py—vouch source usageunder the existingsourcegrouptests/test_source_usage.py— 14 tests (direct + via-evidence citation,dedup, page-reference exclusion, orphan detection, dangling-citation safety,
ordering, non-silent truncation, and the cli)
CHANGELOG.md—[Unreleased]example
validation
python -m pytest tests/ -q --ignore=tests/embeddings→ 1101 passed, 37 skippedpython -m mypy src→ cleanpython -m ruff check src tests→ cleanno linked issue — this is a self-contained read-only viewport that changes
neither the object model, the
kb.*surface, the on-disk layout, the bundleformat, nor the audit shape, so per contributing it doesn't need a vep. happy
to open one if you'd rather track it.