Skip to content

feat(bucket): add server-side copy and check rename and copy before the request - #90

Merged
ehennestad merged 3 commits into
mainfrom
copy-bucket-objects-for-dataset-reorganization
Nov 3, 2026
Merged

ehennestad merged 3 commits into
mainfrom
copy-bucket-objects-for-dataset-reorganization

Conversation

@ehennestad

Copy link
Copy Markdown
Owner

The Data Proxy copies an object within the object store through PUT /v1/buckets/{bucket}/{object}/copy?name=<target>. BucketsClient gets a copyObject method for it and the namespace an ebrains.bucket.copyObject function, next to renameObject. A folder is copied with everything in it when both names end with /.

The copy endpoint takes the name as one percent-encoded path segment. A folder name ends with /, and sent as path segments the request path holds folder//copy; the proxy collapses the double slash before it reads the name, copies a single object that does not exist, and reports the failure only by mail, as described in HumanBrainProject/ebrains-storage#60. The other endpoints keep the path segments, since the signed temporary URLs they return need real separators.

Rename and copy answer 201 "Your copy is processing" and complete in the background, and a failed operation is reported only by mail. Both functions therefore check that the source exists (EBRAINS:Bucket:ObjectNotFound) and that the target is free (EBRAINS:Bucket:TargetExists) before the request, with Overwrite=true to replace the target. Both pass send_success_email=false unless SendSuccessEmail=true. Before this change the rename required a 200, so it threw on every rename the proxy accepted, and each rename mailed the account. The options and defaults follow DataproxyFile.rename() and copy_to() in ebrains-storage (HumanBrainProject/ebrains-storage#55, HumanBrainProject/ebrains-storage#63).

The live tests gain a folder copy, a single-object copy and a rename, each polling the listing until the proxy has completed the operation.

🤖 Generated with Claude Code

…he request

The Data Proxy copies an object within the object store through
PUT /v1/buckets/{bucket}/{object}/copy?name=<target>. BucketsClient gets a
copyObject method for it and the namespace an ebrains.bucket.copyObject
function, next to renameObject.

The copy endpoint takes the name as one percent-encoded path segment. A
folder name ends with "/", and sent as path segments the request path
holds "folder//copy"; the proxy collapses the double slash before it reads
the name, copies a single object that does not exist and reports the
failure only by mail. The other endpoints keep the path segments, since
their signed temporary URLs need real separators.

Rename and copy answer 201 and complete in the background, and a failed
operation is reported only by mail. Both functions therefore check that
the source exists and that the target is free before the request, with an
Overwrite option to replace the target, and both pass
send_success_email=false unless SendSuccessEmail is true. Before this the
rename required a 200 and so threw on every rename the proxy accepted, and
each rename mailed the account. The options and defaults follow
DataproxyFile.rename and copy_to in ebrains-storage.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

767 tests   756 ✅  50s ⏱️
 37 suites   11 💤
  1 files      0 ❌

Results for commit 6d5f0a5.

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.59155% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.28%. Comparing base (d98330a) to head (6d5f0a5).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/ebrains/+ebrains/+bucket/copyObject.m 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #90      +/-   ##
==========================================
+ Coverage   89.04%   89.28%   +0.24%     
==========================================
  Files         109      112       +3     
  Lines        3002     3079      +77     
==========================================
+ Hits         2673     2749      +76     
- Misses        329      330       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ehennestad and others added 2 commits November 2, 2026 16:31
…oss folder and object names

The proxy accepts such a request and reports the outcome only by mail,
and with Overwrite=true the target check no longer stood in the way. The
names are now compared before anything is listed: equal names, a folder
name paired with an object name, and a target within the source folder
are refused.

The listing helper gets tests of its own, the functions tests of a folder
request that goes through, and the client tests of the target's query
encoding and of the warning state after a copy. The class header names
the copy endpoint as the one that takes the name as a single segment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The mock answers requests in the order the responses were queued, and
the rename and copy functions list the source, then the target, before
they send the request. The tests assert on requests by index, so each
queued response now carries a trailing comment naming the step it
answers, and the class help and the moveFunction parameter state the
pairing and the check order once.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@ehennestad ehennestad left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Looks good.

@ehennestad
ehennestad merged commit d61403b into main Nov 3, 2026
5 checks passed
@ehennestad
ehennestad deleted the copy-bucket-objects-for-dataset-reorganization branch November 3, 2026 20:48
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.

2 participants