From 7c09e19d0c86b078df6d1eb0e1cebf3bb7b92164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Wed, 10 Jun 2026 11:54:42 +0200 Subject: [PATCH] update confidence when relinking common tracker to third party MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/coredata/common_tracker_pattern.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/coredata/common_tracker_pattern.go b/pkg/coredata/common_tracker_pattern.go index b06e21203..da894b657 100644 --- a/pkg/coredata/common_tracker_pattern.go +++ b/pkg/coredata/common_tracker_pattern.go @@ -837,9 +837,12 @@ ORDER BY pattern ASC // RelinkCommonThirdPartyByIDs repoints the given common tracker patterns // at a different common third party (or unlinks them when thirdPartyID is -// nil). It only touches the catalog rows; callers re-arm enrichment and -// remap the org-scoped tracker patterns separately. Returns the number of -// rows updated. +// nil). Linking is a manual operator attribution - the highest-trust +// signal - so it bumps confidence to 1 to match the curated/seed tier; +// unlinking makes no attribution and leaves confidence untouched. It only +// touches the catalog rows; callers re-arm enrichment and remap the +// org-scoped tracker patterns separately. Returns the number of rows +// updated. func (ps *CommonTrackerPatterns) RelinkCommonThirdPartyByIDs( ctx context.Context, tx pg.Tx, @@ -850,6 +853,7 @@ func (ps *CommonTrackerPatterns) RelinkCommonThirdPartyByIDs( UPDATE common_tracker_patterns SET common_third_party_id = @third_party_id, + confidence = CASE WHEN @third_party_id::text IS NOT NULL THEN 1 ELSE confidence END, updated_at = NOW() WHERE id = ANY(@ids)