Repository navigation
chore: clean 4 mypy-excluded files with shadowing/untyped-self patterns - #206
Conversation
Annotate four files held out of the mechanical mypy pass in #205 because straightforward `dict[str, Any]` / `self: Any` sprays surfaced design friction: - polylogue/lib/filters.py: ConversationFilter.list() shadows the builtin in its own return annotation. Resolved by referencing `builtins.list[...]` for the three methods that return lists. The three return-type annotations point at Conversation / ConversationSummary, deferred-imported under TYPE_CHECKING; calls into polylogue.lib.query_plan_execution still land in excluded territory and carry localized `# type: ignore[no-any-return]` markers that can drop once that module is cleaned. - polylogue/schemas/operator_annotations.py: JSON-schema walker. Use `dict[str, Any]` consistent with audit_walkers.py and audit_checks.py. - polylogue/schemas/synthetic/build_records.py and build_wire_formats.py: module-level functions bound onto SyntheticCorpus via class-body assignment. Adopt `self: Any` pattern already used in polylogue/schemas/synthetic/runtime.py plus `dict[str, Any]` for payloads. Gate grows from 385 → 389 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 selected for processing (5)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe pull request enhances type safety across the polylogue library by adding explicit type annotations to previously untyped or loosely-typed methods, properties, and function parameters. Four modules receive tighter type hints using standard library types and generics (e.g., 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 |
…ns (#206) ## Summary - Four files held out of the #205 mechanical tier surfaced non-trivial annotation issues. This PR resolves each and removes them from the mypy `exclude`. - Gate grows from 385 → 389 files checked under `mypy --strict`. ## Problem During the #205 mechanical sweep I skipped four files where straight `dict[str, Any]` / `self: Any` sprays either failed or exposed design cruft: 1. `polylogue/lib/filters.py` — `ConversationFilter.list()` shadows the builtin in its own return annotation. `async def list(self) -> list[Conversation]:` fails because `list` in that scope resolves to the method, not the builtin. 2. `polylogue/schemas/operator_annotations.py` — JSON-schema walkers with untyped `dict` parameters. 3. `polylogue/schemas/synthetic/build_records.py` and `build_wire_formats.py` — module-level helpers bound to `SyntheticCorpus` via class-body assignment (`_generate_tree_json = _generate_tree_json`), with untyped `self` and `dict` parameters. ## Solution - `filters.py`: reference `builtins.list[Conversation]` / `builtins.list[ConversationSummary]` for the three methods that return lists and share the name. Add typed property returns for `_since_date`, `_until_date`, `_continuation`, `_sidechain`, `_has_branches`. Localized `# type: ignore[no-any-return]` on three call-sites that cross into `polylogue.lib.query_plan_execution` (still in the exclude list — these markers drop naturally when that module is cleaned). - `operator_annotations.py`: adopt `dict[str, Any]` consistent with sibling `polylogue/schemas/audit_walkers.py` and `audit_checks.py`. - `build_records.py`, `build_wire_formats.py`: adopt `self: Any` pattern already present in `polylogue/schemas/synthetic/runtime.py`, plus `dict[str, Any]` for JSON payloads. ## Verification Commands run: - `nix develop -c mypy --config-file pyproject.toml polylogue/` — `Success: no issues found in 389 source files` - `nix develop -c devtools verify --quick` — all checks passed (format, lint, mypy, render-all --check) - `git push` — pre-push hook (`devtools verify --quick`) passed Full `devtools verify` including pytest deferred to CI (local btrfs metadata pressure, unrelated to this change). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ns (#206) Four files held out of the #205 mechanical sweep because straight `dict[str, Any]` / `self: Any` sprays either failed or exposed design cruft. `lib/filters.py`: `ConversationFilter.list()` shadowed the builtin in its own return annotation (`async def list(self) -> list[Conversation]` resolves `list` to the method, not the type). Reference `builtins.list[...]` on the three methods that return lists and share the name. Add typed property returns for the `_since_date` / `_until_date` / `_continuation` / `_sidechain` / `_has_branches` accessors. `schemas/operator_annotations.py`: adopt `dict[str, Any]` consistent with sibling `audit_walkers.py` and `audit_checks.py`. `schemas/synthetic/build_records.py` and `build_wire_formats.py`: adopt `self: Any` pattern already present in `runtime.py`, plus `dict[str, Any]` for JSON payloads. Gate grows from 385 → 389 files. Verification: mypy clean on 389 files; devtools verify --quick green.
…ns (#206) Four files held out of the #205 mechanical sweep because straight `dict[str, Any]` / `self: Any` sprays either failed or exposed design cruft. `lib/filters.py`: `ConversationFilter.list()` shadowed the builtin in its own return annotation (`async def list(self) -> list[Conversation]` resolves `list` to the method, not the type). Reference `builtins.list[...]` on the three methods that return lists and share the name. Add typed property returns for the `_since_date` / `_until_date` / `_continuation` / `_sidechain` / `_has_branches` accessors. `schemas/operator_annotations.py`: adopt `dict[str, Any]` consistent with sibling `audit_walkers.py` and `audit_checks.py`. `schemas/synthetic/build_records.py` and `build_wire_formats.py`: adopt `self: Any` pattern already present in `runtime.py`, plus `dict[str, Any]` for JSON payloads. Gate grows from 385 → 389 files. Verification: mypy clean on 389 files; devtools verify --quick green.
…ns (#206) Four files held out of the #205 mechanical sweep because straight `dict[str, Any]` / `self: Any` sprays either failed or exposed design cruft. `lib/filters.py`: `ConversationFilter.list()` shadowed the builtin in its own return annotation (`async def list(self) -> list[Conversation]` resolves `list` to the method, not the type). Reference `builtins.list[...]` on the three methods that return lists and share the name. Add typed property returns for the `_since_date` / `_until_date` / `_continuation` / `_sidechain` / `_has_branches` accessors. `schemas/operator_annotations.py`: adopt `dict[str, Any]` consistent with sibling `audit_walkers.py` and `audit_checks.py`. `schemas/synthetic/build_records.py` and `build_wire_formats.py`: adopt `self: Any` pattern already present in `runtime.py`, plus `dict[str, Any]` for JSON payloads. Gate grows from 385 → 389 files. Verification: mypy clean on 389 files; devtools verify --quick green.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ 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
exclude.mypy --strict.Problem
During the #205 mechanical sweep I skipped four files where straight
dict[str, Any]/self: Anysprays either failed or exposed design cruft:polylogue/lib/filters.py—ConversationFilter.list()shadows the builtin in its own return annotation.async def list(self) -> list[Conversation]:fails becauselistin that scope resolves to the method, not the builtin.polylogue/schemas/operator_annotations.py— JSON-schema walkers with untypeddictparameters.polylogue/schemas/synthetic/build_records.pyandbuild_wire_formats.py— module-level helpers bound toSyntheticCorpusvia class-body assignment (_generate_tree_json = _generate_tree_json), with untypedselfanddictparameters.Solution
filters.py: referencebuiltins.list[Conversation]/builtins.list[ConversationSummary]for the three methods that return lists and share the name. Add typed property returns for_since_date,_until_date,_continuation,_sidechain,_has_branches. Localized# type: ignore[no-any-return]on three call-sites that cross intopolylogue.lib.query_plan_execution(still in the exclude list — these markers drop naturally when that module is cleaned).operator_annotations.py: adoptdict[str, Any]consistent with siblingpolylogue/schemas/audit_walkers.pyandaudit_checks.py.build_records.py,build_wire_formats.py: adoptself: Anypattern already present inpolylogue/schemas/synthetic/runtime.py, plusdict[str, Any]for JSON payloads.Verification
Commands run:
nix develop -c mypy --config-file pyproject.toml polylogue/—Success: no issues found in 389 source filesnix develop -c devtools verify --quick— all checks passed (format, lint, mypy, render-all --check)git push— pre-push hook (devtools verify --quick) passedFull
devtools verifyincluding pytest deferred to CI (local btrfs metadata pressure, unrelated to this change).🤖 Generated with Claude Code