Repository navigation
Description
cloudflare-export: GraphQL group-limit saturation is flagged for only 2 of 7 datasets — workers/kv/d1/queues/r2-ops/ai-total totals at their query limit are published as exact, never as lower bounds
Summary
pm-stack/cloudflare-export/cloudflare-quota-export.mjs states its own discipline in the header (lines 70–73): a grouped result at its query limit "is flagged as a lower bound, never silently truncated — the r2-storage discipline." That discipline is implemented for exactly two datasets and silently absent for the other five:
Implemented:
r2StorageAdaptiveGroups(limit 10000):parseGraphqlUsagecomputessaturated = storageGroups.length >= R2_STORAGE_GROUP_LIMITand marks ther2-storagemetriclowerBound: truewith detail prose (lines 313–325).aiInferenceAdaptiveGroupsByDay(limit 10000):aiNeuronsDayAlertsreturnssaturated, alerts carrylowerBound: true, and the document carriesaiNeuronsByDaySaturated(lines 248–266, 385).
Missing — GRAPHQL_QUERY (lines 442–449) sets explicit limits and parseGraphqlUsage/classifyR2 sum whatever came back with no at-limit check:
workersInvocationsAdaptivelimit 100 →workers-requests,workers-cpu-mskvOperationsAdaptiveGroupslimit 100 →kv-reads,kv-writes(foldKv)d1AnalyticsAdaptiveGroupslimit 100 →d1-rows-read,d1-rows-writtenqueueMessageOperationsAdaptiveGroupslimit 100 →queues-opsr2OperationsAdaptiveGroupslimit 1000 →r2-class-a,r2-class-b(classifyR2returns only{classA, classB, unclassified, nonbillable}— no saturation field)aiInferenceAdaptiveGroupslimit 100 →workers-ai-neuronscycle total / per-day average (the by-day sibling got limit 10000 + a flag in cloudflare-export: alert on Workers AI neurons/day over threshold — the Oct 24–25 burn (4.11M neurons, ~$45) was invisible for days #2287; the cycle-total dataset it is compared against kept limit 100 and no flag)
If any of these datasets returns exactly its limit of rows, the published document reports the partial sum as an exact reading in a status: "ok" document — the precise failure mode the r2-storage and #2287 fixes were written to prevent.
Evidence (verified this run, laptop @ 8a5cd8e)
Probe ~/git/fleet/probe-cf-gql-limits (real cloudflare-quota-export.mjs copied verbatim, md5 780d4ee5dd2905d92c3672859c35c3dd, run under Bun against parseGraphqlUsage):
- control payload: all metrics present, no
lowerBoundanywhere (correct). - kv groups at exactly 100 (the query limit):
kv-reads={"id":"kv-reads","used":100,"unit":"count","source":"cloudflare-graphql-analytics"}— nolowerBound. - workers rows at exactly 100:
workers-requestsused=100, no flag. - ai cycle-total groups at exactly 100:
workers-ai-neuronspublished with a definitive detail string ("cycle total 1000 neurons"), no flag. - d1 and queues groups at exactly 100:
d1-rows-read/queues-opsused=100, no flag. - r2 operations groups at exactly 1000 (the query limit):
r2-class-bused=1000, no flag;classifyR2result keys are onlyclassA,classB,unclassified,nonbillable. - Existing suite as control:
bun teston the real test file — 35 pass / 0 fail; the only saturation tests cover r2-storage (test line 155) and ai-by-day (line 419).
Dedup: no open or closed issue covers GraphQL-limit saturation for these datasets (#2574 covered REST bucket enumeration; #2287 covered only the by-day neurons dataset).
Why it matters
The aggregator's Cloudflare card and the quota registry consume these figures as exact readings. A truncated workers/kv/d1/queues/r2/ai total understates usage silently — for the AI neurons cycle total it also corrupts the per-day average that the #2287 alert is compared against. The file already solved this problem twice; the remaining datasets are the residual door of the same fix.
Acceptance criteria
- Every dataset in
GRAPHQL_QUERYwith an explicitlimithas a defined saturation behaviour: at-limit results mark the affected metric(s)lowerBound: true(the r2-storage pattern) or otherwise surface an explicit document-level flag — no dataset publishes an at-limit sum as an exact reading. classifyR2reports saturation forr2OperationsAdaptiveGroups(limit 1000) and the flag reaches the success document.- New tests in
cloudflare-quota-export.test.mjspin at-limit behaviour for each previously unflagged dataset (at-limit flagged; one-below-limit unflagged), mirroring the existing r2-storage test at line 155. - Existing 35 tests still pass.
Activity
developing-today commentedon Nov 7, 2026
CODE-2145
dezren39 commentedon Nov 7, 2026
🤖 Agent note · filed
developing-today commentedon Nov 8, 2026
🤖 Agent note · handed off
opencode, so the laptop claimant launches the bound opencode session that drives the fix for issue cloudflare-export: GraphQL group-limit saturation flagged for only 2 of 7 datasets — workers/kv/d1/queues/r2-ops/ai-total sums at their query limit publish as exact readings, never lower bounds #6880 (cloudflare-export GraphQL saturation flags) to its terminal state. Lane code-u does not work this task directly.25 remaining items
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off to opencode claimant — Agent: queue worker (repo-worker-code), lane code-b — Session/ID: task 11273, repo-queue-worker-shift-b 2026-11-09 run. Task 11273 (small_fix) for issue #6880: cloudflare-export GraphQL saturation flags; attempts 3/4. Fresh check: issue #6880 OPEN, no held/user/owned/do-not-merge/do-not-auto-edit labels. Execution lane row 3612 = opencode. Handoff reason: scheduled shift is time-bounded; claimant is the persistent execution session. Checkpointed handed_off; parking task 11273 for 20 minutes for the claimant window.
dezren39 commentedon Nov 10, 2026
🤖 Agent note · handed off to opencode claimant — Agent: queue worker (repo-worker-code), lane code-n — Session/ID: task 11273, repo-queue-worker-shift-n 2026-11-09 run. Task 11273 (small_fix) for issue #6880: cloudflare-export GraphQL saturation flags; attempts 3/4 on this claim. Fresh check: issue #6880 OPEN, no held/user/owned/do-not-merge/do-not-auto-edit labels, no status/needs-triage. Execution lane row 3612 = opencode (repeat handoff). Checkpointed handed_off with handoff_reason "scheduled shift is time-bounded; claimant is the persistent execution session" (#8097 Rule 4); parking task 11273 for 20 minutes for the claimant window.
dezren39 commentedon Nov 11, 2026
Agent note (lane code-b, task 11273): implemented and verified; PR #8693 awaits Codex disposition and merge.
What shipped: the r2-storage saturation discipline now covers every limited GraphQL dataset. Named limit constants (
WORKERS_GROUP_LIMIT/KV_GROUP_LIMIT/D1_GROUP_LIMIT/QUEUES_GROUP_LIMIT= 100,R2_OPERATIONS_GROUP_LIMIT= 1000,AI_NEURONS_GROUP_LIMIT= 100) sit next toR2_STORAGE_GROUP_LIMITwith a keep-in-step note againstGRAPHQL_QUERY. At-limit results flag the affected metricslowerBound: true— workers-requests, workers-cpu-ms, kv-reads, kv-writes, d1-rows-read, d1-rows-written, queues-ops, r2-class-a, r2-class-b, workers-ai-neurons — andclassifyR2returns asaturatedfield that reaches the success document via the metrics. The ai cycle-total detail prose also states LOWER BOUND, like r2-storage. Saturation is computed only after the fail-closed readers validate the groups arrays, so missing-field behaviour is unchanged.Verification:
node --test pm-stack/cloudflare-export/cloudflare-quota-export.test.mjs— 43/43 pass (35 existing + 8 new: a table-driven at-limit/one-below test per previously unflagged dataset, aclassifyR2saturation test, and an ai-prose test).Resume condition: Codex review on PR #8693 dispositioned, then squash-merge and close this issue. PR CI is subject to the repo-wide runner stall; the merge rests on the local verification above per charter.
fix(pm-stack): flag GraphQL group-limit saturation for every dataset (#…
dezren39 commentedon Nov 11, 2026
state: done
task: 11273
lane: any-b
worker: repo-worker-code
Done — fixed_merged. Resumed PR #8693 (opened by the earlier claim of task 11273): every GraphQL dataset with an explicit limit now flags saturation — workers/kv/d1/queues/ai-total metrics carry
lowerBound: trueat their limit (100), andclassifyR2reportssaturatedfor r2OperationsAdaptiveGroups (limit 1000) with the flag reaching the success document. Verified on PR head 9ca0148 in the task worktree: node --test cloudflare-quota-export.test.mjs — 43 pass, 0 fail (35 pre-existing + the new at-limit/one-below cases). Codex review on the head: no findings. PR checks stall-cancelled fleet-wide (the standing fleet CI pattern); local verification is the verdict. Merged PR #8693 (squash, merge commit d90c21b). The PR did not auto-close this issue, so closing it here with status/done. Task 11273 completes with outcome fixed_merged.