Repository navigation
ci: check WASM parse output against native libpg_query on its test SQL - #187
Open
pyramation wants to merge 2 commits into
Open
pyramation wants to merge 2 commits into
pyramation wants to merge 2 commits into
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This PR introduces a CI parity harness that builds libpg_query natively, drives it with a small C program over the JSON API, and compares its results statement-by-statement against the WASM bindings to catch divergence between the two builds.
Reviewed commit: 4761bd1 |
|
Folded into #190 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
Native parity 🔍step to the existingbuild-wasmmatrix job. No new job. Right afterpnpm run build,scripts/native-parity.js versions/<n>does the following:.cache/*/libpg_query/<x-publish.libpgQueryCommit>) to a temp dir withgit archive, then runs a nativemake build. No network is needed.scripts/native-parity/driver.c, which wrapspg_query_split_with_scannerandpg_query_parse.test/sql/postgres_regress,plpgsql_regress,deparse*,test/plpgsql_samples.sql) into statements.wasm/index.cjsparseSyncgives byte-identical JSON or the same error (message + cursor) for every statement. It exits 1 and prints the first 10 differences otherwise.Native and WASM have one known difference, which the script maps instead of reporting.
FETCH_ALLisLONG_MAX, sohowMany/how_manyis 2^63−1 natively and 2147483647 on wasm32.On glibc ≥ 2.38 (the ubuntu-24.04 runners), PG ≤ 14's vendored
snprintf.cwon't compile natively (conflicting types for 'strchrnul'). The native build therefore getsCPPFLAGS=-DHAVE_STRCHRNUL=on Linux. This only affects the parity build, not the WASM.This catches WASM build regressions (emsdk bump, wrapper or Makefile changes, fork bumps) against the C library itself, using the full PostgreSQL regression suite as input.
Evidence: this PR's CI run
Negative check (local): changing the FETCH_ALL mapping makes it report
58 differences(combocid.sql#26,hash_index.sql#54, …) and exit 1.Parse only for now. On main, v18
fingerprint/normalize/scanstill return some errors as results (fixed in #183), so they would differ from native until that lands.Link to Devin session: https://app.devin.ai/sessions/91c28df261ac4b318f39d1c7242d008c
Open in Devin Desktop: https://app.devin.ai/desktop/session/91c28df261ac4b318f39d1c7242d008c?variant=devin
Requested by: @pyramation