Skip to content

Cost UI: dedicated card, burst honors editor, Load sample button - #44

Merged
aakri0 merged 1 commit into
mainfrom
feat/cost-card-and-burst-fix
May 1, 2026
Merged

Cost UI: dedicated card, burst honors editor, Load sample button#44
aakri0 merged 1 commit into
mainfrom
feat/cost-card-and-burst-fix

Conversation

@aakri0

@aakri0 aakri0 commented May 1, 2026

Copy link
Copy Markdown
Owner

Why

Three related changes around the Invoke tab:

  1. Cost was crammed into the Latest result card. Worth its own card so the breakdown + 30-day total have room to breathe.
  2. The burst (`Invoke ×50`) ignored the editor — it hardcoded `'import os; print(...)'`, which made the load-test feature useless for anything except testing that one snippet.
  3. Empty editor on first load — there's no quick path to a load-test-ready snippet. Existing per-sample link buttons (`hello / compute / sleep / fail / payload`) are buried up near the language picker.

Changes

Cost card

  • New `#cost-card` next to Latest result. Three sections:
    • Estimated max cost (worst-case for the just-submitted job; populated from `/submit`'s `estimated_cost` field, with the existing fallback to `/jobs/estimate` if the API is stale).
    • Actual cost + a four-row breakdown: compute / memory / request / network.
    • Last 30 days rolling total + jobs counted.
  • New `refreshUsageTotal()` calls `/usage/cost?window_days=30` on app boot, after every submit, and after every burst — so the running total reflects load-test traffic in real time without needing to open the Account modal.

Burst honors editor

  • `onBurst()` now calls `buildSubmitBody()` — same shape as the regular `Invoke`. Each of the 50 jobs runs whatever's in the editor (language, files, payload, timeout, memory, retries, auto-install).
  • 50× cost is included automatically in the 30-day total because `/usage/cost` already aggregates by owner.

Load sample button

  • `#btn-load-sample` next to Invoke / Burst loads `SAMPLES[].compute` into the editor and flips to inline mode.
  • The `compute` sample (sum of squares 0..200000) is short, deterministic, and substantial enough to produce meaningful timing under a load test.

Cache busts

  • `app.js?v=15`, `styles.css?v=12`.

Verified locally

  • Estimate populated immediately on submit; actual cost + breakdown filled in once the job completes.
  • 30-day total updates after a single submit (1 job, `$0.000002660`) and again after a burst.
  • Burst with the Python `compute` sample loaded — 50 jobs run that exact snippet (no more hardcoded bytes).
  • Load sample button switches the editor between languages cleanly.

…tton

Three changes packaged together — same area of the Invoke tab.

(1) Dedicated Cost card. Pulled the estimated/actual cost rows out of
the Latest result card into their own card with three sections:
  - Estimated max cost (worst-case for the just-submitted job)
  - Actual cost + a small breakdown (compute / memory / request / network)
  - Last 30 days rolling total + jobs counted
A new refreshUsageTotal() calls /usage/cost?window_days=30 on app boot,
after every submit, and after every burst — so the running total
reflects load-test traffic in real time without needing to open the
Account modal.

(2) Burst honors the editor. The 'Invoke ×50' button used to hardcode
a fixed Python snippet, which made it useless for load-testing
anything other than that one snippet. It now calls buildSubmitBody()
so whatever's in the editor (language, files, payload, timeout,
memory, retries, auto-install) is what each of the 50 jobs runs.

(3) Load sample button. New 'Load sample' button next to Invoke /
Burst loads SAMPLES[<active-language>].compute into the editor and
flips to inline mode. The compute sample is short, deterministic, and
substantial enough to give meaningful timing under a load test — much
better starting point than an empty editor for first-time users.

Bumped app.js?v=15 + styles.css?v=12 so browsers pick up the new IDs
without a hard-refresh dance.
@aakri0
aakri0 merged commit 7834ffb into main May 1, 2026
3 checks passed
@aakri0
aakri0 deleted the feat/cost-card-and-burst-fix branch May 1, 2026 13:41
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