Skip to content

Reject PGXNTOOL_PGTLE_VERSION values that aren't an exact pg_tle range name - #134

Merged
jnasbyupgrade merged 2 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:pre-2.4.0-pgtle-version-validate
Oct 7, 2026
Merged

jnasbyupgrade merged 2 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:pre-2.4.0-pgtle-version-validate

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

make pgtle PGXNTOOL_PGTLE_VERSION=<value> and pgtle.sh --pgtle-version <value> now fail unless <value> is exactly one of the pg_tle range names in pgtle.sh's PGTLE_VERSIONS: 1.0.0-1.4.0, 1.4.0-1.5.0 or 1.5.0+. Before this change, any value was used verbatim as the output directory, so a plain pg_tle version such as 1.5.0 silently created a bogus pg_tle/1.5.0/ directory with capability unknown.

$ make pgtle PGXNTOOL_PGTLE_VERSION=1.5.0
ERROR: invalid pg_tle version range: '1.5.0'
       Valid ranges: 1.0.0-1.4.0 1.4.0-1.5.0 1.5.0+
       '1.5.0' looks like a pg_tle version; did you mean 1.5.0+?
  • The check is in pgtle.sh's --pgtle-version handling, so make pgtle and direct pgtle.sh calls both get it. The list of valid ranges comes from PGTLE_VERSIONS, not from a second hardcoded list.
  • The "did you mean" range comes from the existing --get-dir logic, including its pre-release handling (1.5.0rc1 maps to 1.4.0-1.5.0). It is only shown when --get-dir accepts the value; latest, an empty value, and 1.5.1000 get only the list of valid ranges. --get-dir runs as a child process because get_version_dir depends on errexit to stop when parsing fails, and bash suspends errexit inside an if condition. Called in-process, latest came back as 1.5.0+. --get-dir's own behavior is unchanged.
  • README.asc/README.html: the two sentences saying other values are passed through unvalidated now describe the error. HISTORY.asc has a STABLE entry.

Why validate instead of mapping a plain version to its range

  • The output directory always equals the value given.
  • No second accepted spelling needs documenting and testing.
  • The error turns the common mistake into a one-step fix.
  • It matches the README wording from Fix stale and inaccurate user docs #129: "must be one of those range names exactly; it is not mapped from a plain pg_tle version".

Merge order

This adds behavior, so merge this PR before the paired pgxntool-test PR (pgxntool-test CLAUDE.md, "Merge Order for Paired PRs"). Until this PR lands, the new tests fail against pgxntool master.

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

🤖 Generated with Claude Code

`make pgtle PGXNTOOL_PGTLE_VERSION=...` and `pgtle.sh --pgtle-version` used
the value verbatim as the output directory name, so a plain pg_tle version
such as `1.5.0` silently produced a bogus `pg_tle/1.5.0/` directory with an
"unknown" capability. `pgtle.sh` now accepts only the names in
`PGTLE_VERSIONS` (`1.0.0-1.4.0`, `1.4.0-1.5.0`, `1.5.0+`) and otherwise
errors, listing the valid ranges. When the value parses as a plain version,
the error also names its range via the `--get-dir` logic (e.g. "did you
mean 1.5.0+?"). `--get-dir` itself is unchanged.

README.asc/README.html: the two sentences saying other values are passed
through unvalidated now describe the error instead.

Related changes in pgxntool-test:
- New `test/standard/pgtle-version-validate.bats` invokes `pgtle.sh`
  directly: accepted ranges, plain versions with the hint, garbage values

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 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: 9d979910-6201-4e6e-b070-d8b5248afa22

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
  • Autopilot · 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

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

@jnasbyupgrade
jnasbyupgrade merged commit 9cb2a53 into Postgres-Extensions:master Oct 7, 2026
4 checks passed
@jnasbyupgrade
jnasbyupgrade deleted the pre-2.4.0-pgtle-version-validate branch October 7, 2026 22:38
jnasbyupgrade added a commit to Postgres-Extensions/pgxntool-test that referenced this pull request Oct 7, 2026
Related pgxntool PR:
Postgres-Extensions/pgxntool#134

Tests for `pgtle.sh --pgtle-version`, which now accepts only an exact
pg_tle range name (`1.0.0-1.4.0`, `1.4.0-1.5.0`, `1.5.0+`) and rejects a
plain pg_tle version with a "did you mean <range>?" hint.
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