-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ci): destrava 7 jobs falhos pós-PR #19 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,9 +49,43 @@ env: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VITE_CRM_SUPABASE_ANON_KEY: ${{ secrets.VITE_CRM_SUPABASE_ANON_KEY }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Gate: só roda o deploy quando VERCEL_TOKEN está configurado. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Sem isso o job inteiro falha tentando autenticar contra Vercel. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Enquanto o Lovable bot faz o auto-deploy, manter este gate como | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # "skipped" não bloqueia outros workflows nem cria red flags no CI. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Para ativar: Settings → Secrets and variables → Actions → adicionar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID + as VITE_* listadas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # no header deste arquivo. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| check-secrets: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Check deploy prerequisites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| can_deploy: ${{ steps.check.outputs.can_deploy }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - id: check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$VERCEL_TOKEN" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "can_deploy=true" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ VERCEL_TOKEN configurado — deploy seguirá adiante." >> "$GITHUB_STEP_SUMMARY" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+52
to
+72
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "can_deploy=false" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "## ⏭️ Deploy via GitHub Actions desabilitado" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "VERCEL_TOKEN não está configurado nos secrets do repo." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Enquanto isso, o Lovable bot continua fazendo auto-deploy." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Para ativar este workflow: Settings → Secrets and variables → Actions." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } >> "$GITHUB_STEP_SUMMARY" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preflight incompleto: valide todos os secrets VERCEL_ obrigatórios* Hoje o gate só checa Diff sugerido - id: check
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
+ VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
+ VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
run: |
- if [ -n "$VERCEL_TOKEN" ]; then
+ MISSING=()
+ [ -z "$VERCEL_TOKEN" ] && MISSING+=("VERCEL_TOKEN")
+ [ -z "$VERCEL_ORG_ID" ] && MISSING+=("VERCEL_ORG_ID")
+ [ -z "$VERCEL_PROJECT_ID" ] && MISSING+=("VERCEL_PROJECT_ID")
+
+ if [ ${`#MISSING`[@]} -eq 0 ]; then
echo "can_deploy=true" >> "$GITHUB_OUTPUT"
- echo "✅ VERCEL_TOKEN configurado — deploy seguirá adiante." >> "$GITHUB_STEP_SUMMARY"
+ echo "✅ Secrets Vercel obrigatórios configurados — deploy seguirá adiante." >> "$GITHUB_STEP_SUMMARY"
else
echo "can_deploy=false" >> "$GITHUB_OUTPUT"
{
echo "## ⏭️ Deploy via GitHub Actions desabilitado"
echo ""
- echo "VERCEL_TOKEN não está configurado nos secrets do repo."
+ echo "Secrets ausentes: ${MISSING[*]}"
echo "Enquanto isso, o Lovable bot continua fazendo auto-deploy."
echo ""
echo "Para ativar este workflow: Settings → Secrets and variables → Actions."
} >> "$GITHUB_STEP_SUMMARY"
fi🤖 Prompt for AI Agents
Comment on lines
+69
to
+82
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: O gate de pré-requisitos está incompleto: ele valida só Prompt for AI agents
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| deploy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Build & Deploy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: check-secrets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: needs.check-secrets.outputs.can_deploy == 'true' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -117,7 +117,7 @@ Para cada projeto Supabase você precisa de: | |||||
| 3. Aplicar as migrações em `supabase/migrations/` no projeto principal: | ||||||
| ```bash | ||||||
| npx supabase link --project-ref <seu-project-ref> | ||||||
| npx supabase db push | ||||||
| npx supabase migration up | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Prompt for AI agents
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This section says to apply migrations to the main Supabase project, but Useful? React with 👍 / 👎. |
||||||
| ``` | ||||||
| 4. Deployar as edge functions (opcional em dev — feito via CI): | ||||||
| ```bash | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -311,9 +311,9 @@ | |||||||||||||||||||||||||||
| await page.goto("/login"); | ||||||||||||||||||||||||||||
| await page.fill(Sel.login.email, "smoke-fake@example.com"); | ||||||||||||||||||||||||||||
| await page.fill(Sel.login.password, "SenhaErrada@2025!"); | ||||||||||||||||||||||||||||
| await page.locator(Sel.login.submit).first().click(); | ||||||||||||||||||||||||||||
|
Check failure on line 314 in e2e/flows/20-all-features-smoke.spec.ts
|
||||||||||||||||||||||||||||
| await expect(page).toHaveURL(/\/login/, { timeout: 8_000 }); | ||||||||||||||||||||||||||||
| await expect(page.locator(Sel.login.submit).first()).toBeEnabled({ timeout: 5_000 }); | ||||||||||||||||||||||||||||
| await expect(page.locator(Sel.login.submit).first()).toBeEnabled({ timeout: 15_000 }); | ||||||||||||||||||||||||||||
|
Comment on lines
314
to
+316
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sincronize com a resposta 400 do login para eliminar flake residual. A falha do pipeline nesse cenário indica que só aumentar timeout (Line 316) ainda não estabilizou o teste. Faça a asserção depender do evento de erro do auth (resposta 400), não apenas de tempo. 💡 Patch sugerido- await page.locator(Sel.login.submit).first().click();
- await expect(page).toHaveURL(/\/login/, { timeout: 8_000 });
- await expect(page.locator(Sel.login.submit).first()).toBeEnabled({ timeout: 15_000 });
+ const submit = page.locator(Sel.login.submit).first();
+ const authFailed = page.waitForResponse(
+ (res) => /\/auth\/v1\/token/.test(res.url()) && res.status() === 400,
+ { timeout: 15_000 },
+ );
+ await submit.click();
+ await authFailed;
+ await expect(page).toHaveURL(/\/login/, { timeout: 8_000 });
+ await expect(submit).toBeEnabled({ timeout: 8_000 });📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: e2e[failure] 314-314: [chromium-smoke] › e2e/flows/20-all-features-smoke.spec.ts:297:3 ›
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // 95 · Negativo de recovery: /reset-password sem token NÃO habilita reset. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import { AlertTriangle, CheckCircle2, Clock, Info, Loader2, RefreshCw, WifiOff, | |
| import { AnimatePresence, motion } from 'framer-motion'; | ||
| import { Button } from '@/components/ui/button'; | ||
| import { useCloudStatus } from '@/hooks/ui'; | ||
| import { useDevGate } from '@/hooks/admin'; | ||
| import { DevOnly } from '@/components/dev/DevOnly'; | ||
|
|
||
| import { getStatusTimeline } from '@/lib/cloud-status'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
@@ -35,15 +36,22 @@ const STATUS_CONFIG: Partial<Record<'down' | 'degraded' | 'warming', BannerVaria | |
|
|
||
| const CloudStatusBannerInner = memo(function CloudStatusBannerInner() { | ||
| const { status, snapshot, retry, isChecking } = useCloudStatus(); | ||
| const { isAllowed } = useDevGate(); | ||
| const [showDebug, setShowDebug] = useState(false); | ||
| const [showTimeline, setShowTimeline] = useState(false); | ||
|
|
||
| const timeline = useMemo(() => getStatusTimeline(), []); | ||
| const isIssueStatus = status === 'down' || status === 'degraded' || status === 'warming'; | ||
| const isCritical = status === 'down' || status === 'degraded'; | ||
| const isIssueStatus = isCritical || status === 'warming'; | ||
| const config = isIssueStatus ? STATUS_CONFIG[status] : null; | ||
| // Banner de saúde do backend é gateado externamente por <DevOnly> — aqui só | ||
| // decidimos se há issue ativo para renderizar. | ||
|
|
||
| // Política de visibilidade: | ||
| // - down/degraded (crítico) → SEMPRE renderiza para todos os usuários, | ||
| // pois afeta diretamente a capacidade de trabalho do vendedor. | ||
| // - warming (técnico) → só para devs (gate de infra), por ser ruído. | ||
| // - healthy/unknown → nunca renderiza (indicador fica no DevStatusDot). | ||
| if (!isIssueStatus) return null; | ||
| if (status === 'warming' && !isAllowed) return null; | ||
|
|
||
| // Defensivo: como shouldShow exige status ∈ {down, degraded, warming}, | ||
| // config sempre estará definido aqui. Os fallbacks (?? ...) protegem caso | ||
|
|
@@ -176,9 +184,7 @@ const CloudStatusBannerInner = memo(function CloudStatusBannerInner() { | |
| }); | ||
|
|
||
| export const CloudStatusBanner = memo(function CloudStatusBanner() { | ||
| return ( | ||
| <DevOnly> | ||
| <CloudStatusBannerInner /> | ||
| </DevOnly> | ||
| ); | ||
| // Gating de visibilidade (crítico vs técnico) é feito dentro do Inner para | ||
| // permitir que falhas críticas alcancem TODOS os usuários, não só devs. | ||
| return <CloudStatusBannerInner />; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: After removing the outer Prompt for AI agents |
||
| }); | ||
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new preflight gate marks
can_deploy=truewhen onlyVERCEL_TOKENis present, but this workflow also depends onVERCEL_ORG_IDandVERCEL_PROJECT_ID(declared in the workflow env and required by the subsequentvercel pull/build/deploysteps in CI). In repositories where the token exists but org/project IDs are missing, this job now green-lights the deploy path and the deploy job still fails later, so the gate does not actually prevent the class of failures it was introduced to avoid.Useful? React with 👍 / 👎.