Summary
Two tests in internal/gitview fail for every developer on macOS, and have done
since 2026-05-07. CI never sees it because CI is Linux-only.
$ go test ./internal/gitview/ -run 'TestGitViewTestSuite/TestResolveRevision'
gitView_test.go:543:
Error: Received unexpected error:
open /private/var/folders/21/.../T/testRepoDir951364852/.git: is a directory
--- FAIL: TestGitViewTestSuite/TestResolveRevision
Failing tests (both fail in isolation, so this is not test-order dependent):
TestGitViewTestSuite/TestMatchPatternInCommitMessageORBranchName (gitView_test.go:389)
TestGitViewTestSuite/TestResolveRevision (gitView_test.go:543)
A third site is latent: cmd/kosli/attestJira_test.go:49 has identical setup,
but SetupTest calls SkipIfEnvVarUnset(["KOSLI_JIRA_API_TOKEN", "KOSLI_JIRA_USERNAME"]) first, so on a Mac it skips before reaching the helper.
Set those two variables locally and it fails the same way.
Cause
internal/testHelpers/testHelpers.go:64-71 builds two filesystems from one
os.MkdirTemp path, then inits a repo:
fs := osfs.New(repoPath) // worktree
storerFS := osfs.New(filepath.Join(repoPath, ".git")) // git database
storer := filesystem.NewStorage(storerFS, cache.NewObjectLRUDefault())
repo, err := git.Init(storer, fs)
go-git's createDotGitFile (go-git v5.19.1, repository.go:159-177) decides
whether the git dir is in its default place:
path, err := filepath.Rel(worktree.Root(), storage.Root())
if path == GitDirName { // ".git"
return nil // default place, nothing to write
}
f, err := worktree.Create(GitDirName) // else write a "gitdir: ..." file
go-billy v5.9.0 changed newChrootOS to resolve its base dir:
if baseDir != "" {
resolved, err := filepath.EvalSymlinks(baseDir)
if err != nil {
return chroot.New(&ChrootOS{}, baseDir) // does not exist: keep raw
}
baseDir = resolved
}
v5.8.0 did no resolution at all. osfs is byte-identical between v5.9.0 and
v5.9.1, so the current pin (go.mod: v5.9.1) is not the trigger; the bump to
v5.9.0 in commit ed4e2a2 (2026-05-07, PR #865) is.
The two roots now resolve asymmetrically, because the worktree directory exists
and .git does not exist yet:
mkdirtemp = /var/folders/21/.../T/testRepoDir620401365
worktree = /private/var/folders/21/.../T/testRepoDir620401365 <- resolved
storage = /var/folders/21/.../T/testRepoDir620401365/.git <- not resolved
rel = "../../../../../../../var/folders/21/.../T/testRepoDir620401365/.git"
rel is no longer ".git", so go-git concludes the git dir lives elsewhere and
calls worktree.Create(".git"). git.Init has already created .git as a
directory, so the create fails with "is a directory".
Why macOS only: this needs a symlink in the temp path. On macOS os.MkdirTemp
returns /var/folders/... and /var is a symlink to /private/var. On Linux
the path is under /tmp with no symlink, so EvalSymlinks is a no-op, both
roots agree, and the test passes. Every workflow in .github/workflows runs on
ubuntu-*.
Scope: test-only, no user impact
createDotGitFile is reachable only from git.Init. The CLI never inits or
writes a repository:
- the only production go-git entry point is
git.PlainOpenWithOptions
(internal/gitview/gitView.go:54); there are no git.Init, git.Clone,
.Commit( or Worktree() calls outside tests and the test helper
- audited the whole build graph (1451 package dirs from
go list -deps -f '{{.Dir}}' ./..., grep patterns canary-verified first):
no transitive dependency imports go-git's root package, so nothing else can
call Init
- when a user runs the CLI, both the worktree and its
.git already exist, so
EvalSymlinks succeeds for both and the roots stay consistent
So there is no compliance consequence: nothing here can report a non-compliant
artifact as compliant. The cost is a permanently red local suite on Macs, which
hides real regressions and trains developers to ignore failures.
Suggested fix
Resolve the path once in InitializeGitRepo, before deriving the two
filesystems, so both roots agree regardless of platform:
resolved, err := filepath.EvalSymlinks(repoPath)
if err != nil {
return nil, nil, nil, err
}
fs := osfs.New(resolved)
storerFS := osfs.New(filepath.Join(resolved, ".git"))
Fixing it in the shared helper covers internal/gitview and the latent
cmd/kosli/attestJira_test.go site together.
Acceptance
go test ./internal/gitview/ passes on macOS and on Linux
- the Jira suite passes on macOS with
KOSLI_JIRA_API_TOKEN and
KOSLI_JIRA_USERNAME set
- no production code changes
Summary
Two tests in
internal/gitviewfail for every developer on macOS, and have donesince 2026-05-07. CI never sees it because CI is Linux-only.
Failing tests (both fail in isolation, so this is not test-order dependent):
TestGitViewTestSuite/TestMatchPatternInCommitMessageORBranchName(gitView_test.go:389)TestGitViewTestSuite/TestResolveRevision(gitView_test.go:543)A third site is latent:
cmd/kosli/attestJira_test.go:49has identical setup,but
SetupTestcallsSkipIfEnvVarUnset(["KOSLI_JIRA_API_TOKEN", "KOSLI_JIRA_USERNAME"])first, so on a Mac it skips before reaching the helper.Set those two variables locally and it fails the same way.
Cause
internal/testHelpers/testHelpers.go:64-71builds two filesystems from oneos.MkdirTemppath, then inits a repo:go-git's
createDotGitFile(go-git v5.19.1, repository.go:159-177) decideswhether the git dir is in its default place:
go-billy v5.9.0 changed
newChrootOSto resolve its base dir:v5.8.0 did no resolution at all.
osfsis byte-identical between v5.9.0 andv5.9.1, so the current pin (go.mod: v5.9.1) is not the trigger; the bump to
v5.9.0 in commit ed4e2a2 (2026-05-07, PR #865) is.
The two roots now resolve asymmetrically, because the worktree directory exists
and
.gitdoes not exist yet:relis no longer ".git", so go-git concludes the git dir lives elsewhere andcalls
worktree.Create(".git").git.Inithas already created.gitas adirectory, so the create fails with "is a directory".
Why macOS only: this needs a symlink in the temp path. On macOS
os.MkdirTempreturns
/var/folders/...and/varis a symlink to/private/var. On Linuxthe path is under
/tmpwith no symlink, soEvalSymlinksis a no-op, bothroots agree, and the test passes. Every workflow in
.github/workflowsruns onubuntu-*.Scope: test-only, no user impact
createDotGitFileis reachable only fromgit.Init. The CLI never inits orwrites a repository:
git.PlainOpenWithOptions(
internal/gitview/gitView.go:54); there are nogit.Init,git.Clone,.Commit(orWorktree()calls outside tests and the test helpergo list -deps -f '{{.Dir}}' ./..., grep patterns canary-verified first):no transitive dependency imports go-git's root package, so nothing else can
call
Init.gitalready exist, soEvalSymlinkssucceeds for both and the roots stay consistentSo there is no compliance consequence: nothing here can report a non-compliant
artifact as compliant. The cost is a permanently red local suite on Macs, which
hides real regressions and trains developers to ignore failures.
Suggested fix
Resolve the path once in
InitializeGitRepo, before deriving the twofilesystems, so both roots agree regardless of platform:
Fixing it in the shared helper covers
internal/gitviewand the latentcmd/kosli/attestJira_test.gosite together.Acceptance
go test ./internal/gitview/passes on macOS and on LinuxKOSLI_JIRA_API_TOKENandKOSLI_JIRA_USERNAMEset