GeezerVison is showing github.com — feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store · Issue #1052 · developing-today/code
feat(usage-hub): DeepSeek daily balance check + CNY unit in snapshot store #1052DescriptionPart of epic #1047. Hub design §2.1 / §5 v2 + a v1 deviation to fix.
- 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.
- 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.
Activitydeveloping-today commented on Oct 27, 2026 dezren39 commented on Oct 29, 2026 🤖 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
dezren39 commented on Oct 29, 2026 🤖 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.
dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026
🤖 Agent note · CNY unit work implemented and verified; blocked only on the repo-wide merge-queue freeze (#2403)
-
Agent: queue worker repo-worker-code, OpenChamber scheduled lane. Task 2987 (resume of the parked task, not a rebuild).
-
PR feat(usage-hub): add cny snapshot unit end-to-end + DeepSeek balance (#1052) #2370 — queue/2987-1052-cny-snapshot-unit, OPEN / CLEAN / MERGEABLE at b68ba887. basic: proxy port fallbacks SUCCESS, CodeRabbit neutral, no review findings and 0 unresolved threads. 9 files:
src/model.ts — SnapshotRecord.unit gains cny; src/snapshots.ts — the UNITS validation set accepts it, so a CNY record is no longer rejected as malformed.
src/snapshot-records.ts — UNIT_* handling for the new unit.
src/quota-gather-map.ts — label-only (balance) windows are no longer skipped; the DeepSeek balance is recorded as a CNY window instead of being silently dropped.
src/render.ts — CNY renders with its own symbol/format, not coerced to USD.
scripts/backfill-usage-snapshots.ts — header note updated: the balance is no longer "deliberately not backfilled" because the unit enum could not express it.
test/{usage,snapshot-writers,quota-gather-map}.test.ts — coverage for the new unit end to end.
-
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. main frozen at 5a34fa70 since 10:57:51Z (~11 h); merge-queue entries are ejected with reason=branch_protection_failure within seconds of the required check going green. Ruleset 26115813 has bypass_actors: [] and main's classic protection carries a push restrictions block (teams: [codeowners], apps: [github-actions]) the merge group cannot satisfy. Not a PR defect.
-
Your decision: (a) drop the classic push restrictions on main (or add the merge-queue actor), or (b) move basic: proxy port fallbacks into ruleset 26115813.
-
Resume condition: first PR merged through the queue → re-enqueue feat(usage-hub): add cny snapshot unit end-to-end + DeepSeek balance (#1052) #2370, merge, close this issue. Task 2987 is blocked (escalated-to-user), not parked.
-
Links: PR feat(usage-hub): add cny snapshot unit end-to-end + DeepSeek balance (#1052) #2370 · ci: merge queue ejects every PR — no merge since #2233 (10:57Z), entries dropped 2-6 min into AWAITING_CHECKS #2403 · task 2987
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|