Cost UX round 2: live ticking, breakdown toggle fix, /cost page, clear confirm - #46
Merged
Merged
Conversation
…r confirm
Five fixes/features in one PR — all touch how cost is presented.
(1) Live cost while running.
actual_cost() now handles status=running by adding (now - started_at)
to the prior cumulative duration. The result is tagged live=true so
the UI can render a 'LIVE' pill and tick up in real time. pollResult
drops to a 500ms cadence so the tick is visible.
Verified: a 3s sleep job ticks 0.0000139 -> 0.0000271 -> 0.0000403
-> final 0.0000404.
(2) Breakdown click-to-expand was broken. The .cost-strip-detail rule
set display:flex, which beat the UA stylesheet's [hidden] rule, so
the row was always visible. Added explicit [hidden] override.
(3) Estimated max label clarified — bracketed explanation inline.
(4) Clear-invocations confirmation modal. Replaces the bare confirm()
with a modal that previews the count and cost about to be deleted,
plus copy explaining the 'Last 30 days' panel will drop accordingly.
Cost panels refresh after the delete.
(5) New /cost page (sidebar tab). Lays out the formula, the four rate
knobs (with current values from /usage/cost.pricing), the inputs the
model uses, an explicit definition of 'Estimated max', and a
per-status breakdown of the user's last 30 days. Refreshed on tab
open and after every Invoke / burst / clear.
Schema:
- Cost dataclass gains a live: bool field, surfaced on /jobs responses
for running jobs.
- test_pricing.py: three new cases (live cost, retry-mid-flight,
running-without-started-at).
Asset cache-busts: app.js?v=17, styles.css?v=14.
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.
Five things you flagged, all fixed.
1. Live cost while running
actual_cost()now also handlesstatus=running— it adds(now - started_at)onto the prior cumulative duration and tags the resultlive: true. The UI polls/jobs/{id}at 500ms while running, renders a pulsing LIVE pill next to the actual cost, and the number visibly ticks up in the strip.Verified end-to-end: a 3s
time.sleep(3)job ticks$0.0000139 → $0.0000271 → $0.0000403, then locks in at$0.0000404(live=false) when it completes.2. Breakdown toggle was broken
The CSS
.cost-strip-detail { display: flex }overrode the UA stylesheet's[hidden] { display: none }, so the row was always visible regardless of the toggle. Added explicit[hidden]rule and the click-to-expand on the Actual cell now works.3. "Estimated max" label clarified
The strip label now reads:
So the meaning is visible without hovering for a tooltip.
4. Clear-invocations confirmation modal
The old
confirm()is replaced with a proper modal that previews:N completed (or whatever filter is active)$ ...After the delete, both
refreshUsageTotal()andrefreshCostPage()fire so the cost panels update immediately.5. New
#costpageA new sidebar tab. Two cards:
/usage/cost.pricing), the inputs the model uses (duration_seconds,vcpu_share,memory_mb,attempts,network_seconds), an explicit definition of Estimated max, and a note about what Clear does.completed,failed_permanently,canceledwith their counts and summed cost).Refreshes when the tab opens and after every Invoke / burst / clear.
Test plan
pytest -q— 174 passed (3 new pricing cases for live cost, mid-flight retry, missing started_at).#cost— page renders with current rates, formula, and 30-day breakdown.Asset cache-busts:
app.js?v=17,styles.css?v=14.