Skip to content

feat(core): add three-state LUKS2 initialization detection#129

Merged
imlk0 merged 3 commits into
release-0.3from
0.3.4-recovery-in-init
Jun 26, 2026
Merged

feat(core): add three-state LUKS2 initialization detection#129
imlk0 merged 3 commits into
release-0.3from
0.3.4-recovery-in-init

Conversation

@imlk0

@imlk0 imlk0 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Cherry-pick of three-state LUKS2 initialization feature from the original branch.

Changes

  • VolumeInitState enum (None / Initializing / Ready) and get_init_state() API in cryptpilot-core
  • format() atomically writes subsystem="cryptpilot-initializing" in LUKS2 header
  • show command displays Initializing volumes with a warning indicator
  • init command allows re-initialization of interrupted volumes (Initializing state)
  • Integration tests covering the full None → Initializing → Ready lifecycle
  • mark_volume_as_initialized() call in boot service (already present on this branch)

What was NOT cherry-picked

  • blkid.rs subsystem field — this module was removed from this branch by prior refactoring
  • before_sysroot.rs KnownSignature pattern — this file was rewritten on this branch

Both are functionally equivalent on this branch already.

🤖 Generated with Claude Code

imlk0 and others added 2 commits June 25, 2026 19:40
Add three-state initialization detection (None, Initializing, Ready)
for LUKS2 volumes. get_init_state() reads the subsystem field from
the raw LUKS2 header. is_initialized() is refactored to use
get_init_state() internally, preserving backward compatibility.

feat(core): write initializing marker in format()

format() now sets subsystem='cryptpilot-initializing' directly in
CryptParamsLuks2 during format(), making header creation and marker
write a single atomic operation. Always pass params_ref so subsystem
is written regardless of integrity type.

feat(crypt): add Initializing state to volume status display

Extend VolumeStatusKind with Initializing variant for partially
initialized volumes. determine_status() now uses get_init_state()
to distinguish None, Initializing, and Ready states. The show
command displays Initializing volumes with a warning indicator.
Also handle Initializing state in the init command to allow
re-initialization of interrupted volumes.

test(crypt): add three-state init integration tests

Add tests for the full None -> Initializing -> Ready lifecycle:
- Raw device returns None
- After format returns Initializing
- After mark returns Ready
- is_initialized backward compat: true only for Ready
- Full lifecycle test with blkid -p probing and retry loop

cherry-picked from a32a378 (original branch), minus blkid.rs and
before_sysroot.rs changes which were already addressed on this branch.
Remove 'branches: master' restriction from pull_request triggers
so all CI workflows fire on PRs targeting any branch, not just master.

Co-Authored-By: Claude <noreply@anthropic.com>
@shankailun-aliyun

Copy link
Copy Markdown

@imlk0 ,您好,您的请求已接收,请耐心等待结果。

@shankailun-aliyun

Copy link
Copy Markdown

@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

Co-Authored-By: Claude <noreply@anthropic.com>
@shankailun-aliyun

Copy link
Copy Markdown

@imlk0 ,您好,您的请求已接收,请耐心等待结果。

@shankailun-aliyun

Copy link
Copy Markdown

@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@imlk0 imlk0 merged commit f29f039 into release-0.3 Jun 26, 2026
44 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.

2 participants