Repository navigation
chore: clean 3 single-error mypy files, add types-PyYAML stubs - #207
Conversation
Three files each carrying a single mypy error that the #205 mechanical pass did not resolve — now cleaned and removed from the exclude list. - polylogue/cli/commands/check.py: `_make_schema_progress_callback()` wrapper missing return annotation. Impl (`check_support.py`) returns Any; annotate wrapper as `-> Any` to match. - polylogue/mcp/server.py: `extract_fenced_code` was wrapped in a lambda with a default argument, which mypy could not infer against `Callable[[str, str], list[dict[str, str]]]`. The wrapper was pure forwarding — pass `_extract_fenced_code` directly. - polylogue/rendering/formatting.py: `import yaml` triggered `import-untyped` because stubs were absent. Add `types-PyYAML>=6.0` under the `[project.optional-dependencies] dev` extra and re-lock uv.lock. File itself needs no source change. Gate grows from 389 → 392 files checked under mypy --strict. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThree modules undergo type-checking improvements: Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
## Summary Three excluded files each carrying a single mypy error — cleaned and promoted into the gate. Gate grows from 389 → 392 files under `mypy --strict`. ## Problem From running mypy against the full exclude list, 29 files had exactly one reported error. These three resolved without cascade work: 1. `polylogue/cli/commands/check.py:96` — `_make_schema_progress_callback()` wrapper missing return annotation, but the underlying impl in `check_support.py` explicitly returns `Any`. 2. `polylogue/mcp/server.py:63` — `extract_fenced_code=lambda text, language="": _extract_fenced_code(text, language)`. Mypy could not infer the lambda against `Callable[[str, str], list[dict[str, str]]]` when a default argument was involved. 3. `polylogue/rendering/formatting.py:107` — `import yaml` raised `import-untyped` because PyYAML stubs were never declared. ## Solution - `check.py`: annotate the wrapper as `-> Any` to propagate the impl's declared return. - `server.py`: drop the forwarding lambda and pass `_extract_fenced_code` directly — signatures match exactly. - `pyproject.toml`: add `types-PyYAML>=6.0` to the `dev` extra. Re-lock `uv.lock`. The source file needed no change. ## Verification - `nix develop -c mypy --config-file pyproject.toml polylogue/` — `Success: no issues found in 392 source files` - `nix develop -c devtools verify --quick` — all checks passed (format, lint, mypy, render-all --check) - Pre-push hook (`devtools verify --quick`) passed Full `devtools verify` (with pytest) deferred to CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Three excluded files each carrying exactly one mypy error, cleaned without cascade work. `cli/commands/check.py`: `_make_schema_progress_callback()` wrapper missing return annotation; the underlying impl already returns `Any`. Annotate the wrapper as `-> Any`. `mcp/server.py`: `extract_fenced_code=lambda text, language="": _extract_fenced_code(text, language)` — mypy couldn't infer the lambda against the declared callable type with a default argument. Drop the forwarding lambda and pass `_extract_fenced_code` directly; signatures match. `rendering/formatting.py`: `import yaml` raised `import-untyped` because PyYAML stubs were never declared. Add `types-PyYAML>=6.0` to the dev extra; re-lock `uv.lock`. Source file unchanged. Gate grows from 389 → 392 files. Verification: mypy clean on 392 files; devtools verify --quick green.
Three excluded files each carrying exactly one mypy error, cleaned without cascade work. `cli/commands/check.py`: `_make_schema_progress_callback()` wrapper missing return annotation; the underlying impl already returns `Any`. Annotate the wrapper as `-> Any`. `mcp/server.py`: `extract_fenced_code=lambda text, language="": _extract_fenced_code(text, language)` — mypy couldn't infer the lambda against the declared callable type with a default argument. Drop the forwarding lambda and pass `_extract_fenced_code` directly; signatures match. `rendering/formatting.py`: `import yaml` raised `import-untyped` because PyYAML stubs were never declared. Add `types-PyYAML>=6.0` to the dev extra; re-lock `uv.lock`. Source file unchanged. Gate grows from 389 → 392 files. Verification: mypy clean on 392 files; devtools verify --quick green.
Three excluded files each carrying exactly one mypy error, cleaned without cascade work. `cli/commands/check.py`: `_make_schema_progress_callback()` wrapper missing return annotation; the underlying impl already returns `Any`. Annotate the wrapper as `-> Any`. `mcp/server.py`: `extract_fenced_code=lambda text, language="": _extract_fenced_code(text, language)` — mypy couldn't infer the lambda against the declared callable type with a default argument. Drop the forwarding lambda and pass `_extract_fenced_code` directly; signatures match. `rendering/formatting.py`: `import yaml` raised `import-untyped` because PyYAML stubs were never declared. Add `types-PyYAML>=6.0` to the dev extra; re-lock `uv.lock`. Source file unchanged. Gate grows from 389 → 392 files. Verification: mypy clean on 392 files; devtools verify --quick green.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Three excluded files each carrying a single mypy error — cleaned and promoted into the gate. Gate grows from 389 → 392 files under
mypy --strict.Problem
From running mypy against the full exclude list, 29 files had exactly one reported error. These three resolved without cascade work:
polylogue/cli/commands/check.py:96—_make_schema_progress_callback()wrapper missing return annotation, but the underlying impl incheck_support.pyexplicitly returnsAny.polylogue/mcp/server.py:63—extract_fenced_code=lambda text, language="": _extract_fenced_code(text, language). Mypy could not infer the lambda againstCallable[[str, str], list[dict[str, str]]]when a default argument was involved.polylogue/rendering/formatting.py:107—import yamlraisedimport-untypedbecause PyYAML stubs were never declared.Solution
check.py: annotate the wrapper as-> Anyto propagate the impl's declared return.server.py: drop the forwarding lambda and pass_extract_fenced_codedirectly — signatures match exactly.pyproject.toml: addtypes-PyYAML>=6.0to thedevextra. Re-lockuv.lock. The source file needed no change.Verification
nix develop -c mypy --config-file pyproject.toml polylogue/—Success: no issues found in 392 source filesnix develop -c devtools verify --quick— all checks passed (format, lint, mypy, render-all --check)devtools verify --quick) passedFull
devtools verify(with pytest) deferred to CI.🤖 Generated with Claude Code