Skip to content

repo: Support reading and upgrading from older composefs-rs repos#285

Merged
cgwalters merged 1 commit intocomposefs:mainfrom
cgwalters:old-format-compat
Apr 27, 2026
Merged

repo: Support reading and upgrading from older composefs-rs repos#285
cgwalters merged 1 commit intocomposefs:mainfrom
cgwalters:old-format-compat

Conversation

@cgwalters
Copy link
Copy Markdown
Collaborator

Production bootc (pinned at composefs-rs 2203e8f) predates three format changes:

  • ce66285 repository: Add meta.json for repo metadata and cfsctl init
  • b7dc270 Add repr(c) for SplitStream header structs
  • d5ec81d oci: Generate composefs EROFS at pull time, track via config refs

This commit adds transparent backward compatibility and a non-destructive upgrade path.

The splitstream reader detects old-layout headers (where the Rust compiler reordered SplitstreamHeader fields) and converts them on the fly. Repository::open_upgrade() infers the algorithm and verity mode from existing objects when meta.json is missing, writes it, and opens normally — replacing the destructive --reset-metadata flow. upgrade_repo() walks all tagged images and generates EROFS for any that lack it, rewriting config and manifest splitstreams in the current format. Layer splitstreams stay old-format on disk since the reader handles them transparently.

The CLI uses open_upgrade by default (opt out with --no-upgrade). An integration test pulls a real image with an old cfsctl binary (requires CFSCTL_PATH_OLD) to verify the full upgrade path.

Assisted-by: OpenCode (Claude Opus 4)

Production bootc (pinned at composefs-rs 2203e8f) predates three
format changes:

 - ce66285 repository: Add meta.json for repo metadata and cfsctl init
 - b7dc270 Add repr(c) for SplitStream header structs
 - d5ec81d oci: Generate composefs EROFS at pull time, track via config refs

This commit adds transparent backward compatibility and a
non-destructive upgrade path.

The splitstream reader detects old-layout headers (where the Rust
compiler reordered SplitstreamHeader fields) and converts them
on the fly. Repository::open_upgrade() infers the algorithm and
verity mode from existing objects when meta.json is missing, writes
it, and opens normally — replacing the destructive --reset-metadata
flow. upgrade_repo() walks all tagged images and generates EROFS
for any that lack it, rewriting config and manifest splitstreams
in the current format. Layer splitstreams stay old-format on disk
since the reader handles them transparently.

The CLI uses open_upgrade by default (opt out with --no-upgrade).
An integration test pulls a real image with an old cfsctl binary
(requires CFSCTL_PATH_OLD) to verify the full upgrade path.

Assisted-by: OpenCode (Claude Opus 4)
Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters added a commit to cgwalters/bootc that referenced this pull request Apr 24, 2026
Update composefs-rs to rev b95b1a0b2f which adds support for reading
splitstreams written by bootc <= 1.15.x.  Those builds were missing
#[repr(C)] on SplitstreamHeader, causing the Rust compiler to reorder
fields for alignment.  The new composefs-rs detects this old layout
and translates the header transparently.

Switch the initramfs from init_path() to open_upgrade(), which handles
the meta.json migration non-destructively: it infers the algorithm and
verity mode from existing objects instead of requiring them as arguments.

See: composefs/composefs-rs#285

Assisted-by: OpenCode (Claude Opus 4)
@cgwalters cgwalters requested review from giuseppe and jeckersb April 24, 2026 17:12
Copy link
Copy Markdown
Collaborator

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@cgwalters cgwalters added this pull request to the merge queue Apr 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 27, 2026
@cgwalters cgwalters added this pull request to the merge queue Apr 27, 2026
Merged via the queue into composefs:main with commit 54d248f Apr 27, 2026
20 checks passed
cgwalters added a commit to cgwalters/bootc that referenced this pull request Apr 29, 2026
Add unified storage support to the composefs path, leveraging
the new support for containers-storage.

See: composefs/composefs-rs#285
Assisted-by: OpenCode (Claude Opus 4)
Assisted-by: OpenCode (Claude Sonnet 4.6)
Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters added a commit to cgwalters/bootc that referenced this pull request Apr 29, 2026
Add unified storage support to the composefs path, leveraging
the new support for containers-storage.

See: composefs/composefs-rs#285
Assisted-by: OpenCode (Claude Opus 4)
Assisted-by: OpenCode (Claude Sonnet 4.6)
Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters added a commit to cgwalters/bootc that referenced this pull request May 1, 2026
Add unified storage support to the composefs path, leveraging
the new support for containers-storage.

See: composefs/composefs-rs#285
Assisted-by: OpenCode (Claude Opus 4)
Assisted-by: OpenCode (Claude Sonnet 4.6)
Signed-off-by: Colin Walters <walters@verbum.org>
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.

2 participants