Skip to content

Compare Worktree Paths, Not Strings, in carry.py's Registration Check - #2485

Merged
ptr727 merged 2 commits into
developfrom
fix/carry-worktree-registration-windows
Oct 7, 2026
Merged

ptr727 merged 2 commits into
developfrom
fix/carry-worktree-registration-windows

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

carry.py's verify_target matched each git worktree list --porcelain row against f"worktree {target.resolve()}" as a string. Git prints forward slashes on Windows and pathlib prints backslashes, so a correctly registered worktree never matched, and every carry.py subcommand refused it with target is not a registered git worktree.

  • Each worktree row is now parsed into a path and resolved before comparing, and exactly one must match the resolved target, so a missing or duplicated registration is still refused.
  • apply_tree's change lines printed repository paths with the native separator, owned\file.txt on Windows. They now print POSIX paths on every host, matching what the tests and Linux already expected.

Part of #1117, a child of #1143.

Verification

  • Windows 11, python3 -m unittest tests.test_carry: the registration test and the three change-line tests now pass. The two errors that remain are symlink-creation privilege errors (WinError 1314), a separate class that spans several test files. It will be filed on its own.
  • A regression test patches carry.git so the target's row is spelled with a trailing /.. The old string compare rejects that on every OS, and the resolved compare accepts it. Two subtests drop the row and list it twice, and each must be refused. Run on this host against the base carry.py, the test fails. Mutating the count check to < 1 or < 0 fails a subtest each.
  • ruff check and ruff format clean, pre-commit hook passed.
  • local-strict-review: round 1 raised one finding, the missing refusal cases, fixed in 410442d. Round 2 found nothing.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 7, 2026 09:55
verify_target matched each `git worktree list --porcelain` row against
the native string of the resolved target. Git emits forward slashes on
Windows while pathlib emits backslashes, so a registered worktree never
matched and every carry.py subcommand refused it. Each row is now parsed
and resolved as a path before comparing.

apply_tree's change lines printed repository paths with the native
separator too, so Windows reported owned\file.txt where Linux reported
owned/file.txt. They now print in POSIX form on every host.

Part of #1117.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The registration test only proved a respelled row is accepted, so a
mutation that never refused, or that allowed a duplicate row, passed.
Two subtests now drop the target's row and list it twice, and each
must be refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 7, 2026 17:13
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ef7d3f1-8fe2-4e91-88ee-b609a84913b2
📥 Commits

Reviewing files that changed from the base of the PR and between 2a49747 and 410442d.

📒 Files selected for processing (2)
  • scripts/carry.py
  • tests/test_carry.py
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.50%. Comparing base (e96cb58) to head (410442d).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2485      +/-   ##
===========================================
+ Coverage    58.47%   58.50%   +0.03%     
===========================================
  Files           16       16              
  Lines         8062     8066       +4     
===========================================
+ Hits          4714     4719       +5     
+ Misses        3348     3347       -1     
Flag Coverage Δ
python-3.13 58.50% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved review issues were identified.

0 open findings

What changed in this PR

Fixes cross-platform Git worktree registration checks in carry.py and standardizes reported paths to POSIX separators.

Changes:

  • Compare resolved worktree paths.
  • Reject missing or duplicate registrations.
  • Add regression tests and normalize change-report paths.
File Description
tests/​test_carry.py Adds worktree registration regression coverage.
scripts/​carry.py Implements cross-platform matching and POSIX path output.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit e01f2ef into develop Oct 7, 2026
13 checks passed
@ptr727
ptr727 deleted the fix/carry-worktree-registration-windows branch October 7, 2026 17:23
ptr727 added a commit that referenced this pull request Oct 7, 2026
….py, and install-tools.ps1 (#2489)

## Summary

Promotes four changes to `main`. Three are fixes from the Windows-host
lane, each verified on a native Windows 11 host.

- [#2484](#2484): the six
`test_bootstrap` tests that execute `install-tools.sh` directly now skip
off Linux instead of erroring with `WinError 193`. Linux CI still runs
them.
- [#2485](#2485):
`carry.py`'s worktree-registration check compares resolved paths instead
of strings, so it no longer refuses every registered worktree on
Windows. Its change lines print POSIX paths on every host.
- [#2486](#2486):
`install-tools.ps1` reads a winget Version token that is not a version,
such as `Unknown`, `<` or `>`, as an unread installed version. The tool
reports `unknown` rather than `outdated`, and `-Install` leaves it alone
instead of installing over it.
- [#2482](#2482):
`pr_review.py` reads Copilot's revised overview shape. Refs #2479.

Closes #2473
Closes #1117
Closes #2258

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants