From 4958ea5100ebf8d4ff9fd818b7bc59d01989feb4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 23 Mar 2026 08:08:57 +0200 Subject: fix: address all HIGH-severity code quality audit findings - lsp/server.go: track request goroutines in inflight WaitGroup to prevent use-after-close writes on shutdown - lsp/llm_client_registry.go: acquire write lock before calling build() to eliminate TOCTOU race on cache population - lsp/handlers_codeaction.go: resolveSimplifyCodeAction now uses PromptCodeActionSimplify{System,User} (was wrongly using rewrite prompts) - askcli/taskexport.go: remove exported MustParseTaskExport to prevent panic on malformed external input; move to unexported test helper - cmd/ask/main.go: print error to stderr before os.Exit - llm/{openai,ollama,openrouter}.go: add interface satisfaction assertions - integrationtests/ask_test.go: replace type assertions with errors.As for robust exec.ExitError unwrapping Co-Authored-By: Claude Sonnet 4.6 --- integrationtests/ask_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'integrationtests') diff --git a/integrationtests/ask_test.go b/integrationtests/ask_test.go index 7dfbcb4..a762b9d 100644 --- a/integrationtests/ask_test.go +++ b/integrationtests/ask_test.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "os" "os/exec" @@ -56,8 +57,8 @@ func runAsk(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, ex if err == nil { return } - ee, ok := err.(*exec.ExitError) - if !ok { + var ee *exec.ExitError + if !errors.As(err, &ee) { return bytes.Buffer{}, stderr, -1 } return stdout, stderr, ee.ExitCode() @@ -75,8 +76,8 @@ func runAskWithStdin(ctx context.Context, args []string, stdin string) (stdout, if err == nil { return } - ee, ok := err.(*exec.ExitError) - if !ok { + var ee *exec.ExitError + if !errors.As(err, &ee) { return bytes.Buffer{}, stderr, -1 } return stdout, stderr, ee.ExitCode() @@ -91,8 +92,8 @@ func runTask(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, e if err == nil { return } - ee, ok := err.(*exec.ExitError) - if !ok { + var ee *exec.ExitError + if !errors.As(err, &ee) { return bytes.Buffer{}, stderr, -1 } return stdout, stderr, ee.ExitCode() @@ -108,8 +109,8 @@ func runTaskWithStdin(ctx context.Context, args []string, stdin string) (stdout, if err == nil { return } - ee, ok := err.(*exec.ExitError) - if !ok { + var ee *exec.ExitError + if !errors.As(err, &ee) { return bytes.Buffer{}, stderr, -1 } return stdout, stderr, ee.ExitCode() -- cgit v1.2.3