fix(submit): preserve per-device cross-machine breakdowns#313
Open
IvGolovach wants to merge 3 commits intojunhoyeo:mainfrom
Open
fix(submit): preserve per-device cross-machine breakdowns#313IvGolovach wants to merge 3 commits intojunhoyeo:mainfrom
IvGolovach wants to merge 3 commits intojunhoyeo:mainfrom
Conversation
Contributor
|
@IvGolovach is attempting to deploy a commit to the Inevitable Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/frontend/src/app/api/submit/route.ts">
<violation number="1" location="packages/frontend/src/app/api/submit/route.ts:274">
P1: Disappeared-day reconciliation prunes only `submittedClients`, allowing stale current-device data to persist for omitted clients.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…mit-correctness-refresh
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.
Preserve per-device source breakdowns when the same user submits usage from multiple machines.
The existing merge path can overwrite a client's daily source breakdown when a different device re-submits the same day. This change stores per-device contributions inside each client bucket, replaces only the current device's contribution on re-submit, and preserves other devices.
It also migrates legacy client-only entries into a reserved
__legacy__device bucket, and reconciles days that disappear from the current device's submitted date range without touching days outside that range.No database migration is required.
Related to #248.
Checks:
cd packages/frontend && ../../.bun/bin/bun x vitest run __tests__/api/submit.test.tscd packages/frontend && ../../.bun/bin/bun x vitest runcd packages/frontend && ../../.bun/bin/bun x tsc --noEmit