-
-
Notifications
You must be signed in to change notification settings - Fork 1
arch(analytics): merge code-quality/review/evolution/generation into per-project codebase analytics #3436
Description
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-generationroutes as children ofcodebase/:sourceId - New paths:
/analytics/codebase/:sourceId/code-quality, etc. - Keep
/analytics/code-qualityetc. 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(fromroute.params.sourceId) as a prop to each dashboard
Frontend Components (all 4 dashboards)
- Accept
sourceId: stringprop (or read fromroute.params) - Pass
?source_id=<sourceId>on all backend API calls
Backend API modules (all 4)
analytics_quality.py— addsource_id: Optional[str] = Query(None)to all endpoints; useresolve_source_root(source_id)helper (already inautobot_shared) to scope queriesanalytics_code_review.py— sameanalytics_evolution.py— same; scope Redisevolution:key prefix toevolution:{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— testsCodeEvolutionMiner, not the HTTP APIcode_intelligence/code_review_engine_test.py— testsCodeReviewEngine, 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.pyfor each of the 4 API modules covering:- Happy path with a valid
source_id - Missing
source_idreturns global/fallback (or 400 if scoping is required) - Invalid
source_idreturns 404
- Happy path with a valid
- Frontend:
*.spec.tsfor each dashboard verifyingsourceIdprop is forwarded to API calls
Discovery commits
cf7d83e8— consolidated code-intelligence into/analytics/codebase(removedCodeIntelligenceDashboard,BugPredictionDashboard,CodeIntelligenceView) — the pattern to follow5b529c39,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