Repository navigation
refactor(cli): remove ops state drawer (#2253) - #2256
Conversation
Problem: ops state kept the old user-overlay drawer alive after assertions and query-first mark became the product surface. It also kept stale help baselines, coverage manifests, and archive-debt actions pointing at a command bucket that was not actually operations maintenance. What changed: move candidate assertion judgment under mark candidates, keep tag mutation on query-first mark, remove the old user_state CLI modules and state showcase baselines, update archive-debt actions plus docs/generated CLI references, and retarget tests to the live replacement surfaces. Verification: devtools test tests/unit/cli/test_assertion_candidates.py tests/unit/cli/test_stdout_stderr_split.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_json_output.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_command_aux_runtime.py tests/unit/cli/test_cli_error_boundaries.py::TestCompletionsErrorBoundaries tests/unit/cli/test_terminal_snapshots.py tests/unit/operations/test_archive_debt.py -q (282 passed). devtools render all --check (ok). devtools verify --quick (exit_code 0).
|
Warning Review limit reached
More reviews will be available in 50 minutes and 16 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 To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. 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 (3)
📝 WalkthroughWalkthroughThe Changesops state → mark candidates migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested labels
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 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: 15349770fd
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@polylogue/cli/query_verbs.py`:
- Line 875: The `--limit` option uses `type=int` which permits zero and negative
values that could cause unintended behavior in downstream limit processing.
Replace the `type=int` parameter in the click.option decorator for `--limit`
with `click.IntRange(min=1)` to constrain the option to only accept positive
integers greater than zero, ensuring valid limit values are enforced at the CLI
argument parsing level.
- Around line 800-802: The early return at lines 800-802 silently allows parent
mutation flags like --tag-add, --star, and --note to be ignored when a mark
candidates subcommand is invoked. Before returning when ctx.invoked_subcommand
is not None, check if any mutation flags are set on the parent context (ctx) and
raise an error or validation exception if conflicting flags are detected. This
ensures users are informed of the conflict instead of having their flags
silently ignored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1e4b700c-7189-4734-a37d-8b439469ad3c
📒 Files selected for processing (69)
AGENTS.mddevtools/render_cli_reference.pydocs/cli-reference.mddocs/design/whole-product.mddocs/internals.mddocs/plans/test-closure-matrix.yamldocs/plans/test-coverage-domains.yamldocs/plans/topology-target.yamldocs/search.mddocs/test-quality-workflows.mddocs/topology-status.mdpolylogue/cli/click_app.pypolylogue/cli/click_command_registration.pypolylogue/cli/commands/user_state.pypolylogue/cli/commands/user_state_blackboard.pypolylogue/cli/commands/user_state_feedback.pypolylogue/cli/commands/user_state_tags.pypolylogue/cli/query_group.pypolylogue/cli/query_verbs.pypolylogue/operations/archive_debt.pypolylogue/showcase/exercise_catalog.jsontests/baselines/showcase/help-ops-state-annotations-delete.txttests/baselines/showcase/help-ops-state-annotations-list.txttests/baselines/showcase/help-ops-state-annotations-save.txttests/baselines/showcase/help-ops-state-annotations.txttests/baselines/showcase/help-ops-state-blackboard-list.txttests/baselines/showcase/help-ops-state-blackboard-post.txttests/baselines/showcase/help-ops-state-blackboard.txttests/baselines/showcase/help-ops-state-candidates-accept.txttests/baselines/showcase/help-ops-state-candidates-defer.txttests/baselines/showcase/help-ops-state-candidates-list.txttests/baselines/showcase/help-ops-state-candidates-reject.txttests/baselines/showcase/help-ops-state-candidates-supersede.txttests/baselines/showcase/help-ops-state-candidates.txttests/baselines/showcase/help-ops-state-feedback-clear.txttests/baselines/showcase/help-ops-state-feedback-list.txttests/baselines/showcase/help-ops-state-feedback-record.txttests/baselines/showcase/help-ops-state-feedback.txttests/baselines/showcase/help-ops-state-marks-add.txttests/baselines/showcase/help-ops-state-marks-list.txttests/baselines/showcase/help-ops-state-marks-remove.txttests/baselines/showcase/help-ops-state-marks.txttests/baselines/showcase/help-ops-state-recall-packs-delete.txttests/baselines/showcase/help-ops-state-recall-packs-list.txttests/baselines/showcase/help-ops-state-recall-packs-save.txttests/baselines/showcase/help-ops-state-recall-packs.txttests/baselines/showcase/help-ops-state-saved-views-delete.txttests/baselines/showcase/help-ops-state-saved-views-list.txttests/baselines/showcase/help-ops-state-saved-views-save.txttests/baselines/showcase/help-ops-state-saved-views.txttests/baselines/showcase/help-ops-state-tags.txttests/baselines/showcase/help-ops-state-workspaces-delete.txttests/baselines/showcase/help-ops-state-workspaces-list.txttests/baselines/showcase/help-ops-state-workspaces-save.txttests/baselines/showcase/help-ops-state-workspaces.txttests/baselines/showcase/help-ops-state.txttests/integration/test_cli_tags_surface.pytests/unit/cli/__snapshots__/test_terminal_snapshots.ambrtests/unit/cli/test_assertion_candidates.pytests/unit/cli/test_blackboard.pytests/unit/cli/test_cli_error_boundaries.pytests/unit/cli/test_command_aux_runtime.pytests/unit/cli/test_deterministic_output.pytests/unit/cli/test_json_envelope_contract.pytests/unit/cli/test_json_output.pytests/unit/cli/test_stdout_stderr_split.pytests/unit/cli/test_terminal_snapshots.pytests/unit/cli/test_user_state_command.pytests/unit/operations/test_archive_debt.py
💤 Files with no reviewable changes (45)
- tests/baselines/showcase/help-ops-state-annotations-delete.txt
- tests/baselines/showcase/help-ops-state-feedback-record.txt
- tests/baselines/showcase/help-ops-state-blackboard-post.txt
- tests/baselines/showcase/help-ops-state-marks-remove.txt
- tests/baselines/showcase/help-ops-state-feedback-clear.txt
- tests/baselines/showcase/help-ops-state-candidates-list.txt
- tests/baselines/showcase/help-ops-state-marks-add.txt
- tests/baselines/showcase/help-ops-state-candidates-reject.txt
- tests/baselines/showcase/help-ops-state-candidates-defer.txt
- tests/baselines/showcase/help-ops-state-marks.txt
- tests/baselines/showcase/help-ops-state-workspaces-save.txt
- tests/baselines/showcase/help-ops-state-candidates.txt
- tests/baselines/showcase/help-ops-state.txt
- tests/baselines/showcase/help-ops-state-recall-packs-list.txt
- tests/baselines/showcase/help-ops-state-candidates-supersede.txt
- tests/baselines/showcase/help-ops-state-feedback-list.txt
- tests/baselines/showcase/help-ops-state-annotations-list.txt
- tests/baselines/showcase/help-ops-state-saved-views-list.txt
- tests/baselines/showcase/help-ops-state-recall-packs.txt
- tests/baselines/showcase/help-ops-state-workspaces-list.txt
- tests/baselines/showcase/help-ops-state-workspaces.txt
- tests/baselines/showcase/help-ops-state-candidates-accept.txt
- tests/baselines/showcase/help-ops-state-blackboard-list.txt
- tests/baselines/showcase/help-ops-state-feedback.txt
- polylogue/cli/commands/user_state_tags.py
- tests/baselines/showcase/help-ops-state-marks-list.txt
- tests/baselines/showcase/help-ops-state-saved-views.txt
- tests/baselines/showcase/help-ops-state-saved-views-delete.txt
- AGENTS.md
- tests/integration/test_cli_tags_surface.py
- tests/baselines/showcase/help-ops-state-saved-views-save.txt
- tests/baselines/showcase/help-ops-state-annotations.txt
- tests/baselines/showcase/help-ops-state-blackboard.txt
- tests/baselines/showcase/help-ops-state-annotations-save.txt
- tests/baselines/showcase/help-ops-state-recall-packs-save.txt
- polylogue/cli/commands/user_state.py
- tests/baselines/showcase/help-ops-state-workspaces-delete.txt
- tests/baselines/showcase/help-ops-state-tags.txt
- tests/baselines/showcase/help-ops-state-recall-packs-delete.txt
- docs/internals.md
- tests/unit/cli/test_blackboard.py
- polylogue/cli/commands/user_state_feedback.py
- polylogue/cli/commands/user_state_blackboard.py
- polylogue/cli/click_command_registration.py
- tests/unit/cli/test_user_state_command.py
| if ctx.invoked_subcommand is not None: | ||
| return | ||
|
|
There was a problem hiding this comment.
Reject mixed mark mutation flags when a mark candidates subcommand is used.
At Line 800, the early return makes parent flags (--tag-add, --star, --note, etc.) silently no-op when users run mark candidates .... This can hide operator mistakes.
Suggested fix
- if ctx.invoked_subcommand is not None:
- return
+ if ctx.invoked_subcommand is not None:
+ if any(
+ (
+ tags_to_add,
+ tags_to_remove,
+ star,
+ unstar,
+ pin,
+ unpin,
+ do_archive,
+ do_unarchive,
+ note_text is not None,
+ )
+ ):
+ raise click.UsageError(
+ "Mark mutation flags cannot be combined with `mark candidates ...`."
+ )
+ return🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@polylogue/cli/query_verbs.py` around lines 800 - 802, The early return at
lines 800-802 silently allows parent mutation flags like --tag-add, --star, and
--note to be ignored when a mark candidates subcommand is invoked. Before
returning when ctx.invoked_subcommand is not None, check if any mutation flags
are set on the parent context (ctx) and raise an error or validation exception
if conflicting flags are detected. This ensures users are informed of the
conflict instead of having their flags silently ignored.
|
|
||
| @mark_candidates_group.command("list") | ||
| @click.option("--target-ref", default=None, help="Limit candidates to one target object ref.") | ||
| @click.option("--limit", "-l", type=int, default=50, show_default=True) |
There was a problem hiding this comment.
Constrain --limit to positive integers.
Line 875 uses type=int, so 0/negative values are accepted and may produce unintended broad candidate reads depending on downstream limit semantics.
Suggested fix
-@click.option("--limit", "-l", type=int, default=50, show_default=True)
+@click.option("--limit", "-l", type=click.IntRange(min=1), default=50, show_default=True)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @click.option("--limit", "-l", type=int, default=50, show_default=True) | |
| `@click.option`("--limit", "-l", type=click.IntRange(min=1), default=50, show_default=True) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@polylogue/cli/query_verbs.py` at line 875, The `--limit` option uses
`type=int` which permits zero and negative values that could cause unintended
behavior in downstream limit processing. Replace the `type=int` parameter in the
click.option decorator for `--limit` with `click.IntRange(min=1)` to constrain
the option to only accept positive integers greater than zero, ensuring valid
limit values are enforced at the CLI argument parsing level.
Resolve the reviewed lazy Click-group dispatch bug by invoking the resolved group instead of the proxy group, and keep explicit query terms like 'find mark candidates' on the search path instead of treating them as the candidate subcommand.\n\nVerification:\n- devtools test tests/unit/cli/test_cli_action_contracts.py::test_mark_contract_guard_requires_all_or_first_for_multi_match tests/unit/cli/test_cli_action_contracts.py::test_mark_contract_guard_allows_first_for_multi_match tests/unit/cli/test_cli_action_contracts.py::test_explicit_mark_candidates_terms_remain_query_text tests/unit/cli/test_assertion_candidates.py tests/unit/cli/test_stdout_stderr_split.py::TestErrorOutputContent -q\n- devtools verify --quick
|
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. |
|
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
Remove the old
polylogue ops stateCLI drawer and route the remaining useful user-overlay flow through the product command surface. Candidate assertion judgment now lives underpolylogue mark candidates ...; tag mutation remains query-first throughfind QUERY then mark --tag-add/--tag-remove; the stale marks/annotations/saved-views/recall-packs/workspaces/blackboard/feedback command drawers are deleted rather than preserved as aliases.Closes part of #2253; the issue stays open for
ops insights,ops schema, and thedemo/tutorialplacement decisions.Problem
ops statekept the pre-assertion user-overlay command family alive insideops, even though assertions are now the substrate andmarkis the product action. That madeopsa miscellaneous drawer again, kept old showcase baselines in generated quality docs, and caused archive-debt action hints to point at the wrong owner.Solution
markinto an invoke-without-command Click group and addedmark candidates {list,accept,reject,defer,supersede}using the existing assertion candidate API.polylogue/cli/commands/user_state*.pycommand modules and their state/blackboard/tags CLI tests and showcase baselines.polylogue mark candidates list --format json.ops statereconciliation complete and keep the remaining command-placement work explicit.Acceptance Criteria
ops stateis no longer a registered ops command.mark candidates.mark --tag-add/--tag-removetests.Verification
devtools test tests/unit/cli/test_assertion_candidates.py tests/unit/cli/test_stdout_stderr_split.py tests/unit/cli/test_deterministic_output.py tests/unit/cli/test_json_output.py tests/unit/cli/test_json_envelope_contract.py tests/unit/cli/test_command_aux_runtime.py tests/unit/cli/test_cli_error_boundaries.py::TestCompletionsErrorBoundaries tests/unit/cli/test_terminal_snapshots.py tests/unit/operations/test_archive_debt.py -q→282 passeddevtools render all --check→OK: /realm/project/polylogue/.cache/site matches sourcesdevtools verify --quick→exit_code 0devtools verify --quick→exit_code 0Summary by CodeRabbit
New Features
polylogue mark candidatescommand group for reviewing and acting on pending assertion candidates with subcommands for listing, accepting, deferring, rejecting, and superseding candidate assertions.Changes
markcommand structure.