bdc47dde7f
GSD-Unit: M001/S06/T01
2.0 KiB
2.0 KiB
estimated_steps, estimated_files, skills_used
| estimated_steps | estimated_files | skills_used |
|---|---|---|
| 12 | 4 |
T01: Add preflight gate for live API/auth readiness
Build a repeatable preflight script and doc so environment blockers are caught before browser UAT.
- Why: avoid the ERR_CONNECTION_REFUSED/CORS/auth mismatch that currently blocks the UI.
- Steps:
- Create
scripts/s06-preflight.sh(bash, executable) that assumes backend already started; probes/api/auth/configand/api/admin/systemonhttp://localhost:5202/api, printing database/auth/gmailConfigured/ai status and failing fast on unreachable endpoints. - Ensure script respects
API_BASEenv override and usescurl -fwith readable errors; no secrets logged. - Add a short runbook snippet to
README.mdshowing backend start command fromJobTrackerApi/and how to run the preflight (including auth token note if required). - Sanity-check CORS expectations vs
job-tracker-ui/src/api.tsand document the required origin pairing (UI :3000, API :5202).
- Create
- Failure Modes (Q5): API down → exit 1 with hint to start API; Auth required without token → script notes auth required and how to obtain; malformed JSON → show raw body and fail.
- Load Profile (Q6): trivial single-user curl calls; no scaling concern.
- Negative Tests (Q7): run script with API stopped (expect non-zero); run with wrong
API_BASE(expect clear error message). - Must-haves: preflight script exists/executable; README runbook mentions backend start + preflight; script outputs gmailConfigured/auth/db/ai fields.
- Verification:
bash scripts/s06-preflight.sh
Inputs
JobTrackerApi/Program.csJobTrackerApi/appsettings.Development.jsonjob-tracker-ui/src/api.tsREADME.md
Expected Output
scripts/s06-preflight.shREADME.md
Verification
bash scripts/s06-preflight.sh
Observability Impact
Adds preflight status surface exposing DB/auth/gmail/ai readiness via curl; provides explicit failure messages for unreachable API/CORS/auth.