Repository navigation
test(cli): guard destructive action contracts (#1816) - #1946
Conversation
Problem: #1816 still needed behavioral coverage that ties declared write/destructive action guards to public CLI outcomes, not only registry shape checks. Without that, a guard name could stay declared while the command behavior drifted. What changed: Add contract-bound CLI tests for delete confirmation/dry-run/cardinality behavior and import missing-path rejection. Each behavioral assertion first verifies the relevant CliActionContract guard name is still declared, so contract and behavior drift fail together. Verification: devtools test tests/unit/cli/test_cli_action_contracts.py tests/unit/cli/test_import.py tests/unit/cli/test_verb_cardinality.py -q; devtools verify --quick.
|
Warning Review limit reached
More reviews will be available in 24 minutes and 15 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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
Adds behavioral guard coverage for destructive/write CLI action contracts.
Problem
#1941 declared guards on public action contracts, but #1816 still needed public-behavior tests proving declared write/destructive guards are actually enforced instead of only documented in the registry.
Solution
Extended the CLI action-contract tests with guard-name assertions and public CLI behavior checks for delete and import. The tests bind behavior to declared contract guard names so contract drift is caught when a guard is declared but no longer enforced.
Issue slice: behavioral guard tests for write/destructive action contracts.
Files inspected:
polylogue/cli/action_contracts.py, delete/mark/import command tests, verb-cardinality tests.Files changed:
tests/unit/cli/test_cli_action_contracts.py.Old surface removed or retained: retained existing action-contract and output-assurance surfaces.
Contracts/tests added: guard-bound tests for
delete(dry_run_or_yes_required,single_match_unless_all) andimport(path_exists_or_demo).Generated artifacts updated: none.
Known caveats / SPEC_MISMATCH: no SPEC_MISMATCH; broader guard coverage remains open.
Follow-up intentionally not included:
markguard coverage, daemon acceptance for import, config secret redaction, docs/help/completion metadata, and #1818 machine-envelope/schema checks.Verification
devtools test tests/unit/cli/test_cli_action_contracts.py tests/unit/cli/test_import.py tests/unit/cli/test_verb_cardinality.py -q-> 54 passed, with two existing coroutine warnings intest_verb_cardinality.py.devtools verify --quick-> exit_code 0.Ref #1816