Reports: group by ASN, connection type, language, continent + continent rule

Merged
RI
1mo ago
+89-1

Batch 2 of the Binom gap list. Rules already evaluated ASN, language and connection type, but clicks didn't keep them, so reports couldn't group by them.

What's new

  • Migration 0023_click_network_context.sql: clicks.continent, asn, language, connection (nullable, no backfill; older clicks show "(none)").
  • Redirect stores the exact values rules matched on (same ASN parse, primary Accept-Language tag, datacenter/residential from the built-in cloud ASN list), so a report row always matches what a rule would route.
  • Report + drilldown groupings: Continent, ASN (labelled AS3215 · Orange S.A.), Connection type, Language.
  • New rule criterion: Continent (AF AN AS EU NA OC SA), in rule editor, docs and MCP description.
  • Automation zone blacklist accepts ASN.

Screenshots

ASN:

Connection type:

Language:

Drilldown: Connection type › ASN:

Deploy note

Migration 0023 runs in the deploy workflow before wrangler deploy (adds nullable columns only).

Tests

  • Click via /r/:code with cf.asn, cf.continent, accept-language → stored columns + grouped by asn / connection / language / continent.
  • Continent rule match, case-insensitive values, invalid value rejected.
  • bun run typecheck ✅ · bun run test 116 passed ✅

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Stores the network context rules already match on (continent, ASN, language, connection type) so reports can group by them.

  • Migration 0023_click_network_context.sql adds nullable columns to clicks; no backfill, so older clicks show "(none)".
  • The redirect saves the exact values rules matched on, so a report row always matches what a rule would route.
  • Adds Continent, ASN (labelled AS3320 · Deutsche Telekom), Connection type, and Language report groupings, plus a Continent rule criterion (AF, AN, AS, EU, NA, OC, SA).
  • Automation zone blacklists now accept ASN, and the MCP rule-field description documents the new criterion.

Migration 0023 runs in the deploy workflow before wrangler deploy; it only adds nullable columns.

Summary by CodeRabbit

  • New Features
    • Click reports can now be grouped by continent, ASN, language, and connection type.
    • Routing rules can now use continent conditions, with case-insensitive matching for supported continent codes.
    • Click records now include additional network and visitor details, including continent, ASN, language, and connection type.