Skip to content

wip: apply maintainer review — slim reset credits, local times, schema stays v4 (stacked on #159) - #173

Merged
Loongphy merged 1 commit into
stack/pr-159-headfrom
wip/pr-159-review-fixes
Oct 22, 2026
Merged

Loongphy merged 1 commit into
stack/pr-159-headfrom
wip/pr-159-review-fixes

Conversation

@Loongphy

Copy link
Copy Markdown
Owner

WIP / draft — stacked on #159 (base is #159's head branch; this diff contains only the maintainer-review implementation). Will be retargeted to main after #159 merges.

What

Implements the four changes requested in the #159 review:

  1. NEXT RESET column removed — its value is always one of the two reset timestamps already embedded in the 5H/WEEKLY cells (58% (14:20 on 22 Oct)); the derived next_reset_at field is removed with it (registry, JSON output, and view layers).
  2. ACCESS EXP LOCAL → ACCESS EXPIRE — and the LOCAL suffix pattern is dropped: credit expiry now renders in local time, so every timestamp in the table shares one timezone (the previous per-credit columns pinned the backend timezone).
  3. Per-credit columns (C1 EXP, C2 EXP, …) removed — replaced by the enriched RESET CREDITS cell: N (exp MMM-DD) — the persisted count plus the earliest available-card expiry in local form. The old columns were rigid 23-char, grew unbounded with credits.len, showed expiry without card identity, and mixed UTC into the table.
  4. schema_version stays 4 — the new fields (access_token_expires_at, last_usage.reset_credit) are optional additive data: older binaries ignore unknown keys, and the data self-heals on the next --api refresh. The v4→v5 migration is dropped.

Persisted credit record

"reset_credit": [
  { "id": "credit-1", "status": "available", "expires_at": "2026-11-01T00:00:00Z",
    "title": "Full reset (Weekly + 5 hr)" },
  { "id": "credit-2", "status": "available", "expires_at": null, "title": null }
]
  • Kept: id (upstream opaque identity), status (upstream keeps redeemed rows in the list — RateLimitResetCreditStatus: available/redeeming/redeemed — and rendering filters to available like upstream's picker), expires_at, title (the only human-readable identity).
  • Dropped: wrapper available_count (duplicates reset_credits on disk), total_earned_count (upstream drops it too), reset_type / granted_at / description (nothing renders or acts on them).
  • Rendering filters to status == available exactly like upstream's picker.

Renames

  • auth_expires_at → access_token_expires_at across the registry record, persisted JSON key, fetch layer, view layer, and JSON output — it is specifically the access token's JWT exp, and matches the registry's _at seconds convention (created_at, last_used_at, last_usage_at, resets_at).

Docs

  • schema-migration.md stays at the schema 4 policy (v5 history entry removed).
  • docs/commands/list.md and docs/json-api.md updated: ACCESS EXPIRE / RESET CREDITS columns, slim reset_credit shape, no next_reset_at, all-local time rendering.

Scope

Validation

  • zig build -Doptimize=ReleaseFast clean; full zig build test exit 0
  • pty run of list --live --skip-api: the live table shows ACCESS EXPIRE / RESET CREDITS columns, no NEXT RESET, no per-credit columns, no UTC strings; plain list output is byte-identical to main
  • Registry migration verified: v4 files with the new fields load and stay at schema 4

…a stays v4

- remove the NEXT RESET column and the next_reset_at field (the value is
  always one of the two timestamps already shown in the 5H/WEEKLY cells)
- rename ACCESS EXP LOCAL -> ACCESS EXPIRE and drop the LOCAL suffix
  pattern; credit expiry renders in local time (UTC mixing removed)
- remove the per-credit columns (C1/C2 EXP) and their width machinery
- RESET CREDITS cell shows 'N (exp MMM-DD)': count plus the earliest
  available-card expiry in local form
- slim persisted credit records to {id, status, expires_at, title};
  wrapper available_count/total_earned_count and per-card reset_type/
  granted_at/description dropped (upstream drops total_earned_count too)
- rename auth_expires_at -> access_token_expires_at across the
  persistence/fetch/JSON layers
- schema_version stays 4: additive optional fields, older binaries
  ignore unknown keys, data self-heals on the next --api refresh
- docs and tests updated accordingly
[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant