test: add a real-Postgres e2e suite with add and search tests - #56
Merged
TheGreatAxios merged 4 commits intoSep 27, 2026
Conversation
TheGreatAxios
commented
Sep 25, 2026
TheGreatAxios
left a comment
Contributor
Author
There was a problem hiding this comment.
Self-review, two passes.
Verdict: ready for review.
- Every suite runs against real pgvector Postgres and cleans up its database.
- The suites skip cleanly without
TEST_DATABASE_URL. - Lexical-only coverage and the run-scoped caveat are noted in the description.
TheGreatAxios
force-pushed
the
cl-9064-memory-add-shared-real-postgres-test-harness-in-tests
branch
from
September 25, 2026 07:02
2089726 to
82f8b5f
Compare
TheGreatAxios
force-pushed
the
cl-9064-memory-add-shared-real-postgres-test-harness-in-tests
branch
from
September 25, 2026 18:31
82f8b5f to
bb66414
Compare
TheGreatAxios
force-pushed
the
cl-9064-memory-add-shared-real-postgres-test-harness-in-tests
branch
from
September 26, 2026 01:32
bb66414 to
b07f9a4
Compare
TheGreatAxios
force-pushed
the
cl-9064-memory-add-shared-real-postgres-test-harness-in-tests
branch
from
September 26, 2026 01:36
b07f9a4 to
02abcaf
Compare
TheGreatAxios
added this pull request to stack #61
September 26, 2026 01:57
The shared test harness creates a fresh database per suite on the server named by TEST_DATABASE_URL, applies Interchange's migrations and memory's, mounts createMemoryRoutes under a stand-in tenant middleware, and drops the database afterwards. The first suite adds documents over HTTP, checks that search ranks them by relevance, and checks that another tenant sees none of them. bun run test now runs the unit and end-to-end suites, and CI runs it against a pgvector service; without TEST_DATABASE_URL the end-to-end suites skip.
A second run leaves the memory schema unchanged and creates no tables in public, and a replay behind a long reader fails on the lock timeout instead of blocking. With a non-public host schema the foreign keys point at that schema's tenant and principal tables, and replaying against a different host schema fails instead of passing silently. A database the ledger runner left before the temporal model gets the temporal_class backfill exactly once.
A caller without memory:search gets 403, only a document's creator can forget it, and purge removes the document with its versions and chunks.
A tick over tenant-shared captures writes one inferred claim per document through the HTTP client, and a second tick from the returned cursor writes nothing.
TheGreatAxios
force-pushed
the
cl-9064-memory-add-shared-real-postgres-test-harness-in-tests
branch
from
September 27, 2026 00:32
02abcaf to
5407084
Compare
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.
Summary
Stacked on #55; merge that first.
tests/lib/db-harness.tscreates a fresh database per suite on the server named byTEST_DATABASE_URL, applies Interchange's migrations (@intx/dbrunMigrations) and memory's, and drops the database afterwards. It mountscreateMemoryRouteson aHono<TenantEnv>app behind a stand-in tenant middleware that seats the caller from a bearer token and refuses a path naming another tenant.bun run testrunssrc/andtests/. CI runs it against apgvector/pgvector:pg17service. WithoutTEST_DATABASE_URLthe end-to-end suites skip locally and fail in CI. CONTRIBUTING describes the setup.memory:searchgrant gets 403. Forget is allowed for the creator only. Purge removes the document, its versions and its chunks.memoryschema unchanged and creates no tables inpublic. A replay behind a long reader waits for it instead of failing. Three concurrent runners on a fresh database, then on a migrated one, all succeed. With a non-public host schema the foreign keys target that schema, and a replay against a different host schema fails. A database left by the 0.1.0 runner before0004gets thetemporal_classbackfill exactly once.derived_from, and a replay from the returned cursor writes nothing.Verification
TEST_DATABASE_URL=… bun run test: 428 pass against a local pgvector Postgres 16. Nomemory_test_*databases are left behind.bun run testwithout the variable: 418 pass, and the end-to-end suites skip.bun run typecheckpasses.Closes CL-9064
Closes CL-9085
Closes CL-9086
Closes CL-9088
Closes CL-9087