Repository navigation
test: type cli command contracts - #289
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 13 minutes and 0 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 (11)
✨ 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 - Replace dynamic test annotations across 11 CLI command-contract files with concrete fixture, path, runner, JSON, and generated-case types. - Type CLI property-test case inputs from the existing strategy dataclasses instead of treating them as unstructured values. - Add explicit JSON result narrowing helpers where CLI envelopes intentionally return object-shaped decoded payloads. ## Problem The mypy cleanup campaign still had broad `Any` use in CLI tests. These files cover command routing, JSON envelopes, reset behavior, runtime health, query execution laws, and embed command contracts, but dynamic annotations hid fixture and payload contract drift. ## Solution Typed the CLI test surfaces around existing shared fixtures (`dict[str, Path]`, `CliRunner`, `pytest.MonkeyPatch`, `pytest.CaptureFixture[str]`, `ConversationRepository`) and existing strategy case dataclasses. Where decoded JSON carries mixed payloads, tests now narrow result objects explicitly before indexing. Ref #281 ## Verification - `ruff check tests/unit/cli/test_embed.py tests/unit/cli/test_analytics.py tests/unit/cli/test_check_runtime.py tests/unit/cli/test_auth.py tests/unit/cli/test_run_int.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_reset.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_qa.py tests/unit/cli/test_terminal_snapshots.py` - `mypy tests/unit/cli/test_embed.py tests/unit/cli/test_analytics.py tests/unit/cli/test_check_runtime.py tests/unit/cli/test_auth.py tests/unit/cli/test_run_int.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_reset.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_qa.py tests/unit/cli/test_terminal_snapshots.py` - `pytest -q tests/unit/cli/test_embed.py tests/unit/cli/test_analytics.py tests/unit/cli/test_check_runtime.py tests/unit/cli/test_auth.py tests/unit/cli/test_run_int.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_reset.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_qa.py tests/unit/cli/test_terminal_snapshots.py` - `PATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quick`
CLI tests covering command routing, JSON envelopes, reset behavior, runtime health, query execution laws, and embed command contracts still had broad `Any` use. Dynamic annotations hid fixture and payload contract drift. Replaces dynamic test annotations across 11 CLI command-contract files with concrete fixture, path, runner, JSON, and generated-case types. Types the test surfaces around existing shared fixtures (`dict[str, Path]`, `CliRunner`, `pytest.MonkeyPatch`, `pytest.CaptureFixture[str]`, `ConversationRepository`) and existing strategy case dataclasses. Where decoded JSON carries mixed payloads, tests now narrow result objects explicitly before indexing. Types CLI property-test case inputs from the existing strategy dataclasses instead of treating them as unstructured values; adds explicit JSON result narrowing helpers where CLI envelopes intentionally return object-shaped decoded payloads. Verification: ruff + mypy + pytest over the 11 touched CLI test files; devtools verify --quick green. Ref #281
CLI tests covering command routing, JSON envelopes, reset behavior, runtime health, query execution laws, and embed command contracts still had broad `Any` use. Dynamic annotations hid fixture and payload contract drift. Replaces dynamic test annotations across 11 CLI command-contract files with concrete fixture, path, runner, JSON, and generated-case types. Types the test surfaces around existing shared fixtures (`dict[str, Path]`, `CliRunner`, `pytest.MonkeyPatch`, `pytest.CaptureFixture[str]`, `ConversationRepository`) and existing strategy case dataclasses. Where decoded JSON carries mixed payloads, tests now narrow result objects explicitly before indexing. Types CLI property-test case inputs from the existing strategy dataclasses instead of treating them as unstructured values; adds explicit JSON result narrowing helpers where CLI envelopes intentionally return object-shaped decoded payloads. Verification: ruff + mypy + pytest over the 11 touched CLI test files; devtools verify --quick green. Ref #281
CLI tests covering command routing, JSON envelopes, reset behavior, runtime health, query execution laws, and embed command contracts still had broad `Any` use. Dynamic annotations hid fixture and payload contract drift. Replaces dynamic test annotations across 11 CLI command-contract files with concrete fixture, path, runner, JSON, and generated-case types. Types the test surfaces around existing shared fixtures (`dict[str, Path]`, `CliRunner`, `pytest.MonkeyPatch`, `pytest.CaptureFixture[str]`, `ConversationRepository`) and existing strategy case dataclasses. Where decoded JSON carries mixed payloads, tests now narrow result objects explicitly before indexing. Types CLI property-test case inputs from the existing strategy dataclasses instead of treating them as unstructured values; adds explicit JSON result narrowing helpers where CLI envelopes intentionally return object-shaped decoded payloads. Verification: ruff + mypy + pytest over the 11 touched CLI test files; devtools verify --quick green. Ref #281
|
@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
Problem
The mypy cleanup campaign still had broad
Anyuse in CLI tests. These files cover command routing, JSON envelopes, reset behavior, runtime health, query execution laws, and embed command contracts, but dynamic annotations hid fixture and payload contract drift.Solution
Typed the CLI test surfaces around existing shared fixtures (
dict[str, Path],CliRunner,pytest.MonkeyPatch,pytest.CaptureFixture[str],ConversationRepository) and existing strategy case dataclasses. Where decoded JSON carries mixed payloads, tests now narrow result objects explicitly before indexing.Ref #281
Verification
ruff check tests/unit/cli/test_embed.py tests/unit/cli/test_analytics.py tests/unit/cli/test_check_runtime.py tests/unit/cli/test_auth.py tests/unit/cli/test_run_int.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_reset.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_qa.py tests/unit/cli/test_terminal_snapshots.pymypy tests/unit/cli/test_embed.py tests/unit/cli/test_analytics.py tests/unit/cli/test_check_runtime.py tests/unit/cli/test_auth.py tests/unit/cli/test_run_int.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_reset.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_qa.py tests/unit/cli/test_terminal_snapshots.pypytest -q tests/unit/cli/test_embed.py tests/unit/cli/test_analytics.py tests/unit/cli/test_check_runtime.py tests/unit/cli/test_auth.py tests/unit/cli/test_run_int.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_reset.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_query_exec_laws.py tests/unit/cli/test_qa.py tests/unit/cli/test_terminal_snapshots.pyPATH=/tmp/polylogue-281/.cache/codex-bin:$PATH devtools verify --quick