Skip to content

Schema-invariant pgTAP assertion descriptions in test/core/functions.sql - #46

Open
jnasbyupgrade wants to merge 1 commit into
phase1-test-installfrom
phase2a-schema-invariant-descriptions
Open

Schema-invariant pgTAP assertion descriptions in test/core/functions.sql#46
jnasbyupgrade wants to merge 1 commit into
phase1-test-installfrom
phase2a-schema-invariant-descriptions

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Contributor

pgTAP's auto-generated test descriptions schema-qualify via ncs() (e.g. "Function public.null_count(...) should return int"), which pins the committed expected-output file to whichever schema count_nulls happens to land in. Pass an explicit, schema-free description to every call instead - function_returns/isnt_strict/volatility_is/lives_ok/bag_eq/throws_ok all still resolve and execute against the real, %I-qualified, ncs()-derived name; only the visible description text drops the schema. This is a self-contained cleanup with no dependency on TEST_SCHEMA existing - it's what lets a later schema-switching mechanism reuse a single expected-output file across every schema the suite runs against, instead of needing one per schema value.

Regenerated test/expected/extension_tests.out via make results.

pgTAP's auto-generated test descriptions schema-qualify via ncs() (e.g.
"Function public.null_count(...) should return int"), which pins the
committed expected-output file to whichever schema count_nulls happens to
land in. Pass an explicit, schema-free description to every call instead -
function_returns/isnt_strict/volatility_is/lives_ok/bag_eq/throws_ok all
still resolve and execute against the real, %I-qualified, ncs()-derived
name; only the visible description text drops the schema. This is a
self-contained cleanup with no dependency on TEST_SCHEMA existing - it's
what lets a later schema-switching mechanism reuse a single expected-output
file across every schema the suite runs against, instead of needing one
per schema value.

Regenerated test/expected/extension_tests.out via make results.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. 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

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 23f70f8e-6a6d-4f26-ad26-43d65d94c3f5

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

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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Claude finished @jnasbyupgrade's task in 2m 18s —— View job


Claude finished the review

Todo list


Summary

The change does exactly what the PR description says: every pgTAP assertion in test/core/functions.sql now gets an explicit, schema-free description string, while the actual assertion arguments (ncs()-qualified names, %I-quoted identifiers) are untouched. The regenerated test/expected/extension_tests.out only drops public. from the description text, confirming the assertions themselves didn't change behavior. The new exec_desc parameter threading through pg_temp.test_trigger_raw / pg_temp.test_trigger is correctly plumbed (both the named-arg call site in test_trigger and the positional call site in test__functionality pass all 6 params in the right order).

Finding

test/core/functions.sql:86 — description text says "int", but the actual checked type is "integer"

RETURN NEXT function_returns(
  ncs(), f_name, f_args
  , 'int'::regtype::text -- Sanitize type name
  , format('Function %s(%s) should return int', f_name, array_to_string(f_args, ','))
);

'int'::regtype::text resolves to 'integer' (confirmed by the old auto-generated description still visible in the diff: Function public.null_count(anyarray) should return integer). The new hardcoded description says should return int instead of should return integer — a wording regression introduced by this PR, not present before (the old pgTAP-generated description always tracked the real resolved type name automatically; this new literal string doesn't).

It's cosmetic — the assertion still checks the real return type via the 3rd positional arg, so nothing fails — but it's now a second place that would need to be kept in sync with the type name if it's ever 'trigger', 'integer', etc., which cuts against the "no functional risk from a docs-only cleanup" premise a reviewer would otherwise take for granted. Consider format('Function %s(%s) should return integer', ...) (or format('Function %s(%s) should return %s', f_name, array_to_string(f_args, ','), 'int'::regtype::text) to derive it from the same source of truth used for the check) to keep the description accurate and self-updating.

Fix this →

Other notes (no action needed)

  • test/core/functions.sql:161 (lives_ok( c_command, c_command_desc )) and the errdesc/exec_desc split in test_trigger_raw correctly keep the executed SQL schema-qualified while the description stays schema-free — this is the right pattern and matches the PR's stated goal.
  • The doc comments added at test/core/functions.sql:73-82 and :136-141 clearly explain why the description is decoupled from the executed statement, which will help whoever wires up the schema-switching mechanism mentioned in the PR description.
  • Description strings hardcoding "IMMUTABLE"/"trigger" (lines 98, 108, 114, 120) are fine since those literal comparison values can't drift the way the int/integer one did.

jnasbyupgrade added a commit that referenced this pull request Aug 5, 2026
…_update)

Adds the one checklist item genuinely missing everywhere (cat_tools' own
PR #46 only did this manually, uncommitted, per the design doc this whole
series is based on): a script that installs fresh and 0.9.6-then-updated
copies of count_nulls in their own scratch databases and diffs
pg_get_functiondef/comments/ACLs for every object the extension owns
(discovered live via pg_depend, not a hardcoded object list). Wired into
extension-update-test as an automatic step, crossed with TEST_SCHEMA same
as the rest of that job.

Also scopes out extending pg-tle-test to the update path (documented
inline, and filed as Postgres-Extensions/pgxntool#90): pgxntool 2.3.0's
own fix for installcheck's ordering bug (#83) made installcheck
unconditionally depend on install, which writes a real .control file to
disk - defeating the entire point of proving a pg_tle deployment never
touches the filesystem. There's currently no way to invoke the real pgTAP
suite without a filesystem install happening first. The fresh-install
pg_tle smoke test (already on master via #16) is unaffected, since it
never calls installcheck.

Verified locally against PG17: fresh/update x empty/Quoted all pass via
make verify-results; bin/compare_fresh_vs_update reports identical
definitions for both schema legs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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