Skip to content

fsck: Return typed findings from the checks - #2528

Merged
cgwalters merged 3 commits into
bootc-dev:mainfrom
cgwalters-forge:bot/fsck-findings
Oct 2, 2026
Merged

cgwalters merged 3 commits into
bootc-dev:mainfrom
cgwalters-forge:bot/fsck-findings

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Contributor

The bootc internals fsck checks returned at most one free-form error string (FsckResult = anyhow::Result<Result<(), FsckError>>). This converts them to the two-level shape the readonly report in #2497 uses: fatal errors in the outer anyhow::Result, every problem found collected as a typed finding (code, subject, detail). The runner bounds the output to five findings per check, which the fsverity check used to do on its own.

The types are named CheckFinding/CheckFindingCode for now so this doesn't collide with #2497's private Finding/FindingCode in the same file; once that lands, the check codes can become one more FindingCode group.

Two prep commits: passing checks are now written to the given output instead of stdout, and the resolv.conf check takes a Dir so it can be unit tested.

Testing (16-core devspace): at b5ea223, just validate and just unit-tests passed (bootc-lib: 284 passed, including the new table-driven fsck::tests), and just test-tmt readonly (centos-bootc stream10, ostree) passed, with 015-test-fsck printing ok: etc-resolvconf and ok: fsverity.

Follow-up to #2497.

The Signed-off-by: Colin Walters <walters@verbum.org> on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#35 (review)

Generated-by: https://github.com/cgwalters/#llms

fsck() takes an output stream, but passing checks were still printed
with println!, so a caller capturing the output (or a test) saw only
the failures. Also print runtime errors with their context chain, so
e.g. "Computing verity state" isn't dropped.

Generated-by: AI
Signed-off-by: Colin Walters <walters@verbum.org>
The check opened the ambient /usr itself, so it could only run on a
booted host. Taking the directory makes the check itself testable
against a fixture.

Prep for converting the checks to return findings.

Generated-by: AI
Signed-off-by: Colin Walters <walters@verbum.org>
The checks returned at most one free-form error string, so the fsverity
check pre-formatted its own truncated list of objects, and nothing could
tell the kinds of problems apart. The readonly report being added in
bootc-dev#2497 settled on a two-level
shape instead: fatal errors in the outer anyhow::Result, every problem
found collected as a typed finding with a subject. Use the same shape
here, so the two can share a finding type once that lands.

The output stays bounded: the runner prints at most five findings per
check and counts the rest, as the fsverity check did itself before.
The messages become one "code: subject: detail" line per finding; the
tmt tests only look at the exit status.

Generated-by: AI
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
cgwalters merged commit 57e26c0 into bootc-dev:main Oct 2, 2026
54 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