Cost UI: fall back to /jobs/estimate + diagnostic warn for stale API - #43
Merged
Conversation
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.
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.
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 -ddidn't include--buildafter pulling, soweb/(bind-mounted) was current but the API container was the pre-#40 image without the cost endpoints./submitreturned noestimated_cost, the JS hid the row, and the UI looked broken with zero on-screen feedback.Fix
onSubmit()callsPOST /jobs/estimateas a fallback wheneverestimated_costis missing from the/submitresponse. The estimate row populates either way, so the user sees the number even on a half-deployed stack.console.warnfires when the fallback runs, naming the likely cause: "your API container predates the cost feature: rundocker compose up --build -d api(or./start.sh)". So if cost is genuinely unavailable, the operator gets an actionable message in DevTools.app.js?v=14.Verified
estimated_cost = "$0.000507".app.js?v=14is served and contains the new fallback path (4 references tofetchEstimate/fallbackpergrep -c).