chore: fix ruff, mypy, and pyright findings ahead of Starbase merge
Metadata
Current evaluation
PR #2896 was closed unmerged with no replacement; lint and OSV checks remained failing and review was still pending.
Resolution: closed stale
Reason: The PR was closed without a recorded maintainer rationale or replacement, while review remained pending and lint/OSV checks failed. No resolving commit or directly superseding Charmcraft PR was identified.
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 | PR #2896 was closed unmerged with no replacement; lint and OSV checks remained failing and review was still pending. | |
| stealth/space-bunny-alpha | — | closed stale | Closed unmerged with no recorded replacement or maintainer rationale; review remained pending and lint/OSV checks were failing. | |
| stealth/space-bunny-alpha | — | closed superseded | Closed unmerged in favor of canonical/charmcraft#2896, which carried the same Ruff, mypy, and pyright cleanup for the Starbase merge. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in canonical/charmcraft#2229 as 134e1cb6, fixing Ruff, mypy, and pyright findings before the Starbase merge, including optional typing for Release.expires_at. | |
| stealth/space-bunny-alpha |
Impact:
32
Quick Win:
8
Complexity:
36
Confidence:
74
Actionability:
38
|
needs review | Lint/type cleanup and an expires_at annotation fix; reported open and awaiting review, but lint and OSV checks fail and snap builds are pending (index data instead marks it closed). |
Update history
| Date | Change |
|---|---|
| closed | |
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2892 chore: fix ruff, mypy, and pyright findings ahead of Starbase merge | charmcraft | closed | Closed unmerged without a recorded replacement or maintainer explanation; the proposed Ruff, mypy, and pyright cleanup was not landed. | |
| #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. | |
| #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). | |
| #432 chore(merge): update starbase (2026-10-08) | craft-store | closed | Starbase sync PR closed without merging due to unresolved review comments and failing copilot-setup-steps CI check. | |
| #177 chore(merge): update starbase (2026-07-22) | debcraft | closed | Starbase merge PR #177 was closed unmerged because OSV-scanner failed; the maintainer confirmed main had the same issue and deferred a fresh merge PR. | |
| #238 chore(merge): update starbase (2026-07-16) | craft-archives | closed | PR #238 was closed unmerged after an external linkcheck timeout; its Starbase sync was later merged through replacement PR #252. | |
| #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. | |
| #14 chore: merge the latest starbase in | craft-grammar | closed | PR #14 was closed unmerged after review remained pending, with no approval or CI checks; its proposed Starbase merge was not delivered. | |
| #728 chore: switch to starbase | craft-providers | closed | Closed unmerged after review remained pending; the Starbase migration was later completed by #786/#787, with #787 merged as commit 808597b. |