Skip to content

Fix TestImportPath outside a folder named "specsync" - #151

Merged
androidand merged 1 commit into
mainfrom
fix-import-path-test-worktree-name
Aug 28, 2026
Merged

androidand merged 1 commit into
mainfrom
fix-import-path-test-worktree-name

Conversation

@androidand

Copy link
Copy Markdown
Owner

Summary

Fixes #150. TestImportPath asserted the resolved package directory's basename ends in the literal string "specsync" — true for the primary clone, false for any git worktree named after its branch (this repo's own convention: specsync-<change>). It's been failing in every worktree despite nothing being wrong with the package's location.

Fix

Compare build.Import's resolved pkg.Dir against the test binary's own os.Getwd() instead of a literal folder-name check. go test always sets the process's working directory to the package's source directory, so this checks the real invariant doc.go documents (resolving the canonical import path lands back at wherever the package's files actually are), regardless of what the checkout is named on disk. It still fails the way it's meant to if the package is ever relocated under pkg/.

Testing

go build, go vet, go test ./... — zero failures now (previously 1, this test). release-plan/changelog -fail-on-unlinked-commits/audit-tasks/validate all pass.

🤖 Generated with Claude Code

TestImportPath asserted the resolved package directory's basename ends
in the literal string "specsync" — true for the primary clone, false
for any git worktree named after its branch (this repo's own
convention, e.g. specsync-<change>). Compare pkg.Dir against the test
binary's own working directory instead: go test always sets it to the
package's source directory, so this checks the real invariant
(resolving the canonical import path lands back at wherever the
package's files are) regardless of what the checkout is named on disk.

Closes #150
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying specsync with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8ea234b
Status: ✅  Deploy successful!
Preview URL: https://93f5b99a.specsync.pages.dev
Branch Preview URL: https://fix-import-path-test-worktre.specsync.pages.dev

View logs

@androidand
androidand merged commit e168303 into main Aug 28, 2026
2 checks passed
@androidand
androidand deleted the fix-import-path-test-worktree-name branch August 28, 2026 10:22
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.

Fix TestImportPath failing outside a folder literally named "specsync"

1 participant