Skip to content

fix(analytics): a named source never reads the global stats document (#20513) - #20612

Closed
mrveiss wants to merge 5 commits into
mainfrom
issue-20513-last-indexed
Closed

mrveiss wants to merge 5 commits into
mainfrom
issue-20513-last-indexed

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Thinking Path

#20513's first rule is that a request for one source never gets another's result. Two reads broke it even with a source named: when a source had no stats document of its own, they read the global codebase_stats document, which describes a different tree. This takes those two out; requiring a source on routes comes later and needs its callers checked first.

What Changed

  • endpoints/sources.py: _get_last_indexed reads only the source's own document, so a source with none reports no last-indexed time instead of another tree's.
  • api/analytics_quality.py: _get_problems_from_chromadb reads the source's document when one is named, and the global one only when none is. A source with no document gets empty stats.
  • Test reversed on purpose: analytics_quality_test.py pinned the fallback from bug(quality): _get_problems_from_chromadb reads only "codebase_stats" — misses per-source "codebase_stats_{source_id}" #6670, so that test now asserts the opposite.
  • Size ceiling: analytics_quality.py lowered from 1729 to 1718.

Verification

$ pytest api/analytics_quality_test.py api/codebase_analytics/endpoints/sources_last_indexed_20513_test.py -q
34 passed

Not checked: a real index, or how the pages look with no stats.

Risks

Model Used

Claude Opus 5.5

Issue Link

Refs #20513

🤖 Generated with Claude Code

@mrveiss mrveiss added bug Something isn't working backend phase:M4.11 Safety net: tests and analysers reach the whole tree labels Nov 2, 2026
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between fd4c2df and 982c01e.

Files ignored due to path filters: 1
  • scripts/python_file_size_known_large.py is excluded by !scripts/python_file_size_known_large.py
Files selected for processing: 4
  • autobot-backend/api/analytics_quality.py
  • autobot-backend/api/analytics_quality_test.py
  • autobot-backend/api/codebase_analytics/endpoints/sources.py
  • autobot-backend/api/codebase_analytics/endpoints/sources_last_indexed_20513_test.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20612 (head b16a10e): approve.

Read only; I didn't run the tests. A named source now reads only its own codebase_stats_{source_id} document, so another tree's stats can't be shown as its own, and the reversal of #6670's and #1716's fallback is stated. Effect to expect: a source indexed before per-source documents shows no stats until re-indexed. The count on a real host isn't known, as the body says, so it's worth checking at the first update. No-data health scores stay the defaults.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Landed in the merge train (PR #20692) as 58cbf98: frozen head 0aec1fc is an ancestor of that merge. This PR's later head 982c01e only merged main, with 0 non-merge commits since.

@mrveiss mrveiss closed this Nov 2, 2026
@mrveiss
mrveiss deleted the issue-20513-last-indexed branch November 2, 2026 20:10
timothybrush pushed a commit to timothybrush/AutoBot-AI that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working phase:M4.11 Safety net: tests and analysers reach the whole tree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant