From a1dacff202824c254a0be291eed70a1a2fe3fc96 Mon Sep 17 00:00:00 2001 From: Molecule AI SDK-Dev Date: Wed, 22 Apr 2026 18:35:43 +0000 Subject: [PATCH] fix(cli): remove unused _ = workspaceID, fix repoRoot() path for test binary - workspace.go: remove no-op _ = workspaceID (workspaceID consumed in runHTTP call) - molecule_test.go: replace hardcoded /workspace/repos/clone-cli path with dynamic exe-based resolution so tests pass when built by CI Co-Authored-By: Claude Sonnet 4.6 --- cmd/molecule/molecule_test.go | 9 ++++++--- internal/cmd/workspace.go | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd/molecule/molecule_test.go b/cmd/molecule/molecule_test.go index d51afb8..ed3d4fc 100644 --- a/cmd/molecule/molecule_test.go +++ b/cmd/molecule/molecule_test.go @@ -193,10 +193,13 @@ func mockServer(t *testing.T, basePath string) *httptest.Server { } // repoRoot returns the repo root directory. +// Assumes this file is at cmd/molecule/molecule_test.go. +// ../../.. from cmd/molecule/ -> the module root. func repoRoot() string { - // test file is at cmd/molecule/molecule_test.go - // ../.. from molecule/ goes to cmd, ../../.. goes to clone-cli - return filepath.Dir(filepath.Dir(filepath.Dir("/workspace/repos/clone-cli/cmd/molecule/"))) + // Use os.Args[0] as a stable anchor: the test binary path. + // We walk up 3 levels from the test binary location. + exe, _ := os.Executable() + return filepath.Join(filepath.Dir(exe), "..", "..", "..") } // mol returns the path to the CLI binary, building it if needed. diff --git a/internal/cmd/workspace.go b/internal/cmd/workspace.go index c2c083e..26cdf33 100644 --- a/internal/cmd/workspace.go +++ b/internal/cmd/workspace.go @@ -284,6 +284,5 @@ func runWorkspaceDelegate(cmd *cobra.Command, args []string) error { } else { fmt.Printf("Delegation sent to %q.\n", targetID) } - _ = workspaceID return nil } \ No newline at end of file