Skip to content

ci: refresh published bot IP ranges weekly - #19

Merged
Gdewilde merged 1 commit into
mainfrom
ci/scheduled-range-refresh
Aug 2, 2026
Merged

ci: refresh published bot IP ranges weekly#19
Gdewilde merged 1 commit into
mainfrom
ci/scheduled-range-refresh

Conversation

@Gdewilde

@Gdewilde Gdewilde commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The bundled range snapshot in src/bot-ranges.ts is the one part of identity verification that rots on its own. Vendors rotate their published prefixes, and a stale list doesn't fail loudly — it quietly starts returning spoofed for legitimate crawlers. Since spoofed is the verdict anyone would act on, silent drift is the expensive failure mode.

Runs Mondays 06:00 UTC, plus workflow_dispatch.

Opens a PR, doesn't commit to main

A range change alters what downstream sites report about real traffic, so the diff deserves eyes. A large removal especially — that flips previously-verified traffic to spoofed, and is worth checking against the vendor before merging.

Three guards

So the automation can't make things worse than having none:

  1. refresh-bot-ranges.mjs already aborts on a failed feed or a list that shrinks by >50%, rather than writing a truncated snapshot.
  2. BOT_RANGES_CAPTURED_AT changes every run, so a timestamp-only diff is discarded — no weekly no-op PR to train people into rubber-stamping.
  3. typecheck + the test suite run against the new snapshot before the PR opens. The suite asserts every bundled prefix still compiles, so a malformed feed can't ship.

Verified live

Ran the script against the real feeds before committing:

https://openai.com/gptbot.json        -> 21
https://openai.com/chatgpt-user.json  -> 322
https://openai.com/searchbot.json     -> 35
ChatGPT: 372 prefixes (was 372)
Claude: 20   Perplexity: 8   Apple: 12

All four match the committed snapshot exactly, and the timestamp-only diff was correctly identified as a skip.

Note

Merging a refresh PR doesn't publish. Bump package.json separately when you want new ranges to reach consumers — which also means a rotation takes two steps to land downstream, worth knowing if a vendor ever moves ranges abruptly.

🤖 Generated with Claude Code

The bundled snapshot in src/bot-ranges.ts is the one part of identity
verification that rots on its own. Vendors rotate their published prefixes,
and a stale list doesn't fail loudly — it quietly starts returning 'spoofed'
for legitimate crawlers. That is the verdict people act on, so silent drift is
the expensive failure mode.

Runs Mondays 06:00 UTC (plus manual dispatch) and opens a PR rather than
committing to main, because a range change alters what downstream sites report
about real traffic and deserves eyes on the diff.

Three guards, so the automation can't make things worse than no automation:

- The refresh script already aborts on a failed feed or a list that shrinks by
  more than half, rather than writing a truncated snapshot.
- BOT_RANGES_CAPTURED_AT moves on every run, so a timestamp-only diff is
  discarded instead of opening a weekly no-op PR.
- typecheck and the test suite run against the new snapshot before the PR is
  opened; the suite asserts every bundled prefix still compiles.

Verified by running the script live: all four feeds fetched (372/20/8/12
prefixes, matching the committed snapshot exactly) and the timestamp-only
diff was correctly identified as a skip.
@Gdewilde
Gdewilde merged commit 04dd4c9 into main Aug 2, 2026
3 checks passed
@Gdewilde
Gdewilde deleted the ci/scheduled-range-refresh branch August 2, 2026 08:42
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.

1 participant