fix(stats): stop misreporting broken citations for unreadable source meta#469
fix(stats): stop misreporting broken citations for unreadable source meta#469RealDiligent wants to merge 2 commits into
Conversation
|
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 |
|
CI note: the py3.13 failure was an unrelated flaky timing test (\ est_websocket_broadcasts_on_approve\ — broadcast took 1.17s vs 1.0s budget on a loaded runner). py3.11 and py3.12 passed; retriggered CI with an empty commit. |
citation_summary called list_sources(), which skips unreadable meta via _load_or_skip. Claims citing those sources were misreported as broken_citation in kb.stats / vouch stats — lint already treats the source as present (unreadable_source finding instead). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Root cause:
citation_summary()(used byvouch stats/kb.stats) builtsources_presentfromstore.list_sources(), which skips unreadablemeta.yamlfiles via_load_or_skip. When a source directory exists but its meta is corrupt (hand edit, mojibake), claims citing that source were counted asbroken_citationeven though the source is on disk.health.lint()already fixed this asymmetry via_collect_sources_for_lint()— the source id is its directory name, so citations stay honest and lint reportsunreadable_sourceinstead ofbroken_citation.Fix: Use
_collect_sources_for_lint()for the presence set incitation_summary().Impact:
kb.statscitation coverage metrics no longer lie when a source meta is unreadable; operators aren't sent to delete citations for sources that still exist.Risk / tradeoffs
broken_citationmay drop for KBs that previously looked worse than lint said — that was the bug.vouch lintremains the repair surface for unreadable metas.Test plan
test_citation_summary_honest_when_source_meta_unreadable(new)tests/test_stats.pypass