Skip to content

test(ai): quota figure contract — figure inventory + shared figure probe matrix for the 13 quota providers (design #1942, phase 1) #1943

Closed

Description

@dezren39

test(ai): quota figure contract — figure inventory + shared figure probe matrix for the 13 quota providers (design #1942, phase 1)

Phase 1 of design #1942 ("a figure that cannot exist is not a figure"). Design doc: files/designs/opencode-quota-figure-contract.md in the keep-the-four-repos-healthy goal workspace.

Task

For the thirteen provider quota parsers in packages/ai/src/quota/providers/:

(a) State the design's six figure-contract rules where the parsers live — in packages/ai/src/quota/types.ts beside the window contract (#1794), in the module's existing comment style:

  1. Impossible figures read as absent (zero is a real figure and publishes).
  2. A pair is judged as a pair; the impossible-pair disposition is whole-window and named per provider in the inventory — never split between percent and label.
  3. Scaling inputs are figures too (wire exponent/divisor/multiplier validated to its closed range before scaling; out-of-range reads the scaled figure as absent, sibling figures still publish).
  4. Precision is part of the figure (rounding is a display act, never a parser act).
  5. A result whose only figure is impossible is no result (the provider's existing no-data contract fires).
  6. Every figure path is pinned against this contract. Named exception: turso's stated publish-truthfully over-100% disposition stands.

(b) Add a figure section to the same parser inventory in types.ts (not a second table): per provider, the figures it publishes (percent / money amount / balance / count) and each figure's named disposition for the impossible cases. Mark the known-lossy rows with links and do NOT assert them as conforming: deepseek negative balance → #1928, codex negative credits → #1924, claude negative spend → #1919, groq pair → #1897, opendesign pair → #1879, claude exponent → #1920, antigravity precision → #1941 (design phases 2–3 adopt those issues; they keep their own lifecycles).

(c) Add the shared figure probe matrix in packages/ai/test/quota.test.ts (or a wired sibling): one case per rule (negative figure reads as absent; zero control publishes unchanged; impossible pair under one consistent disposition; out-of-range scaling input reads the scaled figure as absent; sub-percent precision preserved) run against the parsers that already conform — meta parseBillingBanner (negative minor → null), opencode-go toMicroCents (negative → null) and its balance path, command-code's clamp-both windows (#1821), turso's numNonNegative path — with the suite header naming the contract as the oracle.

Acceptance criteria

Parent design: #1942. Sibling contract: #1794 (windows). Do not fix the known-lossy sites in this issue — phases 2–3 are the adopted per-site issues themselves.

Activity

  1. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/aiPackage: ai (pkgs/ or apps/ in this repo)
    on Nov 7, 2026
  2. dezren39 commented on Nov 7, 2026

    @dezren39
    Author

    🤖 Agent note · filed by repo design architect (opencode pass 2026-11-07)

  3. added
    work/assignedAn agent holds this item via the queue (claimed task)
    queue/claimedA queue worker has claimed the task for this item
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 8, 2026
  4. dezren39 commented on Nov 8, 2026

    @dezren39
    Author

    agent-note:v1
    state: picked_up
    worker: repo-worker-opencode
    task: 11283
    queue: repo-health-opencode-pilot
    note: Claimed and revalidated — issue open, no held labels (held/user-owned/do-not-merge/do-not-auto-edit absent), no competing PR found. Implementing design #1942 phase 1: figure contract + inventory in types.ts and shared figure probe matrix, no production parser changes.

  5. added a commit that references this issue on Nov 8, 2026
  6. removed
    queue/claimedA queue worker has claimed the task for this item
    work/assignedAn agent holds this item via the queue (claimed task)
    on Nov 8, 2026
  7. dezren39 commented on Nov 8, 2026

    @dezren39
    Author

    agent-note:v1
    state: done
    worker: repo-worker-opencode
    task: 11283
    queue: repo-health-opencode-pilot
    note: Figure contract (design #1942 phase 1) landed in PR #2125, merged a34791c. types.ts states the six figure rules beside the window contract and carries a figure inventory for all 13 providers; quota.test.ts gains the shared figure probe matrix (oracle: the contract). Fresh-state correction: the seven packet-marked lossy issues (#1928/#1924/#1919/#1897/#1879/#1920/#1941) are all closed/landed, so dispositions are stated and pinned rather than marked lossy. Tests: bun test test/quota.test.ts (packages/ai, laptop) 188 pass / 0 fail. No provider parser logic changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aiPackage: ai (pkgs/ or apps/ in this repo)kind/testTest coverage, test infrastructure, or test-only fixespriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions