Repository navigation
refactor: remove dynamic seam Any typing - #284
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR systematically replaces loose Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
## Summary - Remove the remaining explicit first-party `Any` typing from `polylogue/` and `devtools/` dynamic seam modules. - Replace loose dynamic boundaries with protocol, typed-dict, JSON document, callable, and explicit cast contracts where runtime APIs are inherently dynamic. - Tighten benchmark artifact rows, schema validation inputs, tree-sitter extraction, logging, click option decorators, runtime copy/update helpers, QA capture helpers, and facade console protocols. ## Problem The mypy/refactor campaign had shrunk broad typing debt, but several boundary files still encoded dynamic behavior as explicit `Any`. That left strict checking less meaningful exactly at the seams where provider payloads, click decorators, rich progress IDs, benchmark JSON, schema documents, and logging adapters cross typed code. Ref #281 ## Solution - Introduced typed artifact records for benchmark campaign output and narrowed JSON payload parsing through explicit numeric helpers. - Reworked schema/devtools JSON handling to use `JSONDocument` constructors and validation helpers instead of unchecked dictionaries. - Replaced loose CLI/runtime surface typing with `Callable[..., object]`, protocol-based logger/console contracts, type-only imports, and localized casts for third-party dynamic values. - Updated tests to assert through the same typed JSON and benchmark artifact contracts. ## Verification - `ruff format tests/unit/devtools/test_benchmark_campaign.py devtools/benchmark_campaign.py polylogue/cli/machine_main.py polylogue/cli/run_observers.py polylogue/schemas/validator.py tests/unit/core/test_schema_validation.py` - `ruff check tests/unit/devtools/test_benchmark_campaign.py devtools/benchmark_campaign.py polylogue/cli/machine_main.py polylogue/cli/run_observers.py polylogue/schemas/validator.py tests/unit/core/test_schema_validation.py` - `mypy tests/unit/core/test_schema_validation.py tests/unit/core/test_filters_schemas.py tests/unit/cli/test_run_laws.py tests/unit/cli/test_machine_main.py tests/unit/devtools/test_benchmark_campaign.py polylogue/schemas/validator.py polylogue/cli/machine_main.py polylogue/cli/run_observers.py devtools/benchmark_campaign.py` - `pytest -q tests/unit/cli/test_machine_main.py tests/unit/cli/test_qa_requests.py tests/unit/cli/test_qa_finalization.py tests/unit/cli/test_run_laws.py tests/unit/core/test_schema_validation.py tests/unit/core/test_filters_schemas.py tests/unit/core/test_code_detection.py tests/unit/devtools/test_scenario_coverage.py tests/unit/devtools/test_artifact_graph.py tests/unit/devtools/test_benchmark_campaign.py tests/unit/core/test_config.py` - `PATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quick` - `PATH=/tmp/polylogue-281/.cache/codex-bin:$PATH git push -u origin feature/refactor/dynamic-seam-contracts`
The mypy/refactor campaign had shrunk broad typing debt, but several boundary files still encoded dynamic behavior as explicit `Any`. Strict checking was less meaningful exactly at the seams where provider payloads, Click decorators, Rich progress IDs, benchmark JSON, schema documents, and logging adapters cross typed code. Replaces loose dynamic boundaries with protocol, TypedDict, JSON document, callable, and explicit cast contracts where runtime APIs are inherently dynamic. Introduces typed artifact records for benchmark campaign output and narrows JSON payload parsing through explicit numeric helpers. Reworks schema/devtools JSON handling to use `JSONDocument` constructors and validation helpers instead of unchecked dictionaries. Replaces loose CLI/runtime surface typing with `Callable[..., object]`, protocol-based logger/console contracts, type-only imports, and localized casts for third-party dynamic values. Tightens benchmark artifact rows, schema validation inputs, tree-sitter extraction, logging, click option decorators, runtime copy/update helpers, QA capture helpers, and facade console protocols. Verification: ruff + mypy + pytest over CLI, schema validation, benchmark, and artifact-graph suites; devtools verify --quick green. Ref #281
The mypy/refactor campaign had shrunk broad typing debt, but several boundary files still encoded dynamic behavior as explicit `Any`. Strict checking was less meaningful exactly at the seams where provider payloads, Click decorators, Rich progress IDs, benchmark JSON, schema documents, and logging adapters cross typed code. Replaces loose dynamic boundaries with protocol, TypedDict, JSON document, callable, and explicit cast contracts where runtime APIs are inherently dynamic. Introduces typed artifact records for benchmark campaign output and narrows JSON payload parsing through explicit numeric helpers. Reworks schema/devtools JSON handling to use `JSONDocument` constructors and validation helpers instead of unchecked dictionaries. Replaces loose CLI/runtime surface typing with `Callable[..., object]`, protocol-based logger/console contracts, type-only imports, and localized casts for third-party dynamic values. Tightens benchmark artifact rows, schema validation inputs, tree-sitter extraction, logging, click option decorators, runtime copy/update helpers, QA capture helpers, and facade console protocols. Verification: ruff + mypy + pytest over CLI, schema validation, benchmark, and artifact-graph suites; devtools verify --quick green. Ref #281
The mypy/refactor campaign had shrunk broad typing debt, but several boundary files still encoded dynamic behavior as explicit `Any`. Strict checking was less meaningful exactly at the seams where provider payloads, Click decorators, Rich progress IDs, benchmark JSON, schema documents, and logging adapters cross typed code. Replaces loose dynamic boundaries with protocol, TypedDict, JSON document, callable, and explicit cast contracts where runtime APIs are inherently dynamic. Introduces typed artifact records for benchmark campaign output and narrows JSON payload parsing through explicit numeric helpers. Reworks schema/devtools JSON handling to use `JSONDocument` constructors and validation helpers instead of unchecked dictionaries. Replaces loose CLI/runtime surface typing with `Callable[..., object]`, protocol-based logger/console contracts, type-only imports, and localized casts for third-party dynamic values. Tightens benchmark artifact rows, schema validation inputs, tree-sitter extraction, logging, click option decorators, runtime copy/update helpers, QA capture helpers, and facade console protocols. Verification: ruff + mypy + pytest over CLI, schema validation, benchmark, and artifact-graph suites; devtools verify --quick green. Ref #281
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ 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
Anytyping frompolylogue/anddevtools/dynamic seam modules.Problem
The mypy/refactor campaign had shrunk broad typing debt, but several boundary files still encoded dynamic behavior as explicit
Any. That left strict checking less meaningful exactly at the seams where provider payloads, click decorators, rich progress IDs, benchmark JSON, schema documents, and logging adapters cross typed code.Ref #281
Solution
JSONDocumentconstructors and validation helpers instead of unchecked dictionaries.Callable[..., object], protocol-based logger/console contracts, type-only imports, and localized casts for third-party dynamic values.Verification
ruff format tests/unit/devtools/test_benchmark_campaign.py devtools/benchmark_campaign.py polylogue/cli/machine_main.py polylogue/cli/run_observers.py polylogue/schemas/validator.py tests/unit/core/test_schema_validation.pyruff check tests/unit/devtools/test_benchmark_campaign.py devtools/benchmark_campaign.py polylogue/cli/machine_main.py polylogue/cli/run_observers.py polylogue/schemas/validator.py tests/unit/core/test_schema_validation.pymypy tests/unit/core/test_schema_validation.py tests/unit/core/test_filters_schemas.py tests/unit/cli/test_run_laws.py tests/unit/cli/test_machine_main.py tests/unit/devtools/test_benchmark_campaign.py polylogue/schemas/validator.py polylogue/cli/machine_main.py polylogue/cli/run_observers.py devtools/benchmark_campaign.pypytest -q tests/unit/cli/test_machine_main.py tests/unit/cli/test_qa_requests.py tests/unit/cli/test_qa_finalization.py tests/unit/cli/test_run_laws.py tests/unit/core/test_schema_validation.py tests/unit/core/test_filters_schemas.py tests/unit/core/test_code_detection.py tests/unit/devtools/test_scenario_coverage.py tests/unit/devtools/test_artifact_graph.py tests/unit/devtools/test_benchmark_campaign.py tests/unit/core/test_config.pyPATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quickPATH=/tmp/polylogue-281/.cache/codex-bin:$PATH git push -u origin feature/refactor/dynamic-seam-contracts