fix(dry-run): gate explicit-ID mutation paths behind resolveDryRun#219
Merged
gfargo-horizon-agent[bot] merged 1 commit intoJul 17, 2026
Conversation
--dry-run reached live mutations in optimize/convert/resize/remove-bg/ regenerate/undo/posts-create because explicit-ID paths bypassed the shared resolveDryRun helper (or, for vision/import, checked --apply or --dry-run directly instead of routing through it). rename also wrote a local SQLite row before its dry-run guard. Also strengthens dry-run-honesty.test.ts to require the literal resolveDryRun( call (instead of loose substrings like 'dryRun' or 'parentOpts.apply') and extends coverage to convert/resize/remove-bg/ references, plus adds behavioral tests asserting posts create and rename issue no live mutation under --dry-run.
Contributor
Author
There was a problem hiding this comment.
🔎 Agent review (sonnet) — LGTM
REVIEW: LGTM
RESOLVES: full
Every gap listed in OSS-928 (optimize, convert, resize, remove-bg, regenerate, undo, posts create, rename) is now routed through resolveDryRun exactly as the plan specified, with the honesty test tightened to require the literal call and new behavioral tests for the two highest-risk cases (posts create, rename). Typecheck, lint, and the full unit suite (622 pass) all succeed, and the diff stays tightly scoped to the defect class with no unrelated changes.
gfargo-horizon-agent
Bot
deleted the
agent/localpress-928-localpress-190-dry-run-reaches-live-muta
branch
July 17, 2026 22:17
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Every mutating command's explicit-ID path now routes through the shared
resolveDryRun(parentOpts, default)helper, so a global--dry-runcan no longer reach a live WordPress or SQLite mutation.Why
Closes #190
Plane: OSS-928
--dry-runwas silently ignored on several commands' explicit-ID paths —optimize 123 --dry-run,convert,resize,remove-bg,regenerate 123 --dry-run,undo --snapshot 17 --dry-run, andposts create --dry-runall executed live mutations despite the flag.rename --dry-runalso wrote a local SQLite row before its dry-run guard. The existing honesty test only grepped for loose substrings (dryRun,parentOpts.apply), which any bulk-only or unrelated reference could satisfy, so it passed 13/13 while these gaps existed.How
optimize.ts,undo.ts: replaced ad hocisBulk && !parentOpts.applychecks withresolveDryRun(parentOpts, isBulk).convert.ts,resize.ts,remove-bg.ts: added a dry-run gate (none existed before) ahead of the sharp preload / rembg check, so a preview doesn't even prompt to install native deps.regenerate.ts: unified the previously--all-only dry-run check into one gate covering explicit IDs too; the--allid-listing (read-only) still runs first.posts.ts: added the missing dry-run gate toposts create(update/delete already had it).rename.ts: moved thedb.upsertAttachmentcall inside the existingif (!dryRun)guard so a dry-run no longer writes a local row.vision.ts,import.ts: routed throughresolveDryRuninstead of checkingparentOpts.apply/parentOpts.dryRundirectly — same defect class (an explicit--dry-runwas silently ignored when combined with other flags).dry-run-honesty.test.ts: now requires the literalresolveDryRun(call (no more loose substring matching) and coversconvert/resize/remove-bg/referencesin addition to the existing commands.dry-run-honesty-behavior.test.ts: behavioral tests that actually invokeposts create --dry-run(assertsfetchis never called) andrename --dry-run(asserts no SQLite row is written).Testing
bun test test/unit/— 622 pass, 0 fail)bun run lint)bun run typecheck)Closes #190