← Back to issue list

fix(pack): avoid mypy no-any-return in _part_num()

View original Github issue

Metadata

Project
imagecraft
Number
#452
Type
pull request
State
closed
Author
jahn-junior
Labels
—
Created
Updated
Closed

Current evaluation

PR #452 merged as commit fbcd40d, adding an explicit int | None annotation in _part_num() to prevent mypy no-any-return without changing behavior.

Resolution: closed resolved

Reason: Repository history contains commit fbcd40d with the title “fix(pack): avoid mypy no-any-return in _part_num() (#452)”, confirming the PR landed.

Evaluated by: mr-cal-bot

No scores available.

Issue body

## What `_part_num()` in `imagecraft/pack/grubutil.py` uses `getattr(structure_item, "number", None)` because the `number` field is only defined on `GPTStructureItem`, not the shared `StructureItem` base used across the `StructureList` union (`GPTStructureList | MBRStructureList | HybridStructureList`). Without an explicit annotation, mypy infers `Any` for the `getattr()` result, which trips `no-any-return` when it's returned from a function declared to return `int | None`. ## Why a separate PR This is a pre-existing mypy finding on `main`, unrelated to the `work/starbase/IMAGECRAFT-197` Starbase merge (PR #449) — it was noticed while validating that merge, but the bug and fix exist independently of it. Per the `update-starbase` skill's preparation-PR rules, unrelated pre-existing issues get their own PR rather than being bundled into the merge PR. ## Change Annotate the local variable (`explicit: int | None = ...`) so mypy narrows the `getattr()` result to the function's actual return type instead of inferring `Any`. No behavior change. ## Validation - `make format` - `make lint` (includes mypy) - `make test-fast` 🤖 [BEEP BOOP, A BOT WROTE THIS COMMENT - Claude Sonnet 4.5, GitHub Copilot Chat]

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved PR #452 merged as commit fbcd40d, adding an explicit int | None annotation in _part_num() to prevent mypy no-any-return without changing behavior.
stealth/space-bunny-alpha — closed stale PR #452 proposed a one-line mypy type annotation for _part_num(), but was closed unmerged with no recorded resolution and several CI checks still pending.
stealth/space-bunny-alpha
Impact: 8
Quick Win: 7
Complexity: 3
Confidence: 98
Actionability: 91
needs review Adds an explicit int | None annotation in _part_num to satisfy mypy without changing behavior. CI has no failures; build, snap-build, and OSV jobs remain pending.

Update history

Date Change
closed
updated
created

Related issues

No related issues found above the similarity threshold.