Files
ecrou/AGENTS.md
T
vhaudiquet 51f56116a3 feat(rootfs): cross the rootfs as an ext4 image on a block device
The rootfs was a virtiofs share over an extracted tree, and that
showed: the tree's owners were the host user's, because an
unprivileged extract cannot chown to a tar's uid, and every chown
inside the machine failed with EPERM against the host side.

The rootfs crosses as a raw ext4 image now. mke2fs builds the cache
image straight from the entry tarball (-d takes gz, xz and zst, and
bakes each entry's recorded uid, gid and mode), the run copies it
into a scratch directory with cp --reflink=auto --sparse=auto, and
the engine attaches it with krun_add_disk +
krun_set_root_disk_remount; the init blob mounts /dev/vda at / and
chroots. The OCI layer bundle merges into one plain tar first, with
whiteouts applied across layers and headers passed verbatim, so
registry images keep their ownership too.

Per-run provisioning rides debugfs: the generated init lands at
/ecrou-init, the host resolver overwrites /etc/resolv.conf (unlink
first - resolver-bearing images ship it as a symlink), a stale
control file goes. The exit-code control file now outranks the
machine child's exit code: with a block root the engine's exit-code
channel (an ioctl through the virtiofs root device) never fires, so
decode_status reads the file first and treats the child's code as
machinery talk. Shell detection and the rare control-file read are
debugfs stats, no extracted tree to walk.

extract.rs keeps what the image build consumes (the tar decoder and
the OCI merge) and drops the extraction-to-disk path it once carried;
the module is private now. The engine needs the blk feature from here
on: the snap and the CI engine build follow in their own commits.
2026-10-30 19:10:48 +01:00

3.2 KiB

AGENTS.md

Before every commit

Run, in order, and make sure they are clean before committing:

cargo fmt --all
cargo clippy --all-targets   # no new warnings
cargo test                   # keep green when touching behavior

These mirror CI. cargo fmt may amend files you did not touch; include those changes in the commit (or in a separate chore: commit) rather than leaving the tree dirty.

Commit messages

Follow Conventional Commits with a component scope:

<type>(<scope>): <short summary>

Rules:

  • Types: feat, fix, refactor, perf, test, docs, build, ci, chore.
  • Scopes match the component touched, the module name under crates/ecrou/src/ (library) or crates/ecrou-cli/src/ (CLI):
    • cli - entry point and flags (crates/ecrou-cli/src/main.rs, crates/ecrou-cli/src/cli.rs)
    • vm - the run flow, one-shot machines (crates/ecrou/src/vm.rs)
    • supervise - machine process fork and wait (crates/ecrou/src/supervise.rs)
    • krun - the libkrun FFI (crates/ecrou/src/krun.rs)
    • guest - the guest init script (crates/ecrou/src/guest.rs)
    • rootfs - cache-aware preparation and persistence (crates/ecrou/src/rootfs.rs)
    • cache - the rootfs entry store: naming, locking, freshness, layer pointers (crates/ecrou/src/cache.rs)
    • image - ext4 image building and inspection (crates/ecrou/src/image.rs)
    • distro - distro definitions and mirrors (crates/ecrou/src/distro.rs)
    • download - image download (crates/ecrou/src/download.rs)
    • extract - tar decoding and the OCI layer merge feeding the image build (crates/ecrou/src/extract.rs)
    • registry - OCI registry client (crates/ecrou/src/registry.rs)
    • utils, error, progress - shared helpers
    • deps - dependency additions/bumps (manifests, lockfile)
  • Omit the scope entirely for repo-wide changes that do not belong to a single component (README.md, SPEC.md, root config).
  • Summary: imperative mood ("add", never "added" or "adds"), lowercase first letter, no trailing period, max ~72 characters.
  • Body (optional): separated by a blank line, wrapped at 72 columns; explain why rather than what. Reference issues as #123. Keep body short for small changes (max. 4 lines) and expand into max. 3 paragraphs for big changes.
  • A commit touching several components should be split into one commit per component when practical; otherwise use the dominant scope. Never break bisectability. Each commit should build and work on their own.
  • No merge commits. Integrate work by rebasing onto the target branch; the history stays linear.

Examples

feat(krun): bind the eleven-call stable ABI
feat(vm): propagate guest exit codes through the control file
fix(rootfs): reject image references with empty repo
test(vm): cover the control-file exit-code read
deps: add libloading for runtime dlopen
docs: document the spike snap gate

Code

  • Tests live inline as #[cfg(test)] modules at the bottom of each src/ module; there is no tests/ directory. Scope test commits to the module under test.
  • Comments state constraints the code cannot show; no narration.
  • Design decisions that outlive the session go to SPEC.md, not to new docs or repos.