Repository navigation
Run the integration suite in a throwaway schema and add CI - #6
Merged
Merged
Conversation
rijnb
force-pushed
the
fix/db-test-schema-ci
branch
from
October 17, 2026 10:06
1e19280 to
8f70ee0
Compare
The suite dropped mapcode_request on whatever TEST_DB_URL named. It now pins every connection to a random schema, verifies current_schema() before any DDL, and recreates that schema before each test, so each test seeds its own rows and passes on its own with -t. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npm run typecheck covers src only, so test stubs drift from the contracts they stand in for. typecheck:test checks both and fails today on 2 stale test stubs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The replay query stub in api-recording lacked the country and anon columns. The flatgeobuf override in boundary-service cast a ReadableStream to Uint8Array for an argument no override reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs on pull requests and on pushes to main with Node 22: npm ci, both typechecks, and npm test with TEST_DB_URL pointing at a postgres:16 service container, so the integration suite checks the SQL on every PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-test schema reset left the backfill test with no geo rows that have a point, so dropping `lat IS NULL` from ANON_BACKFILL_SQL passed the suite. Seed GEO_ENCODE and DECODE before the backfill and assert they stay anon=false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
failingReplay returned the optional ServerDeps["replay"], so spreading it into an override left every field optional. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rijnb
force-pushed
the
fix/db-test-schema-ci
branch
from
October 18, 2026 08:29
827cf5a to
c46e77b
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.
Why
The Postgres integration suite ran
DROP TABLE mapcode_requeston whateverTEST_DB_URLnamed, so pointing it at a real database deleted the event log. Its tests also shared state, so a single test run with-tfailed. And nothing ran the suite or typechecked the tests, so both drifted unnoticed.What changed
mapcode_test_*schema, checkscurrent_schema()before any DDL, recreates that schema before each test and drops it at the end. Each test seeds its own rows.npm run typecheck:test(newtsconfig.test.json) typechecks src and test. The 3 stale test stubs it caught are fixed..github/workflows/ci.ymlrunsnpm ci, both typechecks andnpm testwith Node 22 against apostgres:16service on every PR and push to main.Scope
mapcode-rest-service-ts-2ig.8andmapcode-rest-service-ts-2ig.7.Blast Radius
Test code, a new tsconfig, a new script and a new workflow. No runtime code changes. The new workflow will also run on every other open PR, so those pick up a required-looking check once this lands.
Verification
public.mapcode_request: gone after one run of the old suite, still there after the new suite. ATEST_DB_URLwith?options=-c search_path=publicmakes the suite fail on thecurrent_schema()check before any DDL.-t. On main,-t "filters by kind"fails withrelation "mapcode_request" does not exist.node:22container against Postgres 16:npm ci, both typechecks, 722/722 tests, exit 0.lat IS NULL ANDremoved fromANON_BACKFILL_SQLit fails (expected [ { ts: 1000, anon: true }, ...] to deeply equal [ { ts: 1000, anon: false }, ...]); unmutated it passes. It also passes with an addedstatus::int < 40predicate.🤖 Generated with Claude Code