feat: say the backend is starting instead of claiming it is broken - #7
Merged
Conversation
The packaged backend needs a couple of seconds on a warm launch and ~20s on the first launch after an install. During that window every API call failed with "could not reach the backend", which reads as broken, not starting - the message told users to go check on a backend that was doing exactly what it should. The backend gains GET /api/health, and a slim top banner polls it once a second until it answers: "Connecting to the CSEMInsight backend... (Ns)". Past 45s it adds the honest explanation - a first launch can take half a minute, and beyond that the backend at the shown address may genuinely have failed. The banner never renders in demo mode (no backend exists), before the first probe answers, or after the backend is up, so a dev session with the backend already running never sees it. Polling stops for good once ready; a backend dying later is reported by the failing call itself. Note: the local full-suite frontend run currently flakes on three pre-existing TriangleModelWindow timeouts under parallel load (they fail on clean main too, pass in isolation and in CI); tracked separately. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The last piece of the startup plan (#4, #6). The packaged backend needs ~2s on a warm launch and ~20s on the first launch after an install — and during that window every API call failed with "could not reach the backend", telling users to go check on a backend that was doing exactly what it should.
What it does
GET /api/health(two tests, including the CORS preflight).When it stays invisible
Six tests cover: immediate-ready renders nothing, banner while down, clears on recovery, long-wait hint, demo-mode silence, and polling stops after ready.
Verification
bun run buildclean.TriangleModelWindowtimeouts under parallel load. Verified on cleanmain(3 failed / 265 passed there too); they pass in isolation and CI has been green. Tracked as a separate task.🤖 Generated with Claude Code