Skip to content

ci: fuzz the parser, the query modes and pg-native on a random seed - #3782

Open
nigrosimone wants to merge 7 commits into
brianc:masterfrom
nigrosimone:fuzz
Open

nigrosimone wants to merge 7 commits into
brianc:masterfrom
nigrosimone:fuzz

Conversation

@nigrosimone

@nigrosimone nigrosimone commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Three differential fuzzers in fuzz/, and a CI job that runs a few hundred rounds of each on a seed nobody chose, on every push and pull request. A divergence turns the job red and prints the seed that reproduces it, with the case shrunk to the lines worth pasting into a test.

  • wire.js: random backend messages written from the protocol description, parsed in one buffer and cut at random points, against what was written
  • modes.js: client.query against the extended protocol forced, a named statement run twice, rowMode array, the binary result format, pipeline mode, pg-cursor and pg-query-stream
  • native.js: pg against pg-native, as a plain query, a named statement and rowMode array

They run from the command line too:

yarn fuzz:wire                              # the parser alone, no server needed
yarn fuzz:modes                             # needs a server, PG* variables say where
yarn fuzz:native                            # and pg-native built
node fuzz/modes.js --rounds 500             # longer, the default is 100
node fuzz/modes.js --seed 12345 --rounds 1  # replay what the CI printed
node fuzz/modes.js --keep-going             # do not stop at the first divergence

The first runs found #3776, #3777, #3778, #3780 and #3781, each fixed in its own PR with a test that fails on master. This branch carries those five commits so its CI is green; I will rebase it once they are merged. What it cannot fix is #980, a Buffer parameter reaching libpq as a C string, so the native arm draws none.

@nigrosimone
nigrosimone marked this pull request as ready for review September 13, 2026 11:09
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