Skip to content

test: cover deep WASM parses in CI - #19

Merged
devin-ai-integration[bot] merged 1 commit into
18-constructivefrom
devin/1795664405-wasm-depth-ci
Nov 26, 2026
Merged

devin-ai-integration[bot] merged 1 commit into
18-constructivefrom
devin/1795664405-wasm-depth-ci

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Add a push and pull-request CI job that builds libpg_query with Emscripten 6.0.3 and runs the generated test under Node. The test requires successful parsing of 2000 chained terms, 1000 nested subqueries, and 2000 nested function calls, and requires a clean stack depth limit error for 100000 chained terms.

Local evidence before opening this PR:


Devin Review

@luxor-code-review

luxor-code-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Review complete. 🟠 1 high

💬 Inline comments (1)

  • 🟠 Add -sEXIT_RUNTIME=1 so WASM test exit status propagates — ci.yml:97
🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Match stack depth error with strstr, not strcmp (wasm_depth.c:38) — The new WASM depth test asserts the stack-depth failure via an exact strcmp(error, "stack depth limit exceeded") == 0, while the library's own regression test (test/stack_depth.c:44) deliberately tolerates appended context with strstr (test/wasm_depth.c:38).

This change introduces a WebAssembly build-and-test workflow on top of the existing CI, plus a C harness that builds a 2000-level nested query and asserts the parser reports its stack-depth limit rather than crashing.

Files Change
.github/workflows/ci.yml Adds a CI job that clones emsdk, builds the library with emcc (32MB stack, 40MB initial memory, memory growth enabled), and runs the WASM test under Node.
test/wasm_depth.c New stress test generating a deeply nested query, invoking the libpg_query parse entry point, and asserting the expected stack-depth error.

Reviewed commit: e445ed3

@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dc8adf57-e0c5-490a-b90f-a491f3850927

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds a CI job compiling the parser to WebAssembly with emsdk and a new test/wasm_depth.c stress test that parses deeply nested queries to validate stack-depth handling.

Key findings

  • 🟠 Add -sEXIT_RUNTIME=1 so WASM test exit status propagates — ci.yml:97

Comment thread .github/workflows/ci.yml
Comment on lines +97 to +99
emcc -O3 -sENVIRONMENT=node -sSTACK_SIZE=33554432 -sINITIAL_MEMORY=41943040 \
-sALLOW_MEMORY_GROWTH=1 -I. test/wasm_depth.c libpg_query.a -o test/wasm_depth.js
node test/wasm_depth.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 bug · high

Add -sEXIT_RUNTIME=1 so WASM test exit status propagates

The emcc link command for the WASM depth test omits -sEXIT_RUNTIME=1 (.github/workflows/ci.yml:97). With Emscripten's default EXIT_RUNTIME=0, the runtime does not call exit() after main() returns, so the EXIT_FAILURE returned by test/wasm_depth.c is discarded and the Node process exits with code 0. The new CI job therefore always reports success, even when every depth case fails — the check can never catch a regression.

📋 Prompt for AI Agents

In .github/workflows/ci.yml in the build_wasm job's emcc command (lines 97-99), add -sEXIT_RUNTIME=1 to the flag list. Without it, Emscripten's default EXIT_RUNTIME=0 discards the return value of main() and the Node process exits 0 even when test/wasm_depth.c returns EXIT_FAILURE, so the CI check can never fail.

@devin-ai-integration
devin-ai-integration Bot merged commit b333709 into 18-constructive Nov 26, 2026
36 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