Add session performance trend visualization to dashboard#75
Add session performance trend visualization to dashboard#75
Conversation
|
🚅 Deployed to the han-pr-75 environment in han-team-platform
2 services not affected by this PR
|
Adds a weekly performance trend chart showing avg turns, compactions, and effectiveness score per session over time. Helps track whether AI sessions are becoming more focused and efficient. - New SessionPerformancePoint type in Rust GraphQL API - Weekly aggregation computed from scored sessions using chrono - PerformanceTrendChart component with metric toggle tabs - Regression highlighting (red bars when metrics worsen week-over-week) - Integrated into Browse dashboard between Compaction Health and Session Effectiveness https://claude.ai/code/session_01Gkip9YRmLjZbHKQyer3zZK
0cee8eb to
1f44e94
Compare
|
test comment from claude agent - ignore |
Code ReviewGood overall addition - the weekly trend chart fills a real gap in session observability, and the Rust aggregation logic is clean. A few issues worth addressing before merge. MODERATE1. React Native Web violations in PerformanceTrendChart.tsx and DashboardContent.tsx Per .claude/rules/browse/react-native-first.md, HTML/web-only CSS properties must not be used in browse-client. This PR has three violations: PerformanceTrendChart.tsx x-axis label (line 256): uses style whiteSpace nowrap which is web-only. Fix: remove whiteSpace - React Native does not support it and short month labels do not need it. PerformanceTrendChart.tsx empty state (line 150): uses minHeight as a string pixel value (120px). String pixel values are CSS, not React Native. Fix: use minHeight: 120 as a number. DashboardContent.tsx loading state box: uses display flex, alignItems center, justifyContent center, and minHeight 120px in an inline style prop. Fix: replace with the Center atom and minHeight: 120. 2. Schema documentation regression in schema.graphql The PR strips all per-field documentation from SessionFilter and the type-level description, replacing them with generic boilerplate. Field-level docs are also removed. This is a consumer-facing regression - IDE tooling and GraphQL clients surface these descriptions. If the derive macro now controls SDL generation, it should be extended to accept doc strings rather than stripping them. MINOR3. SessionPerformancePoint fields should be non-null All six fields are declared nullable in the schema but the Rust code always produces Some(...) - there is no code path that returns None. They should be declared non-null to reflect the actual API contract. 4. X-axis label logic shows too few labels for typical data windows With 30 days of data there are ~4-5 weeks. The current logic (idx === 0 or idx % 4 === 0) shows only two labels when data spans 4-5 points. Consider anchoring first and last labels, or showing all when there are 6 or fewer data points. 5. Performance trend silently excludes unscored sessions The trend is computed from scored_sessions, which only includes sessions that completed the effectiveness scoring pipeline. Users with new installations will see an empty chart even though sessions exist. A note in the Rust code would help future maintainers. Good feature overall. The BTreeMap aggregation for naturally-sorted weekly keys is a nice touch. The main blockers are the RN violations (item 1) and the schema doc regression (item 2). |
|
PR Review: Add session performance trend visualization to dashboard Overall this is a well-structured addition. The backend computes metrics correctly, the frontend component handles empty states, and the Relay-generated types are up to date. A few issues worth addressing before merge. MODERATE ISSUES theme.borderRadius.md: inconsistent key path vs rest of file. In PerformanceTrendChart.tsx (callout box near the bottom): borderRadius: theme.borderRadius.md. Other uses in the same file correctly use theme.radii.full. While theme.borderRadius is an alias for theme.radii so this works, it is inconsistent. Change to theme.radii.md to match the rest of the file. Performance trend iterates over scored_sessions: verify no LIMIT truncates it. The performance_trend block reuses scored_sessions, which is built from the same SQL effectiveness query. If that query ever gains a LIMIT (for performance), lower-scoring sessions could be silently excluded from weekly aggregation, skewing trend data. Add a comment or assertion clarifying the query is unlimited here, or compute the trend from a separate query. Division by zero risk in trend computation: avg_turns: Some((turns / count as f64 * 10.0).round() / 10.0). count is incremented before this map so it is always >= 1 in current code, but this is fragile. If the entry insertion logic ever changes, this produces silent NaN. Guard with if count > 0. MINOR ISSUES All SessionPerformancePoint fields are Option-T but never null. In the Rust code all fields are always Some(...). Consider making them non-nullable in the GraphQL schema (Float!, String!, Int!) to match how other computed analytics types are modeled. The frontend already handles nullability with ?? 0 fallbacks but a cleaner schema is preferable. Hardcoded hex colors bypass design system. COLORS turns:#f59e0b compactions:#f97316 effectiveness:#10b981 plus inline #ef4444, #3b82f6, rgba(59,130,246,0.1). Consistent with other chart components in the codebase, but noting for future theming work. Key includes redundant index: weekStart is already unique per week; the -idx suffix is unnecessary. The label row below uses only weekStart correctly. SessionFilter doc comment regression. The schema diff replaces detailed per-field docs with generic Auto-generated filter input type. / Association filter (auto-generated). comments. If the macro generates these, it should preserve meaningful descriptions. POSITIVE
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Summary
Adds a new "Session Performance Trend" chart to the dashboard that visualizes weekly session efficiency metrics over the past 30 days. The chart displays three key performance indicators: average turns per session, average compactions per session, and effectiveness score, with trend indicators showing week-over-week improvement or regression.
Changes
New Component:
PerformanceTrendChart.tsx- Interactive chart component with:Backend: Added
SessionPerformancePointGraphQL type andperformanceTrendfield toDashboardAnalyticsGraphQL Schema: Updated schema and generated types to include
performanceTrendfield with weekly performance data pointsDashboard Integration: Integrated
PerformanceTrendChartintoDashboardContentwith proper data mapping and loading statesFragment: Added
performanceTrendquery fragment to fetch required fields from backendType of Change
Testing
Checklist
https://claude.ai/code/session_01Gkip9YRmLjZbHKQyer3zZK