Skip to content

pg-parity-harness: shared PostgreSQL parity harness (D-QSP-H) - #2022

Merged
AdaWorldAPI merged 4 commits into
mainfrom
ccr-ca0562e7-hudvlz-pg-harness
Nov 11, 2026
Merged

AdaWorldAPI merged 4 commits into
mainfrom
ccr-ca0562e7-hudvlz-pg-harness

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

D-QSP-H from d-qsp-parity-roadmap-v1.md §3 is one harness that every parity slice reuses. Before this, each *_pg_parity.rs example ran psql its own way.

What it does

crates/pg-parity-harness is a new workspace member with no dependencies; other crates use it as a dev-dependency.

Pg

  • Runs psql against a real server inside a scratch schema, which Drop removes.
  • Keeps NULL distinct from the empty string.
  • Reads result column types with \gdesc and reads SQLSTATE with VERBOSITY=sqlstate.
  • connect returns Skip when no server answers.

compare checks, in order:

  1. column types;
  2. the rows, either as a multiset (duplicates kept) or as an ordered sequence that allows reordering only inside ties of the ORDER BY keys;
  3. the SQLSTATE, when an error is expected.

An unsupported feature is a typed Refusal, never a silent skip.

Report / check_mutation record each case. A mutation that leaves PostgreSQL's answer unchanged is reported as VacuousMutation.

Migration. lance-graph-r2il/examples/null_aggs_pg_parity.rs now runs on the harness. It prints SKIP without a server and panics on any failure after connecting.

CI. A new line in rust-test.yml runs the harness's unit tests. The live test prints SKIP there, because CI has no PostgreSQL.

Evidence (local PostgreSQL 16.15)

  • 12 unit tests pass. clippy -D warnings and fmt are clean.
  • tests/pg_live.rs live_server_roundtrip passes against the live server. The run prints 9 cases, 5 pass, 3 fail, 1 unsupported; the fails and the refusal are the test's own negative cases, which it asserts on.
  • The migrated r2il example ran 300 queries; bool_or, bool_and and count(DISTINCT) equal PostgreSQL on value and NULL state for all of them. With validity disabled it differs on 224.

Disable runs. For each, the anchor was asserted to occur exactly once and the file was restored afterwards.

  • Red: duplicate counting, both tie closures, NULL to empty string, the unterminated-record check, the SQLSTATE run length, both mutation guards, and the unsupported count.
  • Red against the live server: NULL to empty string, dropping VERBOSITY=sqlstate, and an empty Drop.
  • Stayed green: removing the trailing-; strip in Pg::query. On psql 16 a query ending in ; followed by \gdesc still describes the right columns, so that trim is defensive and not load-bearing. It is kept, and no test claims it.

Not verified

  • Only the r2il example was migrated. The other per-slice examples (quack, contract) still run their own psql and move over one by one.
  • The ordered comparison checks ties only through the declared key columns; NULL placement is whatever PostgreSQL returned.

Generated by Claude Code

Drives psql against a real server in a scratch schema, keeps NULL distinct
from the empty string, reads result column types and SQLSTATE, and compares
an implementation's answer as a multiset, as an ordered sequence that only
allows reorders inside ties, by types, and by error code. Unsupported
features are typed refusals; a mutation that does not change PostgreSQL's
answer is reported as vacuous. Prints SKIP without a server. The r2il
null-aggregate parity example now runs on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMPJjVvasjwqhjJ6c9p
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMPJjVvasjwqhjJ6c9p
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a609b52-fe3c-414b-a56a-111009fb4e0b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review November 11, 2026 19:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T19:59:17.035927Z 9d97943 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d97943629

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/pg-parity-harness/src/report.rs Resolved
…unchanged under the query's ordering

A reorder the query leaves unspecified no longer counts as a changed
answer; the vacuous-mutation check uses the same comparison as parity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMPJjVvasjwqhjJ6c9p
…g-harness

# Conflicts:
#	.github/workflows/rust-test.yml
@AdaWorldAPI
AdaWorldAPI merged commit ea68f4a into main Nov 11, 2026
1 check 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.

2 participants