Skip to content

feat(ENGKNOW-3738): re-add exec gor files rm with recursive delete gated - #135

Merged
gmagnu merged 2 commits into
mainfrom
ENGKNOW-3738-re-add-exec-gor-files-rm
Aug 20, 2026
Merged

feat(ENGKNOW-3738): re-add exec gor files rm with recursive delete gated#135
gmagnu merged 2 commits into
mainfrom
ENGKNOW-3738-re-add-exec-gor-files-rm

Conversation

@gmagnu

@gmagnu gmagnu commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

ENGKNOW-3738

Re-adds exec gor files rm, which was commented out of the files subcommand list in ENGKNOW-3363, and keeps the risky part disabled.

Changes

  • FilesCommandRmCommand.class registered again as a subcommand.
  • RmCommand-r/--recursive is gated behind the system property gor.cli.files.rm.recursive (default false). Without it, rm -r fails with:
    rm: recursive delete is disabled, set -Dgor.cli.files.rm.recursive=true to enable it
    The check runs before the path loop, so a rejected rm -r a b c deletes nothing.
    The property is read per invocation rather than in a static initializer, so a -D flag or a test setting it takes effect.
  • -d (remove empty directories) stays enabled — it only deletes directories it has verified to be empty. -f and -v are unchanged.
  • Tests — the seven @Ignore("rm disabled for now") annotations are removed, testRmRecursive sets the property in a try/finally, and a new testRmRecursiveDisabledByDefault asserts that -r is rejected and leaves the directory and its contents intact.

Testing

./gradlew :gortools:test --tests "org.gorpipe.gor.cli.files.UTestFilesCommandExec" — 31 tests pass, including all 8 rm tests.

🤖 Generated with Claude Code

gmagnu and others added 2 commits August 20, 2026 16:29
Re-registers RmCommand as a subcommand of `exec gor files`, which was
commented out in ENGKNOW-3363.

Recursive delete is off by default: `rm -r` now fails unless the JVM is
started with -Dgor.cli.files.rm.recursive=true. The check runs before the
path loop, so a rejected `rm -r a b c` deletes nothing. Removing empty
directories with -d stays enabled, as it only deletes directories verified
to be empty.

Un-ignores the rm tests and adds a test asserting that -r is rejected and
leaves the directory intact by default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Junit Tests - Summary

4 768 tests  +1   4 597 ✅ +8   22m 35s ⏱️ + 3m 59s
  489 suites ±0     171 💤  - 7 
  489 files   ±0       0 ❌ ±0 

Results for commit 35cf0c1. ± Comparison against base commit 53d459b.

@gmagnu
gmagnu merged commit 36bd22a into main Aug 20, 2026
14 checks passed
@gmagnu
gmagnu deleted the ENGKNOW-3738-re-add-exec-gor-files-rm branch August 20, 2026 22:47
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.

3 participants