hapi migrate and the shared test harness #76

Open
opened 2026-11-27 16:43:19 -05:00 by bobby · 0 comments
Owner

Part of #73 (spec: #72)

What to build

hapi migrate applies a single linear Alembic history, using a strict constraint naming convention, as hapi_migrator. Every later ticket inherits a test harness: a testcontainers Postgres 18 prepared by the same hapi db bootstrap and hapi migrate as prod, the app connecting as hapi_app, each test rolled back, a pinned clock the app depends on, and in-process invocation of the hapi CLI.

Acceptance criteria

  • hapi migrate upgrades an empty bootstrapped database to head and is a no-op at head
  • just migrate and just test work locally
  • Tests run against real Postgres 18 via testcontainers, never a mocked database
  • Tests can pin "now", and the app reads time only through its clock dependency
  • A sample test shows calling the API over httpx.AsyncClient + ASGITransport and calling the CLI in-process
  • Each test's data is rolled back
Part of #73 (spec: #72) ## What to build `hapi migrate` applies a single linear Alembic history, using a strict constraint naming convention, as `hapi_migrator`. Every later ticket inherits a test harness: a testcontainers Postgres 18 prepared by the same `hapi db bootstrap` and `hapi migrate` as prod, the app connecting as `hapi_app`, each test rolled back, a pinned clock the app depends on, and in-process invocation of the `hapi` CLI. ## Acceptance criteria - [ ] `hapi migrate` upgrades an empty bootstrapped database to head and is a no-op at head - [ ] `just migrate` and `just test` work locally - [ ] Tests run against real Postgres 18 via testcontainers, never a mocked database - [ ] Tests can pin "now", and the app reads time only through its clock dependency - [ ] A sample test shows calling the API over `httpx.AsyncClient` + `ASGITransport` and calling the CLI in-process - [ ] Each test's data is rolled back
bobby added the ready-for-agent label 2026-11-27 16:43:19 -05:00
bobby added a new dependency 2026-11-27 16:43:20 -05:00
bobby added a new dependency 2026-11-27 16:43:21 -05:00
bobby added a new dependency 2026-11-27 16:44:15 -05:00
bobby added a new dependency 2026-11-27 16:44:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: bobby/hapi#76