Skip to content

Run the non-Unix worktree removal refusal on Windows CI - #2192

Merged
yyhhyyyyyy merged 3 commits into
mainfrom
hui/worktrees-windows-rejection-test
Nov 25, 2026
Merged

yyhhyyyyyy merged 3 commits into
mainfrom
hui/worktrees-windows-rejection-test

Conversation

@yyhhyyyyyy

Copy link
Copy Markdown
Collaborator

Run the non-Unix worktree removal refusal on Windows CI

What changed

crates/dim-app-server/tests/worktree_removal_flow.rs (new, #[cfg(not(unix))]) starts a product-profile server on a disposable home and calls worktree.remove over the local named pipe for an unregistered directory under the managed root: without --force it must answer worktree_in_use and leave the directory in place, and with --force it must remove it. crates/dim-app-server/tests/app_server_flow.rs includes the module.

crates/dim-app-server/src/worktrees.rs: delete the lib test a_path_based_removal_refuses_an_unregistered_directory. No CI job builds that test target on Windows, so the assertion never ran. The two tests narrowed to #[cfg(unix)] in #2133 keep their assertions and are unchanged; the helper and module import they share are now #[cfg(unix)] too because every remaining test in the module is Unix-only.

scripts/test-windows-native.mjs names the new test in the app_server_flow flow, and scripts/ci-changes.mjs adds crates/dim-app-server/src/worktrees.rs and the new flow file to the windows_native paths. The windows-cli job runs cargo test --locked -p dim-cli --lib, then, when the windows_native group is selected, node scripts/test-windows-native.mjs. That script lists the dim-app-server app_server_flow target, checks that every named test exists in the compiled binary, and runs it with --exact. The new case runs there.

The CI descriptions in docs/architecture/build.md, docs/architecture/tui-e2e.md and docs/release/README.md now name the worktree-removal paths and worktree_removal_flow, so a change to the worktree removal path is documented as selecting the windows-cli job and running the flow there.

Why

The non-Unix branch refuses the non-force removal of an unregistered directory because deleting by path cannot prove the directory being deleted is the one that was checked. #2133 added the branch and an assertion for it, but the assertion sat in a lib test target that the Windows job does not build. A refusal that no CI job exercises can be removed or inverted without a failure.

Verification

  • cargo fmt --all -- --check --config error_on_line_overflow=true
  • cargo test --locked -p dim-app-server --lib worktrees (4 passed)
  • cargo test --locked -p dim-app-server --test app_server_flow prompt_settings_flow (the target builds and runs; the new module is compiled out on Unix)
  • cargo clippy --locked -p dim-app-server --all-targets -- -D warnings
  • cargo check --locked -p dim-app-server --tests --target x86_64-pc-windows-gnu (the Windows-only test compiles for a Windows target)
  • cargo run --locked -p xtask -- check
  • node --test scripts/ci-changes.test.mjs scripts/test-windows-native.test.mjs

The Windows job is the run of the refusal itself; a Unix host cannot execute that branch.

The Windows job does not build the dim-app-server lib test target, so the non-Unix refusal branch had no test that CI executed. Move the assertion into app_server_flow, which the windows-cli job runs, and drive it through worktree.remove over the local transport: an unregistered directory under the managed root must be refused without --force and removed with it.

Name the test in scripts/test-windows-native.mjs and add its file and worktrees.rs to the windows_native paths, so the Windows step runs when either changes.
The Windows-native selection covers the worktree removal refusal in `crates/dim-app-server/src/worktrees.rs` and its flow in `crates/dim-app-server/tests/worktree_removal_flow.rs`. Add the worktree-removal paths and `worktree_removal_flow` to the CI descriptions so a change to that path is documented as selecting the `windows-cli` job.
Both sides edited docs/release/README.md: main rewrote the static-checks sentence, this branch extended the Windows-native path list. The merged paragraph keeps main's static-checks wording and adds the worktree-removal paths.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The exact Windows CI run exercises the previously unrun non-Unix worktree-removal refusal. The test verifies that refusal preserves the directory and that explicitly authorized removal succeeds separately. Windows job selection and script tests passed. No production behavior change or review blocker; the remaining CI gates are independent.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This exercises the product RPC rather than a Windows-only test binary CI never selected. The exact Windows job lists and passes the new test: refusal leaves the directory in place, and a separate explicit force request removes it. The scripts job also passed. Linux and the final CI gate were still pending at review time.

Non-blocking: bound the pipe reply and shutdown waits like the existing cases in named_pipe_flow.rs. A regression that stops replying should fail at this fixture rather than wait for the whole Windows job timeout.

@yyhhyyyyyy
yyhhyyyyyy merged commit ca51d35 into main Nov 25, 2026
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