Skip to content

bug(analytics): opening Codebase Analytics starts scans, last results can't be viewed, and no reindex or change tracking #20491

Open
5 of 10 issues completed

Description

@mrveiss

Problem

Opening a Codebase Analytics page starts analysis work, and the results of the last run can't be viewed without a new one. The maintainer hit this while testing on the live install. There is also no separate reindex action with a record of what changed since the last run.

Evidence

From autobot-frontend/src/components/analytics/CodebaseAnalytics.vue on main at f88cd37:

  • onMounted calls loadCachedAnalyticsData(codeIntelExtraScans()), then more loaders.
  • codeIntelExtraScans (comment: "Bug: Analytics codebase panels appear empty — missing from initial page load scans #2390 Include all code-intel scans so every panel populates on page visit") includes loadConfigDuplicates, loadApiEndpointAnalysis, loadPerformanceScore, loadEnvironmentAnalysis, loadOwnershipAnalysis, getCrossLanguageAnalysis and runCodeIntelligenceAnalysis.

On the same day the host showed endpoint analysis answering 504 and duplicate detection timing out at 120 s under load (#20483).

Not read: how much of each loader computes versus reads stored results.

Required behaviour (maintainer)

  • Opening the page shows the last run's stored results, with when they were produced, and starts no scan.
  • Reindex is its own explicit action.
  • Each run records what changed since the last one.

Acceptance criteria

  • A test proves opening the page starts no scan or reindex.
  • Results of the last run display after a page reload and a backend restart.
  • Reindex runs only from an explicit action.
  • The page shows what changed since the last run: new, resolved and unchanged findings.
  • Each result shows the time and commit it came from.

Activity

  1. added
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 1, 2026
  2. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    needs-structure cleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).

  3. removed
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 1, 2026
  4. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Two additions from the maintainer's live test:

    • The indexing job shows its full id. IndexingProgress.vue:8 shows currentJobId.substring(0, 8) plus an ellipsis, so the job can't be looked up from the screen.
    • The page shows the job's current state. To be checked: the maintainer asked whether a job was still running after its stored status said completed, so I don't yet know if the page displayed it as running.
  5. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Placed under #18115 (codebase analytics runs are not durable). The "what changed since the last run" criterion is the same work as #13534 under that umbrella, so it gets done there, not twice here. #18055 (the run is killed by its own watchdog, so nothing persists) may affect "results display after a restart"; I have not checked that yet.

  6. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    What opening the page does, read from the code on main; nothing was run. This answers the issue's "not read" line.

    Loader on page open Verdict
    Config duplicates (/config-duplicates) Computes on every call: walks and parses the tree
    Performance score (/performance/score) Computes on every call: a directory scan in a process pool
    runCodeIntelligenceAnalysis (5 POSTs) Security, performance and Redis analysis compute. /analyze and /suggestions are sent the root path as if it were code, so they return trivial metrics
    Endpoint analysis, environment, ownership, /duplicates Compute on a miss. Their caches are in-memory, so they are empty after a restart
    Redis health, call graph Compute on a miss. Redis health has a 5-minute in-memory cache, call graph a 5-minute Redis one
    Quality health score Computes on a 300s cache miss, from stored data with no file walk
    Dashboard overview Starts a Celery task every time, for live metrics with no repo walk
    Stats, problems, declarations, hardcodes, charts, */cached routes, debt, sources Read stored results

    Why the last results can't be viewed: several panels only have an in-memory copy, which a restart loses, so showing them means computing them. Stored results have some timestamps, but none records the commit it came from. There is no per-finding history (new, resolved, unchanged) anywhere I searched.

    Reindex is already explicit: POST /index runs from the Index and Analyze All buttons. Nothing on the page-open path calls it. trigger_auto_index_if_unindexed runs from a live import-tree request; the page's mount path uses the cached route instead.

    Plan:

    1. Page open calls only the read-stored loaders; the rest run from the explicit action. Panels with no stored result say so. This reverses Bug: Analytics codebase panels appear empty — missing from initial page load scans #2390's "every panel populates on page visit" as the maintainer asked. It removes the load but leaves those panels empty until a run.
    2. Compute endpoints store their last result durably with time and commit, so panels fill after a reload and a restart.
    3. New, resolved and unchanged findings: feat(codebase-analytics): every scan overwrites the last — no run_id, no timestamps, no retention, so improved-vs-regressed cannot be answered #13534.

    Also found: /index/current is not scoped to a source, so the page can adopt another source's running job. loadCachedSecurityScore appears to call a route that requires source_id without sending it, which would answer 422; not run.

    Slice 1 is waiting for a worktree slot: the worktree ceiling is full.

  7. 6 remaining items

  8. mrveiss commented on Nov 2, 2026

    @mrveiss
    OwnerAuthor

    Verified against main at merge fd4c2df (the merge train, PR #20677).

    AC Evidence
    A test proves opening the page starts no scan or reindex DELIVERED (source-level). repo_tests/analytics_page_open_reads_only_20491_test.py test_page_open_calls_only_what_reads allow-lists onMounted (MOUNT_ALLOWED) and the page-open scan list (SCAN_ALLOWED) in CodebaseAnalytics.vue; PR #20501 showed it fail with a scan planted in onMounted. It reads source, so it does not prove behaviour in a browser.
    Results of the last run display after a page reload and a backend restart OPEN. PR #20501 states results are not yet stored; this is a later slice.
    Reindex runs only from an explicit action DELIVERED (source-level). Same test: the computing loaders are absent from the mount allow-list and test_an_explicit_run_still_calls_them pins that they run from the explicit action.
    The page shows what changed since the last run: new, resolved and unchanged findings OPEN. Nothing on main records or shows a diff between runs.
    Each result shows the time and commit it came from OPEN. No commit is recorded or shown on main.

    2/5 criteria delivered and evidenced.

    Left open or unticked as stated above.

  9. github-actions commented on Nov 8, 2026

    @github-actions
    Contributor

    Landed via the merge train (#21105, merge 4304868fb7) via #20998

  10. mrveiss commented on Nov 8, 2026

    @mrveiss
    OwnerAuthor

    Landed in part via #20998 (merge train #21105, 4304868): the page-open security read now sends its source (useCodeIntelligence.ts:295, useCodeIntelScores.ts:301-303) and a cached-read test pins it. Left open: the remaining criteria are unverified, namely last results shown after reload and backend restart, new/resolved/unchanged change tracking, and time plus commit on each result.

  11. github-actions commented on Nov 9, 2026

    @github-actions
    Contributor

    Landed via the merge train (#21286, merge b150fb5869) via #21132

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontendphase:M4.11Safety net: tests and analysers reach the whole treepriority: high

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions