feat(ai-cost): read the billed months on the AI & Cost screen - #2943
Open
Gregory91G wants to merge 2 commits into
Open
Gregory91G wants to merge 2 commits into
Gregory91G wants to merge 2 commits into
Conversation
The invoiced seat fee reached the metrics API and no surface at all, and the monthly billed extra usage reached none either: the screen carried only the per-day distribution, because a row that totals a window cannot take a figure anchored to the first day of the month it bills for. A section of its own reads both at month buckets, one row per billing month. There is deliberately no total column — the seat fee and the usage billed on top of it answer different questions, and adding them reports a figure the vendor never charged. A tier the invoice does not price reads as absent rather than zero, and a failed request says so instead of calling the period uninvoiced. The view takes two collections through one hook, so the suite's mock now dispatches on the requested keys. Without that a failing per-tool request stands in for a failing monthly one and the new section asserts nothing. Signed-off-by: Gregory Gogin <grigoriy.gogin@constructor.tech>
The suite pinned a week inside July while the monthly result carried points on two month firsts — a pairing the API cannot produce, since both month-grain metrics are anchored to the first day of the month they bill for and a window missing that day returns nothing. The rendering was right and the premise was impossible, which also left the section's real default state untested. The period is now a fixture the tests set: a two-month window for the rows, and a week inside a month for the state a reader meets when the portal opens. The collection hook is mocked and filters nothing, so the empty case says so with an empty monthly result rather than by narrowing the window alone. Signed-off-by: Gregory Gogin <grigoriy.gogin@constructor.tech>
|
Warning Review limit reachedNext included review available in 45 minutes. View limit detailsLimit details: You’ve used the included review currently available. This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
This was referenced Aug 28, 2026
cyberantonz
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2942.
Do not merge as an answer to #2942 — that issue has been reframed. The need there is monthly statistics in general: the same parameters with a monthly cut in place of the daily one, available for every metric. This branch builds a section for two cost keys, which is the narrow reading it was written against.
Open rather than closed. It stands as a worked reference for the monthly reading of these two metrics while the general shape is decided. What ships against #2942 is the product owner's call.
Why.
ai.seat_costhas been served since #2671 and shown on no screen; the monthlyai.extra_usage_costwas shown on none either. So what a seat costs could not be read anywhere in the product.What changed. A new "Billed by month" section on the AI & Cost screen —
Billing month | Seat cost | Extra usage billed, one row per billing month, both figures read at month buckets.No total column, deliberately. The seat fee and the usage billed on top of it answer different questions; adding them reports a figure the vendor never charged. One line to add if a reader asks for a sum.
A section of its own rather than the existing rows. Both metrics are anchored to the first day of the month they bill for, so a row that totals a window drops any month whose first day it misses — which is why the surrounding sections take only the per-day distribution. The new section carries that caveat in place, and a window holding no month start says so.
Split out of #2928. No frontend consumer asked for this, so it waits on its own rather than riding the data-path checks that shipped there.
Verified.
tsc -bclean,eslint . --max-warnings 0clean, and 16/16 inai-cost-view.test.tsx— four of them new: a month's two figures side by side with no sum of them anywhere, a month with no seat fee reading as absent rather than$0, a window inside one month showing the empty state a reader meets when the portal opens, and a failed monthly request saying so instead of calling the period uninvoiced.The suite takes two metric collections through one hook, so its mock now dispatches on the requested keys — without that a failing per-tool request stands in for a failing monthly one and the new section asserts nothing.
Not run.
tests/stand/ui— no browser journey covers this section, and no screenshot of it exists yet. Someone should look at it before this merges.