feat(stelae): stage where the operator said, in both directions - #1191
Conversation
`registry::open` passed `scratch_dir: None` to `stelae::oci::Options`, and that one `None` was the whole gap: every layer a publish built and every layer a restore pulled was staged in the platform temporary directory, which on a real host is not the volume with room for sixteen mainnet state shards. `--scratch-dir` on `snapshot publish` and on `bootstrap stelae`, defaulting to `<storage.path>/scratch` — the volume already sized for the data. A sibling of `storage.path` was rejected: on a dedicated mount it lands on the parent filesystem, exactly the small root volume the default exists to avoid. Staging inside the data directory is safe because scratch files are unlinked at creation, so a backup or a directory listing sees an empty `scratch/` and never a half-written shard — said in both flags' help and in the `storage.path` documentation, because an operator who sizes or backs up that directory is affected. `open` now takes the directory as a plain `PathBuf` rather than an `Option`: the defect was one omission at one call site, and a parameter nobody can omit cannot grow another. `snapshot verify` streams every blob through a staged file too and gets the same default; it grows no flag of its own, because the commands an operator points at a volume are the publish and the restore. Two CLI-level tests, because the transport's own `staging_stays_in_the_scratch_directory_and_leaves_nothing` passes just as well against commands that never set the option. They drive the binary, and each asserts both halves: the directory it was told to use appeared, and the one it was told to use *instead of* did not. The restore test also pins the `--force` ordering — the wipe of `storage.path` completes before the first scratch file is created — by holding the end state against a `file://` restore of the same stele, which stages nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe change adds configurable scratch storage for OCI layer staging. Registry opening now requires a scratch path. Snapshot publishing, inspection, verification, and Stelae restoration resolve and pass scratch directories. Documentation and tests cover the new storage behavior. ChangesOCI scratch-directory staging
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLICommand
participant StorageConfig
participant registry_open
participant OCITransport
CLICommand->>StorageConfig: resolve scratch directory
StorageConfig->>registry_open: pass scratch_dir
registry_open->>OCITransport: configure staging path
OCITransport->>CLICommand: stage OCI transfer layers
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
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 `@docs/content/configuration/schema.mdx`:
- Around line 114-122: Document snapshot verification as a scratch-directory
consumer: in docs/content/configuration/schema.mdx:114-122, state that dolos
snapshot verify uses the default <storage.path>/scratch and does not expose
--scratch-dir; in crates/core/src/config.rs:550-558, include verification in the
StorageConfig::path scratch-directory contract; and in AGENTS.md:49-53, include
verification in the storage layout description.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7c6c9c5b-3c4a-4a47-9dba-6bd5ebeab596
📒 Files selected for processing (12)
.github/workflows/registry.ymlAGENTS.mdcrates/core/src/config.rscrates/snapshot/src/registry.rscrates/snapshot/tests/registry_fixture/mod.rsdocs/content/configuration/schema.mdxsrc/bin/dolos/bootstrap/stelae.rssrc/bin/dolos/common.rssrc/bin/dolos/snapshot/inspect.rssrc/bin/dolos/snapshot/publish.rssrc/bin/dolos/snapshot/verify.rstests/stelae_scratch.rs
Review fix on #1191. The `storage.path` documentation named the publish and the restore and left out `snapshot verify`, which streams every blob through a staged file and — unlike the other two — has no `--scratch-dir` to point somewhere else. An operator sizing that volume off these three documents would have sized it for two of the three commands that use it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Review pass ( No code change; the gate was re-run green ( |
The change is one `None` at one call site plus a flag on two commands; the commentary around it had grown to five separate retellings of the same three facts. Each now has one home: `storage.path` documents `scratch/` in `config.rs` and `schema.mdx`, the flags' help says where the default is, and the rest is deleted. No behaviour, signature or assertion changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| /// Root directory for storage files. | ||
| /// | ||
| /// Besides the stores it holds `scratch/`, where a stele transfer over an | ||
| /// OCI registry stages the layers it is moving. That is the default | ||
| /// because this volume is already sized for the data; a mainnet transfer | ||
| /// stages gigabytes, which the platform temporary directory cannot be | ||
| /// assumed to fit. |
There was a problem hiding this comment.
this is excessive docs about scratch, not the main focus of this field.
A container-spawning integration suite, its CI leg and its AGENTS.md entry for what is a `PathBuf` argument on two commands. The unit test on `stele_scratch_dir` covers the default and the override; the transport's own `staging_stays_in_the_scratch_directory_and_leaves_nothing` covers the option being honoured. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review: the field's subject is the storage root, not the staging directory. `schema.mdx` is where an operator reads the rest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Plan:
plans/dolos-stelae-publisher-operability-scratch-dir.md(Trellis rootBrain/txpipe, ownerorg/coder), the first piece of thedolos-stelae-publisher-operabilityumbrella. Base:mainat0ff6e17d(#1188), which rewrotecrates/snapshot/src/registry.rs.The defect
registry::openpassedscratch_dir: Nonetostelae::oci::Options.Shared::scratchis reachedfrom
layer_sinkon the way up andpull_blob_fileon the way down, so every layer a publish builtand every layer a restore pulled was staged in the platform temporary directory — not always on a
volume with room for sixteen mainnet state shards.
stelae::ocihonoured the option all along inboth directions; nothing set it.
What changed
crates/snapshot/src/registry.rs—opentakes the staging directory as a requiredPathBuf.Not an
Option: a parameter nobody can omit cannot grow anotherNone.src/bin/dolos/common.rs—stele_scratch_dir, one default (<storage.path>/scratch) for allfour commands that open a repository, with a unit test on the default and the override.
--scratch-dironsnapshot publish(conflicting with--output-dir, which stages nothing) andon
bootstrap stelae.snapshot verifyandsnapshot inspecttake the default with no flag.crates/core/src/config.rs,docs/content/configuration/schema.mdx,AGENTS.md—storage.pathdocuments
scratch/.The default is inside
storage.pathrather than beside it: on a dedicated data mount a siblinglands on the parent filesystem, which is the small root volume the default exists to keep bytes off.
tempfile_inunlinks at creation, soscratch/reads as empty even mid-transfer. Decided byorg/founder; the documentation change is part of the deliverable because it changes what anoperator sizing that volume has to count.
Tests
The unit test on
stele_scratch_dircovers the default and that an explicit--scratch-diristaken literally, relative paths included.
staging_stays_in_the_scratch_directory_and_leaves_nothingin
crates/stelae/tests/oci.rsalready covers the transport honouring the option in bothdirections. No CLI-level suite: a container-spawning integration test is out of proportion to a
PathBufargument on two commands.The shared registry fixture now names a
TempDirof its own, so the#[ignore]d registry suitesstop staging in
/tmptoo.Verification
On the committed toolchain (
cargo +1.93), macOS aarch64.Help output and the flag conflict, checked by hand:
The
#[ignore]d registry suites were run againstregistry:2in Docker, since this PR changes theshared fixture they all use:
Notes
plans/dolos-stelae-scratch-dir-diagnostics.md: an unusable--scratch-dirfails with a bare
Not a directory (os error 20)because neithercreate_dir_allnortempfile_incarries the path into its error. That isstelae::oci's to fix.crates/snapshot/tests/snapshot_verify.rs, added by feat(stelae): give a publisher digest, verify and inspect #1188, is#[ignore]d with nothing running it — neither inregistry.ymlnor in AGENTS.md. Run by handhere and green.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
--scratch-diroptions for snapshot publishing and stelae bootstrapping.scratch/directory.--scratch-dirand--output-dir.Documentation