Skip to content

fix(ci): destrava gates do main (seller-scope + TS2589/TS2352 + non-null assertion)#413

Merged
adm01-debug merged 1 commit into
mainfrom
claude/fix-main-ci-blockers
May 26, 2026
Merged

fix(ci): destrava gates do main (seller-scope + TS2589/TS2352 + non-null assertion)#413
adm01-debug merged 1 commit into
mainfrom
claude/fix-main-ci-blockers

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 26, 2026

Destrava o CI do main — 3 regressões pré-existentes

A validação exaustiva (a pedido) revelou que o main atual (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 contra origin/main puro.

Correções

  1. Seller-scope gate (SidebarReorganized.tsx) — a anotação // rls-allow: existia mas estava acima de const … 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 via enabled: isAdmin.)
  2. TypeScript gate (useUserManagement.ts) — TS2589 (instanciação profunda) + TS2352 (cast de SelectQueryError): o embed user_roles(role) não é reconhecido pelos tipos gerados do Supabase. Corrigido tipando o select como string (evita o parser recursivo) + .returns<ProfileWithRoles[]>() e removendo o cast redundante.
  3. ESLint baseline gate (CoverageInsightsDashboardPage.tsx) — removido non-null assertion redundante (o acesso já é guardado por values.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ão
  • check-seller-scope.mjs: ✅ pass

Test plan

  • CI verde (os 3 gates que estavam vermelhos no main)
  • Admin → Usuários carrega normalmente (query de roles inalterada em runtime)
  • Badge de aprovações pendentes no sidebar segue funcionando p/ admin

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.

  • Correções
    • Seller-scope (SidebarReorganized.tsx): move // rls-allow para a linha do .from('discount_approval_requests'); segue admin-only via enabled: isAdmin.
    • TypeScript (useUserManagement.ts): substitui untypedFrom por supabase.from, define ProfileWithRoles, tipa select como string e usa .returns<ProfileWithRoles[]>() para evitar TS2589 e remover o cast que gerava TS2352; query inalterada em runtime.
    • ESLint (CoverageInsightsDashboardPage.tsx): remove non-null assertion redundante já coberta por values.length < 2.

Written for commit cd58ca0. Summary will update on new commits. Review in cubic

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
we-dream-big Error Error May 26, 2026 2:42am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Warning

Review limit reached

@adm01-debug, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7d0fd935-ae19-4fce-9c5a-251b1f1e0e8a

📥 Commits

Reviewing files that changed from the base of the PR and between cd9a300 and cd58ca0.

📒 Files selected for processing (1)
  • src/components/admin/users/useUserManagement.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-main-ci-blockers

Comment @coderabbitai help to get the list of available commands and usage tips.

@supabase
Copy link
Copy Markdown

supabase Bot commented May 26, 2026

This pull request has been ignored for the connected project doufsxqlfjyuvxuezpln because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@adm01-debug adm01-debug marked this pull request as ready for review May 26, 2026 02:30
Copilot AI review requested due to automatic review settings May 26, 2026 02:30
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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') so check-seller-scope recognizes it.
  • Avoid TS2589/TS2352 in the admin users query by widening the select string type and using .returns<...>() for the embedded user_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
@adm01-debug adm01-debug force-pushed the claude/fix-main-ci-blockers branch from 184a433 to cd58ca0 Compare May 26, 2026 02:40
@adm01-debug adm01-debug merged commit 575ab78 into main May 26, 2026
20 of 24 checks passed
@adm01-debug adm01-debug deleted the claude/fix-main-ci-blockers branch May 29, 2026 13:37
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.

3 participants