Skip to content

test(api): Lucid 22.5, tests without a global transaction, ready for pg 9 - #123

Merged
dollyzn merged 1 commit into
mainfrom
chore/lucid-22.5
Nov 25, 2026
Merged

dollyzn merged 1 commit into
mainfrom
chore/lucid-22.5

Conversation

@dollyzn

@dollyzn dollyzn commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Why

Lucid ran a query's preloads in parallel. Inside a transaction, pg queued them on the one connection and warned that pg 9 will refuse it, so Dependabot held pg's major back. Lucid 22.5 fixed that (adonisjs/lucid#1200), but the warning stayed in the API tests. Each test ran inside a global transaction, so the queries the app runs at the same time (Promise.all in the order detail, the assistant's tool calls of one step) also queued on one connection. Production was never affected: there each query takes its own pool connection. Under pg 9 those tests would fail.

What

  • Lucid 22.5.0: preloads inside a transaction run one after the other. The roadmap item and the Dependabot hold on pg's major are removed.
  • API tests: no global transaction. emptyDatabase (tests/helpers/database.ts) deletes the rows a test wrote, after it: one query finds the tables with rows, one round trip deletes them, children first. Every group uses it. Lucid's testUtils.db().truncate() made the suite 46 s instead of 29 s.
  • Test database: runs with synchronous_commit off (only when NODE_ENV=test, in config/database.ts). Now that every write commits, this keeps the suite at its old time.
  • Docs: the tests section of apps/api/AGENTS.md describes the cleanup and why there's no global transaction.

Tests

  • The assistant tests read tool outputs by tool name. The tools of one step really run together now and finish in any order, and "store, day and order tools" failed reading them by position.
  • pnpm check passes twice in a row: 323 API tests in 29 s, no pg deprecation warning (also checked with --trace-deprecation).

Deploy notes

No migrations or new environment variables.

…pg 9

Lucid 22.5 runs a query's preloads one after the other inside a
transaction (adonisjs/lucid#1200), so the roadmap item and the Dependabot
hold on pg's major go.

The pg warning stayed: the tests wrapped each one in a global transaction,
so the queries the app runs at the same time (Promise.all, the assistant's
tool calls) queued on its one connection, which pg 9 refuses. In
production each of them takes its own pool connection.

- tests/helpers/database.ts `emptyDatabase` deletes the rows a test wrote,
  after it, children first, in one round trip (TRUNCATE made the suite half
  again as slow); every group uses it.
- The test database runs with synchronous_commit off, so committing every
  write keeps the suite at its old time (29 s).
- The assistant tests read tool outputs by tool name: tools of one step
  finish in any order.
@dollyzn
dollyzn merged commit 36825f4 into main Nov 25, 2026
4 checks passed
@dollyzn
dollyzn deleted the chore/lucid-22.5 branch November 25, 2026 04:40
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