Skip to content

fix(stats): stop misreporting broken citations for unreadable source meta#469

Open
RealDiligent wants to merge 2 commits into
vouchdev:testfrom
RealDiligent:fix/critical-issue-stats-citation-summary
Open

fix(stats): stop misreporting broken citations for unreadable source meta#469
RealDiligent wants to merge 2 commits into
vouchdev:testfrom
RealDiligent:fix/critical-issue-stats-citation-summary

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

Root cause: citation_summary() (used by vouch stats / kb.stats) built sources_present from store.list_sources(), which skips unreadable meta.yaml files via _load_or_skip. When a source directory exists but its meta is corrupt (hand edit, mojibake), claims citing that source were counted as broken_citation even 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 reports unreadable_source instead of broken_citation.

Fix: Use _collect_sources_for_lint() for the presence set in citation_summary().

Impact: kb.stats citation 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_citation may drop for KBs that previously looked worse than lint said — that was the bug. vouch lint remains the repair surface for unreadable metas.

Test plan

  • test_citation_summary_honest_when_source_meta_unreadable (new)
  • tests/test_stats.py pass

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@plind-junior, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6331a78e-e769-4e62-b26b-7511339d5cef

📥 Commits

Reviewing files that changed from the base of the PR and between 4de2b66 and a9ac580.

📒 Files selected for processing (2)
  • src/vouch/stats.py
  • tests/test_stats.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added tests tests and fixtures size: XS less than 50 changed non-doc lines labels Jul 13, 2026
@RealDiligent

Copy link
Copy Markdown
Contributor Author

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.

RealDiligent and others added 2 commits July 13, 2026 20:04
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>
@plind-junior

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS less than 50 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants