Repository navigation
feat(cli): allow origin import --move with --optimize - #2113
Merged
Merged
Conversation
The chunk-hint pass re-opened the source file after the whole-file blob was written, so `--move` (which renames the source into the store) left nothing for it to re-open. That was the only reason `--optimize` and `--move` were rejected together. Read the chunk pass from the just-written stored object at its content-addressed path instead. The store copy always exists after `import_one_file` — a move renames the source in, a copy stages it there — so the two flags now compose. Chunking the immutable stored bytes also rules out the read race the old two-source-pass code had to guard against; the consistency check now only catches a corrupt stored object. Drop the up-front guard and replace its rejection test with a positive test that `--optimize --move` moves the source away, stores the whole-file blob at its content address, and emits chunk hints. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, aligns with the PR’s stated safety argument, and is covered by an updated integration test exercising the new --move --optimize behavior.
Review effort: Lite
Findings: None
What changed in this PR
This PR enables decdn origin import --move --optimize by changing the --optimize chunk-hint pass to read from the just-written content-addressed object in the origin store (instead of re-opening the source file, which no longer exists after --move).
Changes:
- Remove the up-front rejection of
--movecombined with--optimizeinorigin_import. - Update optimized import to chunk the stored object at
{base}/{shard_prefix}/{hash}and keep a consistency check (whole-file write vs chunk pass read). - Replace the prior “rejected” integration test with
optimize_and_move_compose, asserting the source is moved away and the manifest contains chunk hints.
| File | Description |
|---|---|
| crates/cli/src/commands/origin.rs | Switch optimized chunk-hint read to the stored object path and drop the --move+--optimize incompatibility guard. |
| crates/cli/tests/origin_import.rs | Update the integration test to validate --move --optimize succeeds and emits chunk hints while moving the source away. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Coverage reportTotal: 83.69% (was 83.69%, ● 0.00%) — 86764/103674 lines
History
|
alpergundogdu
deleted the
claude/move-optimize-incompatibility-08f9e0
branch
September 22, 2026 13:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
decdn origin import --move --optimizewas rejected up front. The only reason: the chunk-hint pass re-opened the source file after the whole-file blob was written, and--moverenames the source into the store, leaving nothing to re-open.This makes the chunk pass read the just-written stored object at its content-addressed path instead. The store copy always exists after
import_one_file(a move renames the source in; a copy stages it there), so--optimizeand--movenow compose for free.Why it's safe
Changes
{base}/{shard}/{hash}(viashard_prefix) rather than re-opening the source.--move+--optimizeguard inorigin_import.optimize_and_move_compose, which asserts the source is moved away, the whole-file blob lands at its content address, and the manifest carries chunk hints.Testing
cargo nextest run -p decdn-cli --test origin_import— 17/17 pass.cargo clippy -p decdn-cli --all-targets --all-featuresandcargo fmt --checkclean.🤖 Generated with Claude Code