Skip to content

test(worktree): update tests for destroy→remove rename - #34

Merged
mateodelnorte merged 3 commits into
mainfrom
rename-worktree-destroy-to-remove
Feb 17, 2026
Merged

mateodelnorte merged 3 commits into
mainfrom
rename-worktree-destroy-to-remove

Conversation

@mateodelnorte

@mateodelnorte mateodelnorte commented Feb 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Updates all BATS worktree tests to use remove as the primary command
  • Adds dedicated test verifying destroy still works as a hidden alias
  • Updates help text assertions to check for remove instead of destroy

Context

Companion to gitkb/meta_git_cli#17 — part of [[tasks/meta-63]].

Test plan

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated test suite to rename "destroy" workflows to "remove" across scenarios and help output.
    • Adjusted lifecycle, TTL, centralized-store, hook, prune, ephemeral and multi-repo tests to use the new terminology.
    • Added/updated edge-case and alias tests to verify alias paths and removal behavior remain correct.

Updates all BATS tests to use `remove` as the primary command.
Adds dedicated alias test to verify `destroy` still works.

Implements [[tasks/meta-63]]

Co-authored-by: Claude <claude@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 17, 2026 •

Copy link
Copy Markdown

Walkthrough

Tests updated to replace all "destroy" terminology with "remove" for git worktree operations, including command invocations, test names, directory references, and help output expectations; no functional test behavior changes.

Changes

Cohort / File(s) Summary
Worktree tests
tests/worktree.bats
Replaced git worktree destroy with git worktree remove across tests. Updated test names, directory expectations (e.g., .worktrees/dot-destroy → .worktrees/dot-remove), help-output text, edge-case assertions, and alias-related checks.
Cloud/worktree integration tests
tests/worktree_cloud.bats
Replaced git worktree destroy with git worktree remove in TTL, centralized-store, hook, prune, ephemeral, lifecycle, and JSON-output tests. Updated help-output expectation from "DESTROY OPTIONS" to "REMOVE OPTIONS" and adjusted related test descriptions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through tests both near and far,
Swapped "destroy" for "remove" on every bar.
Names refreshed and paths made neat,
The same old logic, a lighter feet —
A tidy change, a tiny carrot star.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and concisely summarizes the main change: updating tests to reflect a command rename from destroy to remove in the worktree functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rename-worktree-destroy-to-remove

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

@greptile-apps

greptile-apps Bot commented Feb 17, 2026

Copy link
Copy Markdown

Greptile Summary

Updates all worktree tests to use remove as the primary command name instead of destroy, aligning tests with the CLI refactoring in gitkb/meta_git_cli#17.

  • Renamed test functions and commands from destroy to remove (6 test cases)
  • Updated help text assertions to check for remove instead of destroy
  • Added new test case (fix: use PARENT_REPO_PAT for sync commits to protected main #42) verifying destroy alias still functions for backward compatibility
  • Updated test names and inline comments for consistency (e.g., multi-destroy → multi-remove, dot-destroy → dot-remove)
  • Updated section headers and test descriptions throughout

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Test-only changes with systematic rename from destroy to remove, comprehensive backward compatibility test added, all assertions properly updated, no logic changes
  • No files require special attention

Important Files Changed

Filename Overview
tests/worktree.bats Renames all destroy commands to remove in test suite and adds backward compatibility test for destroy alias

Last reviewed commit: 9d5c3e8

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/worktree.bats`:
- Around line 376-428: In the "worktree remove preserves branches" test, the
remove call isn't checking its exit status; invoke the remove using the test
harness (use run "$META_BIN" git worktree remove keep-branch or capture $?
immediately) and add an assertion like [ "$status" -eq 0 ] (or equivalent)
before the subsequent git branch check to ensure the remove succeeded.

Comment thread tests/worktree.bats
Addresses CodeRabbit review: use `run` and assert exit status
before checking branch preservation.

Co-authored-by: Claude <claude@anthropic.com>
@mateodelnorte

Copy link
Copy Markdown
Contributor Author

Note: Merge ordering dependency

The integration tests fail because CI clones meta_git_cli from main, which still has destroy as the primary command. Tests that check for remove in help output naturally fail against the old binary.

Merge order: gitkb/meta_git_cli#17 first, then this PR. Integration tests will pass once CI picks up the updated meta_git_cli from main.

Updates worktree_cloud.bats to use `remove` as the primary command,
matching the rename done in worktree.bats. Fixes failing CI check
for REMOVE OPTIONS help text assertion.

Implements [[tasks/meta-63]]

Co-authored-by: Claude <claude@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/worktree_cloud.bats (1)

295-318: 🧹 Nitpick | 🔵 Trivial

Stale comment: "Destroy" should be "Remove".

The inline comment at line 307 still says # Destroy but the command now uses remove. Update for consistency.

✏️ Suggested fix
     python3 -c "
 import json
 with open('\$STORE') as f:
     data = json.load(f)
 assert any(v['name'] == 'store-rm' for v in data['worktrees'].values())
 "

-    # Destroy
+    # Remove
     run "\$META_BIN" git worktree remove store-rm
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/worktree_cloud.bats` around lines 295 - 318, In the "@test \"worktree
remove removes from centralized store\"" test update the inline comment that
currently reads "# Destroy" to match the command and intent by changing it to "#
Remove"; locate the block around the call to run "$META_BIN" git worktree remove
store-rm and replace that single-line comment so the test comments remain
consistent with the remove operation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@tests/worktree_cloud.bats`:
- Around line 295-318: In the "@test \"worktree remove removes from centralized
store\"" test update the inline comment that currently reads "# Destroy" to
match the command and intent by changing it to "# Remove"; locate the block
around the call to run "$META_BIN" git worktree remove store-rm and replace that
single-line comment so the test comments remain consistent with the remove
operation.

@mateodelnorte
mateodelnorte merged commit 90cc9be into main Feb 17, 2026
8 checks passed
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