mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-27 11:40:00 +01:00
Every suite that starts an embedded Postgres test database used to run initdb, start the cluster and apply all 331 migrations before its first test, and the support probe started a second throwaway cluster per file. On the serial CI server shards that is 5-6s per suite plus 2.5-3s per probe, about a third of each shard's wall time. The first caller on a host now builds one migrated cluster, stops it and publishes the data directory under the OS temp directory, keyed by the embedded-postgres version, the initdb flags and every migration file. Later callers copy the template and start Postgres on the copy; the probe treats a published template as proof of support. Each suite still runs ensurePostgresDatabase and applyPendingMigrations on its copy, so the returned database is identical to the fresh path. Any template failure falls back to a fresh initdb, and PAPERCLIP_TEST_POSTGRES_TEMPLATE=0 bypasses the cache. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>