Skip to content

fix(stats): surface metadata query failures instead of substituting zero counts - #66

Merged
spelech merged 4 commits into
mainfrom
fix-stats-metadata-failure-reporting-3940646652307508422
Oct 28, 2026
Merged

spelech merged 4 commits into
mainfrom
fix-stats-metadata-failure-reporting-3940646652307508422

Conversation

@spelech

@spelech spelech commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Ensure GET /admin/api/stats propagates relational database query errors rather than silently substituting zero counts. Also ensure get_db_connection routes to the active PostgreSQL connection when PostgreSQL is enabled.

Fixes #49


PR created automatically by Jules for task 3940646652307508422 started by @spelech

…eros

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

…cio loop scope

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@spelech

spelech commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

@jules Please review and address the following items for this PR:

Issues to Fix

  1. SQL Table Name Allowlist Validation:
    • In app/api/routers/settings.py:35, _count(table) interpolates the table name into SQL queries. Add explicit allowlist validation (ALLOWED_STATS_TABLES = {"indexed_files", "git_repositories", "ast_symbols"}) to prevent arbitrary table queries.
  2. Requirement Traceability:
    • Tag tests in tests/backend/test_health_check_status.py with @pytest.mark.requirement("STATS-METADATA-01").
    • Re-sync docs/REQUIREMENTS.md.

How to Confirm the Fix

Run the following commands to confirm everything passes:

pytest tests/backend/test_health_check_status.py -v
python3 scripts/generate_requirements.py
pytest tests/backend/test_requirements_sync.py

spelech and others added 2 commits October 28, 2026 01:56
…cio loop scope

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@spelech
spelech merged commit 52509eb into main Oct 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(stats): do not hide metadata query failures as successful zero counts

1 participant