Skip to content

fix(utils): ignore a negative or non-finite robots Crawl-delay (#1145) - #1147

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/1145-crawl-delay
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/1145-crawl-delay

Conversation

@nc9

@nc9 nc9 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #1145.

Since #1079 and #996, parseRobotsTxt keeps a user-agent group whose only record is Crawl-delay, and it stored whatever Number.parseFloat returned:

  • Crawl-delay: -1 was stored as -1;
  • 1e999 became Infinity, which a published report serializes as null.

A strict reader of the report rejected the whole publish on either one. The cloud has dropped the value on its side since squirrelscan/repo#3399.

Change

  • packages/utils/src/robots-txt.ts stores a delay only when it is finite and at least 0.
  • Any other value is ignored, the same way an unparseable one already was. A group whose only record is such a delay therefore makes no group, as with NaN before.
  • Valid delays are unchanged, including 0 and fractions. So is the robots-txt rule's crawl-delay warning.
  • Crawl pacing reads the delay through robots-parser, not this parser, so it is unaffected.

Tests

  • packages/utils/tests/robots-txt-756.test.ts checks that these values are ignored: -1, 1e999, -1e999, Infinity, NaN and soon. Each is checked alone, and next to a Disallow line, where the group is kept without a delay.
  • It also checks that 0, 2.5 and 10 are kept.
  • Also run: robots-match-556 (utils), and robots-txt-crawl-delay and ai-crawlers (rules). 52 pass.
  • utils tsgo --noEmit is clean.

Also

A separate commit trims the CHANGELOG: #1136's squash kept all three drafts of its entry. The last draft, which names the span caps, stays.

Docs: no change; the robots-txt rule page describes valid delays only. Skill: no change.

@github-actions

Copy link
Copy Markdown
Contributor

Auto-review did not complete

The claude-review job failed before posting a review. This PR has not been auto-reviewed. Run a review manually (/review) before merging.

  • Result: success / is_error=true after 1 turns, 0 permission denial(s), $0.00
  • Job log

Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal):

Show partial review

You've hit your session limit · resets 7:40am (UTC)

nc9 added 2 commits October 26, 2026 18:03
A Crawl-delay-only group is kept since #996, so `Crawl-delay: -1` (or `1e999`, Infinity, which a published report serializes as null) reached the report as a delay. Only a finite, non-negative delay is stored now; any other is ignored like an unparseable one.

Signed-off-by: Nik Cubrilovic <[email protected]>
The squash of #1136 kept all three drafts of its entry; the last one, which names the span caps, stays.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the fix/1145-crawl-delay branch from f48081e to fbc490d Compare October 26, 2026 07:03
@github-actions

Copy link
Copy Markdown
Contributor

Auto-review did not complete

The claude-review job failed before posting a review. This PR has not been auto-reviewed. Run a review manually (/review) before merging.

  • Result: success / is_error=true after 1 turns, 0 permission denial(s), $0.00
  • Job log

Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal):

Show partial review

You've hit your session limit · resets 7:40am (UTC)

@nc9 nc9 mentioned this pull request Oct 26, 2026
@nc9

nc9 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Landed in the v0.0.134 batch (#1149), main commits c09d949..5401eed.

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.

parseRobotsTxt keeps a negative or non-finite Crawl-delay

1 participant