Skip to content

refactor(cli): split maintenance run/blob-integrity preview from apply - #3608

Merged
Sinity merged 3 commits into
masterfrom
feature/cli/maintenance-product-split
Aug 3, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/cli/maintenance-product-split

Conversation

@Sinity

@Sinity Sinity commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Splits three fused CLI verbs in polylogue/cli/commands/maintenance/ along the preview/apply seam the maintenance group already establishes elsewhere (preview/plan/run, archive-plan/archive-init): a read-only -preview command with no --apply/--yes flag at all, plus a lean apply command whose flags are only what execution needs.

Problem

  • maintenance run fused --dry-run + resume/operation-id + scope filters + target catalog into one verb, so a mutating and a non-mutating invocation were indistinguishable by command name alone.
  • blob-reference-replace-from-source and blob-reference-prune-orphans fused apply/dry-run behind a --yes flag plus diagnostic sample-limit options, the same anti-pattern.

Solution

  • polylogue/cli/commands/maintenance/_run.py: run now always executes (no --dry-run). The shared body (execute_replay call + output rendering) moved into a private _execute_and_render helper so behavior stays byte-identical.
  • polylogue/cli/commands/maintenance/_run_preview.py (new): run-preview calls the identical _execute_and_render helper with dry_run=True fixed — same resumable per-target checkpointing as before, just no flag to forget.
  • polylogue/cli/commands/maintenance/_blob_integrity.py: blob-reference-replace-from-source now always applies (--manifest-file required, no --yes); new blob-reference-replace-from-source-preview is the read-only twin (--manifest-file optional, still writes a would-be manifest if given). blob-reference-prune-orphans now always prunes (no --yes); new blob-reference-prune-orphans-preview drops --quarantine-file entirely since it's meaningless without a mutation.
  • polylogue/cli/commands/maintenance/__init__.py: registers the two new preview commands.
  • docs/maintenance.md: documents run-preview and the blob-reference preview/apply pairs.
  • docs/plans/topology-target.yaml: regenerated for the new _run_preview.py module.

Out of scope per the tracking mission: _rebuild_index.py's own --plan fusion (separate tracked design) and _shared.py (owned by a parallel lane) are untouched.

Verification

  • devtools test tests/unit/cli/test_archive_maintenance_cli.py tests/unit/cli/test_maintenance_registration.py — 72 passed.
  • devtools verify --quick — all 23 steps ok, including verify docs-coverage (the new preview commands are documented, not baselined).
  • devtools render all --check — no "out of sync" surfaces.

Not run: devtools verify --all (full non-integration suite) — left for CI / a follow-up pass if requested.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 26 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

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, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 67e3e9af-ab9e-48e9-a2af-e2d50fd27a80

📥 Commits

Reviewing files that changed from the base of the PR and between f157068 and 2ea6475.

📒 Files selected for processing (8)
  • docs/maintenance.md
  • docs/plans/topology-target.yaml
  • polylogue/cli/commands/maintenance/__init__.py
  • polylogue/cli/commands/maintenance/_blob_integrity.py
  • polylogue/cli/commands/maintenance/_run.py
  • polylogue/cli/commands/maintenance/_run_preview.py
  • tests/unit/cli/test_archive_maintenance_cli.py
  • tests/unit/cli/test_maintenance_registration.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sinity added 3 commits August 3, 2026 10:59
Problem: `maintenance run` fused --dry-run + resume + scope filters +
target catalog into one verb, and the two blob-integrity mutation
commands (blob-reference-replace-from-source, blob-reference-prune-
orphans) fused apply/dry-run behind a --yes flag with diagnostic
sample-limit options. Both repeat the same anti-pattern the maintenance
group's own preview/plan/run naming already avoids elsewhere.

What changed: split each fused command along the seam the group already
established -- a preview-shaped read command with no --apply/--yes flag
(the command type itself is read-only) and a lean apply command whose
flags are only what execution needs.

- `maintenance run` now always executes (no --dry-run); the identical
  dry-run replay path (including resumable per-target checkpointing)
  moved to a new `maintenance run-preview` command. Both share
  `_execute_and_render` in _run.py so the execute_replay call and output
  rendering stay byte-identical to the old fused behavior.
- `blob-reference-replace-from-source` now always applies (--manifest-
  file required, no --yes); `blob-reference-replace-from-source-preview`
  is the new read-only twin (--manifest-file optional, writes a
  would-be manifest if given).
- `blob-reference-prune-orphans` now always prunes (no --yes);
  `blob-reference-prune-orphans-preview` is the new read-only twin
  (drops --quarantine-file, which is meaningless without a mutation).

Explicitly out of scope: _rebuild_index.py's own --plan fusion (separate
tracked design) and _shared.py (owned by a parallel lane) are untouched.

Verification: tests updated for the new command names/flags; devtools
test + devtools verify --quick to follow.
devtools verify --quick's docs-coverage check flagged the two new
blob-reference-*-preview commands as undocumented public surface (the
apply-only counterparts were already covered by pre-existing baseline
debt entries, but the new preview twins are new surface, not debt).
Documented both pairs in docs/maintenance.md instead of adding them to
docs/plans/docs-coverage-baseline.yaml.
@Sinity
Sinity force-pushed the feature/cli/maintenance-product-split branch from 9d2ffba to 2ea6475 Compare August 3, 2026 09:06
@Sinity
Sinity merged commit 9a32f4d into master Aug 3, 2026
3 checks passed
@Sinity
Sinity deleted the feature/cli/maintenance-product-split branch August 3, 2026 09:40
Sinity added a commit that referenced this pull request Aug 3, 2026
test_source_laws.py: monkeypatch target renamed to
detect_provider_from_raw_bytes_evidence; multi-session-zip fixture
used chat_messages:[] which PR #3537's looks_like_ai tightening
(pre-existing, unrelated to today) correctly refuses -- gave it real
message shape.

test_targets.py: PR #3608 split 'run --dry-run' into 'run'/'run-preview';
3 call sites still used the removed --dry-run flag on 'run'.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant