Skip to content

Conversation

@bennyz
Copy link
Member

@bennyz bennyz commented Jan 13, 2026

Summary by CodeRabbit

  • New Features

    • Added performance timing measurements for download, decompression, and write phases to improve progress tracking visibility.
    • Enhanced format detection logging for improved visibility into image type identification.
  • Tests

    • Added test coverage for Android image sparse header detection validation.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

The changes enhance sparse image detection and logging across multiple modules. Test coverage is added for AIB sparse header detection in FormatDetector, log messages are introduced when sparse image format is detected during auto-detection, and performance measurement instrumentation is added to track download, decompression, and write operation durations during image processing pipelines.

Changes

Cohort / File(s) Summary
Format Detection Testing
src/fls/format_detector.rs
Adds test helper function to construct 8GB-aib sparse headers and two test cases validating sparse header detection behavior: verifying valid AIB sparse header detection yields SparseImage format and consumes expected bytes; testing detection with trailing data respects MAX_BUFFER_SIZE during buffering.
Sparse Image Detection Logging
src/fls/from_url.rs, src/fls/oci/from_oci.rs
Introduces stdout log messages when SparseImage format is detected during auto-detection in both URL-based and OCI-based import paths.
Performance Metrics Instrumentation
src/fls/oci/from_oci.rs
Adds timing measurements to capture download_duration, decompress_duration, and write_duration at distinct stages in download and decompression pipelines for both streaming and raw-disk paths. Updates disk image user-facing log message from "Raw disk image detected" to "Disk image detected".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

  • support sparse simg from a-i-b #3: Introduced the sparse image detection paths in FormatDetector and the from_url/from_oci detection flows that are now exercised by tests and logging additions in this PR.

Suggested reviewers

  • mangelajo

Poem

🐰 Sparse headers now tested with care,
Logs record each format with flair,
Timing the dance of download and decompress,
Performance metrics easing each test,
Detection flows verified—what a success!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes only a subset of the changes (tests in format_detector), but ignores substantial changes to from_url.rs and from_oci.rs including logging and timing measurements. Update the title to reflect all major changes, such as 'Add format detector tests and progress tracking logging' or similar, to accurately represent the full scope of the changeset.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c6990a and 01c45ab.

📒 Files selected for processing (3)
  • src/fls/format_detector.rs
  • src/fls/from_url.rs
  • src/fls/oci/from_oci.rs
🧰 Additional context used
🧬 Code graph analysis (1)
src/fls/format_detector.rs (1)
src/fls/simg.rs (3)
  • header (352-354)
  • new (339-348)
  • is_complete (358-360)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build (aarch64-unknown-linux-gnu)
  • GitHub Check: Build (aarch64-unknown-linux-musl)
🔇 Additional comments (8)
src/fls/from_url.rs (1)

177-181: LGTM!

Clean addition of user-facing log message for sparse image detection. The placement before the debug logging is appropriate, and the message is consistent with similar logging in from_oci.rs.

src/fls/format_detector.rs (3)

382-405: LGTM!

The AIB sparse header helper is well-documented and mathematically correct. The 8GB image calculation (2097152 blocks × 4096 bytes = 8GB) is accurate. The structure mirrors the existing create_test_sparse_header() with realistic production values.


407-432: LGTM!

Good test coverage for AIB-style sparse headers. The explicit match arms with descriptive panic messages make test failures easy to diagnose.


434-461: LGTM!

Excellent test for validating the MAX_BUFFER_SIZE buffering behavior. The test correctly verifies that when input data (140 bytes) exceeds both DETECTION_THRESHOLD (28) and MAX_BUFFER_SIZE (64), the detector caps consumption at MAX_BUFFER_SIZE. The comment explaining the 64-byte breakdown is helpful.

src/fls/oci/from_oci.rs (4)

144-148: LGTM!

Consistent sparse image detection logging with from_url.rs.


529-530: LGTM!

Duration tracking captures cumulative elapsed time at each pipeline stage completion. This pattern is consistent with from_url.rs and provides useful metrics for the final stats output.

Also applies to: 578-579, 601-602


924-925: LGTM!

For the raw disk image path, capturing a single elapsed time for both decompress_duration and write_duration is appropriate since decompression and writing occur in the same pipeline and complete together.

Also applies to: 960-963


1667-1669: LGTM!

The wording change from "Raw disk image" to "Disk image" is appropriate since this function handles both compressed and uncompressed disk images. The compression type is correctly reported on the following line.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bennyz bennyz changed the title add tests to format detector restore stats for OCI flashing Jan 13, 2026
@bennyz bennyz requested a review from mangelajo January 13, 2026 09:45
@mangelajo mangelajo merged commit de377ea into jumpstarter-dev:main Jan 13, 2026
8 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