Repository navigation
Usage push replaces every stored bucket of each hour it sends, so a seat move in .seats leaves no stale bucket (slice 2 of hq#1108) - #93
Conversation
…92) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Reviewer: no blockers. Automated: @orion-setkernel's agent on |
|
Test-diff guard: this PR changes existing test files, and the issue it closes has no
Claude Lead: if these test changes are right, add the line to the issue with the reason, then re-run the Automated: @orion-setkernel's agent on |
lyra-setkernel
left a comment
There was a problem hiding this comment.
A push now deletes every stored bucket of each distinct hour it names inside the same transactionSync before inserting, which fixes the stale other/polaris double count; the new worker test covers it and npm run check and npm run test:worker (52) pass here.
Notes and nits (they block nothing)
README.md:226: The Usage section still says "A bucket pushed again replaces the stored one"; the behaviour is now that a push replaces whole hours (all seats, models, surfaces of each hour named).src/worker.js:202: Replace-whole-hours means a pusher that splits one hour across several POSTs (e.g. to stay under the 256 KiB body cap) would have each later request delete the earlier chunks' buckets. Worth stating in the README contract that every bucket of an hour must go in one push.
Automated: @lyra-setkernel's agent on lyra-dev.
|
Approvals that count toward the two a merge needs: 1 (lyra-setkernel) on head Automated: @lyra-setkernel's agent on |
vega-setkernel
left a comment
There was a problem hiding this comment.
Meets the first three criteria: push deletes every stored bucket of each distinct pushed hour inside the same transactionSync, before the inserts, then re-inserts; unnamed hours are untouched; the new test and comments match. The last criterion (Lead's backfill rerun printing match) is post-deploy and not checkable here. As R3, it still needs Raghav's /approve .
Notes and nits (they block nothing)
src/worker.js:205: The whole-hour delete is only safe if every push carries all buckets of each hour it names; a pusher that split one hour across two requests would erase the first part. The issue says usage.py sends whole hours, but that script is in setkernel/hq, so I did not check it.test/worker/usage.test.js:107: The test file gained one new test and no existing test was edited, so there is no test-edit to list for an allow-test-changes line.
Automated: @vega-setkernel's agent on vega-dev.
|
Approvals that count toward the two a merge needs: 2 (lyra-setkernel vega-setkernel) on head Automated: @vega-setkernel's agent on |
Summary
Usage.pushonly didINSERT OR REPLACEper (hour, seat, model, surface), so an hour first pushed as seatotherand later aspolariskept both, and the echo and the usage page counted it twice. A push now replaces whole hours.What changed
src/worker.js:pushdeletes every stored bucket of each distinct hour in the push, in the sametransactionSyncand before the inserts. Hours not named are untouched. The hours JSON is built once and reused for the echo. Comments aboveUsageandpushsay a push replaces whole hours.test/worker/usage.test.js: new test pushes an hour asother, then aspolaris; onlypolarisis stored, the echo counts it once, and another hour not in the push survives. The existing "replaces a bucket pushed again…" test is unchanged and passes.Tested
npm run check: passnpm test: 250 pass, 0 failnpm run test:worker: 52 pass (3 files)wrangler deploy --dry-run: not run (command denied in this session)For the reviewer
R3 (
src/**, deletes stored rows). Existing stale rows (2026-11-01T14/15/16/22) are only cleaned when those hours are re-pushed; Lead's backfill rerun after deploy does that and is the issue's last criterion.Checks (setkernel:verify, read by the worker)
Closes #92
Automated: @orion-setkernel's agent on
orion-dev.