Repository navigation
feat(cli): add public action contracts (#1816) - #1941
Conversation
Problem: #1816 needs executable CLI action contracts over the #1842 public floor instead of detached output-assurance checklisting. The first slice needs to stay code-coupled to Click and query grammar without broad proof-layer rewrites.\n\nWhat changed: add a lightweight CliActionContract registry for the v0 public floor, including the virtual find grammar marker and the current concrete ops paths. Add generated-style tests that compare the floor against live Click paths, verify find still parses as query intent, and reject unsupported JSON/NDJSON format claims. Regenerate topology docs for the new CLI module.\n\nCompatibility: output_assurance remains in place as a transitional internal surface; this commit does not remove or rename existing CLI commands.\n\nRef #1816
|
Warning Review limit reached
More reviews will be available in 44 minutes and 11 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 (4)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6633b85f2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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 Regenerates `docs/topology-status.md` after the #1940/#1941 batch merges left the generated count stale. ## Problem A post-merge `devtools verify --quick` on current master failed only `render-all --check`, with `render-topology-status` reporting `docs/topology-status.md out of sync`. ## Solution Ran `devtools render-topology-status` and committed the generated count update. ## Verification - Before fix: `devtools verify --quick` -> exit_code 1; only `render-all` failed due stale `docs/topology-status.md`. - After fix: `devtools verify --quick` -> exit_code 0.
…1944) ## Summary Makes the output-assurance report consume the new CLI action-contract registry by adding an action-contract coverage section. ## Problem #1941 added code-coupled action contracts, but `output_assurance.py` still reported only its older top-level command matrix. #1816 needs the old assurance layer to converge toward the contract spine rather than remain a parallel public vocabulary. ## Solution Added contract-derived coverage rows to output assurance, including an internal alias that maps virtual `find` grammar to the existing search assurance row. Regenerated CLI reference output for the new coverage table and added tests that prove the report reflects `ACTION_CONTRACTS`. Issue slice: contract-derived output assurance coverage. Files inspected: `polylogue/cli/output_assurance.py`, `polylogue/cli/action_contracts.py`, output assurance tests. Files changed: `polylogue/cli/output_assurance.py`, `tests/unit/cli/test_cli_output_assurance_matrix.py`, `docs/cli-reference.md`, `docs/topology-status.md`. Old surface removed or retained: retained output assurance as an internal adapter; this slice adds contract coverage rather than deleting the old registry. Contracts/tests added: action-contract coverage in the assurance report, including virtual `find` mapping. Generated artifacts updated: CLI reference and topology status. Known caveats / SPEC_MISMATCH: output assurance remains top-level-command oriented while action contracts are action-path oriented; virtual `find` needs an alias to the existing search assurance row. Follow-up intentionally not included: full retirement of the old assurance registry, behavioral guard tests, docs/help/completion metadata from contracts, and #1818 machine-envelope/schema checks. ## Verification - `devtools test tests/unit/cli/test_cli_output_assurance_matrix.py tests/unit/cli/test_cli_action_contracts.py` -> 82 passed. - `devtools verify --quick` -> exit_code 0. Ref #1816
## 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`) and `import` (`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: `mark` guard 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 in `test_verb_cardinality.py`. - `devtools verify --quick` -> exit_code 0. Ref #1816
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds the first executable CLI action contract registry for the current public command floor.
Problem
#1816 needs code-coupled action contracts over the post-#1842 command surface.
output_assurance.pycan detect some output drift, but it does not describe action effect, input unit, cardinality, formats, daemon requirements, guards, or completion context.Solution
Introduced a lightweight
CliActionContractdataclass and registry for the v0 public floor: find/read/mark/analyze/delete/import/config plus current ops surfaces. Added generated-style tests that verify every floor action has exactly one contract, contract paths resolve to Click or declared virtual grammar actions,findremains recognized by query-first parsing, declared machine formats are actually exposed by live Click options, and default formats are valid.Issue slice: v0 code-coupled action contracts.
Files inspected:
polylogue/cli/command_inventory.py,polylogue/cli/output_assurance.py, command registration, query-first parsing, CLI tests.Files changed:
polylogue/cli/action_contracts.py,tests/unit/cli/test_cli_action_contracts.py,docs/plans/topology-target.yaml,docs/topology-status.md.Old surface removed or retained: retained
output_assurance.py; this slice adds the contract spine only.Contracts/tests added:
CliActionContractregistry and contract coverage tests.Generated artifacts updated: topology projection/status.
Known caveats / SPEC_MISMATCH:
findis query grammar rather than a Click command, so it is a declared virtual action; nopolylogue opsgroup exists, sostatus,doctor, andmaintenanceare contracted as concrete ops paths;importis currently human-only.Follow-up intentionally not included: replacing output assurance, behavioral guard tests, docs/help metadata generation, and #1818 machine-envelope/schema parity.
Verification
devtools test tests/unit/cli/test_cli_action_contracts.py-> 6 passed.devtools verify --quick-> exit_code 0.Ref #1816