Skip to content

Accept workspace-root cwd in validate when worktree is set#1

Open
cengebretson wants to merge 1 commit into
mainfrom
fix/validate-workspace-root-cwd
Open

Accept workspace-root cwd in validate when worktree is set#1
cengebretson wants to merge 1 commit into
mainfrom
fix/validate-workspace-root-cwd

Conversation

@cengebretson

Copy link
Copy Markdown
Owner

What

orc validate rejected a workspace-level next_action.cwd (e.g. ".") whenever the feature also had a worktree, failing with next_action.cwd: "." does not match any recorded worktree.

Why

ResolveCWD already maps "."/"" to the workspace root, and workspace-level stages (for example qa-automation) intentionally run there even when the feature has a worktree (see the STORY-456-export-api testdata fixture, which has a worktree and cwd: "."). ValidateRepos disagreed with ResolveCWD and would reject that valid state. The two are now consistent: a cwd that resolves to the workspace root is accepted, a cwd under a recorded worktree is accepted, and anything else is still rejected.

Changes

  • internal/state/state.go: ValidateRepos accepts a cwd resolving to the workspace root (in addition to under a worktree).
  • internal/state/state_test.go: add TestValidateRepos_CWDWorkspaceRootWithWorktree (failed before the fix, passes after). Existing TestValidateRepos_CWDNotUnderWorktree still rejects a genuinely-wrong path.
  • CHANGELOG.md: Unreleased > Fixed entry.

Verification

  • go test ./... green (full suite).
  • make lint reports 0 issues; gofmt clean.
  • New test confirmed red on main, green with the fix.

Risk

Low. The change only widens validation to accept an already-supported cwd value; it does not loosen the rejection of paths that are neither the workspace root nor under a worktree.

A workspace-level stage (e.g. qa-automation) intentionally runs at the
workspace root via next_action.cwd "." even when the feature has a worktree.
ResolveCWD already maps "."/"" to the workspace root, but ValidateRepos
rejected it as not under any recorded worktree. Validation now accepts a cwd
that resolves to the workspace root, keeping it consistent with ResolveCWD.
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.

1 participant