Repository navigation
refactor: promote schema relation and core test contracts - #285
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 37 minutes and 25 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches🧪 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 - Promote schema relation targets from a dynamic `_ref_target` attribute into the typed `FieldStats.ref_target` contract. - Replace several source-side `type: ignore` suppressions with explicit protocols, casts, or version-gated imports. - Remove explicit `Any` from core config, privacy, schema validation, field stats, JSON, annotation, and version test files. ## Problem The previous mypy cleanup removed the broad exclusion list and explicit first-party `Any` from source modules, but a few source suppressions still represented real internal concepts rather than unavoidable dynamic boundaries. Core tests also still had substantial fixture/callback `Any` usage, making the test suite less useful as documentation of the typed contracts it exercises. Ref #281 ## Solution - Added `FieldStats.ref_target` and updated relation detection, annotation generation, and relation tests to use the typed field directly. - Replaced source suppressions around Rich progress, structlog stderr proxying, Pydantic schema handler access, and TOML loading with explicit typed boundaries. - Retained only the source suppressions that still reflect valid external/dynamic constraints: untyped `dateparser` and dataclass `replace` over the fluent query-plan builder. - Typed core test fixtures and helpers with `Path`, `pytest.MonkeyPatch`, protocols, callable aliases, `JSONDocument`, and Hypothesis `DataObject`. ## Verification - `pytest -q tests/unit/core/test_schema_relational_inference.py tests/unit/core/test_schema_annotation_contracts.py tests/unit/core/test_schema_generation.py tests/unit/core/test_schema_validation.py` - `pytest -q tests/unit/core/test_privacy_config.py tests/unit/core/test_config.py tests/unit/core/test_schema_validation.py` - `pytest -q tests/unit/core/test_json.py tests/unit/core/test_field_stats.py tests/unit/core/test_schema_annotation_contracts.py` - `pytest -q tests/unit/core/test_version.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/source-test-contract-cleanup`
Previous mypy cleanup removed the broad exclusion list and explicit first-party `Any` from source modules, but a few source suppressions still represented real internal concepts rather than unavoidable dynamic boundaries. Core tests also still had substantial fixture/ callback `Any` usage, making the suite less useful as documentation of the typed contracts it exercises. Promotes `FieldStats.ref_target` from a dynamic `_ref_target` attribute into a typed field; relation detection, annotation generation, and relation tests use it directly. Replaces source suppressions around Rich progress, structlog stderr proxying, Pydantic schema handler access, and TOML loading with explicit typed boundaries. Retains only the source suppressions that still reflect valid external/dynamic constraints (untyped `dateparser`, dataclass `replace` over the fluent query-plan builder). Types core test fixtures and helpers with `Path`, `pytest.MonkeyPatch`, protocols, callable aliases, `JSONDocument`, and Hypothesis `DataObject`. Verification: pytest + mypy over schema relation/annotation/ generation/validation, privacy/config, json/field-stats, and version suites; devtools verify --quick green. Ref #281
Previous mypy cleanup removed the broad exclusion list and explicit first-party `Any` from source modules, but a few source suppressions still represented real internal concepts rather than unavoidable dynamic boundaries. Core tests also still had substantial fixture/ callback `Any` usage, making the suite less useful as documentation of the typed contracts it exercises. Promotes `FieldStats.ref_target` from a dynamic `_ref_target` attribute into a typed field; relation detection, annotation generation, and relation tests use it directly. Replaces source suppressions around Rich progress, structlog stderr proxying, Pydantic schema handler access, and TOML loading with explicit typed boundaries. Retains only the source suppressions that still reflect valid external/dynamic constraints (untyped `dateparser`, dataclass `replace` over the fluent query-plan builder). Types core test fixtures and helpers with `Path`, `pytest.MonkeyPatch`, protocols, callable aliases, `JSONDocument`, and Hypothesis `DataObject`. Verification: pytest + mypy over schema relation/annotation/ generation/validation, privacy/config, json/field-stats, and version suites; devtools verify --quick green. Ref #281
Previous mypy cleanup removed the broad exclusion list and explicit first-party `Any` from source modules, but a few source suppressions still represented real internal concepts rather than unavoidable dynamic boundaries. Core tests also still had substantial fixture/ callback `Any` usage, making the suite less useful as documentation of the typed contracts it exercises. Promotes `FieldStats.ref_target` from a dynamic `_ref_target` attribute into a typed field; relation detection, annotation generation, and relation tests use it directly. Replaces source suppressions around Rich progress, structlog stderr proxying, Pydantic schema handler access, and TOML loading with explicit typed boundaries. Retains only the source suppressions that still reflect valid external/dynamic constraints (untyped `dateparser`, dataclass `replace` over the fluent query-plan builder). Types core test fixtures and helpers with `Path`, `pytest.MonkeyPatch`, protocols, callable aliases, `JSONDocument`, and Hypothesis `DataObject`. Verification: pytest + mypy over schema relation/annotation/ generation/validation, privacy/config, json/field-stats, and version suites; devtools verify --quick green. Ref #281
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ 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
_ref_targetattribute into the typedFieldStats.ref_targetcontract.type: ignoresuppressions with explicit protocols, casts, or version-gated imports.Anyfrom core config, privacy, schema validation, field stats, JSON, annotation, and version test files.Problem
The previous mypy cleanup removed the broad exclusion list and explicit first-party
Anyfrom source modules, but a few source suppressions still represented real internal concepts rather than unavoidable dynamic boundaries. Core tests also still had substantial fixture/callbackAnyusage, making the test suite less useful as documentation of the typed contracts it exercises.Ref #281
Solution
FieldStats.ref_targetand updated relation detection, annotation generation, and relation tests to use the typed field directly.dateparserand dataclassreplaceover the fluent query-plan builder.Path,pytest.MonkeyPatch, protocols, callable aliases,JSONDocument, and HypothesisDataObject.Verification
pytest -q tests/unit/core/test_schema_relational_inference.py tests/unit/core/test_schema_annotation_contracts.py tests/unit/core/test_schema_generation.py tests/unit/core/test_schema_validation.pypytest -q tests/unit/core/test_privacy_config.py tests/unit/core/test_config.py tests/unit/core/test_schema_validation.pypytest -q tests/unit/core/test_json.py tests/unit/core/test_field_stats.py tests/unit/core/test_schema_annotation_contracts.pypytest -q tests/unit/core/test_version.pyPATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quickPATH=/tmp/polylogue-281/.cache/codex-bin:$PATH git push -u origin feature/refactor/source-test-contract-cleanup