Skip to content

ci: pg_tle deployment smoke test for extension_drop (chained on cat_tools) - #21

Draft
jnasbyupgrade wants to merge 5 commits into
test-install-foundationfrom
pg-tle-ci
Draft

ci: pg_tle deployment smoke test for extension_drop (chained on cat_tools)#21
jnasbyupgrade wants to merge 5 commits into
test-install-foundationfrom
pg-tle-ci

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Contributor

Migrated from fork-internal PR jnasbyupgrade#5 to enable a native same-repo stacked PR (bases off test-install-foundation, which now exists directly on Postgres-Extensions/extension_tools). Original PR: jnasbyupgrade#5


Summary

Adds a pg-tle-test CI job that proves extension_drop can be deployed with
zero filesystem footprint, via pg_tle (AWS's Trusted Language Extensions
— a database-backed catalog for installing an extension with no .control
file on disk; relevant for RDS/Aurora-style managed deployments). This is a
third deployment dimension, orthogonal to the fresh/update/existing testing
this stack already added in test-install-foundation — not how the
extension got there
across time, but filesystem-installed vs. registered
purely through pg_tle's catalog
.

This branch stacks on:

  • test-install-foundation (fork-internal, this PR's base) — test/install/load.sql, TEST_LOAD_SOURCE, the dependency guard
  • fix-cat-tools-install (upstream draft Postgres-Extensions/extension_tools#10, transitively) — cat_tools installed from a pinned git ref because PGXN's published listing is a stale 2017 release

The chained-dependency gap this fills

The reference implementation for pg_tle testing is Postgres-Extensions/cat_tools PR #47's pg-tle-test job — read directly from cat_tools's current ci.yml, not just summarized. cat_tools is a leaf extension (no dependencies of its own), so its job never had to solve registering a chained dependency through pg_tle. extension_drop requires cat_tools (.control's requires = 'cat_tools', and its own SQL calls cat_tools.routine__parse_arg_types_text(...)), so CREATE EXTENSION extension_drop CASCADE only resolves cleanly if cat_tools is also already registered as a pg_tle extension — otherwise the CASCADE either fails outright or (worse) silently resolves cat_tools from a stray filesystem install, defeating the whole point of the test. This job registers, in order: pg_tlecat_tools (cloned fresh at the same CAT_TOOLS_GIT_REF the Makefile's own filesystem cat_tools target pins to, read via make print-CAT_TOOLS_GIT_REF so the two never drift) → extension_drop (this repo's own make run-pgtle) — all against template1, before any database that needs them is created.

What's taken from cat_tools verbatim / adapted / skipped

  • Verbatim in spirit, adapted in detail: bin/assert_fs_clean (snapshot/verify subcommands, diffing *.control files against a pre-pg_tle baseline) is modeled directly on cat_tools' script of the same name — same mechanism, same reasoning (a stray filesystem control file silently wins over a pg_tle registration of the same name; PostgreSQL never errors, it just resolves from disk). Comments rewritten to stand on their own rather than referencing cat_tools.
  • Adapted: the job structure (dedicated cluster, snapshot-before-pg_tle-install, register-against-template1, fs-clean checks bracketing every step) follows cat_tools' pg-tle-test job shape. The registration step is the real addition — cat_tools' equivalent step is a single make run-pgtle; this repo's is three ordered registrations (pg_tle, cat_tools, extension_drop) because of the dependency chain.
  • Skipped for now (noted so it isn't mistaken for an oversight):
    • The update path via pg_tle (cat_tools' job also tests ALTER EXTENSION UPDATE through pg_tle). extension_drop has no prior released version to update from yet — TEST_UPDATE_FROM has no safe default (see the Makefile's own comment) — so there's nothing real to exercise. Straightforward to add once a real second version ships.
    • Binary pg_upgrade of a pg_tle-deployed extension (cat_tools' pg-tle-upgrade-test). A separate, heavier concern from a fresh-install smoke test.
    • A workflow-level concurrency: group. test-fixes.md-style guidance recommends one, and this workflow doesn't have one yet, but a sibling fork branch (pg-upgrade-ci, same base) is concurrently adding its own job to this same ci.yml — to keep this PR a small, low-conflict diff I deliberately limited my changes to adding my own job plus wiring it into all-checks-passed's needs: list, rather than also touching shared workflow-level YAML. Worth adding in a follow-up once both stacks have landed.
    • No new changes/docs-only gate job — this repo doesn't have one yet; out of scope here.

PG version matrix

Intersection of two independently-moving ranges, checked directly rather than assumed: extension_drop's own tested range (test job: 9.3–17) and pg_tle 1.5.2's supported PostgreSQL range (12–18, dropped PG11 — see pgxntool/pgtle_versions.md). Matrix is [12, 13, 14, 15, 16, 17] — 18 is left out since the existing test job doesn't cover it either.

Local verification

Rehearsed the full flow end to end in this dev container (PG17, on a dedicated throwaway cluster created specifically for this — never touching the shared main/pgupgradetest clusters other work in this container uses):

  1. Built pg_tle 1.5.2 from source against PG17, enabled shared_preload_libraries.
  2. CREATE EXTENSION pg_tle on template1; registered cat_tools (cloned at master, the current CAT_TOOLS_GIT_REF) via make run-pgtle, then this repo's own extension_drop via make run-pgtle — both against template1.
  3. createdb + CREATE EXTENSION extension_drop CASCADE — succeeded, with NOTICE: installing required extension "cat_tools" confirming CASCADE resolved the dependency through pg_tle.
  4. Asserted extversion matched make print-PGXNVERSION (1.0.0) dynamically, and called extension_drop__add/__get/__remove against a real installed extension (pg_tle itself) — a real function call, not just a successful install.
  5. Confirmed zero filesystem .control files present throughout via bin/assert_fs_clean (this dev container actually already had stale filesystem installs of both cat_tools and extension_drop from earlier work in this repo, which — usefully — surfaced a real thing worth knowing: pg_tle's own pgtle.install_extension refuses to register over a pre-existing filesystem control file of the same name, raising control file already exists for the ... extension. I briefly relocated just those two extensions' specific files to rehearse a clean registration, then restored them and confirmed via bin/assert_fs_clean diff that the filesystem was back to its exact prior state, modulo the expected new pg_tle.control from this rehearsal.)
  6. Also regression-tested bin/assert_fs_clean itself: confirmed it passes clean, fails when a synthetic stray .control file is injected, and passes again once removed.
  7. Caught and fixed a real bug during this process: the registration step's cd cat_tools_clone && git checkout ... would have persisted for the rest of that run: block (one continuous shell script), making the following make run-pgtle (meant for this repo) run inside the cat_tools clone instead. Fixed by using -C on both git and make rather than a bare cd.

CI itself will be the final confirmation on a genuinely clean runner (no pre-existing filesystem installs to work around, unlike this dev container).

Test plan

  • pg-tle-test matrix (PG 12–17) goes green on this PR
  • all-checks-passed reflects the new job in its needs: list
  • Confirm no odd CI-triggering behavior from the multi-level fork-internal stack (base is test-install-foundation, itself based on the upstream draft fix-cat-tools-install)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 4, 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: 43e35edc-deb7-4807-af8a-a4ee5100ff6b

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.

jnasbyupgrade and others added 4 commits August 6, 2026 17:41
zzz_build.sql hand-rolled exactly what pgxntool's test/build/ already
does natively: run the raw install script directly (not via CREATE
EXTENSION) for better error messages than a bare CREATE EXTENSION
failure. Postgres-Extensions/cat_tools already made this exact move.

Also fixes the flaky expected-output problem that came with the old
approach: zzz_build.sql ran client_min_messages unsuppressed, so its
expected output captured verbose, PG-minor-version-dependent NOTICEs
(e.g. "%TYPE converted to ..." with a source-file LOCATION line) --
any environment/PG-version drift showed as a spurious diff. test/build
runs as its own separate installcheck invocation with
client_min_messages = WARNING (matching cat_tools's own build.sql),
so the expected output is stable and empty.

PGXNTOOL_ENABLE_TEST_BUILD set explicitly (yes) rather than left to
auto-detect, so an accidental future deletion of test/build/'s
contents is a hard error instead of the check silently vanishing.
…, quoting-requiring schema test

Builds the U&U (update & upgrade) test infrastructure that doesn't require a
real second extension_drop version or pg_upgrade CI to already exist:

- PGXNTOOL_ENABLE_TEST_INSTALL = yes, with test/install/load.sql as the
  committed-once installer for the extension (no test roles exist for this
  extension, so unlike cat_tools there's nothing role-related to add).
- TEST_LOAD_SOURCE (fresh/update/existing) GUC/make-var switch, parse-time
  validated, exported unconditionally, read in load.sql without missing_ok.
  `existing` mode is fully exercised locally (verified against a real,
  already-installed database, including the failure path when the extension
  is genuinely absent). `update` mode is wired up and structurally verified
  end-to-end, but extension_drop has no real prior released version to
  update FROM yet -- the Makefile refuses to run it without TEST_UPDATE_FROM
  set explicitly, and no CI leg exercises it in this repo today.
- Dependency guard (test/sql/dependency_guard.sql): a view depending on
  extension_drop__commands' row type blocks a non-CASCADE DROP EXTENSION;
  proven by actually attempting the drop and asserting failure, not assumed.
- test/sql/schema.sql's custom-schema test names renamed to mixed case
  (requires identifier quoting), reusing its existing coverage rather than
  adding a new schema-testing dimension.
- ci.yml: run `make test && make verify-results` instead of pg-build-test,
  so a real regression actually fails the build (pgxntool's
  .IGNORE: installcheck otherwise reports green regardless of test results,
  per RELEASE.md's existing note about PRs #6/#7).

Moving the extension's own installation into test/install/load.sql required
adapting every test file that used to install it per-test in a rolled-back
transaction (test/deps.sql, test/sql/simple.sql, test/sql/schema.sql,
test/sql/zzz_build.sql) to work against the new committed-once install
instead, since an extension name is a database-wide singleton.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…redate this branch

CI on this branch showed the switch to `make test && make verify-results`
surfacing real pgTAP failures on PostgreSQL 9.3/9.6 (cat_tools/extension_drop
never actually install there). Checked PR #10's own baseline CI
(#10, run
30665031257): PG 9.3 and 9.6 already report "3 of 3 tests failed" in the raw
job log there too, just silently reported as a passing check because
pg-build-test's underlying `make test` hits pgxntool's
`.IGNORE: installcheck` the same way. So this isn't a regression from this
PR's own changes -- it's the exact masking problem RELEASE.md already
documents, just now applying to a different, older part of the PG matrix
than the PRs (#6/#7) it originally cites. Reverting the ci.yml step back to
pg-build-test here keeps this PR scoped to test/install infrastructure;
fixing cat_tools's install path on pre-PG10 belongs to whoever owns that
dependency setup (PR #10 or a follow-up), not this PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jnasbyupgrade
jnasbyupgrade force-pushed the test-install-foundation branch from 8f4e50d to 67855c7 Compare August 6, 2026 23:03
…at_tools)

Proves extension_drop can be deployed with zero filesystem footprint via
pg_tle (AWS's Trusted Language Extensions), the same fresh-install proof
cat_tools' own pg-tle-test job (PR #47) does for itself -- but extension_drop
REQUIRES cat_tools, so this job also registers cat_tools as a pg_tle
extension first (a leaf extension's pg_tle test never has to solve chained
dependency resolution). Every step that could write an extension file to
disk is bracketed by a new bin/assert_fs_clean check (modeled on cat_tools'
script of the same name), since a stray filesystem .control file silently
wins over a pg_tle registration of the same name.

Verified end to end locally: built pg_tle 1.5.2 from source, registered
pg_tle+cat_tools+extension_drop against template1, CASCADE-installed
extension_drop in a smoke database, and called extension_drop__add/__get/
__remove against a real installed extension -- all with zero filesystem
control files present throughout (confirmed via bin/assert_fs_clean).

Explicitly out of scope: the update path via pg_tle (extension_drop has no
prior released version to update from yet) and binary pg_upgrade of a
pg_tle-deployed extension -- both noted as follow-up work in the PR.
@jnasbyupgrade
jnasbyupgrade force-pushed the test-install-foundation branch 3 times, most recently from 2925fca to 03b0355 Compare August 7, 2026 22:14
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