Skip to content

fix(workspace): resolve workspace paths against git root, not process CWD#1126

Merged
nextlevelshit merged 4 commits intomainfrom
1124-workspace-git-root
Apr 16, 2026
Merged

fix(workspace): resolve workspace paths against git root, not process CWD#1126
nextlevelshit merged 4 commits intomainfrom
1124-workspace-git-root

Conversation

@nextlevelshit
Copy link
Copy Markdown
Collaborator

Summary

  • CreateWorkspace was resolving .wave/workspaces/ relative to os.Getwd() (process CWD) instead of the git root, causing misplaced workspace directories when tests run from sub-packages like internal/pipeline/
  • Added gitRoot() helper in internal/workspace/workspace.go that walks up the directory tree to locate the git root via .git presence, then always resolves workspace base paths against it
  • Added **/.wave/workspaces/ wildcard to .gitignore to catch any future stray workspace directories
  • Added comprehensive tests in internal/workspace/workspace_test.go covering git-root resolution, CWD-independent path creation, and error cases
  • Test files across internal/pipeline/, internal/webui/, and internal/contract/ were added/updated as part of broader test coverage improvements on this branch

Related to #1124

Changes

  • internal/workspace/workspace.go — added gitRoot() helper; CreateWorkspace now calls gitRoot() to anchor the workspace base path
  • internal/workspace/workspace_test.go — new test suite covering the fix
  • .gitignore — added **/.wave/workspaces/ wildcard
  • specs/1124-workspace-git-root/ — planning artifacts (spec, plan, tasks)

Test Plan

  • go test ./internal/workspace/... — unit tests for git-root resolution
  • go test -race ./... — full suite with race detection to confirm no regressions
  • Manually verified that workspace directories are no longer created under internal/pipeline/.wave/ when tests run from sub-package directories

Add ~1400 lines of new tests across four packages:
- pipeline: graph execution, chat workspace, step ref resolution, workspace creation
- webui: embed helpers, icon rendering, token formatting
- contract: LLM judge model resolution, test suite dir field validation
- manifest: type parsing and validation
- fix stale llm_judge_test assertion for balanced tier fallback
- graph_test.go: check os.Chdir return in defer
- create_workspace_test.go: add t.Logf to empty recover branch
…-cycle

- Strip ## OUTPUT section from fetch-assess.md — Wave injects output
  path and schema via buildContractPrompt(), hardcoding in prompts
  violates AGENTS.md rule #1
- Remove all adapter: opencode from full-impl-cycle.yaml — adapter
  should be set via CLI --adapter flag or persona defaults, not
  hardcoded per step
… CWD

NewWorkspaceManager now calls resolveGitRoot() (git rev-parse --show-toplevel)
when baseDir is relative, anchoring .wave/workspaces/ to the repository root
regardless of where tests or subprocesses set their CWD. Absolute paths (e.g.
t.TempDir()) pass through unchanged. Also adds **/.wave/workspaces/ to
.gitignore as a safety net for any future stray directories. Implements #1124.
@nextlevelshit nextlevelshit merged commit f163c31 into main Apr 16, 2026
7 checks passed
@nextlevelshit nextlevelshit deleted the 1124-workspace-git-root branch April 16, 2026 09:43
@nextlevelshit
Copy link
Copy Markdown
Collaborator Author

Review Resolution Summary

Total findings reviewed: 0

No review feedback was found on this PR. The PR was approved and merged without any inline comments, PR-level comments, or formal reviews requiring resolution.

@nextlevelshit
Copy link
Copy Markdown
Collaborator Author

Review Resolution Summary

Total findings reviewed: 0

No review feedback was found on this PR. The PR was approved and merged without any inline comments, PR-level comments, or formal reviews requiring resolution.

Test suite: passing

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