Skip to content

perf(transform-ast): one kitchen-sink suite per version pair (~95s β†’ ~12s) - #337

Merged
pyramation merged 1 commit into
mainfrom
fix/transform-ast-test-consolidation
Aug 2, 2026
Merged

perf(transform-ast): one kitchen-sink suite per version pair (~95s β†’ ~12s)#337
pyramation merged 1 commit into
mainfrom
fix/transform-ast-test-consolidation

Conversation

@pyramation

Copy link
Copy Markdown
Collaborator

Summary

@pgsql/transform-ast was the slowest CI job at ~95s, and essentially none of that was transform work. make-kitchen-sink.ts emitted one test file per (fixture file Γ— version pair) β€” 278 Γ— 5 = 1390 suites, each holding a single it() over ~17 statements. Every one of those suites paid the same fixed cost at module scope:

const fixtures = new FixtureTestUtils(13, 14);  // 6 WASM parsers + JSON.parse of a 2.8 MB generated.json

plus its own ts-jest compile and Jest module registry. Measured in isolation a single suite takes ~1.0s, of which the assertions are noise.

The generator now writes a shared manifest and five thin suites:

__tests__/kitchen-sink/
  fixtures.json      # { "misc-indexes": ["misc/indexes-1.sql", ...] }  β€” one copy, all pairs
  13-14.test.ts … 17-18.test.ts
const manifest = JSON.parse(readFileSync(join(__dirname, 'fixtures.json'), 'utf-8'));
const fixtures = new FixtureTestUtils(13, 14);
describe('13-14', () => {
  it.each(Object.entries(manifest))('%s', async (_name, tests) => fixtures.runFixtureTests(tests));
});

Same corpus, same assertions, same per-fixture test names in the report β€” 5 parser-set inits instead of 1390. npx jest in the package: 95s β†’ 12s, 1443 passed.

Two related bits:

  • The old shape silently tolerated dead suites: runFixtureTests([]) logs no filters provided, skipping tests and returns green. The generator now skips zero-statement fixtures outright, and the manifest covers all 23,491 statements (previously 23,477) β€” which surfaced misc/index-clause-ordering, added in fix(deparser): emit CREATE INDEX trailing clauses in grammar orderΒ #336 and never picked up by a transform-ast regeneration.
  • NULLS NOT DISTINCT is PG15+, so those statements can't be parsed by the v13/v14 parsers; added the corresponding parserErrors skip entries, matching the existing MERGE / pg18-* precedent.

Link to Devin session: https://app.devin.ai/sessions/6e8bd0b058a944eeba4a3dbad12d8487
Requested by: @pyramation

Generate a shared fixtures.json manifest and five it.each suites instead
of 1390 single-it files, each of which re-parsed generated.json and spun
up six WASM parsers. Job time drops from ~95s to ~12s.
@pyramation pyramation self-assigned this Aug 2, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

πŸ€– Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

βœ… I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

βš™οΈ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@pyramation
pyramation merged commit fe9a68d into main Aug 2, 2026
15 checks passed
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