Skip to content

Conversation

@jfroche
Copy link
Collaborator

@jfroche jfroche commented Oct 27, 2025

Lower the maintenance by reusing the default extension test.

Summary by CodeRabbit

  • New Features

    • pg_repack extension is now included in the supported extensions.
  • Chores

    • Test harness improved with per-extension flags to selectively run upgrade and regression checks.
    • pg_repack tests consolidated into the shared test flow for consistent upgrade and regression validation.

✏️ Tip: You can customize this high-level summary in your review settings.

@jfroche jfroche requested review from a team as code owners October 27, 2025 09:53
@yvan-sraka yvan-sraka force-pushed the multi-version-ext/pg_repack-test branch 2 times, most recently from 737e4ec to d1a5fa1 Compare November 11, 2025 13:45
@yvan-sraka yvan-sraka requested a review from samrose November 11, 2025 13:46
@jfroche jfroche force-pushed the multi-version-ext/pg_repack-test branch from d1a5fa1 to e490f1e Compare November 11, 2025 13:58
@yvan-sraka yvan-sraka force-pushed the multi-version-ext/pg_repack-test branch from e490f1e to 1a83ad2 Compare November 11, 2025 15:49
@yvan-sraka yvan-sraka self-assigned this Nov 11, 2025
@yvan-sraka yvan-sraka force-pushed the multi-version-ext/pg_repack-test branch 3 times, most recently from b56a390 to 42902bc Compare November 19, 2025 10:07
@yvan-sraka yvan-sraka force-pushed the multi-version-ext/pg_repack-test branch 2 times, most recently from f25a3ce to e0fc35a Compare November 21, 2025 10:37
@yvan-sraka yvan-sraka marked this pull request as draft November 21, 2025 12:52
@yvan-sraka yvan-sraka marked this pull request as ready for review November 21, 2025 13:04
jfroche and others added 15 commits December 12, 2025 09:33
These overlay packages will be removed once the extensions are updated
to use the new `buildPgrxExtension` function.
The previously used version was failing to build:

/build/source/src/common/get_check_data.c: In function 'pgr_SPI_getText':
/build/source/src/common/get_check_data.c:307:28: error: passing argument 1 of 'DatumGetCString' makes integer from pointer without a cast [-Wint-conversion]
  307 |     return DatumGetCString(SPI_getvalue(*tuple, *tupdesc, info.colNumber));
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            char *
In file included from /build/source/include/c_common/postgres_connection.h:29,
                 from /build/source/src/common/get_check_data.c:27:
/nix/store/nn6vpjqlsxxmynwcrsib9agb3hpr5cqj-postgresql-17.4/include/server/postgres.h:335:23: note: expected 'Datum' {aka 'long unsigned int'} but argument is of type 'char *'
  335 | DatumGetCString(Datum X)
      |                 ~~~~~~^
make[2]: *** [src/common/CMakeFiles/common.dir/build.make:149: src/common/CMakeFiles/common.dir/get_check_data.c.o] Error 1
We cannot use nodejs.libv8 as it is too new for plv8 3.1.
We will be able to use it with plv8 3.2.
dbmate 2.27 is now using a varchar for the version column in the
schema_migrations table.

See amacneil/dbmate#641
yvan-sraka and others added 17 commits December 12, 2025 09:33
Add -headerpad_max_install_names linker flag to prevent 'install_name_tool:
changing install names or rpaths can't be redone' errors on macOS. This
allocates sufficient header space for install_name_tool to modify the
shared library during post-install processing.
… extensions

Test assertions were inconsistent: expecting {version}.so and {extension_name}-{version}.so
patterns while actual libraries use {lib_name}-{version}.so (e.g. pg_partman_bgw-5.3.1.so,
timescaledb-loader-2.16.1.so). Updated PostgresExtensionTest to accept Optional[str] lib_name
parameter and use consistent {lib_name}-{version}.so assertions throughout.

Added missing timescaledb-loader.so symlink creation and updated the switch script to
maintain both symlinks when switching versions.

Fixes 'Expected timescaledb version 2.16.1, but found timescaledb-loader-2.16.1.so' and
'Expected pg_partman version 5.3.1, but found pg_partman_bgw-5.3.1.so' test failures.
Use overlay instead of passing full nixpkgs-oldstable to avoid exposing
entire old nixpkgs attribute set. Now provides specific packages
(curl_8_4, v8_oldstable) through overlay.
Keep revision support that was accidentally simplified during nixpkgs update.
Restores conditional logic to support building orioledb from specific git
revision hashes instead of only tags.
These files were moved to subdirectories and the old .nix files should be
removed since they were moved to new directory structure with default.nix files.
Remove nixpkgs-go124 dependency since current nixpkgs has Go 1.25.4
which is sufficient for packer. Remove nix-fast-build input as unused
and add follows directives to resolve duplicate dependencies.
Run flake-linter to eliminate duplicate dependencies, and remove unused
cargo-pgrx / rustc versions hashes.
Move pgrouting.nix to pgrouting/default.nix and groonga package to
pgroonga/groonga.nix. Update imports and fix relative paths for versions.json
and patch files.
Replace inline bash script generation with writeShellScriptBin for rustc
wrapper that filters empty postmaster_stub.rs arguments. Apply wrapper only
for pgrx < 0.12 since issue was fixed upstream in pgrx#1435 and pgrx#1441.
Move nixpkgs-oldstable import to a let binding to avoid importing it
three times...
Remove supabase-groonga from global flake packages and import it locally
in pgroonga extension instead. Other components access groonga via
pgroonga.passthru.groonga since groonga is only used by pgroonga.
The supabase-groonga package was moved to pgroonga extension in commit 1f0ed1f,
but Ansible was still trying to install it separately causing build failures.
This reverts commit 55474686405394826ad07a032cbcf0e36a924554.
This reverts commit cfa9bcb92219f391469ae743f95c8856b0a99561.
Remove references to darwin.apple_sdk.frameworks.{IOKit,CoreFoundation}
which have been deprecated in nixpkgs. Disable CGO to avoid Darwin
framework dependencies entirely.
Lower the maintenance by reusing the default extension test.
@yvan-sraka yvan-sraka force-pushed the multi-version-ext/pg_repack-test branch from e0fc35a to 04f795c Compare December 12, 2025 17:35
@yvan-sraka yvan-sraka requested a review from a team as a code owner December 12, 2025 17:35
@yvan-sraka yvan-sraka changed the base branch from develop to update-nixpkgs December 12, 2025 17:36
@samrose samrose force-pushed the update-nixpkgs branch 3 times, most recently from 771718f to 4e32d5b Compare December 17, 2025 19:36
Base automatically changed from update-nixpkgs to develop January 16, 2026 00:23
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Walkthrough

The test harness is updated to consolidate pg_repack testing: two flags (support_upgrade, run_pg_regress) gate test blocks and metadata; the standalone pg_repack.nix test file was removed and pg_repack was added to the exported extension list.

Changes

Cohort / File(s) Change Summary
Test Harness (flags & gating)
nix/ext/tests/default.nix
Added support_upgrade and run_pg_regress per-extension flags; exposed support_upgrade in test metadata; wrapped pg_regress, upgrade checks, last-version installation, and extension-version switching blocks behind run_pg_regress; tightened ext_has_background_worker to require support_upgrade.
Extension list export
nix/ext/tests/default.nix
Added pg_repack to the exported/public extension list in the extTest factory.
Removed standalone test
nix/ext/tests/pg_repack.nix
Deleted the separate pg_repack runTest-based file that defined an isolated PostgreSQL environment, multi-version upgrade workflow, and migration/test scripts.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Harness as "Test Harness\n(nix/ext/tests/default.nix)"
participant Meta as "Test Metadata"
participant PG15 as "Postgres 15 instance"
participant PG17 as "Postgres 17 instance"
participant PgReg as "pg_regress runner"
participant Ext as "Extension (pg_repack)"

rect rgba(200,200,255,0.5)
Harness->>Meta: emit per-extension flags\n(support_upgrade, run_pg_regress)
Meta-->>Harness: flags for extension
end

rect rgba(200,255,200,0.5)
Harness->>Ext: select extension (pg_repack)
alt run_pg_regress = true
Harness->>PgReg: run pg_regress tests\nagainst PG15/PG17
PgReg->>PG15: execute tests
PgReg->>PG17: execute tests
else run_pg_regress = false
Harness->>Ext: skip pg_regress blocks
end
end

rect rgba(255,200,200,0.5)
alt support_upgrade = true
Harness->>PG15: perform upgrade workflow -> PG17
PG15-->>PG17: upgrade/migrate data
else support_upgrade = false
Harness->>Ext: skip upgrade-related checks
end
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Suggested reviewers

  • samrose
  • LGUG2Z

Poem

🐰 In harness halls the tests converge,
Flags wave softly, flows emerge,
pg_repack hops into line,
One file gone, one flag to shine,
Rabbit cheers—checks pass by design! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description 'Lower the maintenance by reusing the default extension test' is very brief but conveys the intent. However, it lacks detail about what was changed, why, and any implementation notes expected from the template. Expand the description to clarify which files were modified, what the default test harness includes, and any behavioral differences in testing pg_repack after this change.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(pg_repack): use default nixos extension test' clearly and specifically summarizes the main change - consolidating pg_repack to use the default test harness instead of a custom isolated test.
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.


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@nix/ext/tests/default.nix`:
- Around line 180-182: The test calls to check_upgrade_path are unconditional
even when support_upgrade is False; update the test to guard these calls by
checking the instance attribute before invoking them (e.g., wrap calls to
check_upgrade_path(...) in if self.support_upgrade: or if support_upgrade: where
appropriate), or alternatively add an early return at the start of the
check_upgrade_path method that returns immediately when self.support_upgrade is
False; locate the method check_upgrade_path and the boolean support_upgrade
declaration to implement the chosen guard so the upgrade-path test is skipped
when support_upgrade is disabled.

Address CodeRabbit review feedback: when support_upgrade is false (e.g., for
pg_repack), the test was still calling check_upgrade_path unconditionally,
which is semantically incorrect.

Fixed by wrapping upgrade path test calls with conditional guards:
- Only call test.check_upgrade_path() when support_upgrade is true
- Applies to both PostgreSQL 15 and 17 test sections
- Extensions like pg_repack (support_upgrade=false) now skip upgrade tests

This ensures test logic matches the extension's actual upgrade capabilities.
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.

4 participants