Skip to content

feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052

Closed

Description

@dezren39

Part of epic #1047. Hub design §2.1 / §5 v2 + a v1 deviation to fix.

  1. DeepSeek balance check: stewardship reads api.deepseek.com balance daily (key in Bitwarden as deepseek.api-key, verified 2026-10-24: CNY 44.64 at that read) and records it as a dated snapshot. DeepSeek direct is the PAYG reserve only — balance display, never a routine route.
  2. CNY unit: the v1 snapshot backfill SKIPPED the DeepSeek balance because the §4 unit enum has no CNY — recording it as USD would corrupt history. Add a proper currency unit (or currency field) to the snapshot schema + extractors, backfill correctly, and add a test.
    Acceptance: balance appears on the PAYG card in ¥ with measured-at; schema change covered by tests; no USD-labelled CNY records in the store.

Activity

  1. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane D
    • Session / ID: queue task 2317
    • Found via: queue claim
    • Task: Triage issue feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052 — verify the snapshot store still has no CNY unit and no DeepSeek balance record at current main, then route as scoped follow-up or close with evidence
    • Expectation: s — triage verdict backed by code citation at HEAD
    • Links: n/a yet
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    Verdict: CONFIRMED — the snapshot store still cannot represent CNY at HEAD a3cdf6c9a35df1ff8b88b7a02d62e5c04ca4c94a, so the DeepSeek balance still has no snapshot record and no card value. Two files at HEAD defer this exact work to this issue by name.

    Evidence (fresh reads of current main, not the issue text):

    • pm-stack/aggregator/src/snapshots.ts — the store's validation set is UNITS = {pct, usd, count, gb, tokens, usd-est}; isSnapshotRecord rejects anything else, so a CNY record is malformed by definition. pm-stack/aggregator/src/model.ts (~line 1262) types SnapshotRecord.unit with the same six values.
    • pm-stack/aggregator/scripts/backfill-usage-snapshots.ts header, verbatim: "The DeepSeek balance (¥44.63) is deliberately NOT backfilled: the §4 unit enum (pct|usd|count|gb|tokens) has no CNY, and recording it as USD would corrupt history." — the v1 deviation this issue names, still in place.
    • pm-stack/aggregator/src/quota-gather-map.ts, recordsFromEntries: "Label-only windows (balances) yield no record in v1 — the CNY balance case is feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052's unit work; quota-current still carries the label." — the gatherer knowingly emits no DeepSeek balance record.
    • pm-stack/aggregator/src/snapshot-records.ts — UNIT_MAP has no CNY mapping and unmapped units are silently skipped (if (!unit) continue).

    Routing: follow-up enqueued as queue task 2987 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:1052, packet queue-packets/packet-1052-fix.json), with the design pinned: cny as a first-class unit value end-to-end (model type, store validation, extractor mapping — no currency-field redesign, and no CNY→USD conversion anywhere), a recordsFromEntries writer for the moved DeepSeek balance label, the backfill extended to include the skipped balance observations at their original dates (resolving the ¥44.63/¥44.64 discrepancy from the script's dated source line, never by inventing a value), ¥ rendering with measured-at on the PAYG card, and a guard test that no DeepSeek balance record exists with unit usd. This issue stays open and is labelled queue/queued for that task.

  4. added
    queue/queuedHas a queued task in the Supabase agent queue
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 29, 2026
  5. 50 remaining items

  6. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Oct 29, 2026
  7. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  8. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  10. added
    queue/blockedQueue or user escalation state
    status/blockedQueue or user escalation state
    user/escalatedQueue or user escalation state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Oct 29, 2026
  11. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · CNY unit work implemented and verified; blocked only on the repo-wide merge-queue freeze (#2403)

  12. added a commit that references this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

meta/follow-upFollow-up spun out of earlier workqueue/blockedQueue or user escalation statestatus/blockedQueue or user escalation stateuser/escalatedQueue or user escalation state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions