Skip to content

Cost UI: fall back to /jobs/estimate + diagnostic warn for stale API - #43

Merged
aakri0 merged 1 commit into
mainfrom
fix/cost-ui-fallback
May 1, 2026
Merged

Cost UI: fall back to /jobs/estimate + diagnostic warn for stale API#43
aakri0 merged 1 commit into
mainfrom
fix/cost-ui-fallback

Conversation

@aakri0

@aakri0 aakri0 commented May 1, 2026

Copy link
Copy Markdown
Owner

Why

After #42 a user reported they still couldn't see cost estimates, even after wiping volumes and bringing the stack back up. Most likely cause: their operator-side docker compose up -d didn't include --build after pulling, so web/ (bind-mounted) was current but the API container was the pre-#40 image without the cost endpoints. /submit returned no estimated_cost, the JS hid the row, and the UI looked broken with zero on-screen feedback.

Fix

  • onSubmit() calls POST /jobs/estimate as a fallback whenever estimated_cost is missing from the /submit response. The estimate row populates either way, so the user sees the number even on a half-deployed stack.
  • A console.warn fires when the fallback runs, naming the likely cause: "your API container predates the cost feature: run docker compose up --build -d api (or ./start.sh)". So if cost is genuinely unavailable, the operator gets an actionable message in DevTools.
  • Bumped app.js?v=14.

Verified

  • Submit response on a fresh stack still includes estimated_cost = "$0.000507".
  • app.js?v=14 is served and contains the new fallback path (4 references to fetchEstimate / fallback per grep -c).

The cost-rendering code from #42 only fires when /submit returns an
estimated_cost field. If an operator pulls the new web/ but their API
container is still the pre-#40 image (e.g. `docker compose up -d`
without `--build` after a pull), the field is missing, the row stays
hidden, and the UI looks broken with no on-screen explanation.

Two changes so this can't bite silently:

- onSubmit() now calls /jobs/estimate as a fallback when estimated_cost
  is missing from the /submit response. The estimate row populates either
  way, so the user sees the number even on a half-deployed stack (as long
  as the API has *any* cost endpoint at all).

- A console.warn fires when the fallback runs, naming the likely cause
  ('your API container predates the cost feature: run docker compose up
  --build -d api'). Operators can paste this into a bug report.

Bumped app.js?v=14 so browsers pick up the new code without a hard
refresh.
@aakri0
aakri0 merged commit 52c0af5 into main May 1, 2026
3 checks passed
@aakri0
aakri0 deleted the fix/cost-ui-fallback branch May 1, 2026 13:29
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