Repository navigation
feat(cli): make origin import --to a bare filesystem path; document the S3 aws-sync route - #2091
Merged
Merged
Conversation
… the S3 sync route `--to` now takes a plain directory path instead of an `fs:<dir>` target string. The filesystem is the only write backend, so the scheme prefix carried no information; a bare path is what operators expect to type. Populating an S3 origin needs no native writer: the fs and S3 object layouts are byte-identical (the S3 reader keys objects to match the on-disk shard), so an import to a local directory followed by `aws s3 sync <dir> s3://<bucket>/<prefix>` fills the bucket with no renaming. `parse_target` turns an `s3://` target into an error that spells out that exact recipe, and rejects a `http(s)://` target the same way, rather than silently writing to a directory named after the URL. A leftover `fs:` prefix is rejected with a hint to drop it, so muscle memory does not seed a directory literally named `fs:...`. Closes #2090. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The updated ADR text contains a broken inline-code span (split across a newline) that should be fixed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR updates decdn origin import --to to accept a bare filesystem directory path (removing the fs: scheme), and documents the supported operational path for populating S3 origins via a local import followed by aws s3 sync, keeping the CLI AWS-SDK-free.
Changes:
- Switch
--toparsing fromfs:<dir>to a plain directory path and add actionable errors fors3://,http(s)://, and legacyfs:usage. - Update CLI docs and unit/integration tests to reflect the new
--togrammar. - Document the S3 sync workflow in the bundles appendix.
| File | Description |
|---|---|
| crates/common/src/cli/origin.rs | Updates origin import/--to documentation and adjusts clap parsing tests to use bare paths in some cases. |
| crates/cli/src/commands/origin.rs | Updates --to target parsing and error messages; updates unit tests for new behavior. |
| crates/cli/tests/origin_import.rs | Updates integration tests to pass bare directory paths for --to. |
| adr/appendix-bundles.md | Updates documentation for --to <dir> and the aws s3 sync route for S3 origins. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Address PR review: - `OriginImportArgs.to` becomes `Option<PathBuf>` so a non-UTF-8 origin-store directory is accepted on Unix, consistent with `--input`. `parse_target` sniffs the `s3://` / `http(s)://` / legacy-`fs:` schemes on the UTF-8 view; a non-UTF-8 path can be none of them and falls through to the filesystem arm. - Keep the `aws s3 sync <dir> s3://<bucket>/<prefix>` command on one line in appendix-bundles.md so the inline-code span parses under CommonMark. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Coverage reportTotal: 83.36% (was 83.37%, ● 0.00%) — 84361/101195 lines
History
|
The cross-layer `cli_bundle_pull_from_optimize_import_dedups` journey spawns the real `decdn origin import --optimize` and still passed `--to fs:<dir>`, which the parser now rejects — the anvil-e2e journeys job caught it. Pass the store directory directly, matching the new bare-path grammar. Also refresh the stale `fs:/tmp/origin` report-label fixtures and one `--to fs:/o` parse test to the bare-path form. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.


Implements Option 0 from #2090.
What changed
decdn origin import --tonow takes a plain directory path instead of anfs:<dir>target string:The filesystem is the only write backend, so the
fs:scheme prefix carried noinformation — a bare path is what operators expect to type.
Why no native S3 writer
Populating an S3 origin needs no separate writer. The fs and S3 object layouts
are byte-identical — the S3 read backend (
crates/cache/src/origin/s3.rs)keys objects
{prefix}{hex[0..2]}/{hex}(+.obao4) to match the on-diskshard. So the whole "S3 import" story is an import to a local dir plus one
aws s3 sync:Rather than pull the AWS SDK into the deliberately SDK-free publisher CLI
(
.github/scripts/check_crate_edges.py, #578),parse_targetturns ans3://target into an error that spells out that exact recipe. A
http(s)://target isrejected the same way (an HTTP origin is a read-only static server). A leftover
fs:prefix is rejected with a hint to drop it, so muscle memory does notsilently seed a directory literally named
fs:....Changes
crates/cli/src/commands/origin.rs—parse_target: bare path → fs;actionable
s3://(aws-sync recipe) /http(s):/// legacy-fs:errors;updated unit tests.
crates/common/src/cli/origin.rs—--toarg docs + module docstring.crates/cli/tests/origin_import.rs— call sites use bare paths.adr/appendix-bundles.md—--togrammar + the S3-sync note.Verification
cargo nextest run -p decdn-cli -p decdn-common— 1201 passed.cargo clippy -p decdn-cli -p decdn-common --all-targets --all-features -D warnings— clean.cargo fmt -- --check— clean.Closes #2090.
🤖 Generated with Claude Code