fix(#3569210): compare target_id numerically so retroactive update works on PostgreSQL - #19
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe batch updater now compares ChangesBatch updater query fix
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The PR applies a localized database-compatibility fix and reports passing verification; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
8c16914 to
f16dc76
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.x-1.x #19 +/- ##
========================================
Coverage 83.39% 83.39%
========================================
Files 20 20
Lines 783 783
========================================
Hits 653 653
Misses 130 130 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f16dc76 to
d23f47e
Compare
|
@coderabbitai review |
|
Fixes https://www.drupal.org/project/filefield_paths/issues/3569210
Problem
Batch\Updater::batchUpdate()builds the retroactive update entity query with a string comparison on the file reference column:target_idis a bigint. MySQL and SQLite silently coerce the empty string, but PostgreSQL rejects the comparison, so every retroactive update on a PostgreSQL site crashes before the batch is created:Fix
Two commits, so the community fix keeps its own author:
fix: #3569210 Do not treat target_id as textby Mykola Podpriatov (nickolaj), taken from the head of drupal.org MR !59 where liam morland re-rolled it.test(#3569210): pin empty-field exclusion, adding the kernel test and an explanatory comment. No functional change.The fix itself is the one-line numeric comparison:
Semantics are identical on every supported database:
target_idis a file entity ID, always a positive integer when set, and rows with no value are absent from the field table entirely.Verification
Reproduced and verified against a local PostgreSQL 16:
SIMPLETEST_DB="pgsql://..." make test-kernelfails with 7 errors, allSQLSTATE[22P02]raised fromUpdater.phpby the existing kernel tests.That PostgreSQL run was made before this branch was rebased onto the merged cross-scheme work. The condition it targets is unchanged by that merge and still sits at
src/Batch/Updater.php:59, and the suite is green on the rebased branch, but note that CI here runs MySQL and SQLite only, so no automated job can fail on this bug.BatchUpdaterTest::testReturnsFalseWhenFileFieldIsEmptypins the exclusion semantics of the numeric operator. It is coverage of the intent rather than a regression test, since the string comparison is legal on the databases CI runs.Notes
The cross-scheme move work in #18 (https://www.drupal.org/i/3419618) has since merged, and this branch is rebased on top of it.
Summary by CodeRabbit