From 8c2c69582a066a590427ac8a4b4c242b2ce52c47 Mon Sep 17 00:00:00 2001 From: Holger Reinhardt Date: Tue, 6 Oct 2026 21:32:14 +0200 Subject: [PATCH] fix(lint): clear the two findings left by #69 and #70 (#72) - observation_update_test.go (#69) lacked the fts5 build tag its helper (testObservationStore, in observation_store_test.go) has, so `go vet ./...` without tags failed with "undefined: testObservationStore". - Client.knn (#70) concatenates its WHERE clause into the query. The clause is built only from constant text with "?" placeholders (see nearest) and every value goes through args, so gosec's G202 is a false positive; annotate it the way the file already annotates G201. Co-authored-by: Claude Sonnet 5.5 --- internal/db/gorm/observation_update_test.go | 2 ++ internal/vector/sqlitevec/client.go | 1 + 2 files changed, 3 insertions(+) diff --git a/internal/db/gorm/observation_update_test.go b/internal/db/gorm/observation_update_test.go index e46167e..c86999e 100644 --- a/internal/db/gorm/observation_update_test.go +++ b/internal/db/gorm/observation_update_test.go @@ -1,3 +1,5 @@ +//go:build fts5 + package gorm import ( diff --git a/internal/vector/sqlitevec/client.go b/internal/vector/sqlitevec/client.go index 5d63e59..e609f53 100644 --- a/internal/vector/sqlitevec/client.go +++ b/internal/vector/sqlitevec/client.go @@ -526,6 +526,7 @@ func (c *Client) nearest(ctx context.Context, queryBlob []byte, docType, project // knn runs one vec0 nearest-neighbour query. where holds the MATCH and filters vec0 can answer on their own. func (c *Client) knn(ctx context.Context, where string, args []any, limit int) ([]QueryResult, error) { + // #nosec G202 -- where is built from constant clauses with "?" placeholders only (see nearest); every value goes via args rows, err := c.db.QueryContext(ctx, "SELECT doc_id, distance, sqlite_id, doc_type, field_type, project, scope FROM vectors"+where+" ORDER BY distance LIMIT ?", append(append([]any{}, args...), limit)...)