Health, liveness, and readiness checks
Use the public liveness check to confirm the service responds with no sign-in. Use the readiness check inside the signed-in app to confirm the app can serve answers for one college workspace, with database, storage, and background jobs each reported ready or not ready by name only. A public page never calls readiness and never shows dependency detail.
Liveness and readiness compared, as audited on 2026-11-07
Read this table before you set a monitor, a load balancer, or a publish check. Liveness and readiness answer different questions and use different sign-in rules.
| Check | Endpoint | Sign-in | Result and fields shown |
|---|---|---|---|
| Liveness | GET /api/health | None. No cookies. Fresh on each run. | 200 with ok true, status live, service campus, and checked_at provided. A public page reads only ok, status, service and checked_at, with a top-level field taking precedence over any nested data field. Any other field, including any version field and any error field, is ignored and is never shown on a public page. 503 means the service answered but is not confirmed as live. Any other status, a non-JSON answer other than 503, a timeout, or a network failure means did not complete, not not live. Liveness does not report database, storage, or background job state and must never be used as a readiness result. |
| Readiness, unauthenticated probe | GET /api/ready | None, probe only | 404 with ok false and error Not found. The probe fails closed with no readiness detail. Do not use this probe as a readiness result and do not show dependency detail without sign-in. |
| Alias paths, probe only | GET /health, /ready, /readyz, /live, /healthz | None, probe only | 404 for each path. No alias endpoint is offered. Use /api/health for liveness and the signed-in app for readiness. Do not add alias paths. |
| Readiness in the signed-in app | Inside the signed-in app only, with existing sign-in and existing policy. No new login path. | Signed-in staff only | Shows ready or not ready for each dependency in the app. The authenticated response carries only version, uptime_seconds, dependency status, checked_at and ok. Dependency status is ready or not ready for database, MAJIC sign-in, workspace store, storage (file store), and background jobs (queue and scheduler), by name only. Database ready means the database binding answers a minimal query. Storage ready means the file-store binding is present and answers a minimal metadata probe with no file name, bucket name, or content returned. Background jobs ready means the queue and scheduler bindings are present and a no-op probe succeeds, or the last successful tick is fresh within the configured interval, with no job payload, queue name, or backlog count returned. If a binding is missing or unbound, that dependency is not ready, never omitted and never reported ready by fallback. No secret, no address, no configuration name or value, no error text, no topology, and no other college data. The public page never calls this check. |
| Public status page | GET /status | None | 200. Live check on demand. Readiness instructions only. Shows live or not live or did not complete, checked time and response time measured on the device. It never shows dependency, version, configuration, address, secret or error detail and it never calls readiness. |
A 404 on an alias path or on the unauthenticated readiness probe means that path is not offered for that purpose. It is not a ready result and it is not a live result. A signed-in page that requires sign-in for the liveness path would give a false result to a monitor, so /api/health must stay reachable without sign-in.
Readiness dependencies, by name only
Each probe runs only inside the signed-in app, with its own short timeout, so one slow dependency reports not ready for that name only and does not hide the other results. A probe never reads user files, question text, or job payloads, and a failure never returns error text.
| Dependency, by name only | Minimal probe, authenticated only | Ready when | Effect when not ready |
|---|---|---|---|
| Database | Binding present and a minimal query answers within the probe timeout | The query answers in the same college scope with no table or column detail returned | Answers and workspace lists are not served. Publish is blocked. No fallback database is used. |
| MAJIC sign-in | Sign-in binding present and a minimal sign-in service check answers within the probe timeout | The service check answers with no account or token detail returned | Sign-in is not offered as a fallback path. A failed or missing sign-in routes to the named handoff office, never to a public answer. |
| Workspace store | Binding present and a minimal workspace lookup answers within the probe timeout | The lookup answers for the signed-in college only | No workspace list is served. No work is added in another college workspace. |
| Storage (file store) | Binding present and unbound check passes, plus a minimal metadata probe with no file name and no content read | The metadata probe answers within the probe timeout | File sources are unavailable and must not be published. No public storage is used as a fallback. Text and web page sources that do not need the file store are not reported not ready for this reason alone. |
| Background jobs (queue and scheduler) | Queue and scheduler bindings present, plus a no-op probe that creates no user-visible job, or a stored last successful tick checked for freshness within the configured interval | The no-op probe succeeds, or the last successful tick is fresh, within the probe timeout | Scheduled summaries, retention deletion, and reminder jobs do not run and must not be claimed as sent. Queue work stays visible in the app. A backlog count, queue name, and job payload are never returned. |
Overall readiness is ready only when every dependency above is ready. One not ready dependency makes the overall result not ready, with the other dependencies still listed by name. The public liveness result stays unchanged in that case and must not be shown as a readiness result.
Safe response rules for the public liveness check
Keep the public response small and stable. A monitor needs a status code and a verdict, not a diagnostic report.
What a public reader may use
- Status code 200, 503, or did not complete, as stated in the table above
- Four fields only, read as ok, status, service and checked_at
- Checked time in UTC in ISO 8601 form, for example 2026-11-07T12:00:00Z
- Cache control that prevents caching, such as no-store, so a later change reaches the monitor
What a public page must never show
- No version, uptime, dependency status, internal address, private host name, IP address, port, or database name from a public call
- No credential, token, API key, connection string, secret, configuration name or value, or error text
- No dependency name, version, health detail, or error text from a dependency on a public page
- No bucket name, queue name, file name, job payload, backlog count, stack trace, question text, answer text, or person detail
Example only, safe public response body as read on a public page: ok true, status live, service campus, and checked_at in UTC. Do not add a field that names a dependency, a version, or an address, and ignore any extra field the service returns.
{'ok':true,'status':'live','service':'campus','checked_at':'2026-11-07T12:00:00Z'}
Try the liveness check on this page
The button sends a request to /api/health on the same origin with no credentials and no cookies, with up to 2 automatic retries after a transient network failure, timeout, or 5xx answer, for up to 3 attempts in total. The page shows the path, the status code, the elapsed time, the verdict, and the checked time in UTC. The page reads only ok, status, service and checked_at and ignores every other field. The page does not show the response body or response headers. There is no readiness button on this public page, because readiness is authenticated only and a public call would give a false result.
Liveness result
The live check has not run yet on this page.
A timeout after 5000 milliseconds on every attempt means the check did not return a status in time. Treat a timeout as did not complete, not as not live, and repeat the check before you act. While a check is running the Run live check button is disabled, so a second check cannot start at the same time. If the answer cannot be read, the result states did not complete and the button is enabled again so the check can be run again. Entries in the readiness summary below are kept when a live check fails. To see a readiness result, sign in and run the readiness check in the signed-in app, not on this page. See Status for the public live check.
Summarize a readiness result from the signed-in app
Enter only version, uptime_seconds, dependency status, checked_at and ok as shown in the signed-in app. Do not enter a bucket name, a queue name, an address, a configuration value, a secret, a file name, a job payload, or error text. This tool makes no server call, calls no readiness endpoint, and saves nothing. Every field is required. A field left on Choose fails the check and no ready default is shown.
Enter every field as shown in the signed-in app, then choose Show readiness summary. A missing field fails the check.
Safe defaults for config and monitoring
Use these defaults when you configure the checks. They add no new field to any answer or report.
- Use a 5 second timeout for the live check, and no more than one check per monitor interval per origin, so a slow dependency does not create a retry storm
- Use the readiness verdict inside the signed-in app for traffic decisions and the liveness verdict for process restart decisions, never the reverse, and never read a public live result as a readiness result
- Keep test and staff preview sessions out of readiness counts, and label any test result as test
- Keep the live check on demand only, with no sign-in redirect, no polling, no interval, and no scheduled send, and keep the response at the small size stated above
- When readiness inside the signed-in app shows not ready, keep the last ready verdict time beside the current verdict in the monitor and act on the time since the last ready verdict rather than on a single failed check
- Treat storage not ready as file sources unavailable and file source publish blocked, with no fallback to public storage. Treat background jobs not ready as scheduled summaries, retention deletion, and reminders not sent, with queue work still visible in the app and no catch-up send claimed
- When a dependency probe times out, report not ready for that dependency name only, keep the other dependency results, and show no error text, address, or configuration value
Runtime configuration inventory for health checks
Inventory of every environment variable and runtime configuration key referenced for these checks in the site pack, with the safe default stated in code on this page or in the guide named. No secret value is listed. Do not copy an example value into production.
| Config key | Where it is used | Safe default | Fail-fast or fallback |
|---|---|---|---|
| CAMPUS_ANALYTICS_OPT_OUT | Weekly quality rate page only. This is the only environment variable name documented in the site pack. It is not read by the health check on this page. | Recording suppressed when the flag is present in a true form, otherwise recording follows Do Not Track and Global Privacy Control as stated on Weekly quality rate. No value is copied into the health endpoint. | Safe fallback on Weekly quality rate: suppress recording and state that choice. Do not use this flag as a health endpoint setting. |
| Do Not Track and Global Privacy Control | Browser signals read on Weekly quality rate only. Not used by the health check on this page. | Suppressed when present in a true form, as stated on Weekly quality rate. | Safe fallback: suppress recording. No health endpoint change. |
| Live check timeout | Script on this page, AbortController timer for GET /api/health | 5000 milliseconds per attempt, stated on this page and in the script | Timeout means did not complete, not not live. Repeat the check before you act. Do not treat a timeout as a readiness result. |
| Live check retries and interval on this page | Script on this page, up to 3 attempts per button choice | Up to 3 attempts per button choice, up to 2 automatic retries after a transient network failure, timeout, or 5xx answer, on demand only, no polling, no interval, no scheduled send | Safe fallback: no retry storm beyond the 2 stated retries. A monitor must not add an interval or automatic retry that contradicts the on demand rule stated above. |
| Live check cache and credentials | Fetch options on this page | credentials omit, cache no-store, Accept application/json, same origin /api/health | Fresh on each run. Do not cache a live result and do not send cookies. |
| Readiness summary tool server calls and storage | Tool on this page with id readiness-summary-tool | 0 server calls, 0 readiness endpoint calls, nothing saved, shows only version, uptime_seconds, dependency status, checked_at and ok entered from the signed-in app | Safe fallback: if any required field is empty or a field is left on Choose, fail the check, name the missing field, show no ready default, and save nothing. |
| Storage keys on this page | Script on this page | None. This page uses no localStorage and no sessionStorage key. | Do not invent a storage key for health results. A later change that adds one must state the key, lifetime and clear rule in this inventory in the same release. |
| Worker environment variables and bindings: DB, FILES, MAJIC sign-in, workspace store | No file in the site pack defines them. The config matrix on Set retention and access states not stated in this pack for Worker environment variables, wrangler bindings and KV namespaces. | No substitute value from this guide. Required values are read by reference in the Worker slice only. No secret, connection string or sign-in setting is listed here. | Fail-fast: block publish until the Worker slice check passes for every required value. Do not copy an example value into production and do not invent a missing production value. |
| Alias health paths: /health, /ready, /readyz, /live, /healthz | Probed in the audit table above, 404 for each | No alias endpoint is offered. Use /api/health for liveness and the signed-in app for readiness. | Do not add alias paths. A 404 on an alias is not a live or ready result. |
No other environment variable is used by the site part in this pack, as stated on Weekly quality rate. Connection strings, secrets and sign-in settings are not listed here and are not changed by this page. A builder copies only the name CAMPUS_ANALYTICS_OPT_OUT into an example file when that flag is needed, with no secret value beside it, and does not copy it into the health endpoint.
Configuration inventory for health, readiness, and site defaults
This inventory covers every environment variable, binding name, and configuration default named in this pack for the marketing site and signed-in app. It lists names only and lists no secret value. A value marked not stated in this pack is not supplied by this guide and must be verified in the Worker slice before publish. Do not copy an example value into production and do not invent a missing production value.
| Item | Where named in this pack | Safe production default | Validation | Fail-fast or fallback |
|---|---|---|---|---|
| Live check timeout | This guide | 5000 milliseconds, on demand only, no polling and no interval | Positive number of milliseconds | Treat a timeout as did not complete, never as not live, and repeat the check before you act |
| Liveness endpoint GET /api/health | This guide and Status | Required endpoint with no alias and no fallback path | 200 with ok true, status live, service campus, and checked_at in UTC ISO 8601 form ending in Z | A missing or invalid required field means did not complete and the publish check fails. The Live verdict is not shown |
| Readiness unauthenticated GET /api/ready and aliases /health, /ready, /readyz, /live, /healthz | This guide | Required to return 404 with no readiness detail | Status 404 and ok false with no dependency detail without sign-in | Fail closed. Do not use this probe as a readiness result and do not add alias paths |
| Readiness response fields in the signed-in app: version, uptime_seconds, dependency status, checked_at, ok | This guide | Every field required. Dependency status is ready or not ready for database, MAJIC sign-in, workspace store, storage (file store), and background jobs (queue and scheduler), by name only | Version present, uptime_seconds a whole number, checked_at in UTC ISO 8601 form, ok true or false, and each dependency chosen explicitly with no ready default | A missing field means not ready. No ready default is shown and the summary is not produced |
| DB binding, the D1 database binding | Safe defaults that deny access when setup is missing | Required binding read by reference, with no fallback database | Bound for the app | Readiness shows not ready for the database and publishing is blocked |
| FILES binding, the R2 bucket binding for file sources | Safe defaults that deny access when setup is missing | Required for file sources and checked by hand, with no public storage fallback | Bound before any file source is published | File sources are unavailable and must not be published when the binding is missing |
| Worker environment variables, wrangler bindings, and KV namespaces | Complete config matrix in Set retention and access | Not stated in this pack. No substitute value from this guide. Required values are read by reference in the Worker slice | Verified in the Worker slice | Block publish until the Worker slice check passes for every required value |
| CAMPUS_ANALYTICS_OPT_OUT | Runtime configuration in Weekly quality rate | Not set. With no flag, recording follows Do Not Track and Global Privacy Control | Accept true, 1, or text true or 1 ignoring letter case and edge space. Treat any other non-empty text as suppressed | Safe fallback. Suppress recording and state that choice in the status line |
| Do Not Track and Global Privacy Control browser signals | Runtime configuration in Weekly quality rate and site.js | Suppressed when Do Not Track is 1, yes, or true and when Global Privacy Control is true | Accept the true forms stated in Weekly quality rate and treat empty or false as not suppressed | Safe fallback. Suppress recording when a signal is present in a true form |
| Event cap for the weekly quality demo | Runtime configuration in Weekly quality rate | 100 outcomes in memory only on that page | Positive whole number at startup | Fail-fast at startup if the cap is invalid. At the cap, stop recording new outcomes and do not drop an earlier outcome silently |
| Device storage keys: campus-answers:my-answers:v1, campus-answers:canonical-record:v1, campus-answers:role-first-run:v1 prefix, campus-answers:campaign:v1 in session storage | Complete config matrix in Set retention and access | Same versioned key. A new version uses a new key. Campaign values are session only | Entered key matches the versioned key in the matrix exactly | Fail on a mismatch. Do not migrate silently and do not reuse a key from another version |
| Retention mode and days, who may view full questions, who may export | Complete config matrix and safe defaults in Set retention and access | Explicit administrator choice for one college with no silent numeric default. No viewer and no exporter by default. Session-only mode states that rule on screen | Mode is session-only or retention days is a positive number. View and export are separate permission only or none, not everyone | Fail on a missing mode or on everyone. Publishing is blocked |
| Notification digest choice, caps, and quiet period | Complete config matrix in Set retention and access and Set notification preferences | Digest off by default, weekly or monthly only and not both. At most 3 per person per workspace per day, at most 5 non-essential per week, no non-essential send between 21:00 and 08:00 college local time | Digest choice is off, weekly, or monthly. Quiet period check is confirmed | Fail on both cadences or on a missing quiet period check. A send past a cap or in the quiet period queues for 08:00 the next college local day |
| Search pause and word start, and generation temperature | Complete config matrix in Set retention and access, Search scope, and Test answers | 120 millisecond pause, word start at 2 or more letters, word inside at 3 or more, one letter off at 4 or more, temperature 0 with one generation per check | Same values on both public filters and the test panel shows temperature 0 | Fail on a missing or different value. A missing generation setting is a fail in the test panel |
| Placeholder and example values: https://example.edu/page, Example college, localhost | Complete config matrix in Set retention and access | Never a production value | A production source link starts with https and is not example.edu, localhost, or Example college | Fail. Do not save an example value as a real source link or workspace |
No other environment variable is used by the site part in this pack. Connection strings, secrets, and sign-in settings are not listed here and are not changed by this page. Secrets are read by reference only and no secret value is written on this page.
Checks before you rely on a health result
Run each check on the production origin and on a staging origin before you publish.
- Run the live check above and confirm live, and confirm no version, uptime or dependency status is shown on this public page
- Probe GET /api/ready with no sign-in and confirm 404 with no readiness detail, and probe GET /health, /ready, /readyz, /live and /healthz and confirm 404 for each
- Sign in and run the readiness check in the signed-in app and confirm each dependency, including storage (file store) and background jobs (queue and scheduler), shows ready or not ready by name only, and confirm version and uptime_seconds appear only in the signed-in app and never on a public page
- Confirm a missing or unbound storage or queue binding reports not ready for that name only, the other dependencies still report, and no fallback is claimed, on a staging origin where the binding can be removed
- Leave this page open and confirm no repeat live check call occurs, no polling occurs and no scheduled message is sent
- Confirm the live check answer, this page, and the readiness summary contain no secret, no address, no configuration value, no bucket or queue name, no file name, no job payload, no backlog count, no error text and no topology detail
- Each control is at least 44 pixels high, focus stays visible by keyboard, and each result is announced once by the status region
- Choose Show readiness summary with any dependency left on Choose and confirm the check fails, names the missing field, and shows no ready default
- Confirm the live check does not show Live when checked_at is missing or is not in UTC ISO 8601 form
Confirm the service is live, then check readiness in the app
Run the live check on this page, then sign in and run readiness inside the signed-in app before you act.