Skip to content

Add mypy type checking to disassembler modules; fix mypy errors#702

Open
ANogin wants to merge 4 commits intoredballoonsecurity:masterfrom
ANogin:maintenance/add_missing_inspect
Open

Add mypy type checking to disassembler modules; fix mypy errors#702
ANogin wants to merge 4 commits intoredballoonsecurity:masterfrom
ANogin:maintenance/add_missing_inspect

Conversation

@ANogin
Copy link
Contributor

@ANogin ANogin commented Feb 4, 2026

  • I have reviewed the OFRAK contributor guide and attest that this pull request is in accordance with it.
  • I have made or updated a changelog entry for the changes in this pull request.

One sentence summary of this PR (This should go in the CHANGELOG!)

Add mypy type checking to disassembler modules; fix mypy errors

Link to Related Issue(s)

N/A

Please describe the changes in your request.

Enable mypy enforcement in ofrak_ghidra, ofrak_cached_disassembly, and ofrak_pyghidra. Fix type errors including:

  • Add TypedDicts for structured data (BasicBlockInfo, DataWordInfo, InstructionInfo)
  • Fix method signatures with proper defaults (config: None = None)
  • Add subprocess stream assertions for type safety
  • Fix variable shadowing in batch handlers (requests -> reqs)
  • Handle Java exception interop with hasattr + type ignore
  • Add type ignores for ResourceTag metaclass limitations with TODO comments
  • Fix Optional[str] handling in os.path.join calls
  • Use str() instead of hex() for GetDecompilation.java compatibility

Anyone you think should look at this, specifically?

Not sure; @whyitfor should probably decide.

Enable mypy enforcement in ofrak_ghidra, ofrak_cached_disassembly, and
ofrak_pyghidra. Fix type errors including:

- Add TypedDicts for structured data (BasicBlockInfo, DataWordInfo, InstructionInfo)
- Fix method signatures with proper defaults (config: None = None)
- Add subprocess stream assertions for type safety
- Fix variable shadowing in batch handlers (requests -> reqs)
- Handle Java exception interop with hasattr + type ignore
- Add type ignores for ResourceTag metaclass limitations with TODO comments
- Fix Optional[str] handling in os.path.join calls
- Use str() instead of hex() for GetDecompilation.java compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ANogin ANogin requested a review from whyitfor February 4, 2026 19:25
@ANogin ANogin self-assigned this Feb 4, 2026
ANogin pushed a commit that referenced this pull request Feb 8, 2026
Aleksey Nogin and others added 3 commits February 13, 2026 19:36
- Fix PyGhidraAutoAnalyzer generic type to match config usage
  (Analyzer[Optional[PyGhidraAnalyzerConfig], ...])
- Add Optional to PyGhidraCodeRegionUnpacker.unpack config parameter
- Document behavioral bug fixes in ofrak_ghidra and ofrak_pyghidra
  CHANGELOGs (stderr capture, decompilation error handling, ISA error)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The assert claimed program_file was "guaranteed by earlier logic" but
nothing guaranteed it — passing None without memory_regions would just
crash inside pyghidra. Add an explicit ValueError guard instead.

Also fix review findings:
- Fix InstructionInfo TypedDict: instr_mode is NotRequired (code uses .get() with default)
- Move PyGhidraComponentException to top-level import (module already imported)
- Fix pre-existing CHANGELOG version: 1.0.0 → 0.1.0 to match setup.py
- Fix CHANGELOG categories: split Changed into Added/Fixed per Keep a Changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ANogin pushed a commit that referenced this pull request Feb 14, 2026
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