chore: fix ruff, mypy, and pyright findings ahead of Starbase merge
Metadata
Current evaluation
Closed unmerged without a recorded replacement or maintainer explanation; the proposed Ruff, mypy, and pyright cleanup was not landed.
Resolution: closed stale
Reason: The PR was closed with review still pending and no comments. No resolving commit, merged PR, or superseding reference was recorded.
Evaluated by: mr-cal-bot
No scores available.
Issue body
## Why
The upcoming Starbase merge wires `mypy` and `pyright` into `make lint` for the first time (currently only `ruff` runs). This PR fixes the findings those tools surface on `main` today, so the merge itself lands with a clean lint run instead of bundling unrelated fixes into that already-large change.
## What
- Move type-only imports under `TYPE_CHECKING` across several modules (`application/commands/init.py`, `application/main.py`, `services/analysis.py`, `services/charmlibs.py`, `services/init.py`, `services/package.py`, `services/provider.py`, `services/store.py`)
- Minor ruff-style cleanups (loops → comprehensions, redundant `.startswith()` calls merged, relative → absolute import)
- Fix a real bug pyright caught: `Release.expires_at` was typed as non-optional `datetime` but is assigned `None` in `store/store.py`
- Add a missing `list[LibData]` annotation in `utils/charmlibs.py` needed after a ruff autofix
- Drop 7 stale `[tool.mypy.overrides]` entries in `pyproject.toml` for modules that no longer exist
- Keep existing `# noqa: PLW1641` suppressions (still required under `main`'s current ruff config)
## Validation
- `ruff check` / `ruff format --check`: clean
- `mypy charmcraft`: `Success: no issues found in 70 source files`
- `pyright charmcraft`: 0 errors (12 pre-existing, out-of-scope `reportIncompatibleVariableOverride` warnings in `models/project.py` left untouched)
- `pytest tests/unit`: passes except 2 pre-existing, environment-specific failure categories confirmed unrelated (verified against unmodified `main`): a store-login test that detects real local credentials, and 5 tests requiring an `apt` package backend unavailable in this environment
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed stale | Closed unmerged without a recorded replacement or maintainer explanation; the proposed Ruff, mypy, and pyright cleanup was not landed. | |
| stealth/space-bunny-alpha | — | closed stale | Closed unmerged with no replacement or maintainer explanation; review remained pending and lint/OSV checks were failing. | |
| stealth/space-bunny-alpha | — | closed stale | PR #2892 was closed unmerged without a replacement or maintainer explanation; review remained pending and lint/OSV checks were unsuccessful. | |
| stealth/space-bunny-alpha | — | closed stale | PR #2896 was closed without a recorded merge, superseding change, or maintainer explanation; review remained pending and OSV failed. | |
| stealth/space-bunny-alpha |
Impact:
39
Quick Win:
17
Complexity:
32
Confidence:
88
Actionability:
65
|
needs review | Prepares Charmcraft for the Starbase merge by fixing Ruff, mypy, and Pyright findings and correcting Release.expires_at’s optional type; review is pending, OSV-Scanner is failing, and several tests are still running. |
Update history
| Date | Change |
|---|---|
| closed | |
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2896 chore: fix ruff, mypy, and pyright findings ahead of Starbase merge | charmcraft | closed | PR #2896 was closed unmerged with no replacement; lint and OSV checks remained failing and review was still pending. | |
| #568 chore(linter): rebase on starbase linters config | craft-parts | closed | Closed unmerged after review requests; the Starbase Ruff migration was subsequently implemented more narrowly by PR #580 in commit 111c8907. | |
| #574 chore(linter): rebase on starbase linters config | craft-parts | closed | Closed unmerged for redo; the narrower Starbase Ruff migration landed in #580 (111c8907), with autofixes in #581 (30b73d97). | |
| #103 chore: fix new lints from ruff 0.12 | craft-grammar | merged | Merged PR #103 as a3ef1dd, updating Ruff to 0.12 and fixing resulting lint errors across four files; cherry-picked from canonical/starbase#409. | |
| #237 chore(merge): update starbase (2026-07-14) | craft-archives | closed | PR #237 was closed unmerged after failing CI checks and leaving 29 review comments unresolved; no resolving commit was identified. | |
| #865 chore(merge): starbase into main | rockcraft | merged | Merged starbase into main via PR #865 (commit 93f70f62); the reported pyright failure was confirmed to pre-exist on clean main. |