Conversation
✅ Deploy Preview for netlify-plugins ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBumps Next.js plugin version pins in site/plugins.json from 5.15.8 to 5.15.9 (two occurrences). Adds retry helpers to test/main.js: Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/main.js (1)
20-34: Good retry implementation with one minor defensive improvement.The retry logic correctly handles 429 responses and the
Retry-Afterheader parsing gracefully falls back to backoff for edge cases (missing header, HTTP-date format, or zero value).Consider adding optional chaining on
headersaccess for defensive coding, though in practicegotv11 always provides headers when a response exists:🛡️ Optional: add defensive optional chaining
if (error.response?.statusCode === 429 && attempt < retries) { - const retryAfter = Number(error.response.headers['retry-after']) * ONE_SECOND_IN_MS || backoff * (attempt + 1) + const retryAfter = Number(error.response.headers?.['retry-after']) * ONE_SECOND_IN_MS || backoff * (attempt + 1) await sleep(retryAfter)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/main.js` around lines 20 - 34, The retry logic in fetchWithRetry should defensively guard header access: when reading the Retry-After value use optional chaining on response headers (e.g., error.response?.headers?.['retry-after']) and keep the existing fallback to backoff so missing headers or unexpected shapes don't throw; update the expression that computes retryAfter to reference error.response?.headers?.['retry-after'] and preserve the Number(...) || backoff * (attempt + 1) fallback behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/main.js`:
- Around line 20-34: The retry logic in fetchWithRetry should defensively guard
header access: when reading the Retry-After value use optional chaining on
response headers (e.g., error.response?.headers?.['retry-after']) and keep the
existing fallback to backoff so missing headers or unexpected shapes don't
throw; update the expression that computes retryAfter to reference
error.response?.headers?.['retry-after'] and preserve the Number(...) || backoff
* (attempt + 1) fallback behavior.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/test.yml:
- Around line 28-29: The workflow currently exposes GITHUB_TOKEN via the env
block without explicit job-level permissions; add a job-level permissions
mapping immediately above the env section that grants only the minimal scopes
your tests require (e.g., contents: read or other specific permissions) instead
of broad defaults, so the GITHUB_TOKEN is scoped and not left to repo/org
defaults; update the job containing env: GITHUB_TOKEN to include the new
permissions block and adjust scopes to the least privilege needed for the test
job.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a5304f9b-2bd5-4581-b87f-d3d19341b883
📒 Files selected for processing (2)
.github/workflows/test.ymltest/main.js
🚧 Files skipped from review as they are similar to previous changes (1)
- test/main.js
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
| const BACKOFF_BASE = 5000 | ||
| const ONE_SECOND_IN_MS = 1000 | ||
|
|
||
| const fetchWithRetry = async (url, { retries = 3, backoff = BACKOFF_BASE } = {}) => { |
There was a problem hiding this comment.
tests started to hit github's 429 errors randomly, so added some retry and using github action's token to make authenticated requests to raise the quota
Thanks for contributing the Netlify plugins directory!
Are you adding a plugin or updating one?
Have you completed the following?
Test plan
Please add a link to a successful public deploy log using the stated version of the plugin. Include any other context reviewers might need for testing.