Repository navigation
Description
test(ai): the quota suite still pins none of claude / meta-billing / opendesign's pure parsers — and three of them demonstrably drop or invent windows on plausible payload shapes
Sibling of #1725 (which covers opencode-go's three parsers and openrouter's reset math). The same gap remains for the other exported pure parsers in packages/ai/src/quota/providers/, re-exported from packages/ai/src/quota/index.ts:21-26:
toClaudeUsage—packages/ai/src/quota/providers/claude.ts:166parseBillingBanner—packages/ai/src/quota/providers/meta.ts:105parseCodingPlanWindows—packages/ai/src/quota/providers/opendesign.ts:78normalizeOpenDesignCredential—packages/ai/src/quota/providers/opendesign.ts:49
grep across packages/ai/test/ and packages/core/test/ returns zero references to any of the four (verified this run on main 8185486080). packages/ai/test/quota.test.ts pins mistral, meta subscription, turso, groq, command-code and the toNumber blank-string cases — none of these four.
Verified fragile behaviors (laptop probe, main 8185486)
Probe: ~/git/fleet/probe-2026-11-05-creator-opencode-1535/probe-quota-parsers.ts on the laptop, importing the real modules.
parseBillingBannerrejects numeric strings that every sibling parser accepts.parseBillingBanner({ remaining_minor_units: 12345, currency: "USD" })→123.45, butparseBillingBanner({ remaining_minor_units: "12345", currency: "USD" })→null. The function hand-rolls atypeof minor !== "number"check (meta.ts:106-109) instead of the module's sharedtoNumber(utils.ts), which accepts numeric strings — the exact lesson of fix(ai): quota toNumber coerces empty strings to 0 — an empty upstream field reports a pool 100% used (or 0% used) #1741 (providers send string-typed numbers; the quota suite now pins that for command-code/opencode-go/meta-subscription). A string-typed banner silently nulls the Meta billing cross-check credits.toClaudeUsagediscards the legacy windows wheneverlimitsis non-empty. Withlimits: [{ kind: "weekly_scoped", … }]plus populated legacyfive_hour/seven_dayfields, the result iswindows: {}— the session and weekly windows vanish, because the legacy branch is anelseoflimits.length > 0(claude.ts:175-215). A payload whose limits list contains only scoped or unrecognized kinds loses data the payload itself carries.parseCodingPlanWindowspublishes a window for a zero limit.{ durationSeconds: 18000, limitCredits: 0, remainingCredits: 0 }yields a5hwindow withusedPercent: nullandvalueLabel: "0 / 0 credits"(opendesign.ts:92-99 publishes whenever either percent or label exists viatoUsageWindow). Compare command-code's pinned behavior: a zero monthly balance is a real 100%-used window (fix(ai): Command Code quota monthly window vanishes when remaining credits exceed the hard-coded 10 included — an over-limit payload reads as 'could not be parsed' #1744 tests), not a null-percent label-only window. DuplicatedurationSecondsentries also silently overwrite (last wins, no note).
normalizeOpenDesignCredential showed no defect in the probe (bare token correctly prefixed with the session-cookie name; a full better-auth… cookie passed through) — it is included for pinning, not as a defect claim.
Why it matters
These parsers feed the same quota surfaces as the #1722/#1741/#1744/#1746 line of bugs: every one of those was a pure-parser shape assumption that only surfaced in production payloads. The four parsers above are the remaining unpinned surface of the same module, and two of them already demonstrably diverge from the module's own conventions on plausible payload shapes.
Acceptance criteria
-
packages/ai/test/quota.test.ts(or a sibling test file) pins all four parsers: happy path, missing/malformed fields, string-typed numbers, and the null/empty conventions the rest of the module follows. -
parseBillingBanneraccepts numeric-stringremaining_minor_unitsvia the sharedtoNumber(or the strictness is documented as deliberate, with a test pinning the rejection). -
toClaudeUsagewith a non-emptylimitsarray that yields no session/weekly window still surfaces legacyfive_hour/seven_daywindows (or the exclusivity is documented and pinned by test). -
parseCodingPlanWindowszero-limit behavior matches the module convention (a pinned test states which), and duplicate-duration handling is pinned. - Existing quota tests still pass (
bun test test/quota.test.tsin packages/ai) andbunx tsgo --noEmitfor packages/ai is clean.
Activity
developing-today commentedon Nov 5, 2026
🤖 Agent note · filed
hidden_files/issue-opencode-quota-parsers-untested-2.md; laptop probe~/git/fleet/probe-2026-11-05-creator-opencode-1535/probe-quota-parsers.ts; queue packet enqueued this run (repo-health-opencode-pilot).17 remaining items
dezren39 commentedon Nov 5, 2026
Implementation PR opened — task 10684 parked on CI.
PR: #1766 (branch
queue/10684-1750-quota-parsers, commit 278454a, laptop worktree~/git/fleet/10684-1750-quota-parsers)What it does, per this issue's acceptance criteria:
parseBillingBanner(meta.ts) now uses the sharedtoNumber— numeric-stringremaining_minor_unitsconverts instead of silently nulling.toClaudeUsage(claude.ts): legacyfive_hour/seven_daywindows fill any session/weekly window the limits list did not produce; scoped-only limits no longer discard them, and a limits-produced window wins its own slot.parseCodingPlanWindows(opendesign.ts): zero/negative-limit entries publish no window (was the label-only "0 / 0 credits" window); duplicate durations keep the first entry instead of silently overwriting.quota.test.tspins all four parsers (includingnormalizeOpenDesignCredential, pin-only as probed): happy path, string-typed numbers, missing/malformed, null/empty conventions.Resume brief (task 10684, parked, not_before 2026-11-05T21:45:00Z): check PR #1766 CI (ai tests + typecheck) and Codex review; fix on red and re-push from the laptop worktree; disposition any Codex findings; merge when green per the standing directive — the PR closes this issue on merge — then complete task 10684. Note: the queue park reason was truncated to a placeholder by a flag probe; this comment is the authoritative resume brief.
Parked by: lane opencode-a, task 10684 — PR #1766 awaiting CI
Merge pull request #1766 from developing-today-forks/queue/10684-1750…
dezren39 commentedon Nov 5, 2026
Merged — PR #1766 landed as 4b9febf and this issue auto-closed.
Verification actually run (laptop, worktree
~/git/fleet/10684-1750-quota-parsers, against the PR branch):bun test test/quota.test.tsin packages/ai: 24 pass / 0 fail (102 expect() calls) — all pre-existing tests plus the 9 new test(ai): quota suite pins none of claude / meta-billing / opendesign's pure parsers — billing banner rejects numeric strings, claude transform drops legacy windows when limits is non-empty, coding-plan publishes a zero-limit window #1750 tests.bunx tsgo --noEmitandbunx tsgo --noEmit -p tsconfig.types.json: no diagnostics.Queue bookkeeping: task 10684 is parked (not_before 2026-11-05T21:45:00Z) from the PR-open step; the work is now done, so the next claim of task 10684 should simply complete it as done/merged — no further code work remains.
Completed by: lane opencode-a, task 10684 — PR #1766 merged 4b9febf
dezren39 commentedon Nov 5, 2026
🤖 Agent note · done
queue/10684-1750-quota-parsers), MERGED 2026-11-05T20:32:39Z as 4b9febf, and the issue auto-closed as COMPLETED at 20:32:41Z. Verified fresh twice this run (gh issue view+gh pr view).