repository: honor --dry-run in repository delete - #174
Open
jonathanmcmichael wants to merge 1 commit into
Open
Conversation
repository::delete never checked dry_run and always called the real delete RPC. Gate it behind execution_context().globals().dry_run(), matching the pattern already used in repository/clone.rs and branch/push.rs. Also fix the CLI success message so a dry run reports "would be deleted" instead of falsely claiming the repository was deleted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Jonathan McMichael <jonathanmc@dpr.com>
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
lore repository delete --dry-runnow actually performs a dry run insteadof deleting the repository. The CLI also reports "Repository would be
deleted" rather than "Repository deleted successfully" when
--dry-runisset.
Why
lore-revision/src/repository/delete.rs::delete()never checkeddry_run— it calledrepository_service.delete(id)unconditionally.Every other destructive command in this codebase (
revision commit,branch push/switch,clone) gates its mutating call behindglobals.dry_run()/execution_context().globals().dry_run();deletewas simply missing that check. This is a safety-flag correctness bug: a
user relying on
--dry-runbefore a destructive operation gets no warningand no protection.
How
lore-revision/src/repository/delete.rs: wrap therepository_service.delete(id)call inif !execution_context().globals().dry_run(), following the same patternalready used in
repository/clone.rsandbranch/push.rsin this crate.The repository name/ID is still resolved and validated either way, so a
dry run still surfaces a bad URL/name the same way a real delete would.
lore-client/src/cli/commands/repository.rs: the delete callback'ssuccess message now distinguishes
dry_run(prints "Repository would bedeleted") from a real delete ("Repository deleted successfully"),
matching the message style already used by
revision commit("Previewing commit" vs "Committing").
Testing
cargo +nightly fmt --allcargo clippy -p lore-revision -p lore-client --all-targets -- -D warnings --no-deps(full-workspace clippy currently fails on an unrelated pre-existing issue inlore-revision/src/util/fs.rs, not touched by this PR)cargo test -p lore-revision -p lore-clientrepository deleteat all, and none of this crate's tests spin up areal server, so covering this properly meant adding new test
infrastructure rather than a single test function. That's split out
into a companion PR (in-process gRPC server harness + dry-run/real-delete
tests for
repository::delete::delete()) so it can be reviewed on itsown.
Notes for reviewers
Small, mechanical, non-security change — no auth/crypto paths touched.
AI assistance disclosure
This change (code and this PR description) was developed with Claude (Anthropic) assistance. I reviewed and tested the change myself and am responsible for its correctness.