Skip to content

test: real-Postgres harness and an HTTP send-and-read e2e - #39

Merged
TheGreatAxios merged 1 commit into
cl-9201-mailbox-replace-readme-installmailbox-wrapper-with-shortfrom
cl-9325-mailbox-add-shared-real-postgres-test-harness-in-tests
Sep 27, 2026
Merged

TheGreatAxios merged 1 commit into
cl-9201-mailbox-replace-readme-installmailbox-wrapper-with-shortfrom
cl-9325-mailbox-add-shared-real-postgres-test-harness-in-tests

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Stacked on docs(readme): quickstart that migrates, mounts and closes; route table #38.
  • tests/lib/db-harness.ts creates a fresh database per suite, applies the control plane and runMailboxMigrations, and drops it on close (also on a failed setup).
  • createTestApp plays the tenant middleware and mounts createMailboxRoutes on a Hono<TenantEnv>.
  • tests/send-and-read.test.ts: alice sends over HTTP; bob lists his inbox and reads the thread.
  • bun run test and CI run src and tests. The test role needs CREATEDB (CI's postgres user has it). The unused MAILBOX_DATABASE_URL is dropped.

Verification

CI is green on this branch: install --frozen-lockfile, build, typecheck, tests against Postgres, and the Node consumer smoke test.

Closes CL-9325
Closes CL-9072

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: the branch went through two independent review passes, and every finding is fixed. Two findings were waived after a senior ruling: the README stays stale on #37 until #38 lands, and the default resolver has no null guard because TenantEnv guarantees tenant and principal. Build, typecheck and 171 tests pass against real Postgres.

@TheGreatAxios
TheGreatAxios force-pushed the cl-9325-mailbox-add-shared-real-postgres-test-harness-in-tests branch from 4e453bb to c3a026d Compare September 25, 2026 15:02
@TheGreatAxios
TheGreatAxios force-pushed the cl-9325-mailbox-add-shared-real-postgres-test-harness-in-tests branch 2 times, most recently from bbeb192 to ee340ad Compare September 26, 2026 01:28
@TheGreatAxios
TheGreatAxios added this pull request to stack #47 September 26, 2026 01:58
A suite gets its own migrated database behind a host that plays the
tenant middleware, so a test drives the routes the way a hub does
rather than calling internals.

Closes CL-9325, CL-9072.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9325-mailbox-add-shared-real-postgres-test-harness-in-tests branch from ee340ad to 5ed809f Compare September 26, 2026 02:40
@TheGreatAxios
TheGreatAxios removed this pull request from stack #47 September 26, 2026 02:40
@TheGreatAxios
TheGreatAxios added this pull request to stack #50 September 26, 2026 02:40
@TheGreatAxios
TheGreatAxios merged commit d10ae90 into main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant