Skip to content

repository: Add meta.json for repo metadata and cfsctl init#268

Merged
Johan-Liebert1 merged 6 commits intocomposefs:mainfrom
cgwalters:meta-json
Apr 1, 2026
Merged

repository: Add meta.json for repo metadata and cfsctl init#268
Johan-Liebert1 merged 6 commits intocomposefs:mainfrom
cgwalters:meta-json

Conversation

@cgwalters
Copy link
Copy Markdown
Collaborator

Add a meta.json file to the repository format that records the digest
algorithm, format version, and feature flags, so tools can auto-detect
the configuration instead of requiring --hash on every invocation.

The versioning model is inspired by Linux filesystem superblocks
(ext4, XFS, EROFS): a base version integer for fundamental layout
changes, plus three tiers of feature flags for finer-grained
evolution:

  • compatible: old tools can safely ignore
  • read-only-compatible: old tools may read but must not write
  • incompatible: old tools must refuse the repository entirely

Because creating a repo is no longer just mkdir, add
'cfsctl init --algorithm=fsverity-sha512-12 [path]'.

Closes: #181

Comment thread crates/cfsctl/src/lib.rs Outdated
Copy link
Copy Markdown
Collaborator

@Johan-Liebert1 Johan-Liebert1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment, otherwise lgtm

Comment thread crates/cfsctl/src/lib.rs Outdated
@cgwalters cgwalters force-pushed the meta-json branch 2 times, most recently from 0df572b to 6ef4ab9 Compare March 19, 2026 20:35
@cgwalters
Copy link
Copy Markdown
Collaborator Author

OK there's now an even bigger change here, see the tip commit. I think it cleans up the UX a lot though.

Comment thread crates/composefs/src/fsverity/hashvalue.rs Outdated
Comment thread crates/composefs/src/repository.rs Outdated
Comment thread crates/cfsctl/src/lib.rs Outdated
Comment thread crates/composefs/src/repository.rs Outdated
@cgwalters cgwalters marked this pull request as draft March 20, 2026 17:09
auto-merge was automatically disabled March 20, 2026 17:09

Pull request was converted to draft

@cgwalters
Copy link
Copy Markdown
Collaborator Author

OK moving back to draft for some more refactoring

@cgwalters cgwalters force-pushed the meta-json branch 2 times, most recently from 8567826 to 7bd48fd Compare March 20, 2026 18:35
@cgwalters cgwalters marked this pull request as ready for review March 20, 2026 18:39
@cgwalters cgwalters marked this pull request as draft March 20, 2026 20:15
Add a validated Algorithm type that wraps the fsverity-<hash>-<lg_blocksize>
string format (e.g. 'fsverity-sha512-12'). Implements FromStr for parsing
with proper error types and Display for serialization, so it can be used as
a clap value_parser argument. Includes for_hash::<H>() constructor to
derive from FsVerityHashValue types at compile time.

Prep for repository metadata support.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
Prep for repository metadata (meta.json) serialization.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
Add a meta.json file to the repository format that records the digest
algorithm, format version, and feature flags, so tools can auto-detect
the configuration instead of requiring --hash on every invocation.

The versioning model is inspired by Linux filesystem superblocks
(ext4, XFS, EROFS): a base version integer for fundamental layout
changes, plus three tiers of feature flags for finer-grained
evolution:

  - compatible: old tools can safely ignore
  - read-only-compatible: old tools may read but must not write
  - incompatible: old tools must refuse the repository entirely

Because creating a repo is no longer just `mkdir`, add
'cfsctl init --algorithm=fsverity-sha512-12 [path]'.

Closes: composefs#181

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
Prep for auto-detecting security mode from meta.json verity.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
Derive the repository's insecure flag from whether meta.json has
fs-verity enabled, rather than requiring a per-invocation --insecure
flag. If meta.json carries verity, all objects are expected to have
it too.

We keep the `--insecure` CLI flag but it's a no-op as the semantics
now changed to have fsverity enablement be controlled by the repo
state. Via CLI and API one can override that to required - so
we get a clean error if the repo doesn't have fsverity.

Note that the composefs=? karg case uses this because source of
truth has to be the karg, not the on-disk state.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
We need to handle the upgrade case in bootc, this is prep
for that.

When opening a repository without meta.json, check for the
presence of objects/ to distinguish an old-format repo from an
uninitialized directory.  The error message directs users to
`cfsctl init --reset-metadata` for migration.

`init --reset-metadata` removes especially the splitstream
data which changed format, but we keep the objects since
those didn't change.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters marked this pull request as ready for review March 31, 2026 13:57
@cgwalters cgwalters enabled auto-merge March 31, 2026 15:38
@cgwalters cgwalters requested a review from jeckersb March 31, 2026 15:38
@cgwalters
Copy link
Copy Markdown
Collaborator Author

OK, this one should be first in line I think for merge.

Copy link
Copy Markdown
Collaborator

@Johan-Liebert1 Johan-Liebert1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. Seems to be working as expected. I'll admit I didn't read the code in its entirety

@cgwalters cgwalters added this pull request to the merge queue Apr 1, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 1, 2026
@Johan-Liebert1 Johan-Liebert1 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into composefs:main with commit 820e468 Apr 1, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo metadata

3 participants