Skip to content

fix(build): restore Vercel production build — validator + TS + ESLint + test regressions#565

Closed
adm01-debug wants to merge 4 commits into
mainfrom
fix/supabase-validator-pattern
Closed

fix(build): restore Vercel production build — validator + TS + ESLint + test regressions#565
adm01-debug wants to merge 4 commits into
mainfrom
fix/supabase-validator-pattern

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

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

Problema

Desde que o PR #541 foi mergeado, o build de produção do Vercel está quebrado. O script scripts/validate-supabase-config.mjs testa padrões antigos (envMatchesCanonical) que foram substituídos no client.ts refatorado (FORBIDDEN_REFS / envPointsToForbidden). O gate pré-build falha e impede o deploy.

Correções incluídas

Commit 1 — Correção principal (restaura build Vercel)

scripts/validate-supabase-config.mjs: Atualiza as verificações 2 e 3 para aceitar tanto o padrão antigo quanto o novo:

  • hasFallbackLogic: aceita .includes("doufsxqlfjyuvxuezpln") OU FORBIDDEN_REFS OU envPointsToForbidden
  • hasCorrectAssignment: aceita envMatchesCanonical ? ... OU envPointsToForbidden || !envUrl ? ...

Commit 2 — Regressões ESLint

  • src/utils/security-audit.ts: console.infoconsole.warn (semântica correta para auditoria)
  • src/stores/__tests__/useBadgeVisibilityStore.test.ts: tipo de resolve mock corrigido
  • src/tests/ProductFetch.test.ts: supressão @typescript-eslint/no-explicit-any correta

Commit 3 — Regressões TypeScript (8 erros TS)

  • ComparisonHighlights.tsx: Restaura exports useComparisonHighlight e highlightClasses (TS2305 — imports em CompareTableView.tsx falhavam)
  • Header.tsx: Remove import duplicado de Tag (TS2300)
  • CommemorativeDateFilter.tsx: Remove compact={compact} de componente Omit<Props, 'compact'> (TS2322)
  • useNovelties.ts: Corrige narrowing TS 5.4 em variável let atribuída em callback (TS2339) via const sid = topSupplierId as string
  • useBadgeVisibilityStore.ts: Corrige TS2698 (spread em Json) com narrowing de runtime + cast as unknown as Json

Commit 4 — Regressão de teste

  • OptimizedImage.tsx: Reverte console.warnconsole.info com supressores // eslint-disable-next-line no-console. A regra no-console é 'warn' (não conta como erro no baseline). A mudança para console.warn quebrou o teste OptimizedImage > emits console.info only when debug is true.

Validação (Node 20 — idêntico ao CI)

✅ check-tsc-baseline.mjs  → 62 = 62 (zero novas regressões)
✅ check-eslint-baseline.mjs → 64 ≤ 107 (65 erros eliminados, zero regressões)
✅ test:deploy-gate → 3 arquivos, 309 testes, 0 falhas
✅ OptimizedImage tests → 2 arquivos, 15 testes, 0 falhas

Generated by Claude Code


Summary by cubic

Restores the Vercel production build by updating the Supabase config validator to accept the new enforcement pattern, and fixes TypeScript/ESLint/test regressions so CI is green again.

  • Bug Fixes
    • Updated scripts/validate-supabase-config.mjs to accept both the old envMatchesCanonical and the new FORBIDDEN_REFS/envPointsToForbidden patterns, including the SUPABASE_URL assignment check.
    • TypeScript: restored missing exports in ComparisonHighlights.tsx, removed a duplicate import and prop mismatch, tightened narrowings in useNovelties.ts, and fixed Supabase Json update payloads in useBadgeVisibilityStore.ts.
    • ESLint: corrected console semantics in security-audit.ts, removed unused imports, and applied targeted no-explicit-any suppressions in tests.
    • Tests: reverted OptimizedImage logs to console.info with inline suppressors to satisfy existing assertions.

Written for commit dcd0656. Summary will update on new commits.

Review in cubic

claude added 4 commits May 31, 2026 14:50
…en pattern

The script was written when client.ts used envMatchesCanonical but was never
updated when main switched to the FORBIDDEN_REFS / envPointsToForbidden pattern.
Update checks 2 and 3 to accept either enforcement pattern.

https://claude.ai/code/session_0125oiydTY8BPgg4bbwY9otU
…le.info, no-explicit-any

Fixes 25 new lint problems across 14 file:rule pairs introduced by feature
commits on main (OptimizedImage, EnhancedProductCard, NoveltyBadge, BadgeVisibilityStore,
SecurityAudit). No logic changes.

https://claude.ai/code/session_01JjQ4rSnq71cTyYTVTExfjw
- ComparisonHighlights.tsx: restore missing useComparisonHighlight and highlightClasses exports (were gutted, still imported by CompareTableView)
- Header.tsx: remove duplicate Tag import (TS2300)
- CommemorativeDateFilter.tsx: remove compact prop from CommemorativeDateItem JSX (Omit<Props,"compact"> doesn't accept it)
- useNovelties.ts: capture topSupplierId in const to bypass TS5.4 never-narrowing in let+forEach pattern (TS2339)
- useBadgeVisibilityStore.ts: add Json import, fix profile.preferences spread with runtime object check + double-assert cast (TS2698→TS2322→fixed)

TS gate: 62 atual = 62 baseline. ESLint: 64 atual < 107 baseline.

https://claude.ai/code/session_01JjQ4rSnq71cTyYTVTExfjw
…t spy

OptimizedImage.test.tsx asserts console.info is called when debug=true.
The ESLint lint pass changed these to console.warn, breaking that test.
The no-console rule is severity 'warn' (not error), so these calls only
produce ESLint warnings — they do not count toward the error baseline.
Reverted to console.info with eslint-disable-next-line suppressors.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 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 1, 2026 11:08am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 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: e90631e0-8fb4-4acb-9008-c0fa898f8f22

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 fix/supabase-validator-pattern

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

@supabase
Copy link
Copy Markdown

supabase Bot commented Jun 1, 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 added a commit that referenced this pull request Jun 1, 2026
…#565)

- scripts/validate-supabase-config.mjs: accept FORBIDDEN_REFS + envPointsToForbidden pattern
- src/components/compare/ComparisonHighlights.tsx: restore exports (TS2305 fix)
- src/components/layout/Header.tsx: remove duplicate Tag import (TS2300)
- src/components/filters/CommemorativeDateFilter.tsx: remove compact prop (TS2322)
- src/hooks/products/useNovelties.ts: fix let narrowing TS 5.4 (TS2339)
- src/stores/useBadgeVisibilityStore.ts: fix Json spread (TS2698)
- src/utils/security-audit.ts: console.info → console.warn
- src/components/ui/OptimizedImage.tsx: eslint-disable no-console + test fix
- Various: remove unused imports (Sparkles, Clock, TrendingUp, UrgencyType, AlertTriangle)

Closes PR #565
@adm01-debug adm01-debug closed this Jun 1, 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