Skip to content

Guarantee test/install/*.sql schedule ordering - #120

Open
jnasbyupgrade wants to merge 1 commit into
Postgres-Extensions:masterfrom
jnasbyupgrade:issue-111-install-order
Open

jnasbyupgrade wants to merge 1 commit into
Postgres-Extensions:masterfrom
jnasbyupgrade:issue-111-install-order

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

TEST_INSTALL_SQL_FILES fed the test/install schedule straight from $(wildcard), whose order depended entirely on the underlying filesystem/libc glob() behavior -- alphabetical in practice almost everywhere, but never a documented guarantee. A real consumer hit this: two install files had an implicit dependency (one provisioning roles the other's CREATE EXTENSION ... CASCADE requires), named such that alphabetical order ran them backwards. It "worked" for a long time only because an unrelated step elsewhere in the same test run happened to provision the same roles as a side effect.

Wraps the wildcard in $(sort ...). GNU Make's sort is a plain byte-value comparison, independent of locale (LC_COLLATE etc. have no effect on it), so ordering is now a guarantee pgxntool itself enforces rather than an accident of the platform. Documented in README.asc and base.mk, along with the numeric-prefix convention for consumers with an inter-file dependency between install scripts.

Fixes #111.

Related pgxntool-test PR: Postgres-Extensions/pgxntool-test#84

`TEST_INSTALL_SQL_FILES` fed the test/install schedule straight from
`$(wildcard)`, whose order depended entirely on the underlying
filesystem/libc `glob()` behavior -- alphabetical in practice almost
everywhere, but never a documented guarantee. A real consumer hit this:
two install files had an implicit dependency (one provisioning roles the
other's `CREATE EXTENSION ... CASCADE` requires), named such that
alphabetical order ran them backwards.

Wrap the wildcard in `$(sort ...)`. GNU Make's `sort` is a plain
byte-value comparison, independent of locale (`LC_COLLATE` etc. have no
effect on it), so ordering is now a guarantee pgxntool itself enforces
rather than an accident of the platform. Documented in `README.asc` and
`base.mk`, along with the numeric-prefix convention for consumers with an
inter-file dependency between install scripts.

Related changes in pgxntool-test:
- Regression test creating install files out of sorted order and
  asserting the generated schedule lists them correctly anyway
- Direct check that `base.mk` wires `TEST_INSTALL_SQL_FILES` through
  `$(sort ...)`, since this container's libc already returns sorted
  `glob()` results by default and the behavioral test alone can't
  distinguish the fix from a revert here

Fixes Postgres-Extensions#111.

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

coderabbitai Bot commented Sep 15, 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: Advanced

Run ID: bd800d51-809e-440f-8866-b1b0aa158c87

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.

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.

Document (or provide) an ordering guarantee for test/install/*.sql files

1 participant