Skip to content

Fix #14#16

Merged
Eeems merged 1 commit intomainfrom
issue/14
Feb 12, 2026
Merged

Fix #14#16
Eeems merged 1 commit intomainfrom
issue/14

Conversation

@Eeems
Copy link
Copy Markdown
Owner

@Eeems Eeems commented Feb 12, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved boundary handling in data peek operations to prevent attempting to read beyond available content.
  • Tests

    • Expanded test coverage for data peek functionality, including edge case validation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

The changes modify the BlockIO.peek method to clamp size when the cursor approaches the end of data, preventing reads past the boundary. Additionally, test infrastructure is enhanced with optional debug callbacks and new test cases for peek behavior.

Changes

Cohort / File(s) Summary
BlockIO Boundary Clamping
ext4/block.py
Modified peek method to clamp size parameter, ensuring cursor + size does not exceed total data length, preventing out-of-bounds reads.
Test Infrastructure Enhancement
test.py
Added Callable type import, extended _assert function signature with optional debug parameter for enhanced error reporting, and introduced new test sequence validating peek behavior with deferred lambda assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A peek beyond the boundary? Not today!
Size gets clamped in the clever way,
Tests now whisper what they see,
With debug helpers, wild and free! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix #14' is vague and does not clearly describe the actual changes made to the codebase. Provide a more descriptive title that explains what issue is being fixed, such as 'Fix BlockIO.peek to clamp size near end of data' or reference the specific problem being addressed.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue/14

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
test.py (1)

104-105: Late-binding closure over loop variables x and b (Ruff B023).

The lambda captures x and b by reference rather than by value. This is safe here because _assert consumes the callback immediately within the same iteration, so the value of x is always correct at call time. However, if you want to silence the Ruff warning and make the intent explicit:

Suggested fix
         for x in range(1, 15):
-            _assert(f"b.peek({x}) == {data[:x]}", lambda: b.peek(x))
+            _assert(f"b.peek({x}) == {data[:x]}", lambda x=x: b.peek(x))

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

@Eeems Eeems linked an issue Feb 12, 2026 that may be closed by this pull request
@Eeems Eeems merged commit e22a031 into main Feb 12, 2026
26 checks passed
@Eeems Eeems deleted the issue/14 branch February 12, 2026 21:11
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.

Reading more than available bytes returns more bytes than expected

1 participant