feat(health): /healthz reports last applied migration (P4-I)#82
Merged
Conversation
Architect audit P4-I. `GET /healthz` body gains a `migration` field carrying the lex-highest entry from `SequelizeMeta` (e.g. `"20260519000000-idempotency-keys"`). Sequelize-cli timestamp-prefixes migration filenames so lex order matches apply order — pulling the top row is equivalent to "last applied" without a separate marker. Use cases: - Rolling-deploy verification: poll /healthz across pods, confirm every instance is at the expected migration before flipping traffic. - Drift detection: a stuck pod that didn't pick up a migration shows up as a different `migration` value in the response. - Compliance/audit: timestamps the schema version visible at probe time. Implementation notes: - The migration query is wrapped in its own try/catch. A failure to read SequelizeMeta (missing table on a fresh DB, perms, etc.) does NOT flip `status` to `degraded` — the DB itself is up, so the API is functional. `migration` just falls back to `null`. - No new query when the DB ping fails — `migration` stays null and the outer 503 covers the case. - OpenAPI spec updated to document the new field. Tests: - New healthz case asserts `migration` is present and is either `null` or a string. Specific values are covered by integration tests against a real DB. - Full suite: 358 pass / 4 skip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Part of architect audit issue #73 — iteration P4-I.
Summary
GET /healthzbody gainsmigration— last applied migration name fromSequelizeMeta. Lets a rolling-deploy caller verify every pod is at the expected schema version.migration: null.Test plan
migrationkey present + null|string.This code proudly made in Nebraska. GO BIG RED! 🌽 https://xkcd.com/2347/