fix(ci): destrava gates do main (seller-scope + TS2589/TS2352 + non-null assertion)#413
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 19 minutes and 57 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR unblocks main’s CI by fixing three pre-existing gate failures: seller-scope checker annotation placement, TypeScript inference/cast issues in a Supabase embed query, and an ESLint baseline hit from a redundant non-null assertion.
Changes:
- Move
// rls-allow:to the exact line immediately above.from('discount_approval_requests')socheck-seller-scoperecognizes it. - Avoid TS2589/TS2352 in the admin users query by widening the
selectstring type and using.returns<...>()for the embeddeduser_roles(role)shape. - Remove a redundant non-null assertion in coverage trend calculation to satisfy the ESLint baseline gate.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/components/layout/SidebarReorganized.tsx | Places // rls-allow: where the seller-scope checker expects it for the admin-only badge query. |
| src/components/admin/users/useUserManagement.ts | Fixes Supabase embed typing to avoid deep type instantiation and removes an unnecessary cast. |
| src/pages/tools/CoverageInsightsDashboardPage.tsx | Removes a redundant non-null assertion in getTrend() to satisfy the ESLint baseline. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| avatar_url: string | null; | ||
| is_active: boolean | null; | ||
| created_at: string; | ||
| user_roles: { role: string }[] | null; |
…ull assertion Regressões pré-existentes no main (introduzidas pela leva #384–#399) que bloqueavam TODOS os PRs no CI: - SidebarReorganized.tsx: anotação `// rls-allow` estava acima de `const … await supabase`, não imediatamente acima do `.from(...)`, então o seller-scope checker não a reconhecia. Movida para a linha correta. - useUserManagement.ts: o embed `user_roles(role)` não é reconhecido pelos tipos gerados do Supabase, gerando TS2589 (instanciação profunda) e TS2352 (cast de SelectQueryError). Corrigido com select tipado como string + `.returns<ProfileWithRoles[]>()` e remoção do cast redundante. - CoverageInsightsDashboardPage.tsx: removido non-null assertion redundante (acesso já guardado por `values.length < 2`). Gates verdes localmente: tsc (484 vs 486, -2), eslint (sem regressão), seller-scope (pass). https://claude.ai/code/session_01HjiGVkF3Df9GiFjDbfxDYn
184a433 to
cd58ca0
Compare
Destrava o CI do
main— 3 regressões pré-existentesA validação exaustiva (a pedido) revelou que o
mainatual (428213a) está vermelho no CI, bloqueando todos os PRs. As 3 regressões foram introduzidas pela leva recente de merges (#384–#399) — nenhuma é de PRs meus anteriores. Confirmado rodando os gates contraorigin/mainpuro.Correções
SidebarReorganized.tsx) — a anotação// rls-allow:existia mas estava acima deconst … await supabase, não imediatamente acima do.from('discount_approval_requests'), então o checker não a reconhecia. Movida para a linha correta. (Sem mudança de comportamento — segue admin-only viaenabled: isAdmin.)useUserManagement.ts) —TS2589(instanciação profunda) +TS2352(cast deSelectQueryError): o embeduser_roles(role)não é reconhecido pelos tipos gerados do Supabase. Corrigido tipando oselectcomostring(evita o parser recursivo) +.returns<ProfileWithRoles[]>()e removendo o cast redundante.CoverageInsightsDashboardPage.tsx) — removidonon-null assertionredundante (o acesso já é guardado porvalues.length < 2). (Estava oculto no CI porque o seller-scope falhava antes, com fail-fast.)Verificação local (todos verdes)
check-tsc-baseline.mjs: 484 vs 486 baseline → ✅ sem regressão (−2)check-eslint-baseline.mjs: ✅ sem regressãocheck-seller-scope.mjs: ✅ passTest plan
main)https://claude.ai/code/session_01HjiGVkF3Df9GiFjDbfxDYn
Generated by Claude Code
Summary by cubic
Destrava o CI do main ao corrigir três gates quebrados: seller-scope, erros TypeScript (TS2589/TS2352) e um aviso de ESLint. Resultado: CI verde novamente, sem mudanças de comportamento em produção.
SidebarReorganized.tsx): move// rls-allowpara a linha do.from('discount_approval_requests'); segue admin-only viaenabled: isAdmin.useUserManagement.ts): substituiuntypedFromporsupabase.from, defineProfileWithRoles, tipaselectcomo string e usa.returns<ProfileWithRoles[]>()para evitar TS2589 e remover o cast que gerava TS2352; query inalterada em runtime.CoverageInsightsDashboardPage.tsx): remove non-null assertion redundante já coberta porvalues.length < 2.Written for commit cd58ca0. Summary will update on new commits. Review in cubic