# Test recovery for [#15833](https://github.com/pingdotgg/t3code/pull/15833)

- Head repository: [SunkenInTime/t3code](https://github.com/SunkenInTime/t3code).
- Branch: `t3code/worktree-remove-junction-leftovers`; base: `main`.
- Worktree: `/home/ubuntu/wt/worktree-git-01`.
- Starting head: [8e5f073fe3](https://github.com/SunkenInTime/t3code/commit/8e5f073fe3cad85190f23f3a83383a96589202be).
- Final head: [7890d409b3](https://github.com/SunkenInTime/t3code/commit/7890d409b3361084b042d2297e1ee9fcabfa26c8) (`7890d409b3361084b042d2297e1ee9fcabfa26c8`).
- Commit: `test(server): restore worktree short-name regression coverage`.
- This stage was local and test-only. No push, merge, browser, dev server, provider turn, network retry, or unrelated PR work. T3 thread metadata was linked to the target PR.
- Remote maintainer-edit permission was not queried; the parent owns publication.

## Change and counts

Restored the existing real-Git `it.effect("leaves a folder alone that only shares the worktree's short name", ...)` verbatim from the starting head's parent. One test, 27 inserted lines including its wrapper and blank separator, no new helpers. Both deterministic parameterized cleanup cases are unchanged.

Selected recovery coverage: **2 → 3 cases** (two cleanup cases plus one short-name regression).
Focused `-t worktree` suite: **34 → 35 passing cases**. The 34 baseline is supplied by the parent; this stage directly observed 35 passing, 133 skipped, 168 total in the file. File total increased from 167 to 168.

The real-Git test creates an external registered worktree named `short` and an unrelated `cwd/short/linked` junction/symlink. Removal through the driver must leave the unrelated link and external worktree intact. The fake-success cleanup cases cannot exercise Git's short-name resolution.

## Fail-before / pass-after proof

All commands ran from the worktree and began with:
```sh
export PATH="$HOME/.local/bin:$PATH";
```
Only the installed `./node_modules/.bin/vp` was invoked, with no dependency install.

Initial valid-production sanity check:
```sh
export PATH="$HOME/.local/bin:$PATH"; ./node_modules/.bin/vp test run apps/server/src/vcs/GitVcsDriverCore.test.ts -t "leaves a folder alone that only shares"
```
Exit 0: **1 passed, 167 skipped (168)**; 3.01 seconds.

Fail-before mutation changed exactly one production line:
```diff
-    args.push("--", target);
+    args.push("--", input.path);
```
No other production behavior changed. Ran:
```sh
export PATH="$HOME/.local/bin:$PATH"; ./node_modules/.bin/vp test run apps/server/src/vcs/GitVcsDriverCore.test.ts -t "leaves a folder alone that only shares"
```
Exit 1: **1 failed, 167 skipped (168)**; 2.51 seconds. Failure:
```text
Error: ENOENT: no such file or directory, lstat '/tmp/git-vcs-driver-test-Z5v4ca/short/linked'
GitVcsDriverCore.test.ts:3863:30
assert.isTrue(NodeFS.lstatSync(pathService.join(unrelated, "linked")).isSymbolicLink());
```
This is an observable filesystem regression: the unrelated link was removed.

Restored the production file byte-for-byte from the starting head, then ran:
```sh
export PATH="$HOME/.local/bin:$PATH"; ./node_modules/.bin/vp test run apps/server/src/vcs/GitVcsDriverCore.test.ts -t worktree
```
Exit 0: **35 passed, 133 skipped (168)**; one file passed; 9.21 seconds. This includes the restored regression and both unchanged cleanup cases.

## Targeted checks

```sh
export PATH="$HOME/.local/bin:$PATH"; ./node_modules/.bin/vp lint apps/server/src/vcs/GitVcsDriverCore.test.ts
```
Exit 0, one existing warning at line 2045: `t3code(no-inline-schema-compile)` for `Schema.decodeEffect(ReviewDiffPreviewInput)`. Verified that line is unchanged from the starting head.

```sh
export PATH="$HOME/.local/bin:$PATH"; ./node_modules/.bin/vp fmt --check apps/server/src/vcs/GitVcsDriverCore.test.ts
export PATH="$HOME/.local/bin:$PATH"; git diff --check
```
Both exit 0. Formatting: all matched files use the correct format (one file).
The commit hook also passed staged-file formatting.

Post-commit assertions confirm a clean worktree, only the existing test file changed, production equals the starting head byte-for-byte, and removing the restored block exactly reproduces the starting test file. No repo-wide checks or typecheck ran.

## Handoff

Parent owns body refresh, full parallel reviews, and push when connectivity permits. This stage adds no implementation changes and no additional cases beyond the single restored regression.
