From b64a33e868562d8626d4fa6af3435f35180b6450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Tue, 16 Jun 2026 19:45:38 +0200 Subject: [PATCH] Fix lint issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/cookiebanner/tracker_mapping_agent_test.go | 6 ++++++ pkg/cookiebanner/tracker_mapping_worker.go | 1 + pkg/cookiebanner/tracker_mapping_worker_test.go | 3 +++ pkg/coredata/common_tracker_pattern_test.go | 10 ++++++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pkg/cookiebanner/tracker_mapping_agent_test.go b/pkg/cookiebanner/tracker_mapping_agent_test.go index 4d1b146d5..a0ff5bfba 100644 --- a/pkg/cookiebanner/tracker_mapping_agent_test.go +++ b/pkg/cookiebanner/tracker_mapping_agent_test.go @@ -280,6 +280,7 @@ func TestVendorAttributionRejected(t *testing.T) { "rejects below confidence threshold", func(t *testing.T) { t.Parallel() + r := confident(func(r *TrackerMappingAgentResult) { r.ThirdPartyConfidence = 0.3 }) assert.True(t, h.vendorAttributionRejected(ctx, tp, r, "https://example.com")) }, @@ -289,6 +290,7 @@ func TestVendorAttributionRejected(t *testing.T) { "rejects empty name", func(t *testing.T) { t.Parallel() + r := confident(func(r *TrackerMappingAgentResult) { r.ThirdPartyName = "" }) assert.True(t, h.vendorAttributionRejected(ctx, tp, r, "https://example.com")) }, @@ -298,6 +300,7 @@ func TestVendorAttributionRejected(t *testing.T) { "rejects when evidence source is none", func(t *testing.T) { t.Parallel() + r := confident(func(r *TrackerMappingAgentResult) { r.EvidenceSource = evidenceSourceNone }) assert.True(t, h.vendorAttributionRejected(ctx, tp, r, "https://example.com")) }, @@ -307,6 +310,7 @@ func TestVendorAttributionRejected(t *testing.T) { "rejects when evidence source is empty", func(t *testing.T) { t.Parallel() + r := confident(func(r *TrackerMappingAgentResult) { r.EvidenceSource = "" }) assert.True(t, h.vendorAttributionRejected(ctx, tp, r, "https://example.com")) }, @@ -316,6 +320,7 @@ func TestVendorAttributionRejected(t *testing.T) { "rejects when name matches scanned site", func(t *testing.T) { t.Parallel() + r := confident(func(r *TrackerMappingAgentResult) { r.ThirdPartyName = "Example" }) assert.True(t, h.vendorAttributionRejected(ctx, tp, r, "https://example.com")) }, @@ -325,6 +330,7 @@ func TestVendorAttributionRejected(t *testing.T) { "rejects cookie-database aggregator", func(t *testing.T) { t.Parallel() + r := confident(func(r *TrackerMappingAgentResult) { r.ThirdPartyName = "Cookiepedia" }) assert.True(t, h.vendorAttributionRejected(ctx, tp, r, "https://example.com")) }, diff --git a/pkg/cookiebanner/tracker_mapping_worker.go b/pkg/cookiebanner/tracker_mapping_worker.go index 47245a82b..e582d9899 100644 --- a/pkg/cookiebanner/tracker_mapping_worker.go +++ b/pkg/cookiebanner/tracker_mapping_worker.go @@ -244,6 +244,7 @@ func (h *trackerMappingHandler) Process(ctx context.Context, tp coredata.Tracker } else { match, err = h.persistAgentIdentification(ctx, tx, tp, *ident, det.untrustedThirdPartyID) } + if err != nil { return err } diff --git a/pkg/cookiebanner/tracker_mapping_worker_test.go b/pkg/cookiebanner/tracker_mapping_worker_test.go index ab55ed637..a1a2e76b5 100644 --- a/pkg/cookiebanner/tracker_mapping_worker_test.go +++ b/pkg/cookiebanner/tracker_mapping_worker_test.go @@ -1816,6 +1816,7 @@ func TestProcess_FirstPartyVerdictIsTerminal(t *testing.T) { assert.Nil(t, reloaded.ThirdPartyID, "a first-party verdict must never attribute a third party") reloadedCommon := coredata.CommonTrackerPattern{} + require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error { return reloadedCommon.LoadByID(ctx, conn, firstPartyCommon.ID) })) @@ -1915,6 +1916,7 @@ func TestProcess_LowConfidenceCatalogVendorNotAdopted(t *testing.T) { _ = client.WithTx(context.Background(), func(ctx context.Context, tx pg.Tx) error { _, _ = tx.Exec(ctx, `DELETE FROM common_tracker_patterns WHERE id = $1`, lowConfCommon.ID) _, _ = tx.Exec(ctx, `DELETE FROM common_third_parties WHERE id = $1`, commonThirdPartyID) + return nil }) }) @@ -1935,6 +1937,7 @@ func TestProcess_LowConfidenceCatalogVendorNotAdopted(t *testing.T) { // The catalog row is untouched: its low-confidence vendor remains for // a later evidence-backed corroboration. reloadedCommon := coredata.CommonTrackerPattern{} + require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error { return reloadedCommon.LoadByID(ctx, conn, lowConfCommon.ID) })) diff --git a/pkg/coredata/common_tracker_pattern_test.go b/pkg/coredata/common_tracker_pattern_test.go index 78ffafbef..6f3fc6849 100644 --- a/pkg/coredata/common_tracker_pattern_test.go +++ b/pkg/coredata/common_tracker_pattern_test.go @@ -545,8 +545,10 @@ func TestCommonTrackerPatterns_SetAttributionByIDs(t *testing.T) { var affected int64 require.NoError(t, client.WithTx(ctx, func(ctx context.Context, tx pg.Tx) error { - var ps coredata.CommonTrackerPatterns - var err error + var ( + ps coredata.CommonTrackerPatterns + err error + ) affected, err = ps.SetAttributionByIDs(ctx, tx, []gid.GID{linked.ID}, coredata.CommonTrackerPatternAttributionFirstParty) @@ -586,7 +588,9 @@ func TestCommonTrackerPatterns_RelinkCommonThirdPartyByIDs_SetsAttribution(t *te require.NoError(t, client.WithTx(ctx, func(ctx context.Context, tx pg.Tx) error { var ps coredata.CommonTrackerPatterns + _, err := ps.RelinkCommonThirdPartyByIDs(ctx, tx, []gid.GID{row.ID}, &party.ID) + return err })) @@ -598,7 +602,9 @@ func TestCommonTrackerPatterns_RelinkCommonThirdPartyByIDs_SetsAttribution(t *te require.NoError(t, client.WithTx(ctx, func(ctx context.Context, tx pg.Tx) error { var ps coredata.CommonTrackerPatterns + _, err := ps.RelinkCommonThirdPartyByIDs(ctx, tx, []gid.GID{row.ID}, nil) + return err }))