ci: guard que exige o gate de tipos como required status check (Ação B)#214
ci: guard que exige o gate de tipos como required status check (Ação B)#214adm01-debug wants to merge 1 commit into
Conversation
Causa-raiz das regressoes de TS recorrentes (ver #208/#196/#181/#178): a branch protection da main esta com required_status_checks vazio (enforcement_level: off), entao PRs vermelhos mergeiam e cada leva de agente reintroduz erro de tipo mais rapido do que e corrigido reativamente. O job check-protection-config do branch-protection-sentinel.yml so le o booleano `protected` e reporta "protegida" — falso positivo que escondeu o buraco. Este guard le /branches/main/protection de fato e FALHA (nao so avisa) quando: - nao ha branch protection (HTTP 404), ou - o contexto obrigatorio "Lint, Typecheck & Test" nao esta nos required status checks. Tambem sinaliza enforce_admins=false (admins furando o gate). Roda em push para main, diariamente (cron) e via dispatch. Requer permissions: administration:read para ler a proteção. NB: deve entrar JUNTO com a aplicacao da branch protection — sozinho, ele falha de proposito em main ate a protecao existir (forcing function).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 13 minutes and 57 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, 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 trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ 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 |
There was a problem hiding this comment.
Pull request overview
Adiciona um workflow de CI dedicado para validar (e falhar) quando a branch main não estiver protegida ou quando o check Lint, Typecheck & Test não estiver configurado como required status check, evitando merges que ignoram o gate de types/lint/tests.
Changes:
- Cria o workflow
.github/workflows/required-checks-guard.ymlque consultaGET /branches/main/protection. - Falha quando a proteção não existe (HTTP 404) ou quando
Lint, Typecheck & Testnão está entre os required checks. - Emite warning quando
enforce_admins=falsee escreve um Step Summary com os contexts detectados.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Garante que o gate de tipos/lint/test e um REQUIRED status check em main. | ||
| # Sem isso, PRs vermelhos podem mergear — causa-raiz das regressoes de tipo | ||
| # recorrentes (ver #208 e a leva #196/#181/#178). Este guard FALHA (nao so | ||
| # avisa) quando a protecao esta ausente ou o contexto obrigatorio sumiu. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| schedule: | ||
| - cron: '0 9 * * *' # diario ~06:00 BRT | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| administration: read # necessario para ler /branches/main/protection |
| if ! printf '%s\n' "$CONTEXTS" | grep -qxF "$REQUIRED"; then | ||
| echo "::error::Required status check '$REQUIRED' ausente — o gate de tipos esta apenas consultivo. Corrija a branch protection." | ||
| { | ||
| echo "" | ||
| echo "❌ **\`$REQUIRED\` nao e required.**" | ||
| } >> "$GITHUB_STEP_SUMMARY" |
Contexto — causa-raiz das regressões de TS recorrentes
A branch protection da
mainestá vazia:protection.enabled: false,required_status_checks.enforcement_level: "off",contexts: []. Ou seja, nenhum status check é obrigatório — o jobquality("Lint, Typecheck & Test") roda mas é consultivo, e PRs vermelhos (ex.: #202, que quebrou 13 call-sites delazyWithRetry) mergeiam mesmo assim. Cada leva de agente reintroduz erro de tipo mais rápido do que os PRs reativos (#208/#196/#181/#178) conseguem corrigir.O
branch-protection-sentinel.ymlreportava "main protegida ✅" porque o jobcheck-protection-configsó lê o booleanoprotected— falso positivo que escondeu o buraco.O que este PR faz
Adiciona
.github/workflows/required-checks-guard.yml, que lê de fato/branches/main/protection(viapermissions: administration:read) e FALHA (não só avisa) quando:Lint, Typecheck & Testnão está nos required status checks.Também sinaliza
enforce_admins=false. Roda em push paramain, diariamente (cron) e viaworkflow_dispatch.Optei por um guard dedicado em vez de reescrever os 12KB do sentinel — mais cirúrgico e sem risco de corromper o arquivo existente. O
check-protection-configdo sentinel pode ser aposentado num follow-up.Este guard deve entrar junto com a aplicação da branch protection (Ação A —
PUT /branches/main/protectioncom os contextsLint, Typecheck & Test+Production Build & Warnings Gate+Edge Functions — Deno typecheck,strict: true,enforce_admins: true). Sozinho, ele falha de propósito emmainaté a proteção existir — é a forcing function pretendida, mas não mergear isolado.Summary by cubic
Adds a CI guard that enforces the
Lint, Typecheck & Testjob as a required status check onmain. This blocks red PRs from merging by failing when branch protection is missing or misconfigured.New Features
.github/workflows/required-checks-guard.yml./branches/main/protectionwithadministration: read.Lint, Typecheck & Testis not required.enforce_admins=falseand writes a brief step summary.main, daily cron, andworkflow_dispatch.Migration
mainwith required checks:Lint, Typecheck & Test,Production Build & Warnings Gate,Edge Functions — Deno typecheck; setstrict: trueandenforce_admins: true.mainby design.Written for commit 110e9b3. Summary will update on new commits. Review in cubic