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
test(usage-hub): contract tests for /api/quota.json saas/payg schema #1119
Part of epic #1047. Design: hub-v2-v3-design-2026-10-26.md §6.
Add contract tests pinning the /api/quota.json schema for the hub sections — saas, payg, charges, attention, subscriptions — in the aggregator test suite. Consumers (quota-guidance, the measurement gate, the render layer) depend on these shapes; the v2 collector work (#1048-#1052, Modal/Bitwarden) will change producers, and a silent schema drift would surface as wrong quota guidance, not an error.
Tests: fixture-fed schema assertions per section (required fields, unit enums incl. the CNY case from the DeepSeek issue, null-used semantics: null means unmeasured, never 0), plus a live-feed smoke shape check that can run in CI without secrets.
Acceptance: suite green; a deliberate schema break in a scratch branch fails the new tests.
Verdict — CONFIRMED:/api/quota.json (pm-stack/aggregator/src/server.ts:650) does emit all the hub sections — saas, payg, charges, attention, domains, subscriptions over the pools shape — but the only test assertion on the endpoint in the whole suite is test/boot.test.ts:137-138: quota.pools.length > 0. Code search finds no per-section schema assertions, no unit-enum pinning, and no null-used semantics anywhere in pm-stack/aggregator/test/. The risk named in the issue is real and current: the v2 collector work (feat(usage-hub): v2 Cloudflare live collector — hourly analytics feed + billing scope #1048–feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052) changes producers, and the unit enum is already a live question — src/quota-gather-map.ts notes "the CNY balance case is feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052's unit work" while scripts/backfill-usage-snapshots.ts records the current enum (pct|usd|count|gb|tokens) has no CNY. Without a contract test, that change drifts silently; with one, it breaks loudly and deliberately.
Route: follow-up task 3015 enqueued (dedupe key repo-health:v1:fix:developing-today/code:issue:1119): fixture-fed per-section schema assertions (required fields, pinned current unit enum with the feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052 CNY break named in a comment, null = unmeasured ≠ 0), a secrets-free boot smoke shape check, and the issue's own acceptance — a deliberate schema break on a scratch branch must fail the new tests, recorded here.
Task: Started the test(usage-hub): contract tests for /api/quota.json saas/payg schema #1119 contract-test work but the ~30-minute scheduled-lane budget ended before implementation. What exists: branch queue/3015-1119-quota-contract-tests pushed at 5a34fa70 (empty, cut from origin/main) and worktree ~/git/fleet/3015-1119-quota-contract-tests; /api/quota.json confirmed to emit {...quota, saas, payg, charges, attention, domains, subscriptions} at pm-stack/aggregator/src/server.ts ~L650-660. The exact next step (test file contents, unit-enum pin naming feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052, null-used semantics, fixture-fed smoke) is recorded in the task checkpoint. Parked 15 min.
Expectation: done = pm-stack/aggregator/test/quota-contract.test.ts green locally, PR open, deliberate-break check recorded here, task completed.
Activity
developing-today commentedon Oct 27, 2026
CODE-257
dezren39 commentedon Oct 29, 2026
🤖 Agent note · done (triage verdict: CONFIRMED — routed to follow-up task 3015)
/api/quota.json(pm-stack/aggregator/src/server.ts:650) does emit all the hub sections —saas, payg, charges, attention, domains, subscriptionsover the pools shape — but the only test assertion on the endpoint in the whole suite istest/boot.test.ts:137-138:quota.pools.length > 0. Code search finds no per-section schema assertions, no unit-enum pinning, and no null-used semantics anywhere inpm-stack/aggregator/test/. The risk named in the issue is real and current: the v2 collector work (feat(usage-hub): v2 Cloudflare live collector — hourly analytics feed + billing scope #1048–feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052) changes producers, and the unit enum is already a live question —src/quota-gather-map.tsnotes "the CNY balance case is feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052's unit work" whilescripts/backfill-usage-snapshots.tsrecords the current enum (pct|usd|count|gb|tokens) has no CNY. Without a contract test, that change drifts silently; with one, it breaks loudly and deliberately.repo-health:v1:fix:developing-today/code:issue:1119): fixture-fed per-section schema assertions (required fields, pinned current unit enum with the feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052 CNY break named in a comment, null = unmeasured ≠ 0), a secrets-free boot smoke shape check, and the issue's own acceptance — a deliberate schema break on a scratch branch must fail the new tests, recorded here.pm-stack/aggregator/src/server.ts·pm-stack/aggregator/test/boot.test.tsdezren39 commentedon Oct 29, 2026
🤖 Agent note · parked
queue/3015-1119-quota-contract-testspushed at5a34fa70(empty, cut fromorigin/main) and worktree~/git/fleet/3015-1119-quota-contract-tests;/api/quota.jsonconfirmed to emit{...quota, saas, payg, charges, attention, domains, subscriptions}atpm-stack/aggregator/src/server.ts~L650-660. The exact next step (test file contents, unit-enum pin naming feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052, null-used semantics, fixture-fed smoke) is recorded in the task checkpoint. Parked 15 min.pm-stack/aggregator/test/quota-contract.test.tsgreen locally, PR open, deliberate-break check recorded here, task completed.56 remaining items
dezren39 commentedon Oct 29, 2026
🤖 Agent note · parked
dezren39 commentedon Oct 29, 2026
🤖 Agent note · contract tests written; blocked only on the repo-wide merge-queue freeze (#2403)
Agent: queue worker
repo-worker-code, OpenChamber scheduled lane. Task 3015 (resume of the parked task).PR test(usage-hub): contract tests for /api/quota.json hub sections (#1119) #2393 —
queue/3015-1119-quota-contract-tests, OPEN / CLEAN / MERGEABLE atdc27adc0,basic: proxy port fallbacksSUCCESS, CodeRabbit neutral. One file:pm-stack/aggregator/test/quota-contract.test.ts— fixture-fed schema assertions per hub section (saas,payg,charges,attention,domains,subscriptions) on top of the existingpools.length > 0check, so a producer change from the feat(usage-hub): v2 Cloudflare live collector — hourly analytics feed + billing scope #1048–feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052 v2 collectors cannot drift/api/quota.jsonsilently.Why it is not merged: ci: merge queue ejects every PR — no merge since #2233 (10:57Z), entries dropped 2-6 min into AWAITING_CHECKS #2403 —
mainfrozen at5a34fa70since 10:57:51Z; every merge-queue entry is ejected withreason=branch_protection_failure. Full config enumeration and the exact reversible fix are in my note on ci: merge queue ejects every PR — no merge since #2233 (10:57Z), entries dropped 2-6 min into AWAITING_CHECKS #2403 (posted 22:12Z): the one unverified protection is the classic pushrestrictionsallowlist.Resume condition:
mainadvances → re-enqueue test(usage-hub): contract tests for /api/quota.json hub sections (#1119) #2393, merge, close this issue. Task 3015 is blocked (escalated-to-user), not parked.Links: PR test(usage-hub): contract tests for /api/quota.json hub sections (#1119) #2393 · ci: merge queue ejects every PR — no merge since #2233 (10:57Z), entries dropped 2-6 min into AWAITING_CHECKS #2403 · task 3015