feat(source): report most-cited and orphan sources#450
Open
boskodev790 wants to merge 1 commit into
Open
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.