feat: cross-machine usage aggregation with device-level dedup#252
Open
Yeachan-Heo wants to merge 1 commit intojunhoyeo:mainfrom
Open
feat: cross-machine usage aggregation with device-level dedup#252Yeachan-Heo wants to merge 1 commit intojunhoyeo:mainfrom
Yeachan-Heo wants to merge 1 commit intojunhoyeo:mainfrom
Conversation
Port device-level tracking from PR junhoyeo#55 into the client-based structure. Each client now tracks per-device contributions (keyed by API token ID) to prevent double-counting when the same user submits from multiple machines. On resubmit, only the device's data is replaced while other devices' data is preserved. Legacy data without device tracking is gracefully migrated to a __legacy__ device key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
@Yeachan-Heo 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/lib/db/helpers.ts">
<violation number="1" location="packages/frontend/src/lib/db/helpers.ts:222">
P2: Legacy incoming payloads that only provide modelId (no models) will drop model-level attribution after recalculation because device contributions only copy incomingClient.models. recalculateClientAggregate rebuilds client.models exclusively from device.models, so legacy modelId data is lost.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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.
Summary
feat/cross-machine-aggregation-sync) into the currentclient-based codebase structuredevicesfield keyed by API token ID__legacy__device key on first mergeChanges
helpers.ts: AddedDeviceClientDatainterface,devices?field onClientBreakdownData,recalculateClientAggregatehelper, and updatedmergeClientBreakdownsto acceptdeviceIdand perform device-level merge with legacy migrationroute.ts: INSERT path now initializesdevices[tokenId]from the start; UPDATE path passestokenRecord.tokenIdto the merge functionschema.ts: Addeddevices?to thesourceBreakdownJSONB type definitionsubmit.test.ts: Added 8 new tests covering device-level dedup scenarios (resubmit, multi-device aggregation, legacy migration, device removal, cross-device model aggregation, multi-client multi-device)Test plan
__legacy__🤖 Generated with Claude Code
Summary by cubic
Add per-device usage tracking and dedup to client aggregation to support cross‑machine submissions. Resubmits now replace only that device’s data, preventing double counting and keeping totals accurate.
Written for commit 556afd9. Summary will update on new commits.