You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Usage store and write path (slice A of #66): Usage Durable Object, POST /ingest/usage #68
Part of setkernel-live#66 (the per-seat daily token table) and the v1 tracker setkernel/hq#721. PR #67 did all of #66 in 401 changed lines, one over the 400-line review limit, so it is split in two. Take the code from #67's branch agent/66-setkernel-live-usage-durable-object-with (head 642f2efb) onto current main, keeping only this slice's parts. Each slice leaves main deployable: this site deploys on every merge.
Slice A of 2: storage and ingest. Nothing can read usage yet.
Acceptance criteria
src/usage.js (cleanUsage, monthRange, sumByDay, keepFrom, COUNTS) with test/usage.test.mjs
The Usage SQLite Durable Object (migration tag v2, new_sqlite_classes), its table and push(), the USAGE binding in wrangler.jsonc; rows older than 400 days deleted
POST /ingest/usage checked against INGEST_AUD: body ≤ 256 KiB, seat and surface allowlists, non-negative integers, hour YYYY-MM-DDTHH, otherwise 400/413/403; the response echoes per-day per-seat totals for the hours pushed
Worker tests: a 48-bucket push and its echo, replace on re-push, the 400-day delete, the 400/413/403/405 cases, and the privacy check that /api/state, /api/replay and the first /ws frame contain none of the pushed numbers
README's ingest section and the AGENTS.md layout line; npm run validate passes; under 400 changed lines
The PR body says Closes setkernel/setkernel-live#<this issue> and Refs setkernel/hq#721
Files likely touched
src/usage.js
src/worker.js
wrangler.jsonc
test/usage.test.mjs
test/worker/usage.test.js
README.md
AGENTS.md
Risk class
R3: a new private data store and write route on a site that deploys on every merge
Activity
orion-setkernel commentedon Nov 1, 2026
Picked up. Working on branch
agent/68-usage-store-and-write-path-slice-a-of-66. Automated: @orion-setkernel's agent onorion-dev.