Rank HTTP cookie source above pre-existing

The tracker-pattern source ranking collapsed HTTP into the PRE_EXISTING
tier, so a cookie first enumerated as pre-existing and later re-observed
only via a Set-Cookie response header stayed pre-existing. That left it
on the agent-skipped tier (isPreExistingSource), even though an HTTP
server-set cookie is real page evidence, not the extension-state
catch-all the skip was built to suppress.

Give HTTP its own rank between SCRIPT and EXTENSION
(SCRIPT > HTTP > EXTENSION > PRE_EXISTING) in both sourceRank and the
bestSource merge rollup, so an HTTP re-detection now promotes the
pattern and re-arms mapping, unblocking the identification agent.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-18 22:00:21 +02:00
parent f56d3daa2c
commit 4435a93eca
2 changed files with 65 additions and 22 deletions

View File

@@ -1159,15 +1159,45 @@ func TestShouldPromoteSource(t *testing.T) {
want: false,
},
{
name: "HTTP collapses to PRE_EXISTING rank: does not promote SCRIPT",
name: "HTTP does not promote to SCRIPT (HTTP ranks below SCRIPT)",
existing: &script,
candidate: &http,
want: false,
},
{
name: "HTTP collapses to PRE_EXISTING rank: equal to nil existing",
name: "nil existing promotes to HTTP",
existing: nil,
candidate: &http,
want: true,
},
{
name: "PRE_EXISTING promotes to HTTP",
existing: &preExisting,
candidate: &http,
want: true,
},
{
name: "EXTENSION promotes to HTTP (real server cookie outranks extension state)",
existing: &extension,
candidate: &http,
want: true,
},
{
name: "HTTP promotes to SCRIPT",
existing: &http,
candidate: &script,
want: true,
},
{
name: "HTTP does not promote to EXTENSION",
existing: &http,
candidate: &extension,
want: false,
},
{
name: "HTTP does not promote to PRE_EXISTING",
existing: &http,
candidate: &preExisting,
want: false,
},
}