Skip to content

feat(pgtap): replace skeleton with 3 proper pgTAP smoke tests - #421

Merged
flyingrobots merged 9 commits into
mainfrom
feat/pgtap-smoke-tests-416
Mar 11, 2026
Merged

flyingrobots merged 9 commits into
mainfrom
feat/pgtap-smoke-tests-416

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Summary

Closes #416

  • Replaced the non-standard ops.pgtap.sql DO-block wrapper with 3 proper pgTAP test files: parameterless view, parameterized function (ILIKE), and nested LATERAL join
  • CI now applies *.view.sql alongside *.fn.sql (views first)
  • Expanded seed data with deterministic UUIDs: user, order, 2 order items
  • Test runner loops all *.pgtap.sql files instead of a single hardcoded path
  • EXPLAIN snapshots generated for all 4 ops
  • Added all_products.graphql to test fixtures for self-contained coverage

Test plan

  • test-pgtap CI job goes green (all 16 assertions across 3 files)
  • Existing CI checks (unit tests, bats, lint) remain green
  • EXPLAIN snapshot artifacts uploaded for all 4 ops

Replace the non-standard `ops.pgtap.sql` DO-block wrapper with three
proper BEGIN/plan/finish pgTAP test files:

- ops-parameterless-view: tests all_products view + zero-arg function
- ops-parameterized-fn: tests products_by_name ILIKE filter
- ops-nested-lateral: tests orders_with_items_by_user LATERAL join

CI changes:
- Apply *.view.sql alongside *.fn.sql (views first)
- Expanded seed data with deterministic UUIDs (user, order, 2 items)
- Run all *.pgtap.sql files instead of single file
- EXPLAIN snapshots for all 4 ops
- Added all_products.graphql to test fixtures

Closes #416
@coderabbitai

coderabbitai Bot commented Mar 10, 2026 •

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added GraphQL query for retrieving all products.
  • Tests

    • Expanded test coverage with pgTAP smoke tests for database operations, including parameterized and parameterless queries.
  • Chores

    • Enhanced CI/CD pipeline for improved SQL file processing and test execution.
    • Added graphql dependency to CLI package.

Walkthrough

Apply ops SQL for views and functions transactionally, add deterministic DB seed, install and run pgTAP across multiple test files via docker-compose/CI, add three focused pgTAP suites and a GraphQL example, update workflow and CLI dependency, and adjust EXPLAIN snapshots to use explicit UUIDs.

Changes

Cohort / File(s) Summary
CI workflow
​.github/workflows/wesley-holmes.yml
Rename step; iterate and apply *.view.sql and *.fn.sql with missing-file/empty-file guards; run multi-file pgTAP loop and aggregate TAP results.
Docker & test runner
docker-compose.yml
Postgres init ordering clarified; pgtap service mounts /ops, applies OPS SQL (views then functions) transactionally, installs/loads pgTAP, and runs /tests/*.pgtap.sql loop with TAP parsing and aggregate failure exit.
Postgres schema & seed
test/fixtures/postgres/02-wes-ops-schema.sql, test/fixtures/postgres/03-seed.sql
Add wes_ops schema and deterministic, idempotent seed data (explicit UUIDs) for products, user, order, and order_items used by tests.
pgTAP test suites (added)
test/fixtures/examples/tests/ops-parameterless-view.pgtap.sql, test/fixtures/examples/tests/ops-parameterized-fn.pgtap.sql, test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql
Add focused pgTAP suites validating emitted views/functions: existence, signatures, filter behavior, JSONB key presence, and nested LATERAL structure.
pgTAP test suite (removed)
test/fixtures/examples/tests/ops.pgtap.sql
Remove prior consolidated/conditional pgTAP block (replaced by focused test files and new runner).
Examples & explain snapshots
test/fixtures/examples/ops/all_products.graphql, .../explain/*.json
Add GraphQL AllProducts example; update EXPLAIN JSON snapshots to use explicit UUIDs and include additional queries.
CLI dependency
packages/wesley-cli/package.json
Add graphql dependency to wesley-cli package.json.
Misc (workflow/docs/changelog)
CHANGELOG.md
Add changelog entries for pgTAP smoke tests and CLI dependency; remove outdated entry.

Sequence Diagram(s)

sequenceDiagram
  participant Actions as GitHub Actions
  participant Runner as CI Runner / Shell
  participant Docker as Docker Compose
  participant Postgres as Postgres DB
  participant pgtap as pgTAP Runner

  Actions->>Runner: start workflow
  Runner->>Docker: docker-compose up (postgres + pgtap)
  Runner->>Postgres: ensure init scripts (02-wes-ops-schema, 03-seed, 04-tests) applied
  pgtap->>Postgres: apply `*.view.sql` files (transactional)
  pgtap->>Postgres: apply `*.fn.sql` files (transactional)
  pgtap->>Runner: build & install pgTAP, load extension
  pgtap->>Postgres: execute `/tests/*.pgtap.sql` (loop)
  Postgres-->>pgtap: TAP output
  pgtap->>Runner: parse TAP, aggregate failures
  Runner->>Actions: exit non-zero if any test failures
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

  • #416: test(qir): pgTAP smoke tests for emitted ops — This PR implements the requested pgTAP smoke tests, fixtures, and runner matching the issue objectives.
  • tests(qir): pgTAP smoke tests for ops emission wesley-postgres#53 — Adds pgTAP smoke tests and supporting docker/fixtures; the changes here appear to fulfill that work.

Possibly related PRs

Poem

Views then functions, ordered tight and clean,
UUIDs anchored, seed rows set to preen.
pgTAP sings in loops, each file checked and scored,
Docker spins the stage, CI keeps the sword. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely summarizes the primary change: replacing a skeleton pgTAP setup with three proper pgTAP smoke tests.
Description check ✅ Passed The description is well-structured with Summary, Test plan sections, and references linked issue. However, it lacks explicit Coverage (Why/Rationale), Risk, Backout, and Testing command sections from the template.
Linked Issues check ✅ Passed All three acceptance criteria from #416 are met: 3 pgTAP test files (parameterless view, parameterized function, nested LATERAL), Docker integration, and CI workflow step added. Shape, filter, and RLS objectives are addressed through comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes align with #416 scope: pgTAP test infrastructure, seed data, Docker/CI integration, GraphQL fixture, and CHANGELOG updates. No unrelated code modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pgtap-smoke-tests-416

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Mar 10, 2026 •

Copy link
Copy Markdown

🚢 SHIPME

[REALM] PASS — sha 32e030a

@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: 2d130cf467

ℹ️ 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 test/fixtures/examples/ops/all_products.graphql
- Fix op name: `op_allproducts` not `op_all_products` (sanitizeIdentBase
  strips underscores from GraphQL operation name "AllProducts")
- Fix products_by_name test: assert no price_cents key (not in projection)
- Fix CI EXPLAIN snapshot to use `op_allproducts` name
- Add shared seed SQL file (test/fixtures/postgres/03-seed.sql)
- Add wes_ops schema init (test/fixtures/postgres/02-wes-ops-schema.sql)
- Update docker-compose.yml: pgtap service now applies ops SQL (views
  then functions), installs pgTAP via pgtap-static.sql, and runs all
  *.pgtap.sql files with pass/fail summary

Verified: all 16 assertions pass locally via Docker compose.

@coderabbitai coderabbitai 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.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/wesley-holmes.yml:
- Around line 500-509: The workflow currently runs pgTAP files with
PGPASSWORD=postgres psql ... -f "$f" which does not fail the job on TAP
assertion failures; replace that step to invoke pg_prove (or run a TAP parser)
against the same files so TAP failures return non-zero and fail CI.
Specifically, install/run pg_prove and call it with the same connection options
(e.g., --dbname/test, --host/--username) against
test/fixtures/examples/tests/*.pgtap.sql (or call pg_prove per file in the
existing loop) and ensure its exit code is used to fail the job; alternatively
capture psql output and parse TAP output for failed tests and exit non-zero when
any test fails. Ensure you modify the code referencing the files array and the
loop that currently executes PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h
localhost -U postgres -d test -f "$f".

In `@CHANGELOG.md`:
- Line 19: There is a duplicate "### Added" heading under the [Unreleased]
section causing markdownlint MD024; locate the second "### Added" header in
CHANGELOG.md and merge its entries into the existing "### Added" subsection
under [Unreleased], then remove the duplicated "### Added" header so only one
"### Added" section remains with all added items combined.

In `@test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql`:
- Around line 16-23: The test only asserts count for
'00000000-0000-0000-0000-000000000001' so it won’t catch a function that ignores
its user_id; add a second SELECT is(...) that calls op_orders_with_items_by_user
with a different UUID (e.g. '00000000-0000-0000-0000-000000000002') and expects
0::bigint, update the test description accordingly, and increment the pgtap plan
count to account for the additional assertion so the plan remains correct.
- Around line 38-46: The test only checks jsonb_array_length on row_data ->
'items' so malformed item objects can pass; update the test to assert each item
has the required keys by iterating jsonb_array_elements(row_data -> 'items') and
using bool_and to ensure every element contains 'id','product_id','quantity'
(e.g. use the ?& operator or explicit existence checks) against the result of
wes_ops.op_orders_with_items_by_user (the same row_data used now); keep the
length check but add a second assertion that jsonb_array_elements(... ) returns
elements where (elem ?& array['id','product_id','quantity']) is true for all
items.

In `@test/fixtures/examples/tests/ops-parameterized-fn.pgtap.sql`:
- Around line 16-28: Add a new test that proves the published=true filter by
querying op_products_by_name with a pattern that would match the seeded
unpublished "Beta" row (e.g., 'Be%') and assert the count is 0, then increment
the TAP plan count to reflect the added test; locate and update the existing
test block that calls op_products_by_name (the SELECT is(... FROM
wes_ops.op_products_by_name(...)) and the test plan declaration to add this
assertion.

In `@test/fixtures/examples/tests/ops-parameterless-view.pgtap.sql`:
- Around line 19-35: Add an assertion that the zero-arg function returns the
same rowset count as the view: compare (SELECT count(*)::bigint FROM
wes_ops.op_all_products) with (SELECT count(*)::bigint FROM
wes_ops.op_all_products()) and update the TAP plan count accordingly; locate the
existing checks around op_all_products and op_all_products() in the test and
insert this parity/is-count assertion so the function cannot silently drop rows
while preserving keys.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3e533340-0c09-45d6-bb07-991bf5bfba37

📥 Commits

Reviewing files that changed from the base of the PR and between 29bc7c8 and 2d130cf.

📒 Files selected for processing (7)
  • .github/workflows/wesley-holmes.yml
  • CHANGELOG.md
  • test/fixtures/examples/ops/all_products.graphql
  • test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql
  • test/fixtures/examples/tests/ops-parameterized-fn.pgtap.sql
  • test/fixtures/examples/tests/ops-parameterless-view.pgtap.sql
  • test/fixtures/examples/tests/ops.pgtap.sql
💤 Files with no reviewable changes (1)
  • test/fixtures/examples/tests/ops.pgtap.sql

Comment thread .github/workflows/wesley-holmes.yml
Comment thread CHANGELOG.md Outdated
Comment thread test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql
Comment thread test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql Outdated
Comment thread test/fixtures/examples/tests/ops-parameterized-fn.pgtap.sql
Comment thread test/fixtures/examples/tests/ops-parameterless-view.pgtap.sql Outdated
The dynamic `import('graphql')` in generate.mjs for .graphql ops
compilation fails under pnpm strict module resolution. The package
was only available transitively via @wesley/core, which pnpm disallows.

This fixes the CI failure where all_products.graphql could not compile
because graphql was not resolvable from wesley-cli's module scope.
@github-actions

github-actions Bot commented Mar 10, 2026 •

Copy link
Copy Markdown

🔍 The Case of Pull Request #421

🕵️ SHA-lock HOLMES's Investigation (click to expand)

🕵️ SHA-lock HOLMES Investigation

  • Generated: 2026-03-11T01:23:14.774Z
  • Commit SHA: 32e030a
  • Bundle Version: 2.0.0

⚠️ Evidence valid only for commit 32e030a

🔍 Executive Deduction

"Watson, after careful examination of the evidence, I deduce..."

Weighted Completion: ██████░░░░ 60.0%
Scores: SCS 60.0% · TCI 70.0% · MRI 20.0%
Verification Status: 2 claims verified
Ship Verdict: REQUIRES INVESTIGATION

🧩 SCS Breakdown

Component Score Coverage
Sql 60.0% 0.60/1.00
Types 60.0% 0.60/1.00
Validation 60.0% 0.60/1.00
Tests 70.0% 0.70/1.00

🧪 TCI Breakdown

Component Score Coverage Note
Unit Constraints 70.0% 1/1 N/A
Unit Rls 0.0% — N/A
Integration Relations 0.0% — N/A
E2e Ops 0.0% — Not tracked in quick emit mode

⚠️ MRI Breakdown

Component Risk Share Points Count
Drops 100.0% 20 0
Renames Without Uid 0.0% 0 0
Add Not Null Without Default 0.0% 0 0
Non Concurrent Indexes 0.0% 0 0

📊 The Weight of Evidence

"Observe, Watson, how not all features carry equal importance..."

Element Weight Status Evidence Deduction
schema 5 ✅ SQL & tests out/schema.sql:1-9999@32e030a Elementary!

🚪 Security & Performance Gates

"Elementary security measures, Watson..."

Gate Status Evidence Holmes's Ruling
Migration Risk ✅ MRI: 20.0% "Acceptable risk"
Test Coverage ⚠️ TCI: 70.0% "Insufficient coverage"
Sensitive Fields ✅ 0 fields "All secured"

📋 The Verdict

⚠️ REQUIRES FURTHER INVESTIGATION
"Some clues remain unclear. Address the noted issues."

Signed and sealed,

  • S. Holmes, Consulting Detective

[END OF INVESTIGATION FOR COMMIT 32e030a]


🩺 Dr. WATSON's Verification (click to expand)

🩺 Dr. Watson's Independent Verification Report

Medical Examination of Evidence

  • Examination Date: 2026-03-11T01:23:49.613Z
  • Patient SHA: 32e030a

🔬 Citation Verification

"Let me examine each piece of evidence independently..."

  • Citations Examined: 2
  • Verified: 0 ✅
  • Failed: 0 ❌
  • Unable to Verify: 2

Verification Rate: 0.0%

📊 Mathematical Verification

"I shall recalculate Holmes's arithmetic..."

Holmes claimed SCS: 60.0%
Watson calculates: 100.0%
Difference: ⚠️ Significant

🔍 Consistency Analysis

"Checking for contradictions in Holmes's deductions..."

✅ No logical inconsistencies detected

🩺 Dr. Watson's Medical Opinion

VERIFICATION: CONCERNS NOTED ⚠️

"While Holmes's methods are generally sound, I have noted some"
"discrepancies that warrant further investigation."

Respectfully submitted,

  • Dr. J. Watson, M.D.
    Medical Examiner & Verification Specialist

🔮 Professor MORIARTY's Predictions (click to expand)

🧠 Professor Moriarty's Temporal Predictions

The Mathematics of Inevitability

  • Analysis Date: 2026-03-11T01:24:13.436Z

🔮 Current State

SCS: ██████░░░░ 60.0%
TCI: ███████░░░ 70.0%
MRI: 20.0% risk

📈 Velocity Analysis

SCS Velocity: +0.00%/day
Git Activity (window): 24h · commits 19 (7 relevant) · ~19.00 commits/day
↳ Magnitude: ~339 relevant LOC/day across ~9.0 files/day
Activity Index: 38 / 100 (PR 0, Window 95)
Blended Velocity: +0.23%/day
Commit Size Burstiness: 63 / 100 (higher = more uneven commit sizes)
ℹ️ Low SCS movement, but recent Git activity suggests ongoing work. Plateau not flagged.

⏰ Completion Predictions

ETA: Cannot predict (insufficient velocity)

"At current velocity, completion is... improbable."

🧪 Readiness EXPLAIN

  • SCS ≥ 80% → FAIL ❌ (actual 60.0%)
  • TCI ≥ 70% → PASS ✅ (actual 70.0%)
  • MRI ≤ 40% → PASS ✅ (actual 20.0%)
  • CI Stability ≥ 90% (branch main) → PASS ✅ (actual 95% over ~168h)
  • Delivery context (last 168h): 1 issues closed · 22 PRs merged (informational, not gating)

Signals blend: SCS velocity (70%) + Git activity (30%, branch-first). Activity only suppresses false plateaus; it never inflates readiness.

📊 Historical Trajectory

03-11: ██████░░░░ 60.0%
03-11: ██████░░░░ 60.0%
03-11: ██████░░░░ 60.0%

"Every problem becomes elementary when reduced to mathematics"
— Professor Moriarty


Machine-readable reports: holmes-report.json · watson-report.json · moriarty-report.json (see workflow artifacts).


Filed at 221B Repository Street

- Re-add tests.sql mount as 04-tests.sql in docker-compose (was dropped
  during wes_ops/seed mount additions)
- Remove duplicate ### Added heading in CHANGELOG.md
- Remove unused docker.sock mount from pgtap service
- Add cross-reference comments between 03-seed.sql and CI workflow to
  prevent seed data drift

Closes #416
psql -f exits zero even when pgTAP assertions fail — it only raises
non-zero on SQL errors. Both the CI workflow and docker-compose pgtap
runner now capture output and grep for "not ok" TAP lines, exiting
non-zero when any assertion fails.
- ops-parameterized-fn: add 'Be%' test proving published=true filter
  excludes unpublished Beta product
- ops-nested-lateral: add negative UUID case (0 rows for non-existent
  user) and item key shape assertion (id, product_id, quantity)
- ops-parameterless-view: add view/function row count parity assertion
@flyingrobots

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 10, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot added enhancement New feature or request feature New feature or request labels Mar 10, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/wesley-holmes.yml (1)

726-734: ⚠️ Potential issue | 🔴 Critical

Delete the orphaned "Ensure history for MORIARTY" step — the comment-report job has no repository checkout.

The comment-report job contains only artifact downloads and GitHub Actions; there is no actions/checkout step. The git commands at lines 726-734 will execute without a .git directory, causing immediate failure. This is a copy-paste artifact from the moriarty-predict job (lines 182-189) where checkout does exist.

🗑️ Remove the orphaned step
-      - name: "🔄 Ensure history for MORIARTY"
-        shell: bash
-        run: |
-          set -euo pipefail
-          # In case fetch-depth wasn't honored or repo is shallow, try to unshallow
-          if git rev-parse --is-shallow-repository >/dev/null 2>&1; then
-            git fetch --prune --unshallow --tags || true
-          fi
-          git fetch --prune origin '+refs/heads/*:refs/remotes/origin/*' || true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/wesley-holmes.yml around lines 726 - 734, Remove the
orphaned CI step named "🔄 Ensure history for MORIARTY" from the comment-report
job: delete the entire step that runs the git commands (the bash block with set
-euo pipefail and the git fetch/unshallow/fetch refs commands) since
comment-report has no actions/checkout and this will fail; simply remove that
step from the job to match its artifact-only workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docker-compose.yml`:
- Around line 53-64: The container currently builds and installs pgTAP from
source on every run (the wget/tar/make/DESTDIR install sequence and psql -f
sql/pgtap-static.sql), which slows local iteration; fix this by pre-baking pgTAP
into a custom image (create a Dockerfile that runs apk add build-base perl,
downloads pgtap v1.3.0, make && make install, and copies the extension so the
server has it) or switch docker-compose to use an existing Postgres image with
pgTAP pre-installed (e.g., docker.io/supabase/postgres) and remove the runtime
build steps (the wget/tar/make/DESTDIR and psql -f sql/pgtap-static.sql
commands) from the compose service.

In `@test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql`:
- Around line 47-56: The test currently inspects only the first row because of
LIMIT 1; update the assertion to validate the items array across all returned
orders from the function wes_ops.op_orders_with_items_by_user so it doesn't
silently ignore additional orders. Replace the LIMIT 1 pattern in the SELECT
that calls jsonb_array_length(row_data -> 'items') with an aggregate-style check
over all rows (for example using bool_and(jsonb_array_length(row_data ->
'items') = 2) or ensuring jsonb_array_length(...) > 0 for every row) so the test
asserts the expected shape for every order returned by
wes_ops.op_orders_with_items_by_user.

---

Outside diff comments:
In @.github/workflows/wesley-holmes.yml:
- Around line 726-734: Remove the orphaned CI step named "🔄 Ensure history for
MORIARTY" from the comment-report job: delete the entire step that runs the git
commands (the bash block with set -euo pipefail and the git
fetch/unshallow/fetch refs commands) since comment-report has no
actions/checkout and this will fail; simply remove that step from the job to
match its artifact-only workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7622368d-63b8-4a82-9670-7b12bfbe283d

📥 Commits

Reviewing files that changed from the base of the PR and between 2d130cf and 603a2b0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .github/workflows/wesley-holmes.yml
  • CHANGELOG.md
  • docker-compose.yml
  • packages/wesley-cli/package.json
  • test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql
  • test/fixtures/examples/tests/ops-parameterized-fn.pgtap.sql
  • test/fixtures/examples/tests/ops-parameterless-view.pgtap.sql
  • test/fixtures/postgres/02-wes-ops-schema.sql
  • test/fixtures/postgres/03-seed.sql

Comment thread docker-compose.yml
Comment thread test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql Outdated
Replace the 40-line inline SQL heredoc in the CI workflow with a single
psql -1 -f pointing at test/fixtures/postgres/03-seed.sql. Single source
of truth for seed data used by both docker-compose and CI.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/fixtures/postgres/03-seed.sql`:
- Around line 7-11: The INSERTs use ON CONFLICT DO NOTHING without an explicit
conflict target which is ambiguous; update each INSERT into product, "user",
"order", and orderitem to specify the exact conflict target (either the
unique/index column(s) such as the primary key column like id or the specific
constraint name via ON CONSTRAINT constraint_name) so the intent is explicit and
future-proof; locate the INSERT INTO product (...) VALUES (...) ON CONFLICT DO
NOTHING and change to ON CONFLICT (id) DO NOTHING or ON CONFLICT ON CONSTRAINT
<constraint_name> DO NOTHING, and apply the same explicit conflict target
approach for the INSERTs into "user", "order", and orderitem.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 809728a2-3d65-45a0-8d73-2f26f432591c

📥 Commits

Reviewing files that changed from the base of the PR and between 603a2b0 and 6ed2a49.

📒 Files selected for processing (3)
  • .github/workflows/wesley-holmes.yml
  • CHANGELOG.md
  • test/fixtures/postgres/03-seed.sql

Comment thread test/fixtures/postgres/03-seed.sql Outdated
- ops-nested-lateral: replace LIMIT 1 with bool_and aggregate so items
  count assertion covers all returned orders, not just the first
- 03-seed.sql: specify explicit conflict target (id) on all INSERT
  ON CONFLICT clauses for unambiguous intent
@flyingrobots

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 10, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/fixtures/postgres/03-seed.sql`:
- Around line 21-27: The seeded order row in the INSERT INTO "order" statement
has total_cents set to 300 but its corresponding orderitem rows sum to 400
(2×100 + 1×200); update the total_cents value in the "order" INSERT for the
order with id '00000000-0000-0000-0000-000000000201' to 400 so the fixture is
internally consistent with the orderitem totals.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fcd5c6ad-b037-480c-a5f0-13fb71ae2919

📥 Commits

Reviewing files that changed from the base of the PR and between 6ed2a49 and 681d3ae.

📒 Files selected for processing (2)
  • test/fixtures/examples/tests/ops-nested-lateral.pgtap.sql
  • test/fixtures/postgres/03-seed.sql

Comment thread test/fixtures/postgres/03-seed.sql
@flyingrobots
flyingrobots merged commit 82716e3 into main Mar 11, 2026
26 checks passed
@flyingrobots
flyingrobots deleted the feat/pgtap-smoke-tests-416 branch March 11, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(qir): pgTAP smoke tests for emitted ops

1 participant