Conversation
rasifr
commented
Mar 27, 2026
📝 WalkthroughWalkthroughThe changes coordinate a version downgrade from 6.0.0-devel to 5.1.0 across the codebase. Updates include version metadata, a migration script with schema column type and function definition changes, test version references, and a new comprehensive TAP test validating schema equivalence after upgrading from 5.0.6 to 5.1.0. Changes
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
- Update SPOCK_VERSION to "5.1.0" and SPOCK_VERSION_NUM to 50100 in include/spock.h (spock.control is generated from this at build time) - Rename sql/spock--6.0.0-devel.sql -> sql/spock--5.1.0.sql - Rename sql/spock--5.0.6--6.0.0-devel.sql -> sql/spock--5.0.6--5.1.0.sql, update header comment and \echo version string - Add ALTER COLUMN to fix sub_skip_schema column type in the upgrade script: the 5.0.1->5.0.2 migration added the column as plain `text`, but the fresh-install script has always declared it as `text[]`; align the upgrade path by casting: USING sub_skip_schema::text[] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verifies that upgrading Spock from 5.0.6 to 5.1.0 via ALTER EXTENSION UPDATE produces a schema identical to a fresh 5.1.0 installation. Each Spock version requires PostgreSQL built with its own branch-specific patches, so the test maintains two separate PG installs. When V5_PG_INSTALL and V51_PG_INSTALL env vars point at pre-built installs, all builds are skipped (fast path for local dev). Otherwise PG and Spock are built from source (CI path). Test is excluded from the default schedule (slow); run via: V5_PG_INSTALL=... V51_PG_INSTALL=... prove t/018_upgrade_schema_match.pl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
868f54b to
1cf3438
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/tap/t/018_upgrade_schema_match.pl (1)
150-165: Minor: Temporary file cleanup on early exit.If
psql_querydies between creating$tmpfileand theunlink, the temp file is left behind. Consider using a block-scoped cleanup or wrapping in eval.♻️ Suggested improvement
sub psql_query { my ($port, $sql) = `@_`; my $tmpfile = "/tmp/spock_018_$$.sql"; + my $out; open my $fh, '>', $tmpfile or die "Cannot write $tmpfile: $!"; print $fh $sql; close $fh; - open $fh, '-|', "$PG_BIN/psql", '-X', '-t', '-A', - '-p', $port, '-d', $DB_NAME, '-U', $DB_USER, '-f', $tmpfile - or die "Cannot run psql: $!"; - my $out = join '', <$fh>; - close $fh; - unlink $tmpfile; + eval { + open $fh, '-|', "$PG_BIN/psql", '-X', '-t', '-A', + '-p', $port, '-d', $DB_NAME, '-U', $DB_USER, '-f', $tmpfile + or die "Cannot run psql: $!"; + $out = join '', <$fh>; + close $fh; + }; + my $err = $@; + unlink $tmpfile; + die $err if $err; chomp $out;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/tap/t/018_upgrade_schema_match.pl` around lines 150 - 165, psql_query currently writes a temp file and may leave it behind if the function dies before the final unlink; modify psql_query to guarantee cleanup by using a safe temporary-file helper (e.g., File::Temp->new or a block-scoped temp file) or wrap the write/psql invocation in an eval/finally-like construct (local $@; eval { ... }; my $err = $@; unlink $tmpfile if -e $tmpfile; die $err if $err) so that the temp file is always removed; reference the psql_query function and the $tmpfile variable when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/tap/t/018_upgrade_schema_match.pl`:
- Around line 150-165: psql_query currently writes a temp file and may leave it
behind if the function dies before the final unlink; modify psql_query to
guarantee cleanup by using a safe temporary-file helper (e.g., File::Temp->new
or a block-scoped temp file) or wrap the write/psql invocation in an
eval/finally-like construct (local $@; eval { ... }; my $err = $@; unlink
$tmpfile if -e $tmpfile; die $err if $err) so that the temp file is always
removed; reference the psql_query function and the $tmpfile variable when making
the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 87b0828a-fe94-4595-8692-810148ddddff
⛔ Files ignored due to path filters (2)
tests/regress/expected/init_1.outis excluded by!**/*.outtests/regress/expected/init_fail.outis excluded by!**/*.out
📒 Files selected for processing (6)
include/spock.hsql/spock--5.0.6--5.1.0.sqlsql/spock--5.1.0.sqltests/regress/sql/init_fail.sqltests/tap/scheduletests/tap/t/018_upgrade_schema_match.pl