Skip to content

arch(analytics): merge code-quality/review/evolution/generation into per-project codebase analytics #3436

@mrveiss

Description

@mrveiss

Problem

The four analytics dashboards below are currently routed as flat, global top-level tabs in AnalyticsView.vue, completely disconnected from any project/source context:

Page Current route File
Code Quality /analytics/code-quality CodeQualityDashboard.vue
Code Review /analytics/code-review CodeReviewDashboard.vue
Evolution /analytics/evolution EvolutionView.vue
Code Generation /analytics/code-generation CodeGenerationDashboard.vue

Root cause: None of these components read route.params.sourceId and none of the corresponding backend API modules (analytics_quality.py, analytics_code_review.py, analytics_evolution.py, analytics_code_generation.py) accept a source_id parameter. All four analyse an implicit global context with no project scoping.

These pages were created between Nov 2025 (issues #225, #228, #230, #247) as standalone features. The CodebaseAnalytics.vue per-project shell existed separately and the two were never wired together.

Intended Architecture

/analytics/codebase                       ← project picker (landing) [unchanged]
/analytics/codebase/:sourceId             ← project shell with tab bar:
  ├── Overview                            ← current CodebaseAnalytics panels [unchanged]
  ├── Code Quality                        ← CodeQualityDashboard scoped to sourceId
  ├── Code Review                         ← CodeReviewDashboard scoped to sourceId
  ├── Evolution                           ← EvolutionView scoped to sourceId
  └── Code Generation                     ← CodeGenerationDashboard scoped to sourceId

Required Changes

Router (autobot-frontend/src/router/index.ts)

  • Move code-quality, code-review, evolution, code-generation routes as children of codebase/:sourceId
  • New paths: /analytics/codebase/:sourceId/code-quality, etc.
  • Keep /analytics/code-quality etc. as redirect to landing (/analytics/codebase) for backwards compat

AnalyticsView.vue

  • Remove the 4 tabs (code-quality, code-review, evolution, code-generation) from the global nav
  • They belong in a per-project tab bar inside CodebaseAnalytics.vue

CodebaseAnalytics.vue

  • Add a sub-tab bar for the 4 project-scoped dashboards
  • Pass sourceId (from route.params.sourceId) as a prop to each dashboard

Frontend Components (all 4 dashboards)

  • Accept sourceId: string prop (or read from route.params)
  • Pass ?source_id=<sourceId> on all backend API calls

Backend API modules (all 4)

  • analytics_quality.py — add source_id: Optional[str] = Query(None) to all endpoints; use resolve_source_root(source_id) helper (already in autobot_shared) to scope queries
  • analytics_code_review.py — same
  • analytics_evolution.py — same; scope Redis evolution: key prefix to evolution:{source_id}:
  • analytics_code_generation.py — same

resolve_source_root helper

Already extracted in autobot_shared via refactor(analytics): extract resolve_source_root into shared helper (#2760) — import from there.

Tests Lost / Missing

Never had API-level tests

The four backend modules were created in Nov 2025 (commits 5b529c39, 3a407a801, 0fae2a32b, a4ea772ce) with no test files. The only co-located tests that exist cover the code_intelligence/ engine layer:

  • code_intelligence/code_evolution_miner_test.py — tests CodeEvolutionMiner, not the HTTP API
  • code_intelligence/code_review_engine_test.py — tests CodeReviewEngine, not the HTTP API

Never had frontend tests

No *.test.ts / *.spec.ts exists for CodeQualityDashboard, CodeReviewDashboard, EvolutionView, or CodeGenerationDashboard.

What needs to be added as part of this issue

  • Backend: co-located _test.py for each of the 4 API modules covering:
    • Happy path with a valid source_id
    • Missing source_id returns global/fallback (or 400 if scoping is required)
    • Invalid source_id returns 404
  • Frontend: *.spec.ts for each dashboard verifying sourceId prop is forwarded to API calls

Discovery commits

  • cf7d83e8 — consolidated code-intelligence into /analytics/codebase (removed CodeIntelligenceDashboard, BugPredictionDashboard, CodeIntelligenceView) — the pattern to follow
  • 5b529c39, 3a407a801, 0fae2a32b, a4ea772ce — original creation of the 4 standalone API modules (Nov 2025, no tests)
  • cfa16b964 — wired code intelligence scores into the per-project panel — the pattern for wiring

Out of scope

  • BI, Security, Audit, Conversation Flow, LLM Patterns, Log Patterns, Performance, Pre-commit Hooks, Technical Debt — these are correctly global tabs and should remain in AnalyticsView.vue

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions