Skip to content

perf(testing): Keep CI Postgres in memory and share the test database reset - #2098

Closed
dcramer wants to merge 10 commits into
mainfrom
claude/test-speed-next
Closed

dcramer wants to merge 10 commits into
mainfrom
claude/test-speed-next

Conversation

@dcramer

@dcramer dcramer commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The Postgres test harness is now in one place, and CI runs it on a Postgres that keeps its data in memory. Isolation does not change: each test file gets a new database, and each test starts with every table truncated.

  • CI Postgres in memory. Each test file drops and clones a database, and each test truncates every table. Both make Postgres write and sync files. The seven Postgres services in CI now keep the data directory in memory.
  • One reset. The reset before each test moves from the setup file of packages/junior to @sentry/junior-testing/postgres, with no change to what it does. Every package that uses the harness gets the same reset.
  • One safety check. The check that the harness only runs on a local server had three copies. It is now in createPostgresHarnessConfig.
  • Tests read the shared test package from source. pnpm keeps a copy of @sentry/junior-testing in node_modules and does not update it after a pull, so a checkout could run an old harness. The Vitest configs and the two tsconfig files that typecheck tests now resolve it from source, as they already do for junior-plugin-api and junior-memory. With the copy broken on purpose, typecheck and the tests of all five packages that use it pass.

Vitest duration of the core jobs in CI, one sample each. CI times vary a lot between runs, so read these as a direction:

CI job Before After
junior unit 61 s 45 s
junior component 58 s 46 s
junior integration 137 s 128 s

An earlier version of this pull request truncated only the tables that had rows. It is removed: that check does not see rows of a transaction that is still open.

Local runs do not get faster with this change. compose.yaml keeps one Postgres on disk for tests and for the development database.

One commit adds the recordings of the Google Calendar free/busy eval, which main did not have. The other recording commits are from the eval bot.

Refs #2001

🤖 Generated with Claude Code

…r file

The core suite spent more worker time in the Postgres harness than in
test bodies. Two costs made that time.

Each test truncated all 25 tables, about 12 ms, even when no table had
rows. The reset now truncates only the tables that have rows. It moves
from the setup file of packages/junior to @sentry/junior-testing, so
every package gets the same reset.

Each test file drops and clones a database, and Postgres does a
checkpoint for each drop. CI now keeps the Postgres data directory in
memory, so a checkpoint does not wait for the disk. Each file still gets
a new database.

The check that the harness only runs on a local server had three
copies. It is now in createPostgresHarnessConfig.

Local runs of the whole core suite, four workers, on a new Postgres:
198 s before, 128 to 130 s with both changes. Two runs had no timeout.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Oct 10, 2026 4:04pm UTC

Request Review

The integration evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37977349844.
The evals of this commit replay them in strict mode.

Eval-Suite: integration
@sentry-evals

sentry-evals Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Sentry Evals

junior-behavioral

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 67 6 0 $1.21 0 387.03s

Base commit 9b9647b has no eval run to compare against.

junior-guardian

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 53 0 5 $0.01 0 34.72s

Base commit 9b9647b has no eval run to compare against.

junior-integration

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 92 0 0 $0.48 0 153.11s

Base commit 9b9647b has no eval run to compare against.

junior-router

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 12 0 0 $0.00 0 0.16s

Base commit 9b9647b has no eval run to compare against.

The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/37977349924.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
pnpm installs a copy of each workspace package in node_modules. It
updates a copy only after the build script of that package, and
@sentry/junior-testing has no build, because tests read its TypeScript
source. So the copy keeps old code after a pull or a checkout, and
pnpm install does not update it. Tests and typecheck then run against
an old harness.

Each Vitest config that uses the package now resolves it from source,
as the configs already do for junior-plugin-api and junior-memory. The
two tsconfig files that typecheck tests map it too.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38007002624.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
The eval had no recording, so each run made its model requests live. The
last CI run failed on the judge score of a live answer, and CI dropped
the recording. A local live run passed, and these are its recordings.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The integration evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38015297836.
The evals of this commit replay them in strict mode.

Eval-Suite: integration
The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38015297818.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral
@dcramer
dcramer marked this pull request as ready for review October 10, 2026 15:40
@github-actions github-actions Bot added the risk: high PR risk score: high label Oct 10, 2026
The reset truncated only the tables that had rows. That check does not
see rows of a transaction that is still open, so a test that leaves one
open could pass its rows to the next test. A TRUNCATE of every table
waits for that transaction and has no such gap.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dcramer dcramer changed the title perf(testing): Make the Postgres test harness cheaper per test and per file perf(testing): Keep CI Postgres in memory and share the test database reset Oct 10, 2026
The behavioral evals recorded these model responses in https://github.com/getsentry/junior/actions/runs/38065716902.
The evals of this commit replay them in strict mode.

Eval-Suite: behavioral

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 5c989784 Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant