Conversation
|
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: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA database migration revokes PUBLIC role access to the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 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)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/build_time_tracking.test.ts (1)
138-158: Consider usingit.concurrent()and strengthening the error assertion.Two suggestions:
Per coding guidelines, tests should use
it.concurrent()for parallel execution. While existing tests in this file also useit(), new tests should follow the guideline.The assertion
expect(error).toBeTruthy()is broad—any error (network, malformed input, etc.) would pass. Consider verifying the error indicates a permission denial to ensure the migration is working as intended.Suggested improvements
- it('should reject unauthenticated calls to record_build_time RPC', async () => { + it.concurrent('should reject unauthenticated calls to record_build_time RPC', async () => { const supabaseUrl = process.env.SUPABASE_URL const supabaseAnonKey = process.env.SUPABASE_ANON_KEY if (!supabaseUrl || !supabaseAnonKey) throw new Error('SUPABASE_URL and SUPABASE_ANON_KEY are required for this test') const publicSupabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { persistSession: false, }, }) const { error } = await publicSupabase.rpc('record_build_time', { p_org_id: ORG_ID, p_user_id: USER_ID, p_build_id: randomUUID(), p_platform: 'ios', p_build_time_unit: 30, }) expect(error).toBeTruthy() + expect(error?.message).toMatch(/permission denied|not authorized/i) })As per coding guidelines: "Design all tests for parallel execution; use
it.concurrent()instead ofit()to maximize parallelism".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/build_time_tracking.test.ts` around lines 138 - 158, Change the test to run in parallel by replacing it(...) with it.concurrent(...), and strengthen the assertion so it verifies the failure is a permission denial from the database/RPC rather than any error: after invoking publicSupabase.rpc('record_build_time', {...}) assert that error is truthy and additionally check a permission-specific indicator (for example assert error.message or error.details includes 'permission' or 'permission denied', or that error.code equals the Postgres permission error code such as '42501') so the test specifically confirms the RPC was rejected due to insufficient privileges.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/build_time_tracking.test.ts`:
- Around line 138-158: Change the test to run in parallel by replacing it(...)
with it.concurrent(...), and strengthen the assertion so it verifies the failure
is a permission denial from the database/RPC rather than any error: after
invoking publicSupabase.rpc('record_build_time', {...}) assert that error is
truthy and additionally check a permission-specific indicator (for example
assert error.message or error.details includes 'permission' or 'permission
denied', or that error.code equals the Postgres permission error code such as
'42501') so the test specifically confirms the RPC was rejected due to
insufficient privileges.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 307d15c9-b140-4b68-9cf8-813571c40325
📒 Files selected for processing (2)
supabase/migrations/20260308203309_cli_created_record_build_time_public_revoke.sqltests/build_time_tracking.test.ts
b24d072 to
fbfd02d
Compare
|



Summary (AI generated)
public.record_build_timevia Supabase migration so anonymous role cannot call it./rest/v1/rpc/record_build_timewithSUPABASE_ANON_KEYand asserts the call is rejected and nobuild_logsrow is written.Motivation (AI generated)
record_build_timepath allowed unauthenticated callers to inject build-time rows, enabling usage/quota poisoning and cross-tenant abuse.Business Impact (AI generated)
Test Plan (AI generated)
bunx eslint tests/build_time_tracking.test.tsGenerated with AI