fix(analytics): aggregate sections before sampling#424
Conversation
|
2a71bea to
04d8d2d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a71bea5b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SUM(CASE WHEN event_kind IN ('hint_emitted', 'hint_escalated', 'missing_session') THEN 1 ELSE 0 END) AS emitted, | ||
| SUM(CASE WHEN event_kind = 'hint_outcome' AND LOWER(TRIM(COALESCE(outcome, ''))) = 'acted' THEN 1 ELSE 0 END) AS followed, | ||
| SUM(CASE WHEN event_kind = 'hint_outcome' AND LOWER(TRIM(COALESCE(outcome, ''))) = 'ignored' THEN 1 ELSE 0 END) AS ignored, | ||
| SUM(CASE WHEN event_kind LIKE 'suppressed_%' THEN 1 ELSE 0 END) AS suppressed |
There was a problem hiding this comment.
Normalize hint event kinds in the SQL rollup
For legacy/imported analytics rows whose event_kind is hyphenated or differently cased (for example hint-emitted or suppressed-duplicate), the previous hint_summary_from_events path counted them after trimming/lowercasing and replacing - with _. This DB-side rollup now matches the raw value (and the WHERE clause below does the same), so those in-window rows are dropped and the MCP hints section reports zeros for data it used to include; apply the same event-kind normalization in the SQL predicates.
Useful? React with 👍 / 👎.
Three-way verification pass after the rebase and external deepening commits: reconcile remaining stale merge-state claims (#418 released, #423/#424/#425/#407 merged at base 3567e31; #409 closed-not-merged), enforce single canonical definitions (DiagnosticEnvelopeV1 -> plan 24, SanitizationReceiptV1 -> plan 18, CursorPage -> plan 17), fix a stray non-canonical error code in plan 01, and repair four tables broken by unescaped pipes in inline code. Lab inventory, budgets, tool counts, FM-001..103 contiguity, links after the docs/plans move, and PR-letter namespace all verified clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Verification
cargo test --test mcp_suite analytics_test::cargo test --test session_suite open_at_upgrades_existing_global_db_with_analytics_events_tablecargo clippy --lib --test mcp_suite --test session_suite -- -D warningscargo fmt --check