Skip to content

Add fuzzing#26

Merged
Eeems merged 31 commits intomainfrom
fuzz
Apr 2, 2026
Merged

Add fuzzing#26
Eeems merged 31 commits intomainfrom
fuzz

Conversation

@Eeems
Copy link
Copy Markdown
Owner

@Eeems Eeems commented Apr 1, 2026

Summary by CodeRabbit

  • New Features

    • Added an automated fuzzing harness and runnable fuzz target with deterministic seed handling.
  • Chores

    • Broadened CI Python matrix, added a dedicated fuzz job, and made fuzzing a prerequisite for publish/release.
    • Added Makefile support for running fuzzing with timeout control and expanded phony targets.
    • Consolidated packaging config, introduced optional dependency groups, and removed dynamic dependency sourcing.
    • Updated ignore rules to exclude fuzz artifacts and seed corpus; trimmed requirements file.
  • Refactor

    • Widespread type-annotation and import cleanups across the codebase.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

Adds an Atheris fuzzing harness and CI fuzz job, moves dependency declarations into pyproject.toml with optional groups, extends Makefile with a fuzz target and timeout, updates .gitignore for fuzz artifacts, and applies widespread import regrouping and type-annotation tightening across the ext4 package.

Changes

Cohort / File(s) Summary
Fuzz harness & CI
fuzz.py, .github/workflows/build.yaml, .gitignore
Adds fuzz.py (Atheris harness with TestOneInput and custom mutator), a CI fuzz job and Python version matrices, updates publish/release jobs to depend on fuzz, and ignores fuzz artifacts (crash-*, timeout-*, corpus/seed/).
Makefile & script updates
Makefile, test.sh
Makefile: remove requirements.txt as build input, switch bootstrap to pyproject.toml, add FUZZ_TIMEOUT default and fuzz target, install editable extras per-target, expand .PHONY; test.sh replaced inline pip installs with invoking make venv activation targets.
Packaging & tooling
pyproject.toml, requirements.txt
Moves deps into pyproject.toml (explicit dependencies, optional groups dev/test/fuzz), removes dynamic file-sourced deps, adds tool.ruff/tool.pyright configs; removes cachetools/crcmod entries from requirements.txt.
Public exports
ext4/__init__.py
Reorganized imports and declares an explicit __all__ enumerating exported symbols (block/device/IO types, directory/entry types, extents/htree/xattr types, enums/constants, Superblock, Volume, etc.).
Compatibility shim
ext4/_compat.py
Conditional override import: use typing_extensions.override for Python <3.12 and typing.override for ≥3.12; removes custom fallback and adds Pyright directives.
Typing & imports (library)
ext4/*.py
ext4/block.py, ext4/blockdescriptor.py, ext4/directory.py, ext4/enum.py, ext4/extent.py, ext4/htree.py, ext4/inode.py, ext4/struct.py, ext4/superblock.py, ext4/volume.py, ext4/xattr.py
Widespread import regrouping and tightening of type annotations across many modules (added -> None, explicit return types on properties/methods, narrower forward refs). Notable functional tweaks: Ext4Struct short-read OSError now includes errno.EIO; BlockIO.seek uses os.strerror for the error string; Inode.__new__ now uses get_file_type + UnknownInode instead of immediate exception.
Tests
test.py
Adds explicit return annotations, linters suppressions, small runtime assertions ensuring volume.superblock/bad_blocks/boot_loader/journal not None before further checks.

Sequence Diagram(s)

sequenceDiagram
  participant A as "Atheris runner"
  participant F as "fuzz.py"
  participant M as "mkfs.ext4 (subprocess)"
  participant V as "ext4.Volume"
  participant I as "Temporary image file"

  rect rgba(200,200,255,0.5)
  A->>F: Start fuzzing (Setup + TestOneInput)
  end

  rect rgba(200,255,200,0.5)
  F->>M: Invoke mkfs.ext4 with generated tree and features
  M-->>I: Produce filesystem image file
  end

  rect rgba(255,200,200,0.5)
  F->>V: Open image via ext4.Volume and exercise parsing (superblock, groups, inodes, htree, xattrs)
  V-->>A: Exceptions/returns exercised by library
  end

  rect rgba(220,220,220,0.5)
  F->>I: Cleanup temporary image
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Add more type hints #11: Overlapping bulk type-hint and signature refactors across ext4 modules (Inode, Volume, Struct, htree, extent).
  • Fix #6 #7: Related changes to ext4/struct.py read semantics and I/O handling.

Poem

🐰 I tunneled bytes and stitched a tiny stream,

I seeded corpus paths where fuzzer-sprites gleam,
I nibbled imports and lined types neat and bright,
Atheris hums softly through the quiet night,
Little paws applaud — parse on, ext4 delight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.83% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add fuzzing' is directly related to the main change: introducing fuzzing support via fuzz.py, workflow updates, dependency management, and type annotation improvements.

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


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 marked this pull request as ready for review April 1, 2026 23:10
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@Eeems

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@Eeems Eeems merged commit 0307d84 into main Apr 2, 2026
32 checks passed
@Eeems Eeems deleted the fuzz branch April 2, 2026 04:57
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.

1 participant