Skip to content

fix(qa): P0 build (index.html base64) + restaura gates TSC/ESLint verdes#634

Closed
adm01-debug wants to merge 1 commit into
mainfrom
claude/system-testing-qa-M1wKn
Closed

fix(qa): P0 build (index.html base64) + restaura gates TSC/ESLint verdes#634
adm01-debug wants to merge 1 commit into
mainfrom
claude/system-testing-qa-M1wKn

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented Jun 3, 2026

Contexto

Auditoria QA exaustiva rodando os gates reais da branch para medir a saúde do sistema. A maioria estava verde, mas encontrei 1 P0 que quebra produção e 2 gates de CI vermelhos. Todas as correções são cirúrgicas e verificadas.

🚨 P0 — index.html inteiro em base64 → build sem JavaScript

O index.html da branch não era HTML: era o HTML real codificado em base64 (PCFkb2N0eXBlIGh0bWw+ = <!doctype html>). O Vite lia o arquivo como entry, não encontrava <script type="module" src="/src/main.tsx"> e o npm run build emitia o blob base64 como dist/index.html sem nenhum assets/*.js — o deploy serviria uma página de lixo, sem nenhum JavaScript do app.

❌ Gate ESLint (estava vermelho — exit 1)

  • src/utils/currency.ts:39/48/57eqeqeq (== null=== null || === undefined); comportamento idêntico, satisfaz o gate.
  • src/pages/NotFound.tsx — remove import morto Search (lucide-react) + diretiva eslint-disable inútil.

❌ Gate TSC (drift pré-existente dos PRs #624–628 — exit 1)

  • src/lib/notifications-metrics.ts:371reset() esquecia a chave 'filter-change' do Record<FetchSource, number> (contador real não-resetado).
  • src/hooks/auth/useProfileRoles.ts — o .select() pedia a coluna organization_id inexistente em profiles (PostgREST retorna 400, deixando profileResult.error setado e impedindo o profile de carregar silenciosamente). Além disso buscava só 4 de 13 campos do Profile, deixando preferences/user_id/is_active/created_at undefined em runtime mesmo no caminho feliz (esses campos são lidos em vários pontos do app). Fix: select com todas as colunas reais de Profile + cast pontual de preferences (JsonRecord<string, unknown>).

🧪 Teste obsoleto

✅ Verificação (exaustiva)

Gate Resultado
npm run typecheck (baseline TSC) ✅ 0 regressão
node scripts/check-eslint-baseline.mjs ✅ 0 regressão
npm run build ✅ 358 chunks JS, index.html referencia o bundle
npm run test:ci-core (deploy gate) ✅ 317/317
Testes dos módulos tocados ✅ NotFound 5/5, notifications-metrics, NotificationDrawer counters
Sanity funcional currency.ts ✅ null/undefined/NaN → "R$ 0,00"; números/negativos/compacto/parseBRL OK

Zero regressão: 10 falhas pré-existentes (ProductDetailHero.priceFreshness, MockupHistoryPage, postgrest-migration, theme-presets) foram confirmadas idênticas com e sem estas mudanças via git stash — nenhuma importa os módulos alterados. Ficam registradas como backlog não relacionado.

https://claude.ai/code/session_01Kn4RqeLmAJdjZaKdVzGHWo


Generated by Claude Code


Summary by cubic

Corrige um P0 de build ao decodificar o index.html que estava em base64, voltando a carregar o JavaScript do app. Restaura os gates de ESLint e TSC e atualiza um teste obsoleto.

  • Bug Fixes
    • Build: index.html decodificado; <script type="module" src="/src/main.tsx"> restaurado; build volta a emitir bundles JS.
    • ESLint: aplica eqeqeq em src/utils/currency.ts e remove import morto + diretiva inútil em src/pages/NotFound.tsx.
    • TSC: notifications-metrics.reset() passa a zerar 'filter-change'; useProfileRoles corrige select (remove coluna inexistente, busca todas as colunas de Profile e faz cast de preferences), evitando 400 silencioso e campos undefined.
    • Testes: tests/pages/NotFound.test.tsx agora espia console.warn (alinhado ao comportamento atual).

Written for commit 95e7641. Summary will update on new commits.

Review in cubic

Auditoria QA exaustiva rodando os gates reais da branch. Achados e correções:

P0 — index.html estava inteiro em base64 (não era HTML). O Vite lia como
entry, não encontrava o <script src="/src/main.tsx"> e o build emitia o blob
base64 como dist/index.html SEM nenhum assets/*.js — o deploy serviria uma
página sem JavaScript. Origem: PR #618 base64-encodou vários arquivos; o
hotfix #622 corrigiu robots.txt/sitemap.xml/cors.ts/.tsc-baseline.json mas
esqueceu o index.html. Fix: decode in-place (roundtrip exato, 136 linhas).
Build agora gera 358 chunks JS e o index.html referencia o bundle.

Gate ESLint (estava vermelho):
- src/utils/currency.ts: eqeqeq (== null -> === null || === undefined) em 3 fns
- src/pages/NotFound.tsx: remove import morto `Search` + diretiva eslint-disable inútil

Gate TSC (drift pré-existente dos PRs #624-628, deixava o gate vermelho):
- src/lib/notifications-metrics.ts: reset() esquecia a chave 'filter-change'
  do Record<FetchSource, number> (bug real de contador não-resetado)
- src/hooks/auth/useProfileRoles.ts: select pedia coluna organization_id
  inexistente em `profiles` (400 PostgREST silencioso impedindo o profile de
  carregar) e só buscava 4 de 13 campos do Profile (preferences/user_id/
  is_active/created_at ficavam undefined em runtime). Fix: select com todas as
  colunas reais de Profile + cast pontual de `preferences` (Json -> Record).

Teste obsoleto:
- tests/pages/NotFound.test.tsx espiava console.error; o PR #625 trocou para
  console.warn. Atualizado.

Gates verificados: typecheck baseline OK, eslint baseline OK, build OK
(358 JS chunks), test:ci-core 317/317. Zero regressão (10 falhas pré-existentes
em price-freshness/mockup-history/postgrest-remap/theme-presets confirmadas
idênticas com/sem estas mudanças via git stash).
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

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

Project Deployment Actions Updated (UTC)
we-dream-big Ready Ready Preview, Comment Jun 3, 2026 2:03am

@supabase
Copy link
Copy Markdown

supabase Bot commented Jun 3, 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 ↗︎.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 383cdb5a-6159-4b5d-866a-041ca65ac16c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/system-testing-qa-M1wKn

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

adm01-debug added a commit that referenced this pull request Jun 3, 2026
…out JS

The index.html on main was stored as base64 text since PR #618.
Vite reads this as entry point, finds no <script> tags to transform,
and outputs the base64 blob as dist/index.html — the deployed site
serves base64 text instead of HTML, with zero JS bundles.

Fix: replace with the decoded HTML (136 lines, exact roundtrip).
Same fix as PR #634 branch but applied directly to main for immediate
production recovery.
Copy link
Copy Markdown
Owner Author

Fechando como superseded pela main atual (ad37ba7).

  • O P0 index.html base64 já está corrigido na main (o arquivo já é <!doctype html> válido).
  • Os gates TSC/ESLint já foram restaurados na main por merges posteriores (esta branch está 19 commits atrás).
  • O único delta residual único era um micro-fix em src/utils/currency.ts (guards === undefined), redundante porque isNaN(undefined) === true já cobre o caso.

Sem valor único a integrar — fechando para reduzir ruído de PRs concorrentes. O saneamento de gates está sendo conduzido sobre a main atual.


Generated by Claude Code

@adm01-debug adm01-debug closed this Jun 3, 2026
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.

2 participants