feat: add --no-setup for worktree creation #5

Merged
jercik merged 1 commit from feat/no-setup into main 2026-10-23 08:45:26 +00:00
Owner

Allows repair checkouts to be created when dependency setup cannot yet succeed. Callers can repair their lockfile in the new checkout, then run the required setup themselves.

An explicit opt-out avoids deliberately attempting a failing install or changing failure cleanup. Default setup remains enabled. Built CLI fixtures preserve copied local files, skip installation and Next.js type generation, and retain cleanup on copy failures.

Consumers must wait for publication and verify the installed artifact before using the flag. Native lock repairs and frozen-install validation remain separate work.

Allows repair checkouts to be created when dependency setup cannot yet succeed. Callers can repair their lockfile in the new checkout, then run the required setup themselves. An explicit opt-out avoids deliberately attempting a failing install or changing failure cleanup. Default setup remains enabled. Built CLI fixtures preserve copied local files, skip installation and Next.js type generation, and retain cleanup on copy failures. Consumers must wait for publication and verify the installed artifact before using the flag. Native lock repairs and frozen-install validation remain separate work.
feat: add an option to skip project setup
All checks were successful
Checks / pr-flow-canary (pull_request) Has been skipped
Checks / reuse (pull_request) Successful in 4s
commit-msg / commitlint (pull_request) Successful in 12s
Checks / quality-checks (26.5.0) (pull_request) Successful in 34s
Checks / quality-checks (24.15.0) (pull_request) Successful in 34s
Review / Review (pull_request_target) Successful in 3m37s
dc92d05f3a

Review 01M5KYKJ8CSYC0N6NN53NV6KNS — head dc92d05f3ad8f59df61ab2dd20a193cb5ba56580

Review — j4k-oss/worktree-add @ f56cdec3b8

Scope: diff against base tree 9ee75924a31f
Status: dispatched — coverage complete (9/9 slots terminal)
Facts: current review-wide projection

Computed under:

{
  "abandonment": "abandonment-v1",
  "anchor_recipe": 1,
  "batch_policy": "batch-v1",
  "coverage": "coverage-v3",
  "dispatch_policy": "dispatch-v2",
  "grounder_version": 1,
  "grounding_read_rule": "grounding-read-v1",
  "promotion_policy": "promotion-v1",
  "report": "report-v4",
  "tally": "tally-v1",
  "triage_settle": "triage-settle-v2"
}

Findings (1)

low — The unborn-HEAD creation test derives its expected outcome from the production guard

  • claim: 01M5KYQPY3NZD1KME8DGD71ZFZ
  • anchor: src/cli/run-worktree-add.test.ts (snippet)
    const oldGitVersion = findTooOldGitForUnbornHead();
  • lens: test-trimming · arm: default
  • verdicts: 1 valid / 0 invalid / 0 uncertain
    • pass 01M5KYR2F200SRCZKJX002BAJM · valid: The grounded excerpt confirms that the test calls the production helper findTooOldGitForUnbornHead() to set oldGitVersion. The reviewer quotes the assertion expect(worktreeBranch).toBe(oldGitVersion === undefined ? "feature/new" : "no worktree") and the guard in runWorktreeAdd, which throws formatUnbornHeadGitMessage(oldGitVersion) whenever that same helper returns a value. The trace is coherent, so the oracle is the implementation's own decision. That matches the test guideline's 'expectation copied from the implementation' disconnect. The claim supplies the promised behavior (on supported Git, creation succeeds for an unborn HEAD), the weakness (the expected outcome follows the helper), and a regression it would miss: if the helper returns a version for every unborn HEAD, production refuses and the test's expectations shift to accept the refusal, so it stays green. Adapting to the installed Git is a legitimate need, but it does not require the production helper as the oracle. The proposed remedy keeps the integration test and the refusal check and only replaces the oracle with an independent probe, which matches the guideline's preference for repair over deletion. A separate unit test of unborn-head-support.ts might cover the helper itself, but the batch shows none, and that would not restore this test's own end-to-end protection. Low severity is appropriate.
  • disposition: none

The test named “creates the worktree” can pass when a regression rejects every repository with no commits, including ones whose Git supports creating the worktree. Its filesystem assertion does not independently protect creation because the same guard also decides whether absence is expected.

The test calls findTooOldGitForUnbornHead() to set oldGitVersion, then expects either “created” or the version error according to that result. It also asserts expect(worktreeBranch).toBe(oldGitVersion === undefined ? "feature/new" : "no worktree"). In runWorktreeAdd, the production path calls the same helper and throws new Error(formatUnbornHeadGitMessage(oldGitVersion)) whenever it returns a value. For example, changing the helper to return "0.0" for every unborn HEAD would make the command refuse creation; both the expected error and expected missing worktree would change to accept that refusal. The companion cleanup test likewise uses this helper to choose between an installation failure and the early version refusal.

Determine support independently in the fixture, for example by probing Git's ability to create an unborn worktree in a separate scratch repository, then require creation on supported installations. Retain the existing branch and filesystem checks, and retain a separate refusal check for unsupported Git. This restores the intended creation protection without deleting the useful integration tests.

This is a static trace through both unborn-HEAD tests in src/cli/run-worktree-add.test.ts, the guard in src/cli/run-worktree-add.ts, and src/git/unborn-head-support.ts. I also inspected src/git/create-worktree.test.ts; its mocked command tests do not exercise this guard. I did not execute the hypothetical mutation; test dependencies are absent from the snapshot environment.

Running the tests on supported Git with the helper changed to reject all unborn HEADs would establish the missed regression. An independent assertion that still requires creation under that mutation would refute it.

Other claims

  • grounding-pending (0)
  • ungrounded (0)
  • rejected (1)
    • 01M5KYQ5CXFHGY0ZVSFY0KG1JX low — The --no-setup skip notice is split into a dry-run branch and a raw console.error branch, each restating what setupProject does
  • duplicate-of (0)
  • unadjudicated (0)

Coverage

Coverage pass: 01M5KYKJB04473MTF1PMWQ139P
Accounting: complete
Slot health: healthy

lens part arm unit status runs loss
general-bug whole default no-claims 1 no
writing-quality whole default no-claims 1 no
test-trimming whole default claims-emitted 1 no
restated-sets whole default no-claims 1 no
project-docs whole default no-claims 1 no
unix-cli whole default no-claims 1 no
use-effect whole default no-claims 1 no
module-design whole default claims-emitted 1 no
react whole default no-claims 1 no
<!-- review:summary --> **Review** `01M5KYKJ8CSYC0N6NN53NV6KNS` — head `dc92d05f3ad8f59df61ab2dd20a193cb5ba56580` # Review — j4k-oss/worktree-add @ f56cdec3b805 Scope: diff against base tree `9ee75924a31f` Status: dispatched — coverage complete (9/9 slots terminal) Facts: current review-wide projection Computed under: ```json { "abandonment": "abandonment-v1", "anchor_recipe": 1, "batch_policy": "batch-v1", "coverage": "coverage-v3", "dispatch_policy": "dispatch-v2", "grounder_version": 1, "grounding_read_rule": "grounding-read-v1", "promotion_policy": "promotion-v1", "report": "report-v4", "tally": "tally-v1", "triage_settle": "triage-settle-v2" } ``` ## Findings (1) ### low — The unborn-HEAD creation test derives its expected outcome from the production guard - claim: `01M5KYQPY3NZD1KME8DGD71ZFZ` - anchor: `src/cli/run-worktree-add.test.ts` (snippet) ``` const oldGitVersion = findTooOldGitForUnbornHead(); ``` - lens: test-trimming · arm: default - verdicts: 1 valid / 0 invalid / 0 uncertain - pass `01M5KYR2F200SRCZKJX002BAJM` · valid: The grounded excerpt confirms that the test calls the production helper findTooOldGitForUnbornHead() to set oldGitVersion. The reviewer quotes the assertion expect(worktreeBranch).toBe(oldGitVersion === undefined ? "feature/new" : "no worktree") and the guard in runWorktreeAdd, which throws formatUnbornHeadGitMessage(oldGitVersion) whenever that same helper returns a value. The trace is coherent, so the oracle is the implementation's own decision. That matches the test guideline's 'expectation copied from the implementation' disconnect. The claim supplies the promised behavior (on supported Git, creation succeeds for an unborn HEAD), the weakness (the expected outcome follows the helper), and a regression it would miss: if the helper returns a version for every unborn HEAD, production refuses and the test's expectations shift to accept the refusal, so it stays green. Adapting to the installed Git is a legitimate need, but it does not require the production helper as the oracle. The proposed remedy keeps the integration test and the refusal check and only replaces the oracle with an independent probe, which matches the guideline's preference for repair over deletion. A separate unit test of unborn-head-support.ts might cover the helper itself, but the batch shows none, and that would not restore this test's own end-to-end protection. Low severity is appropriate. - disposition: none > The test named “creates the worktree” can pass when a regression rejects every repository with no commits, including ones whose Git supports creating the worktree. Its filesystem assertion does not independently protect creation because the same guard also decides whether absence is expected. > > The test calls `findTooOldGitForUnbornHead()` to set `oldGitVersion`, then expects either “created” or the version error according to that result. It also asserts `expect(worktreeBranch).toBe(oldGitVersion === undefined ? "feature/new" : "no worktree")`. In `runWorktreeAdd`, the production path calls the same helper and throws `new Error(formatUnbornHeadGitMessage(oldGitVersion))` whenever it returns a value. For example, changing the helper to return "0.0" for every unborn HEAD would make the command refuse creation; both the expected error and expected missing worktree would change to accept that refusal. The companion cleanup test likewise uses this helper to choose between an installation failure and the early version refusal. > > Determine support independently in the fixture, for example by probing Git's ability to create an unborn worktree in a separate scratch repository, then require creation on supported installations. Retain the existing branch and filesystem checks, and retain a separate refusal check for unsupported Git. This restores the intended creation protection without deleting the useful integration tests. > > This is a static trace through both unborn-HEAD tests in `src/cli/run-worktree-add.test.ts`, the guard in `src/cli/run-worktree-add.ts`, and `src/git/unborn-head-support.ts`. I also inspected `src/git/create-worktree.test.ts`; its mocked command tests do not exercise this guard. I did not execute the hypothetical mutation; test dependencies are absent from the snapshot environment. > > Running the tests on supported Git with the helper changed to reject all unborn HEADs would establish the missed regression. An independent assertion that still requires creation under that mutation would refute it. ## Other claims - grounding-pending (0) - ungrounded (0) - rejected (1) - `01M5KYQ5CXFHGY0ZVSFY0KG1JX` low — The `--no-setup` skip notice is split into a dry-run branch and a raw `console.error` branch, each restating what `setupProject` does - duplicate-of (0) - unadjudicated (0) ## Coverage Coverage pass: 01M5KYKJB04473MTF1PMWQ139P Accounting: complete Slot health: healthy | lens | part | arm | unit status | runs | loss | | --- | --- | --- | --- | --- | --- | | general-bug | whole | default | no-claims | 1 | no | | writing-quality | whole | default | no-claims | 1 | no | | test-trimming | whole | default | claims-emitted | 1 | no | | restated-sets | whole | default | no-claims | 1 | no | | project-docs | whole | default | no-claims | 1 | no | | unix-cli | whole | default | no-claims | 1 | no | | use-effect | whole | default | no-claims | 1 | no | | module-design | whole | default | claims-emitted | 1 | no | | react | whole | default | no-claims | 1 | no |
Author
Owner

The low-severity claim 01M5KYQPY3NZD1KME8DGD71ZFZ identifies an existing test weakness. Both unborn-HEAD tests and their findTooOldGitForUnbornHead() expectations are unchanged from base 45765d21f1575e7e53348c60ba85b9de695eb7ff in this PR's head dc92d05f3ad8f59df61ab2dd20a193cb5ba56580.

The weakness is not fixed here. It falls outside this change's accepted setup opt-out, default, copy, cleanup and dry-run criteria. The user's instruction is to report findings outside those criteria instead of starting another round, so no follow-up PR or issue is being created. The independent reviews and built-CLI checks cover this PR's behavior.

The low-severity claim `01M5KYQPY3NZD1KME8DGD71ZFZ` identifies an existing test weakness. Both unborn-HEAD tests and their `findTooOldGitForUnbornHead()` expectations are unchanged from base `45765d21f1575e7e53348c60ba85b9de695eb7ff` in this PR's head `dc92d05f3ad8f59df61ab2dd20a193cb5ba56580`. The weakness is not fixed here. It falls outside this change's accepted setup opt-out, default, copy, cleanup and dry-run criteria. The user's instruction is to report findings outside those criteria instead of starting another round, so no follow-up PR or issue is being created. The independent reviews and built-CLI checks cover this PR's behavior.
jercik merged commit 787f70f421 into main 2026-10-23 08:45:26 +00:00
jercik deleted branch feat/no-setup 2026-10-23 08:45:26 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
j4k-oss/worktree-add!5
No description provided.