Skip to content

feat: dedicated data-plane rate-limit bucket - #699

Merged
neuromechanist merged 2 commits into
devfrom
feat/data-plane-rate-limit
Jun 5, 2026
Merged

neuromechanist merged 2 commits into
devfrom
feat/data-plane-rate-limit

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Problem

data.nemar.org rewrites to /data/* and re-enters api.fetch (index.ts:210), so every anonymous data-plane GET passes through rateLimiter (index.ts:82) at 500/60s per IP. A parallel downloader (e.g. nemar-py --jobs 16) on its HTTPS backend, which 302s every file through the Worker, trips that on any large dataset. This is the source of Bruno's data.nemar.org 429 reports.

Change

Add a dedicated data-ip bucket at 10000/60s for /data and /nemar/data paths, IP-keyed and isolated from the API/auth buckets.

  • The data plane is read-only, CDN-cached, and 302s bytes to S3/GitHub (nothing streams through the Worker), so a high cap is safe.
  • A bounded floor still backstops runaway loops (a scraper can't make unbounded Worker invocations).
  • Regex is anchored (^/(nemar/)?data(/|$)) so the write API at /datasets/* keeps the standard cap.

Tested

  • 9 __selectBucket selector tests pass (incl. new data-plane + /datasets-is-not-data-plane cases)
  • Sibling rate-limit-retry suite green (21 pass)
  • tsc --noEmit clean (pre-commit)

If you'd prefer a full exemption over the 10000/60s floor, it's a one-line change.

data.nemar.org re-enters api.fetch and so passes through the rateLimiter; anonymous clients were capped at 500/60s per IP. A parallel downloader (nemar-py --jobs 16) on the HTTPS backend, which 302s every file through the Worker, tripped that on large datasets (Bruno's data.nemar.org 429 reports).

Add a dedicated data-ip bucket at 10000/60s for /data and /nemar/data paths, IP-keyed and isolated from the API/auth buckets. The data plane is read-only, CDN-cached, and 302s bytes to S3/GitHub (nothing streams through the Worker), so a high cap is safe; a bounded floor still backstops runaway loops. Anchored so /datasets (write API) is untouched.

Tested: 9 selector tests pass; sibling rate-limit suite green.
@github-actions

github-actions Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR699

Version: 0.8.47-PR699.b902a8e
Commit: b902a8e


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit 5ac085b into dev Jun 5, 2026
10 checks passed
@neuromechanist
neuromechanist deleted the feat/data-plane-rate-limit branch June 5, 2026 08:13

This branch was previously deployed

1 inactive deployment
npm — b902a8e6 Deployed Jun 5, 2026 by neuromechanist via publish #1311
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