feat(client): probe /api/health on server-setup save (#236) #382
No reviewers
Labels
No labels
area:auth
area:ci
area:db
area:infra
area:native
area:pwa
area:service
epic
feature
foundation
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
james/carol!382
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "236-health-probe"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #236
The server-setup screen only checked that the URL was syntactically
http(s). A wrong address surfaced later as a confusing login failure. Now, after the syntactic check and before saving, the screen probes the server and confirms it actually looks like Carol.What changed
lib/serverUrlProbe.ts(new): pure helper with injectablefetch. GETs<url>/api/healthwith a 5sAbortSignal.timeout. Success = HTTP 200 and a JSON body carrying stringstatus+version(HealthDto's signature). A throw/abort →unreachable; a non-200 or wrong-shaped body →notCarol.app/server-setup.tsx: probe runs between the syntactic check and the save; inlineActivityIndicatorspinner + disabled submit while probing; distinct error copy per failure reason.serverSetup.errors.unreachable/serverSetup.errors.notCarolin Carol's voice (verified they resolve relative to the screen's namespace).Verification
Merge note
Overlaps #239 on
apps/client/app/server-setup.tsx(this PR changes its logic; #239 scrubs its style arrays). Merge this first; #239 rebases cleanly on top.🤖 Generated with Claude Code
The server-setup screen only validated the URL was syntactically http(s); a wrong address surfaced later as a confusing login error. After the syntactic check and before saving, probe the server. - lib/serverUrlProbe.ts: pure, injectable-fetch helper. GET <url>/api/health with a 5s AbortSignal.timeout; success = 200 + a body carrying string `status` + `version` (HealthDto's signature). A throw/abort → unreachable; non-200 or wrong body → notCarol. - server-setup.tsx: probe between the syntactic check and the save; inline spinner + disabled submit while probing; distinct error copy. - i18n: serverSetup.errors.{unreachable,notCarol} (Carol's voice). - Unit tests: happy path + network-throw + abort/timeout + non-200 + wrong/unparseable body. Closes #236 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>📊 Test coverage
Patch coverage: no testable lines changed.
Overall (
app/,lib/,db/, excluding UI per ADR-0019):Soft thresholds per ADR-0019. Coverage is informational and does not block merge.