feat(analytics): planet insights aggregate v2 (amounts, recipe mixes, user thresholds) and the plan suggestions preference - #70
Merged
Conversation
… user thresholds) and the plan suggestions preference - Aggregator adds v2 `buildings` (amounts, recipes, top 3 recipe mixes) and `experts` in the same pass; v1 keys unchanged (snapshot test) - Player-based thresholds: planet >= 15 plans and >= 10 users; buildings, recipes and mixes >= 5 % and >= 10 users; medians round half up - `total_users` on AnalyticsPlanAggregate (migration 0008) and in the response; `below_threshold` sends `insights_data: null` instead of `aggregated_data` - User preference `planSuggestions` (default true) - seed_perf: 12 insights users on KW-688c so one planet passes every threshold Spec: specs/2026-10-01-insights-01a-aggregate-v2.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 33 |
| Duplication | 0 |
🟢 Coverage 98.97% diff coverage · +0.12% coverage variation
Metric Results Coverage variation ✅ +0.12% coverage variation (-1.00%) Diff coverage ✅ 98.97% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (7dd03bf) 4791 4579 95.58% Head commit (ebb2fda) 4883 (+92) 4673 (+94) 95.70% (+0.12%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#70) 97 96 98.97% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Planet insights are too thin to drive suggestions in the building and recipe pickers. Hard cutoffs drop most buildings and recipes. There are no amounts and no recipe combinations, and the counts are of plans rather than players. This adds v2 data (per-building amounts, recipe mixes, expert counts) with player-based thresholds next to the unchanged v1 keys, plus a "Plan suggestions" preference for the frontend work in insights-01b and insights-02.
Changes
buildings(amounts, recipes, top 3 recipe mixes) andexperts, collected in the same pass as v1. The v1 keys are unchanged, checked by a snapshot test againstmain's output.total_usersonAnalyticsPlanAggregate(migration 0008) and in the response.below_thresholdnow sendsinsights_data: nullinstead ofaggregated_data, which the frontend already accepts.planSuggestions(defaulttrue).seed_perfadds 12 insights users on KW-688c, so the e2e stack has one planet that passes every threshold.Expert
typein v2 is the value stored in plans (Chemistry,Resource_Extraction).How it was verified
ruff check,ruff format --check,ty check,pytest(809 passed)./sync-apiagainst today's frontend: additive changes only, no breaks.total_users: 12with FRM in two mixes.insights_data: null.Deploy
Can deploy alone; it is backward compatible. After deploy, run "Run aggregator" once in the admin (Plan Aggregates) so existing rows get the v2 keys. Before shipping, check on prod data how many planets still pass with ≥ 10 players.
🤖 Generated with Claude Code