Harden worktree guard contracts across Bash and PowerShell - #3113
Chris0Jeky wants to merge 13 commits into
Conversation
|
@codex review Please review exact head |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43c446b625
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex address that feedback Please fix the reviewed exact head by making whitespace-only expected-branch input fail closed consistently in Bash and PowerShell, add cross-shell regression coverage for that input, run the focused guard contracts, and leave the PR unmerged for exact-head hosted qualification and re-review. |
Summary
Testing
|
|
@codex address that feedback The regression-first head Please implement the narrow fix now:
|
|
@codex address that feedback The prior task summary is not published: reported commit Please apply the already-described Bash and PowerShell fix directly to branch |
Summary
Testing
|
Summary
Testing
|
|
@codex review Please re-review exact head |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Exact-head verification refresh for
The PR is technically qualified but remains deliberately unmerged because it changes |
Summary
Closes the remaining executable residuals in #1855 across both worktree guards and their hosted contract suite.
.gitpointer is valid, so it satisfies pointer check 2, but its git directory is not under<common-git-dir>/worktrees/<name>, so containment check 1 must reject it.detachedplus a named branch is a caller configuration error with exit code2; the existingAny + branchshorthand still implies branch mode.2, while an empty string still means no named branch requirement.WT_REPO_ROOTandWT_GIT_DIRin one path flavour under Git for Windows. Internal security comparisons continue to use physicalpwd -Ppaths; only the public export preserves Git's own absolute spelling (C:/...) so native-tool callers no longer receive mixedC:/...and/c/...values.windows-latest, while preserving the existing PowerShell governance checks.Design and safety boundary
The linked-worktree policy is unchanged: acceptance remains based on repository substance, not a conventional directory name. The implementation still verifies the physical linked git directory and
.gitpointer before exporting anything.No ADR is added for item 7. This PR does not introduce a new architectural choice; it turns the already-documented "substance over path shape" rule into mutation-backed executable evidence, aligns the two shell contracts, and removes an export representation mismatch. The tests and guard headers are the closest, actively enforced source of truth.
Regression-first evidence
43f6af24a32e6be63d5cc7b84d902a342399f2a8: all 38 existing guard checks and the submodule mutation contract passed, then the new shell expectation contract failed becausedetached + branchreturned0instead of setup error2.4d282043f02beb7b42243303c606666005759917: Ubuntu passed, while the exact Windows job reportedWT_REPO_ROOT=C:/...andWT_GIT_DIR=/c/...and failed the new contract.11181eb0ec3cbd665412198a2793d985ff1df1e9: required CI run34954334883, Docs Governance job104332612683, passed the existing 38 guard checks and both submodule checks, then the new Bash malformed-input case returned ordinary mismatch exit1instead of setup error2.Verification
Exact head:
e507fea64d0a5127ec09426509797a7e839bab7a349550321353495503257734955032542e507feaPRRT_kwDOQXwLG86idc7G: resolved with RED/GREEN evidencemain2cdc4525766101211fe04787e23bfb46b6aa4011Merge boundary
This PR touches
.github/workflows/reusable-docs-governance.ymland the agent-safety guard surface. Under ADR-0066/J.3 it remains open for maintainer review even after CI is terminal green; this PR is not auto-merged by the coordinator.Closes #1855