UTMIST | #54 [task]: Add API readiness probes and bot health checks - #231
Merged
Merged
Conversation
kr1shap
marked this pull request as ready for review
September 25, 2026 14:05
kr1shap
requested review from
angelayzheng,
michelle-yl,
pusheen5000000 and
qiuethan
as code owners
September 25, 2026 14:05
qiuethan
approved these changes
Sep 25, 2026
qiuethan
left a comment
Collaborator
There was a problem hiding this comment.
Approving. is_ready is Protocol-first and in both adapters, the unauthenticated 503 body is static (no DSN or DB error text), /health stays DB-independent, docs/railway.json/.env.example all updated. Fast suites + ruff green locally for both services, bot test/lint/format green. Not run: test_postgres_adapter.py (no local Postgres).
Worth a follow-up, non-blocking:
discord-bot/src/index.js:40+discord-bot/railway.json: the health listener only starts whenENABLE_DISCORD=true, but the Railway healthcheck is unconditional. A web-only deploy (ENABLE_DISCORD=false ENABLE_WEB=true) sits 300s and fails healthcheck with no hint why. Either bind unconditionally and return 503 with no client, or add one sentence todiscord-bot/README.mdanddocs/RAILWAY-DEPLOYMENT.md.services/*/src/storage/postgres.pyis_ready: the failure is swallowed silently, so an operator sees 503 with no log line. Logtype(exc).__name__only (neverstr(exc), psycopg messages include host/user). Same shape in both services.
Nits: is_ready sits above __init__ in both in_memory.py files but below it in postgres.py; services/team-tracking/docs/DEPLOYMENT.md post-deploy checklist replaced the runnable railway run … curl command with prose, keep the command with the new path.
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.
What this changes
Adds unauthenticated
/health/readyprobes to team-tracking and documentation-system that check each service's own Postgres connection and return a service-specific 503 when unavailable. The Discord bot now serves/health/readyon Railway'sPORT(default 3002 locally), returning 503 until its gateway is ready or after a disconnect. Railway checks the readiness routes; the APIs' DB-independent/healthliveness routes remain available.Why
Closes #54. Part of the observability epic #46. Previously the two APIs could report healthy while their databases were down, and Railway had no Discord gateway readiness signal for the bot.
Zone
services/team-tracking·services/documentation-system·discord-bot·docsThis PR deliberately spans zones because #54 requires both DB-backed APIs and the Discord bot to participate in the same Railway readiness rollout. The shared deployment runbook also needs to describe the new paths and bot binding.
How to verify
Completed locally without Docker:
The offline API tests use fake healthy and unreachable engines and assert
/health/readyreturns 200/503 while/healthstays 200. The bot test uses a fake client to assert 503 -> 200 -> 503 across disconnect, readiness, and disconnect again.DOCKER NEEDED BELOW
Then request both APIs'
/healthand/health/readywithout an API key. With their databases up, both should return 200. With a database stopped,/healthshould remain 200 while/health/readyreturns 503 with that service's name. Restore the database afterward. In Discord mode,GET http://localhost:3002/health/readyshould return 200 once the gateway is ready.Checklist
stagingand targetingstaging.uv run ruff check .anduv run ruff format --check .clean for both Python services.docs/CONTRIBUTING.mdguides and completed their Docker-free checks..env.example, and Railway deployment docs.Deployment notes
/health/readyfor team-tracking, documentation-system, and discord-bot. A new deployment waits for its own DB or Discord gateway before becoming healthy.PORT; local Discord mode uses port 3002 whenPORTis unset. The web playground continues usingWEB_PORT=3001.