fix: correct multipart part numbering and selectObjectContent XML payload - #1492
Conversation
…load - Remove duplicate partNumber++ in uploadStream that caused fresh uploads to number parts as 1,3,5 instead of 1,2,3 (regression from minio#1490) - Fix selectObjectContent building XML body as array-of-objects instead of a flat object, which produced malformed XML rejected by S3/MinIO - Functional test: replace host-name guard on Select test with a runtime MethodNotAllowed catch so the test runs and passes on supporting servers and silently skips on servers that don't implement S3 Select
32ca789 to
dc35761
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughCorrects resumed multipart upload part numbering, changes Select Object Content payload construction to an object-shaped configuration, and updates functional tests for asynchronous bucket cleanup and unsupported-operation handling. ChangesMultipart upload
Select Object Content
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Warning
CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.
Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/functional/functional-tests.js`:
- Around line 4624-4630: Update the S3 Select error handler in the enclosing
test callback to use a regular function so Mocha’s context is available, then
call this.skip() when err.code is MethodNotAllowed instead of done(). Preserve
done(err) for all other failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 43fffa66-57ff-4497-b2f7-534209a7de8e
📒 Files selected for processing (2)
src/internal/client.tstests/functional/functional-tests.js
Switch the selectObjectContent step callback from an arrow function to a regular function so Mocha's context is available, then call this.skip() when the server returns MethodNotAllowed instead of done(), which was incorrectly marking the step as passed on unsupported deployments.
Summary
uploadStreampart numbering: Removes a duplicatepartNumber++that caused fresh multipart uploads to number parts as1, 3, 5, …instead of1, 2, 3. The counter is already incremented at the top of the loop; the stray second increment after each upload doubled the step for every uploaded chunk (skipped chunks were unaffected becausecontinuebypassed it).selectObjectContentmalformed XML: Fixes the request body being built as anArray<Record<string, unknown>>instead of a flatRecord<string, unknown>.xml2js.Builder.buildObject()expects an object — passing an array produced numeric-keyed<0>…</0><1>…</1>elements rather than the expected<Expression>,<ExpressionType>, etc., causing MinIO/S3 to reject the request withMethodNotAllowed.Functional test resilience: Replaces the host-name-based skip guard on the Select Object Content test with a runtime
MethodNotAllowedcatch, so the test exercises the API on servers that support S3 Select and silently passes through on those that don't.Test plan
uploadStream multipart part numbering— all 3 cases pass (1,2,3fresh; resume skip; mismatch re-upload)selectObjectContentstep passes against a MinIO server that supports S3 SelectselectObjectContentstep silently skips (no failure) against a MinIO AIStor server that does not support S3 Select432 passing, 3 pending, 0 failingSummary by CodeRabbit