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/api/elaborate_test.go | 2 ++ internal/api/server_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'internal/api') diff --git a/internal/api/elaborate_test.go b/internal/api/elaborate_test.go index 0b5c706..5216bcd 100644 --- a/internal/api/elaborate_test.go +++ b/internal/api/elaborate_test.go @@ -350,6 +350,8 @@ func TestElaborateTask_InvalidJSONFromClaude(t *testing.T) { // Fake Claude returns something that is not valid JSON. srv.elaborateCmdPath = createFakeClaude(t, "not valid json at all", 0) + // Ensure Gemini fallback also fails so we get the expected 502. + srv.geminiBinPath = "/nonexistent/gemini" body := `{"prompt":"do something"}` req := httptest.NewRequest("POST", "/api/tasks/elaborate", bytes.NewBufferString(body)) diff --git a/internal/api/server_test.go b/internal/api/server_test.go index 5c0deba..516e289 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -255,7 +255,7 @@ func TestGeminiLogs_ParsedCorrectly(t *testing.T) { } // 6. Verify the content retrieved via the API endpoint. - req = httptest.NewRequest("GET", "/api/tasks/"+tk.ID+"/executions/"+exec.ID+"/log", nil) + req = httptest.NewRequest("GET", "/api/executions/"+exec.ID+"/log", nil) w = httptest.NewRecorder() srv.Handler().ServeHTTP(w, req) -- cgit v1.2.3