Skip to content

ADR-0016: a same-day spend row from before the unknown count reads as complete after the upgrade, and chat's total-first cost read falls back on a zero total #96

Description

@ohdearquant

Source

What the code does

On #75's head the accumulation reads "unknown": (spend.get("unknown", 0) if same_day else 0) + unknown (

"unknown": (spend.get("unknown", 0) if same_day else 0) + unknown,
). A spend row written by the previous version the same day has no unknown key; the first wake after the upgrade writes 0 there, so a day that already held unpriced calls reads as fully accounted. The mark cannot say "not counted before this version".

Separately, and on main: spent in the chat CLI reads total_cost_usd or usage.cost or 0 (

return sum(float(c.get("total_cost_usd") or (c.get("usage") or {}).get("cost") or 0) for c in calls)
), so an envelope whose total is a true zero beside a non-zero usage.cost is billed at usage.cost; the documented order is total first.

Done when

A row missing the key on the same day carries a reading that says its earlier calls were not counted (a None/"unmeasured" the readers render), or the record says the day of the upgrade reads as partial by rule; spent falls back only when the total is absent (is None), with a test for a zero total beside a usage cost.

Read at a18a2a94904b. The record's wording wins over this summary; when they differ, the record is the spec.

Activity

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

    adr-owedWork an ADR record marks as owedbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions