Skip to content

file-io: split into pplx-space-aes-gcm-stream, pplx-space-sparse-file and pplx-space-reflink - #2664

Merged
ac-pplx merged 1 commit into
mainfrom
ac/cap-file-io-split
Dec 2, 2026
Merged

ac-pplx merged 1 commit into
mainfrom
ac/cap-file-io-split

Conversation

@ac-pplx

@ac-pplx ac-pplx commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pplx-space-file-io held three unrelated capabilities under one name that
says none of them: streaming AES-256-GCM encryption, readers and writers that
keep a sparse file's holes, and reflink copies that keep NoCoW and holes with a
byte-copy fallback. Every reflink user linked aes-gcm. For example,
node-manager's clone_tree.rs calls
pplx_space_file_io::reflink::copy_on_descriptors through a dependency whose
first module is an AES stream.

This splits it into three Foundation crates and deletes
pplx-space-file-io, with no facade or re-export:

Package Path Moved with git mv from crates/l10_foundation/file/io/src/
pplx-space-aes-gcm-stream crates/l10_foundation/aes/gcm/stream fs.rs → src/lib.rs, fs/tests.rs → src/tests.rs
pplx-space-sparse-file crates/l10_foundation/sparse/file sparse.rs → src/lib.rs, sparse/extent.rs, sparse/reader.rs, sparse/tests.rs, sparse/reader/tests.rs → src/…
pplx-space-reflink crates/l10_foundation/reflink reflink.rs → src/lib.rs, reflink/tests.rs → src/tests.rs

Each moved module is its crate's root, so paths are short
(pplx_space_reflink::copy_file, pplx_space_sparse_file::SparseFileWriter).

Features. pplx-space-reflink has no feature (depending on it is the
opt-in) and keeps the old unix gate as #![cfg(unix)].
pplx-space-sparse-file keeps sparse-read and adds extent
(= sparse-read), which takes over the old reflink gate on next_extent
and re-exports Extent and next_extent at the root; pplx-space-reflink
enables it. Every dependent still builds the sparse code with sparse-read
and extent.

The one API change. The encrypted format's 8-byte magic is passed in:
encrypt_file_blocking, encrypt_stream_blocking, decrypt_file_blocking
and decrypt_stream_blocking take magic: &[u8; 8]. HEADER_LEN and the
rest of the format are unchanged. volume-manager's crypto.rs keeps its magic
constant with its existing bytes and wraps the four functions with their
previous signatures, so its callers are unchanged.

Forced edits.

  • Extent and next_extent widen from pub(crate) to pub, re-exported
    under extent; Extent gains a doc line on what its variants carry.
  • Dependents retarget: nofollow-fs, node-manager and node-runtime-core to
    pplx-space-reflink; sandbox-manager to pplx-space-reflink, now explicit
    (it used to get the reflink feature only by unification); template-manager
    to pplx-space-reflink and pplx-space-sparse-file[sparse-read];
    volume-manager to all three. Only paths change in their code, plus rustfmt's
    re-sort of two use lines and one joined match arm.
  • rustix is Linux-only in pplx-space-reflink, since only its Linux code
    uses it; pplx-space-aes-gcm-stream declares thiserror for CryptoError.
  • Docs and comments in the moved files that named a service, snapshots,
    sandboxes, artifacts, shadow paths or the magic's value say the same thing
    generically; test strings (AAD, plaintext, sibling paths) are generic. Each
    reworded line is listed in the commit message.
  • The two decrypt functions' docs say that the magic, version and reserved
    byte are checked when the header is read, and that the nonce prefix and the
    chunks are authenticated with the AAD. SparseFileReader's doc names the
    extent feature where it named reflink.
  • archcheck's rootfs_copy allow path and comments, the privileged nextest
    clause and two test-duration budget entries are re-keyed to the new crates.

Validation

At this head:

  • cargo fmt --all -- --check, cargo check --locked --workspace --all-targets --all-features (0 warnings), ci/scripts/run-rust-checks.sh clippy and ci/scripts/run-archcheck.sh <merge-base> (no findings): pass.
  • cargo check -p with default features, --all-features and
    --no-default-features: the three new crates (--all-targets, 0
    warnings) and the six direct dependents pass. The 19 other packages that
    reached pplx-space-file-io at the base pass cargo check -p with default
    features.
  • cargo clippy --locked -p <crate> --no-default-features --all-targets -- -D warnings for each new crate: pass.
  • cargo check --target aarch64-apple-darwin --all-targets with all three
    feature sets: pplx-space-sparse-file and pplx-space-reflink pass with
    no warnings; pplx-space-aes-gcm-stream's lib passes, and its test target
    stops in zstd-sys's build script (dev-dependency zstd), which needs a
    macOS C toolchain.
  • nextest, new crates: 39 passed, the same 39 tests the base ran for
    pplx-space-file-io, under every feature set.
  • Format compatibility: volume-manager's
    crypto::tests::ciphertext_from_an_earlier_build_decrypts_and_new_output_keeps_its_magic
    (in crates/l40_api/volmgr/server/src/crypto/tests.rs) decrypts a
    ciphertext written by the base build, checks a fresh encryption's first
    eight bytes and length against it, and checks another magic fails with
    BadHeader. Changing one byte of volume-manager's magic makes it fail.
  • nextest, six dependents as an ordinary user: 3775 run, 3768 passed, 7
    failed; the 7 are privileged-group tests that assert they run as root. The
    privileged group as root for the touched packages: 39 run, 26 passed. The
    moved NoCoW test and the other reflink-related tests pass; 12 node-manager
    firewall tests fail the same way at the base (host tools missing on the test
    machine), and node-manager's gateway-isolation test fails because its
    re-executed test binary sits below a directory the unprivileged identity
    cannot enter, and passes when run from a readable path.
  • The privileged-group clause check passes: every clause matches, and the
    re-keyed clause selects
    pplx-space-reflink tests::nocow_preparation_clones_shared_extents_and_rejects_aliases.
    That test ran as root but returned early: the machine has no btrfs.
  • Doc tests: 0 at the base and 0 at this head for every touched crate.
  • cargo doc --no-deps for the aes-gcm-stream and sparse-file crates: the
    intra-doc links in the decrypt docs resolve; the one warning, a crate-doc
    link to the private TAG_LEN, is the same as before these doc edits.

Kind smoke: not selected by the changed paths. Requested with the kind-smoke label, because template pulls, snapshot staging and volume encryption run through the three crates. It ran in Pull CI on this head, every shard, and passed.

Severity and risk

Severity: does not apply; this is a structural split with no behaviour
change. Risk: a missed feature or path would fail the build, not run
differently; rollback is a revert.

Rollout

No runtime behaviour, wire, metric or schema change. The encrypted file
format is byte-identical, including its magic, so old and new binaries read
each other's encrypted artifacts: the only change to the writer and the
reader is that the magic is an argument, volume-manager passes the bytes the
constant had, and the volume-manager test above decrypts a ciphertext from
the base build and pins the magic and length of new output. Rollback is a revert.

Identity changes visible outside the code:

  • Test names move to the new packages (fs::tests::* →
    pplx-space-aes-gcm-stream tests::*, sparse::tests::* and
    sparse::reader::tests::* → pplx-space-sparse-file tests::* and
    reader::tests::*, reflink::tests::* → pplx-space-reflink tests::*).
  • The macOS-only hole-punch debug event logs under pplx_space_sparse_file
    instead of pplx_space_file_io::sparse.
  • No type_name use sees a moved type, and moved production code has no
    panic sites.

Not covered

  • scripts/move_crates.toml still names pplx-space-file-io: it records
    packages as they were before the layer move and lists itself as a stale-path
    exemption.
  • docs/observability.md is unchanged: its file_io_ms is a span field, not
    the crate.
  • Descriptions of the format in hosts and docs (credential-manager's
    envelope.rs, volume-manager's stream_push.rs,
    docs/snapshot-upload-streaming.md) keep their wording.
  • The moved NoCoW test was not run against a real btrfs.

Local review: round 1 (Codex + Claude), READY after fixes; the fixes were checked against the review in round 2.

AI assistance: Claude Code made the change, wrote the tests and drafted this
description.

@ac-pplx ac-pplx added the kind-smoke Run the Kind/Firecracker smoke on this PR, whatever it changes, from its next push label Dec 2, 2026
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The workspace replaces the combined file-I/O crate with separate AES-GCM stream, sparse-file, and reflink crates. The AES-GCM stream API accepts a caller-supplied 8-byte magic, while Volume Manager wrappers use SPACEAEA. Consumers and configuration references now use the new crates and paths.

Possibly related PRs

Merge Risk: Minimal · up to e4c2b · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Security architecture risk: Minimal · up to e4c2b

The Volume Manager keeps its existing SPACEAEA snapshot format and still controls the keys and identity data used to protect it. The inspected filesystem callers switch packages without changing how they copy, prepare, or publish files. No material security or rollback regression was identified in those paths.

Security review details

Security Blast Radius

  • inferred — The broad package migration does not translate into broader observed control over encrypted artifacts. The only production bindings to the new stream crate found in the reviewed workspace are the Volume Manager’s wrappers, which do not let artifact bytes or request inputs select the expected magic.

Trust Boundaries and Controls

  • observed — The Volume Manager remains responsible for key lifecycle and identity-bound AAD. The Foundation crate receives the key, AAD, and expected format marker from the Volume Manager; it does not choose credentials or storage targets.

Resilience and Maintainability Implications

  • observed — The reflink move preserves separate copy-with-fallback and clone-only operations. Sandbox Manager’s encrypted snapshot copy and Volume Manager’s shadow staging still use the clone-only operation and propagate failure rather than falling back to a byte copy.
Pre-merge checks: Passed 7

Check name Status Explanation
Title check Passed The title "file-io: split into pplx-space-aes-gcm-stream, pplx-space-sparse-file and pplx-space-reflink" uses the lowercase area prefix with a colon, followed by a lowercase summary. It clearly descri…
Description Follows The Pr Template Passed The PR description (PR #2664, opened by ac-pplx) contains all four required items with real content: 1. "## Summary": Present. It states that the change splits pplx-space-file-io into `pplx-spac…
Bug Fixes Name A Regression Test Passed The check applies only when the pull request fixes a defect in application behavior under crates/, shim/, or ui/. This pull request does not fix a defect. Its only commit is "file-io: split into pplx-…
Weakened Safeguards Are Justified Passed The diff does not remove, disable, or weaken a test, assertion, lint, CI check, or repository guard. I checked each category the custom check names. - Test filter (.config/nextest.toml): The pri…
Agent Tooling Runs No New Commands Passed The check does not apply to this pull request, so it passes. Evidence: - The changed-file inventory for the reviewed range (refs/coderabbit/pre-merge-check/base to head) lists 60 paths. None is an…
External Code Sources Need A Person Passed The check fails only if the diff adds or changes where external code comes from. I found no such change. - Cargo.toml path dependencies: The only new dependency sources are three workspace-interna…
Public-Safe Content Passed The Public-safe content check passes. I scanned the 323 added lines in the reviewed diff (base to head) and the PR title and description. - Personal absolute paths (/Users/, /home/, C:\Users): none fo…
Full details: Title check

Explanation

The title "file-io: split into pplx-space-aes-gcm-stream, pplx-space-sparse-file and pplx-space-reflink" uses the lowercase area prefix with a colon, followed by a lowercase summary. It clearly describes the main change: the removal of the pplx-space-file-io crate and its split into three crates. The code identifiers keep their case, there is no trailing period, and there are no ticket IDs or links. The title meets the configured requirements.

Full details: Description Follows The Pr Template

Explanation

The PR description (PR #2664, opened by ac-pplx) contains all four required items with real content: 1. "## Summary": Present. It states that the change splits pplx-space-file-io into pplx-space-aes-gcm-stream, pplx-space-sparse-file, and pplx-space-reflink, and that the old crate is deleted with no facade. 2. "## Validation": Present. It names the commands run (cargo fmt --all -- --check, cargo check --locked --workspace --all-targets --all-features, clippy, archcheck, per-crate checks, nextest, and the volume-manager compatibility test) and records each result and the known failures. 3. "## Severity and risk": Present. It gives "Severity: does not apply; this is a structural split with no behaviour change" and a risk statement ("a missed feature or path would fail the build, not run differently; rollback is a revert"). 4. "AI assistance:" line: Present. It reads "AI assistance: Claude Code made the change, wrote the tests and drafted this description." No required section is missing or empty. This verdict judges presence only, as the check requires. No code tools were needed for this check.

Full details: Bug Fixes Name A Regression Test

Explanation

The check applies only when the pull request fixes a defect in application behavior under crates/, shim/, or ui/. This pull request does not fix a defect. Its only commit is "file-io: split into pplx-space-aes-gcm-stream, pplx-space-sparse-file and pplx-space-reflink". The description states that the change is a structural split with "no behaviour change", and it lists "Severity: does not apply". The diff matches that description. The volume-manager crypto.rs change moves the existing SPACEAEA magic into a wrapper that keeps the old public signatures. The new crypto/tests.rs test is a compatibility test for an unchanged format, not a regression test for a fixed bug. The check therefore passes as not applicable.

Full details: Weakened Safeguards Are Justified

Explanation

The diff does not remove, disable, or weaken a test, assertion, lint, CI check, or repository guard. I checked each category the custom check names. - Test filter (.config/nextest.toml): The privileged-group clause now targets pplx-space-reflink tests::nocow_preparation_clones_shared_extents_and_rejects_aliases. It replaces pplx-space-file-io reflink::tests::..., which named the same test at the old path. Nothing is excluded. - Test duration budget (ci/test-duration-budget.toml): Two entries are re-keyed to pplx-space-aes-gcm-stream tests::.... Both keep the 5-second ceiling. No limit was raised. - Architecture allowlist (ARCHITECTURE.toml): The rootfs_copy allow entry changes from crates/l10_foundation/file/io/src/reflink.rs to crates/l10_foundation/reflink/src/lib.rs. That is the same file after the move. The entry count is unchanged, and the pattern list is unchanged. - Baseline (architecture-baseline.toml): Only a comment changed. No counts changed. - Lints: The three new crates declare [lints] workspace = true, the same as the removed pplx-space-file-io. No [lints] level was lowered. - Suppressions: The added lines contain no #[allow], #[expect], continue-on-error, || true, set +e, skip, xfail, or SPACE_TEST_DEPS_OPTIONAL. - Moved tests: Test counts and assert counts match base for all four moved test files. volmgr crypto tests go from 4 to 5 with a new compatibility test. The removed unwrap_err lines were rewritten to pass MAGIC and still assert the error. The changed #[cfg(feature = "reflink")] gates are now extent, which the new crate enables. The gate scope is the same. - Not changed: CI scripts, check-scope files, kind path lists, and AGENTS.md/CLAUDE.md or other guideline files are not in the changed-file list. scripts/move_crates.toml still names pplx-space-file-io. The diff does not touch it, so it adds no new weakening. The description notes this as an open item.

Full details: Agent Tooling Runs No New Commands

Explanation

The check does not apply to this pull request, so it passes. Evidence: - The changed-file inventory for the reviewed range (refs/coderabbit/pre-merge-check/base to head) lists 60 paths. None is an agent plugin manifest (plugin.json, plugin.yaml), a SKILL.md, a command file, an agent config directory, an MCP or LSP config, a hooks file, or an agent guideline file (AGENTS.md, CLAUDE.md, .mdc). - The changed files are Cargo manifests, Rust sources, Rust test files, .toml config (nextest.toml, ARCHITECTURE.toml, architecture-baseline.toml, ci/test-duration-budget.toml), and Cargo.lock. The only .toml edits are the crate-path and test-filter re-keying described in the PR. - A search of added lines for !` shell substitutions, hooks, mcpServers, mcp_servers, lsp, allowed-tools, and plugin returned no matches. No hook, MCP server, LSP server, command-running entry, skill frontmatter key, or inline shell substitution is added or changed.

Full details: External Code Sources Need A Person

Explanation

The check fails only if the diff adds or changes where external code comes from. I found no such change. - Cargo.toml path dependencies: The only new dependency sources are three workspace-internal path entries in the root Cargo.toml (crates/l10_foundation/aes/gcm/stream, sparse/file, reflink). These are repository crates, so they pass. - Other dependency edits: Every other manifest change is a workspace = true reference or a feature change to a workspace crate. The new crate manifests use workspace = true for their external dependencies (aead-stream, aes-gcm, rand, thiserror, libc, rustix, tempfile, zstd). These resolve through the workspace table, which this diff does not change. Removed lines are pplx-space-file-io references and its manifest entries. - Cargo.lock: The diff adds or removes no source or checksum lines. - Pre-existing sources: A git source for sqlx (Cargo.toml line 397) and a path source for pplx-space-oci-registry (line 468) exist at head. My added-line scan did not flag them, so they are not part of this diff. - Containers, binaries, and charts: The diff changes no Dockerfile, Helm chart, Chart.yaml, or Chart.lock. Added-line scans for FROM, image:, digests, https?://, curl, and wget found no matches. No item in the check's failure list applies, so the check passes.

Full details: Public-Safe Content

Explanation

The Public-safe content check passes. I scanned the 323 added lines in the reviewed diff (base to head) and the PR title and description. - Personal absolute paths (/Users/, /home/, C:\Users): none found. - URLs: no http(s) links in added lines, so no internal URLs or private tracker, chat, or document links. - Credentials, tokens, and private keys: no matches for key, secret, token, password, or known token prefixes. The only key-like material is EARLIER_CIPHERTEXT_HEX in crates/l40_api/volmgr/server/src/crypto/tests.rs (lines 272-273 of the scan). It is a test vector encrypted under key bytes 0..32 and AAD fixed-aad, so it is obviously fake test data. - Cloud account IDs and ARNs: none. The 12-digit scan matched only inside that hex vector. - Internal hostnames and environment names: no .internal, .corp, .local, or similar patterns, and no internal registry or ssh remotes. Cargo.lock adds no non-crates.io sources. - Production logs, measurements, or incident details: none in the diff or description. - Security vulnerability details: none. The description covers a format-compatibility test and a magic-byte parameter, not an undisclosed flaw. - AI credit: the description ends with a plain "AI assistance" statement. It has no "Created with" line or link, and it holds no sensitive value. The description also mentions "Local review: round 1 (Codex + Claude)". That is not a listed sensitive category.

Recent review info

Automatic approval policy

Commit: e4c2b3ff4320.

Setting Effective value Source
Automatic approvals Enabled Global configuration
Merge risk Moderate Global configuration
Security risk Not set Global configuration

No overrides matched. The global limits apply.

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f7eb6f6 and e4c2b3f.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
Files selected for processing: 38

  • .config/nextest.toml
  • ARCHITECTURE.toml
  • Cargo.toml
  • architecture-baseline.toml
  • ci/test-duration-budget.toml
  • crates/l10_foundation/aes/gcm/stream/Cargo.toml
  • crates/l10_foundation/aes/gcm/stream/src/lib.rs
  • crates/l10_foundation/aes/gcm/stream/src/tests.rs
  • crates/l10_foundation/file/io/src/lib.rs
  • crates/l10_foundation/nofollow/fs/Cargo.toml
  • crates/l10_foundation/nofollow/fs/src/contained_copy.rs
  • crates/l10_foundation/reflink/Cargo.toml
  • crates/l10_foundation/reflink/src/lib.rs
  • crates/l10_foundation/reflink/src/tests.rs
  • crates/l10_foundation/sparse/file/Cargo.toml
  • crates/l10_foundation/sparse/file/src/extent.rs
  • crates/l10_foundation/sparse/file/src/lib.rs
  • crates/l10_foundation/sparse/file/src/reader.rs
  • crates/l10_foundation/sparse/file/src/reader/tests.rs
  • crates/l10_foundation/sparse/file/src/tests.rs
  • crates/l40_api/node/mgr/server/Cargo.toml
  • crates/l40_api/node/mgr/server/src/clone_tree.rs
  • crates/l40_api/node/mgr/server/src/service/artifact_fs/receive.rs
  • crates/l40_api/node/runtime/core/Cargo.toml
  • crates/l40_api/node/runtime/core/src/lib.rs
  • crates/l40_api/sbx/mgr/server/Cargo.toml
  • crates/l40_api/sbx/mgr/server/src/service/grpc_state_snapshot.rs
  • crates/l40_api/template/mgr/server/Cargo.toml
  • crates/l40_api/template/mgr/server/src/file_reader.rs
  • crates/l40_api/template/mgr/server/src/rootfs_backing.rs
  • crates/l40_api/template/mgr/server/src/rootfs_backing/tests.rs
  • crates/l40_api/template/mgr/server/src/rootfs_zstd.rs
  • crates/l40_api/template/mgr/server/src/service.rs
  • crates/l40_api/volmgr/server/Cargo.toml
  • crates/l40_api/volmgr/server/src/crypto.rs
  • crates/l40_api/volmgr/server/src/crypto/tests.rs
  • crates/l40_api/volmgr/server/src/executor.rs
  • crates/l40_api/volmgr/server/src/staging.rs
Files with no reviewable changes: 1

  • crates/l10_foundation/file/io/src/lib.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@github-actions github-actions Bot added the triage:pending Waiting for a maintainer to triage label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! A SPACE maintainer will take a look.

CONTRIBUTING.md explains how we review outside contributions.

@ac-pplx
ac-pplx force-pushed the ac/cap-file-io-split branch from a09826c to 2fc4337 Compare December 2, 2026 07:57
@ac-pplx

ac-pplx commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Force-pushed: rebased onto current main, still one commit. Changes from the local review round:

  • The docs on the two decrypt functions say exactly what is checked and what is authenticated: the header's magic, version and reserved byte are checked when the header is read; the nonce prefix and the chunks are authenticated together with the caller's AAD.
  • SparseFileReader's doc names the extent feature (it named the removed reflink feature).
  • Description: one inaccurate clause about a crate that only encrypts is gone, and Rollout names the test and the diff that show the format is unchanged.

@ac-pplx
ac-pplx marked this pull request as ready for review December 2, 2026 08:21
coderabbitai[bot]
coderabbitai Bot previously approved these changes Dec 2, 2026
@ac-pplx
ac-pplx force-pushed the ac/cap-file-io-split branch from 2fc4337 to 50e6ee0 Compare December 2, 2026 09:06
@ac-pplx

ac-pplx commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Force-pushed: rebased onto current main to resolve a conflict in one Cargo.toml and in Cargo.lock with a change that landed next to this one. Still one commit; nothing else changed.

@github-actions
github-actions Bot dismissed coderabbitai[bot]’s stale review December 2, 2026 09:07

The pull request changed after this approval. CodeRabbit approves again after it reviews the current head.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Dec 2, 2026
… and pplx-space-reflink

pplx-space-file-io held three unrelated capabilities under one name that
says none of them: streaming AES-256-GCM encryption (fs), readers and
writers that keep a sparse file's holes (sparse), and reflink copies that
keep NoCoW and holes with a byte-copy fallback (reflink). Every reflink
user linked aes-gcm. For example, node-manager's clone_tree.rs
calls pplx_space_file_io::reflink::copy_on_descriptors, through a
dependency whose first module is an AES stream. The crate becomes three
Foundation crates, one per capability, and pplx-space-file-io is deleted
with no facade or re-export left behind.

Moved with git mv (from crates/l10_foundation/file/io/src/):
- fs.rs -> aes/gcm/stream/src/lib.rs
- fs/tests.rs -> aes/gcm/stream/src/tests.rs
- sparse.rs -> sparse/file/src/lib.rs
- sparse/extent.rs -> sparse/file/src/extent.rs
- sparse/reader.rs -> sparse/file/src/reader.rs
- sparse/tests.rs -> sparse/file/src/tests.rs
- sparse/reader/tests.rs -> sparse/file/src/reader/tests.rs
- reflink.rs -> reflink/src/lib.rs
- reflink/tests.rs -> reflink/src/tests.rs
(all under crates/l10_foundation/). Each moved module becomes its crate's
root, so public paths are short: pplx_space_reflink::copy_file,
pplx_space_sparse_file::SparseFileWriter,
pplx_space_aes_gcm_stream::encrypt_stream_blocking. The old lib.rs and
Cargo.toml are deleted.

Gates and features. The old `pub mod fs;` and `pub mod sparse;` had no
cfg; `pub mod reflink;` had cfg(all(unix, feature = "reflink")).
pplx-space-reflink has no feature of its own (depending on it is the
opt-in) and keeps the unix gate as #![cfg(unix)] on its root.
pplx-space-sparse-file keeps `sparse-read` (dep:rustix) and adds
`extent` (= sparse-read), which replaces the old `reflink` feature on
next_extent and re-exports Extent and next_extent at the crate root under
cfg(all(unix, feature = "extent")); pplx-space-reflink enables it. Every
dependent still builds the sparse code with sparse-read and the
next_extent path enabled, as before.

The one API change: the stream format's 8-byte magic is passed in. The
four encrypt_*/decrypt_*_blocking functions take `magic: &[u8; 8]`;
HEADER_LEN and the rest of the format are unchanged, and a private
MAGIC_LEN replaces the magic's length. volume-manager's crypto.rs keeps
the magic constant with its existing bytes and wraps the four functions
with their previous signatures, so its call sites are unchanged. A new
volume-manager test decrypts a ciphertext written by the previous build,
checks that a fresh encryption starts with the same eight bytes and has
the same length, and that any other magic fails with BadHeader.

Widened from pub(crate) to pub, re-exported at the sparse-file root
under the `extent` feature: Extent (gains a doc line saying Data and Hole
carry the extent's end offset and Unsupported means the filesystem cannot
report extents) and next_extent. The extent module stays pub(crate).

Dependents, each retargeted in this change:
- pplx-space-nofollow-fs, node-manager, node-runtime-core:
  file-io[reflink] -> pplx-space-reflink.
- sandbox-manager: file-io (no features; it got reflink by feature
  unification) -> pplx-space-reflink, explicitly. Its one call in
  service/grpc_state_snapshot.rs changes path only.
- template-manager: file-io[reflink] -> pplx-space-reflink and
  pplx-space-sparse-file[sparse-read].
- volume-manager: file-io[reflink] -> pplx-space-aes-gcm-stream,
  pplx-space-reflink and pplx-space-sparse-file[sparse-read].
rustfmt re-sorts two `use` lines and joins one match arm in
template-manager and volume-manager.

Manifests: aes-gcm-stream: aead-stream, aes-gcm, rand, thiserror (dev:
tempfile, zstd). sparse-file: libc, pplx-space-stopwatch, optional rustix,
tracing on macOS (dev: tempfile). reflink: libc, pplx-space-sparse-file,
tempfile, and rustix on Linux only, since only its Linux code uses it.

Reworded docs and comments in the moved files:
- aes-gcm-stream crate doc: the paragraph naming the orchestrating
  service, snapshot transfers, sandboxes and storage layout now says
  callers supply a key, an AAD and an 8-byte magic, and that key
  management and storage layout live in the caller; the format diagram
  and header text describe the magic as caller-chosen.
- aes-gcm-stream item docs: "multi-GiB snapshots" -> "multi-GiB inputs";
  "SPACEAEA-framed" -> "framed" (twice); "encrypted artifact" ->
  "encrypted file"; BadHeader names the caller's magic; the four
  functions' docs gain a sentence on `magic`.
- aes-gcm-stream tests: test AAD, plaintext and sibling-path strings are
  generic; two comments no longer name a host pipeline or function.
- aes-gcm-stream item docs: the two decrypt functions' docs say that the
  magic, version and reserved byte are checked when the header is read,
  and that the nonce prefix and the chunks are authenticated with the AAD.
- sparse-file crate doc: "zero-heavy artifacts" -> "zero-heavy files".
- sparse-file: SparseFileReader's doc names the `extent` feature where it
  named `reflink`.
- reflink crate doc: says what the crate does; "latency-sensitive shadow
  paths" -> "latency-sensitive paths".
volume-manager's crypto.rs module doc names the new crate and says it
supplies the magic.

archcheck: rootfs_copy's allow path moves to
crates/l10_foundation/reflink/src/lib.rs, and the comments in
ARCHITECTURE.toml and architecture-baseline.toml name pplx-space-reflink.
.config/nextest.toml's privileged clause and the two
ci/test-duration-budget.toml entries are re-keyed in place.

Moved identities:
- Test names: pplx-space-file-io fs::tests::* ->
  pplx-space-aes-gcm-stream tests::* (16), sparse::tests::* ->
  pplx-space-sparse-file tests::* (17), sparse::reader::tests::* ->
  pplx-space-sparse-file reader::tests::* (4), reflink::tests::* ->
  pplx-space-reflink tests::* (2).
- Log target: the macOS-only hole-punch debug event moves from
  pplx_space_file_io::sparse to pplx_space_sparse_file. There are no
  other events or spans.
- type_name: no type_name use sees a moved type.
- Panic locations: production code in the moved files has no
  expect/unwrap/assert; only test assertions change file.

No runtime behaviour, wire format, metric or schema change: old and new
binaries write and read byte-identical encrypted files. Rollback is a
revert.
@ac-pplx
ac-pplx force-pushed the ac/cap-file-io-split branch from 50e6ee0 to e4c2b3f Compare December 2, 2026 09:42
@ac-pplx

ac-pplx commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Force-pushed: rebased onto current main to resolve a Cargo.lock conflict with a change that landed next to this one. Still one commit; nothing else changed.

@github-actions
github-actions Bot dismissed coderabbitai[bot]’s stale review December 2, 2026 09:42

The pull request changed after this approval. CodeRabbit approves again after it reviews the current head.

@ac-pplx

ac-pplx commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@ac-pplx
ac-pplx added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 9137288 Dec 2, 2026
45 checks passed
@ac-pplx
ac-pplx deleted the ac/cap-file-io-split branch December 2, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind-smoke Run the Kind/Firecracker smoke on this PR, whatever it changes, from its next push triage:pending Waiting for a maintainer to triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant