feat!: standardize co CLI on --dry-run and --timeout#28
Conversation
Review summaryNice, coherent cleanup — standardizing on Two things worth a look:
On the breaking change itself (dropping |
5bd8716 to
9e21a2e
Compare
Review summaryClean, focused follow-up. Both concerns from the previous round are addressed, and I've resolved those threads:
The rest reads well: One operational reminder (already noted last round, not a code issue): dropping Note: this PR is stacked on #27 ( |
9e21a2e to
c48c283
Compare
There was a problem hiding this comment.
Review summary
Third pass — verifying the fixes from the prior rounds hold. They do, and I don't find anything new worth changing.
Confirmed resolved:
- Legacy locale keys —
record_deletion_prompt/prompt_canceled_messageare retained inen.yml(with a comment pointing atblock:purge), andlib/tasks/block.rake:17,37still resolves both. The genuinely-unusedorphaned_deletion_prompt/trim_scan_promptare correctly dropped, and no other rake task references them. - Dry-run boundary off-by-one — windows are now half-open (
rowid: r1..(r1 + limit_param - 1)inpurge_proc,r2 = r1 + orphaned_limit_param - 1inpurge_orphaned_proc) with a matchingstepstride, so consecutive dry-run batches no longer double-count the boundary row. Dry-run counts now match the real delete path.
Also checked, all clean: no dangling references to the removed continue?/confirm?/yes?/apply_trim_timeout helpers; every I18n key used by co.thor resolves; the scope-reuse in purge_proc is correct (lazy relation, independent .first/.count/.delete_all queries); apply_trim_timeout → shared apply_session_timeout reads well and is now applied under --dry-run too (desirable — dry-run scans can also run long); and CLAUDE.md / README are kept in sync.
One operational reminder (not a code issue, and unchanged since round one): dropping --yes/-y is a breaking change — any cron entry or script still passing that flag will now error on the unknown option, and bin/thor co:purge with no --dry-run deletes immediately with no confirmation. The rationale (unattended cron + --dry-run as the preview mechanism) is sound and well-documented; just make sure the existing cron entries are updated when this ships. Note this is stacked on #27 (feat/co-trim) — merge that first.
LGTM.
Remove the --yes/-y flag and interactive confirmation from all commands; they now print the scan estimate and execute immediately. --dry-run becomes the uniform preview mechanism: co:purge and co:purge_orphaned_entities gain it (counting instead of deleting), and all dry runs summarize with "Would purge/trim total N rows." Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019rxDnL4R89uo579K66Gtbd
Generalize co:trim's session max_statement_time override (apply_session_timeout, default 600 s) to co:purge and co:purge_orphaned_entities; the orphaned-entities NOT EXISTS batches were observed being killed by the 10 s .env TIMEOUT on cold caches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019rxDnL4R89uo579K66Gtbd
c48c283 to
0ae2be4
Compare
Review summaryFourth pass, focused on anything the prior rounds didn't cover. Nothing new worth fixing — the change is clean and both previously-raised issues remain correctly resolved. Verified this pass:
One operational reminder (unchanged, not a code issue): dropping LGTM. |
Review summary (independent pass)LGTM. Standardizing the CLI on
Also verified: One operational note (a deliberate, well-documented design choice, not a blocker): dropping |
Why
With
--dry-runavailable on every command, the interactive--yes/-yconfirmation prompt is redundant and blocks unattended (cron) runs. Separately,
the
.envTIMEOUTof 10 s kills long-running statements on cold caches — theco:purge_orphaned_entitiesNOT EXISTSbatches were observed being killed at10 s — so every command needs a per-run override.
What
Two cross-cutting changes that standardize the CLI across
co:purge,co:purge_orphaned_entities, andco:trim:feat!: drop --yes prompts in favor of --dry-run— removes the--yes/-yflag and all interactive confirmation. Commands now print thescan estimate and execute immediately.
--dry-runbecomes the uniformpreview mechanism:
co:purgeandco:purge_orphaned_entitiesgain it(counting instead of deleting), and every dry run summarizes with
"Would purge/trim total N rows."
feat: support --timeout on all commands— generalizesco:trim'ssession
max_statement_timeoverride (--timeout, default 600 s) toco:purgeandco:purge_orphaned_entitiesvia a sharedapply_session_timeout.⚠ Breaking change
--yes/-yis removed. Any script or cron job passing-y/--yesmust dropit. Commands no longer prompt — they act immediately; use
--dry-runto previewfirst.
Review fixes applied
that the legacy
block:purgerake task still uses (record_deletion_prompt,prompt_canceled_message). Both are retained inen.yml(with a comment) soblock:purgekeeps working; the unusedorphaned_deletion_prompt/trim_scan_promptstay removed.r1..(r1 + step - 1)(half-open), so consecutive
--dry-runbatches no longer double-count the rowon each boundary.
purge_procalso drops a duplicatedBlock.where(...)build in the process.
Test plan
co:purge_orphaned_entities --dry-runnow completes under the default--timeout=600(previously killed at the 10 s.envTIMEOUT).co:purge/co:trimdry-run smoke tests pass.rubocopclean apart from the pre-existingMetrics/ClassLengthoffense.🤖 Generated with Claude Code