From 17a36cc83980d278a8cab5132bf14de731b352ca Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 16 Mar 2026 19:46:44 +0000 Subject: fix: repair test regressions and add pre-commit/pre-push verification gates Fix four pre-existing bugs exposed after resolving a build failure: - sandboxCloneSource: accept any URL scheme for origin remote (was filtering out https://) - setupSandbox callers: fix := shadow variable so sandboxDir is set on BlockedError - parseGeminiStream: parse result lines to return execution errors and cost - TestElaborateTask_InvalidJSONFromClaude: stub Gemini fallback so test is hermetic Add verification infrastructure: - scripts/verify: runs go build + go test -race, used by hooks and deploy - scripts/hooks/pre-commit: blocks commits that don't compile - scripts/hooks/pre-push: blocks pushes where tests fail - scripts/install-hooks: symlinks version-controlled hooks into .git/hooks/ - scripts/deploy: runs scripts/verify before building the binary Co-Authored-By: Claude Sonnet 4.6 --- internal/executor/claude_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/executor/claude_test.go') diff --git a/internal/executor/claude_test.go b/internal/executor/claude_test.go index 04ea6b7..e76fbf2 100644 --- a/internal/executor/claude_test.go +++ b/internal/executor/claude_test.go @@ -414,7 +414,7 @@ func TestSetupSandbox_ClonesGitRepo(t *testing.T) { src := t.TempDir() initGitRepo(t, src) - sandbox, err := setupSandbox(src) + sandbox, err := setupSandbox(src, slog.New(slog.NewTextHandler(io.Discard, nil))) if err != nil { t.Fatalf("setupSandbox: %v", err) } @@ -441,7 +441,7 @@ func TestSetupSandbox_InitialisesNonGitDir(t *testing.T) { // A plain directory (not a git repo) should be initialised then cloned. src := t.TempDir() - sandbox, err := setupSandbox(src) + sandbox, err := setupSandbox(src, slog.New(slog.NewTextHandler(io.Discard, nil))) if err != nil { t.Fatalf("setupSandbox on plain dir: %v", err) } @@ -621,12 +621,12 @@ func TestTeardownSandbox_BuildSuccess_ProceedsToAutocommit(t *testing.T) { func TestTeardownSandbox_CleanSandboxWithNoNewCommits_RemovesSandbox(t *testing.T) { src := t.TempDir() initGitRepo(t, src) - sandbox, err := setupSandbox(src) + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + sandbox, err := setupSandbox(src, logger) if err != nil { t.Fatalf("setupSandbox: %v", err) } - logger := slog.New(slog.NewTextHandler(io.Discard, nil)) execRecord := &storage.Execution{} headOut, _ := exec.Command("git", "-C", sandbox, "rev-parse", "HEAD").Output() -- cgit v1.2.3