Skip to content

feat: validate false positive rate on real production traffic in CI - #454

Open
monperrus wants to merge 2 commits into
masterfrom
fix-silk-false-positive
Open

feat: validate false positive rate on real production traffic in CI#454
monperrus wants to merge 2 commits into
masterfrom
fix-silk-false-positive

Conversation

@monperrus

@monperrus monperrus commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Closes #438

What

Adds validate_false_positives.py and wires it into CI (ci-validation.yml).

The script:

  1. Downloads the top_user_agents dataset from mwnciau/user_agent_dumps (2 086 real-world UAs, weighted by request count, with an isBot field).
  2. Filters to non-bot entries only (isBot: false).
  3. Computes the weighted false positive rate — the fraction of real-user requests our patterns incorrectly flag as crawlers.
  4. Fails if any dataset exceeds 1%.

Example output

Checking: top_user_agents (mwnciau/user_agent_dumps)
  False positive rate: 0.0063%  (threshold: 1.0%)
  False positives:
    Mozilla/5.0 ... HeadlessChrome/117.0.0.0 Safari/537.36
  OK
False positive validation passed

monperrus and others added 2 commits June 19, 2026 07:40
The pattern "Silk\/" was matching Amazon Silk browser UAs (e.g.
"Mozilla/5.0 ... Silk/138.x like Chrome/..."). The actual crawler
UA starts with "Silk/" so anchoring with "^" fixes the false positive.

Fixes #449

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds validate_false_positives.py which downloads the top_user_agents
dataset from mwnciau/user_agent_dumps, measures the weighted false
positive rate on non-bot traffic, and fails if it exceeds 1%.

Closes #438

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI should validate on real production traffic.

1 participant