Fix lint issues

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-16 19:45:38 +02:00
parent 973bd99a8f
commit b64a33e868
4 changed files with 18 additions and 2 deletions

View File

@@ -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"))
},

View File

@@ -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
}

View File

@@ -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)
}))

View File

@@ -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
}))