SPB Git forge

spb/countryatlas

Public
20commits 1branches 0releases
268.3 MBsize
maindefault branch
12 days agolast push
TypeScript 57% Python 38.6% JavaScript 3.6% CSS 0.6%

Never fail a render or a build on a transient API error: 429/5xx render the calm not-built state; deploy hook uses pipefail so a failed web build fails the deploy

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Simon-Pierre Boucher committed 12 days ago (Sep 12, 2026) parent 6bbab12

2 changed files +4 −3

modified apps/web/src/lib/api.ts +3 −2
@@ -43,9 +43,10 @@ export class ApiError extends Error {
43 43 this.problem = problem;
44 44 this.path = path;
45 45 }
46 − /** The snapshot does not exist yet (fresh deployment, pipeline still running) — or the API is down. */
46 + /** The data service is unavailable right now: no snapshot yet (503), unreachable (0), rate-limited (429) or failing (5xx).
47 + * Pages render the calm "data is being prepared" state for all of these instead of crashing (and never fail a build). */
47 48 get notBuilt(): boolean {
48 − return this.status === 503 || this.status === 0;
49 + return this.status === 503 || this.status === 0 || this.status === 429 || this.status >= 500;
49 50 }
50 51 get notFound(): boolean {
51 52 return this.status === 404;
modified deploy/countryatlas.mld.json +1 −1
@@ -91,7 +91,7 @@
91 91 "post_sync": [
92 92 "export PATH=\"$HOME/.local/bin:/opt/homebrew/bin:$PATH\"; (test -x .venv/bin/python || uv venv --python 3.12 .venv) && uv pip install -q --python .venv/bin/python -e . && echo ' python deps ok'",
93 93 "export PATH=\"/opt/homebrew/bin:$PATH\"; pnpm install --frozen-lockfile --silent && echo ' web deps ok'",
94 − "export PATH=\"/opt/homebrew/bin:$PATH\"; cd apps/web && API_URL=http://127.0.0.1:8291 NEXT_PUBLIC_SITE_URL=https://www.countryatlas.co CA_ADMIN_TOKEN=c9ae6c67cdeb415c9df7db09d255c86d3537fb7670cf3c5a NEXT_TELEMETRY_DISABLED=1 pnpm build 2>&1 | tail -3 && echo ' web build ok'",
94 + "set -o pipefail; export PATH=\"/opt/homebrew/bin:$PATH\"; cd apps/web && API_URL=http://127.0.0.1:8291 NEXT_PUBLIC_SITE_URL=https://www.countryatlas.co CA_ADMIN_TOKEN=c9ae6c67cdeb415c9df7db09d255c86d3537fb7670cf3c5a NEXT_TELEMETRY_DISABLED=1 pnpm build 2>&1 | tail -3 && echo ' web build ok'",
95 95 "mkdir -p $HOME/countryatlas-data/{raw,staging,build,snapshots,exports,logs} && echo ' data dirs ok'"
96 96 ],
97 97 "post_start": []
98 98