Skip to content

test(v18): commit the parsePlPgSQL output for every PL/pgSQL fixture - #222

Merged
devin-ai-integration[bot] merged 1 commit into
mainfrom
feat/plpgsql-output-snapshots
Nov 26, 2026
Merged

devin-ai-integration[bot] merged 1 commit into
mainfrom
feat/plpgsql-output-snapshots

Conversation

@pyramation

@pyramation pyramation commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

#221 committed the outputs of parse, fingerprint, normalize and scan; this does the same for parsePlPgSQL, the remaining exported function.

  • versions/18/test/snapshots/plpgsql-corpus.json: the 261 PL/pgSQL fixtures, copied from pgsql-parser's __fixtures__/plpgsql-generated/generated.json (at pgsql-parser@1069446).
  • versions/18/test/snapshots/plpgsql-pg18.json: the full parsePlPgSQLSync result for each, one line per fixture (255 kB, so no hashing; an output change is readable in the diff).
  • versions/18/test/snapshots.test.js: the comparison is now one check(corpus, snapshot, functions) used for both corpora. pg18.json is unchanged.

The test fails on builds whose outputs differ

Same file pointed at published packages (Node 22):

Release PL/pgSQL fixtures
18.1.5 fail, 45 outputs changed
18.2.4 fail, 45 outputs changed
18.2.6, 18.2.7 pass
this build (Node 20, 22, 24) pass

The 45 are an output change that came in after 18.2.4 without a note. Example, declare x record := row(1,2,3) (plpgsql_varprops-5.sql): the PLpgSQL_rec datum now carries "default_val":{"PLpgSQL_expr":{"query":"row(1,2,3)","parseMode":2}}, which 18.2.4 left out. It looks like an improvement; the point is that a change like this now fails a test and shows in the diff.


libpg-query and parser opened this PR for Dan
Implemented in session Find why regressions slip past our release process
Review with Devin · Open in Devin Desktop


Summary by CodeRabbit

  • Tests
    • Expanded PostgreSQL 18 snapshot coverage for PL/pgSQL, including transaction control, exception handling, procedure calls, arrays, and control-flow constructs.
    • SQL and PL/pgSQL snapshots are now checked separately, with clearer mismatch output.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@luxor-code-review

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

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


The change extends the versions/18 snapshot harness to cover parsePlPgSQLSync alongside the existing SQL outputs and commits the corresponding snapshot fixtures. The refactor is faithful and the fixtures are self-consistent, so no blocking issues were found.

Files Change
versions/18/test/snapshots.test.js Refactors the snapshot test into a generic check() helper that runs each registered parse/scan function per corpus entry and aggregates diffs.
versions/18/test/snapshots/plpgsql-corpus.json, versions/18/test/snapshots/plpgsql-pg18.json Adds a 261-entry PL/pgSQL corpus and its committed pg18 parse-output snapshots, including error-expected and new pg18 feature fixtures.

Reviewed commit: 911dc6a

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PostgreSQL 18 snapshot tests now run separate SQL and PL/pgSQL corpora. New PL/pgSQL fixtures and committed parse-tree outputs cover variables, control flow, transactions, procedure calls, and other constructs.

Changes: PL/pgSQL snapshot coverage

Layer / File(s) Summary
PL/pgSQL fixtures and expected outputs
versions/18/test/snapshots/plpgsql-corpus.json, versions/18/test/snapshots/plpgsql-pg18.json
The fixture corpus and expected outputs cover variable properties, triggers, exceptions, transactions, schema-qualified references, domains, deparsing, control flow, procedure calls, caching, and arrays.
Shared snapshot runner
versions/18/test/snapshots.test.js
The test harness checks separate SQL and PL/pgSQL corpora against their snapshots. It can write snapshots when UPDATE_SNAPSHOTS is set and truncates output values in mismatch details.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Possibly related issues

  • PG 18 issues — upstream issue #157: The new snapshots exercise the same PL/pgSQL JSON interface and record output differences, but the available details do not show whether the reported cases are fixed.

Possibly related PRs

Suggested reviewers: luxor-code-review

Merge Risk: Minimal · up to 911dc

This PR extends the committed PostgreSQL 18 snapshot tests to cover PL/pgSQL parse output. It changes only test code and test data, so it has no production impact. No concrete merge-blocking risk was found.

Security architecture risk: Minimal · up to 911dc

The PR adds regression coverage for existing PL/pgSQL parser output without changing production behavior or expanding access to the parser.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title says the PR commits parsePlPgSQL output for every PL/pgSQL fixture. The objectives confirm this is the main change: committed parsePlPgSQL output snapshots for all 261 fixtures, plus a refac…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title says the PR commits parsePlPgSQL output for every PL/pgSQL fixture. The objectives confirm this is the main change: committed parsePlPgSQL output snapshots for all 261 fixtures, plus a refactor of the snapshot test to a shared check function. The title is specific, short, and in conventional-commit style. The title does not mention the test refactor, which is a secondary detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 860db1c and 911dc6a.

Files selected for processing: 3

  • versions/18/test/snapshots.test.js
  • versions/18/test/snapshots/plpgsql-corpus.json
  • versions/18/test/snapshots/plpgsql-pg18.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

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

Copy link
Copy Markdown
Contributor

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

@devin-ai-integration
devin-ai-integration Bot merged commit c91bcfb into main Nov 26, 2026
64 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