Skip to content

fix(ci): repair TypeScript gate (decode base64 supabase-untyped, distributive Omit)#326

Closed
adm01-debug wants to merge 1 commit into
mainfrom
claude/fix-ts-lint-gates
Closed

fix(ci): repair TypeScript gate (decode base64 supabase-untyped, distributive Omit)#326
adm01-debug wants to merge 1 commit into
mainfrom
claude/fix-ts-lint-gates

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

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

Objetivo

Deixar o gate de TypeScript verde (parte do plano aprovado "atualizar baseline / alinhar tipos"). Em vez de regenerar o types.ts inteiro (que pioraria — testei: surgem ~30 mismatches latentes pois o frontend depende do shape atual dos tipos), encontrei e corrigi a causa-raiz do gate vermelho.

Diagnóstico

main estava 521 erros de TS vs baseline 508 (+13) — por isso o "TypeScript gate" falhava em todo PR. Raízes:

  1. src/lib/supabase-untyped.ts estava commitado em base64 (mesmo padrão da migration base64), então não exportava untypedFrom8× TS2305 ("no exported member 'untypedFrom'") em personalization/intelligence/products/trends + 3× TS2304 no próprio arquivo. → decodificado para o TS real.
  2. bridge-status-events.ts: emitBridgeStatus usava Omit<BridgeStatusEvent,'ts'>, mas BridgeStatusEvent é união discriminada — Omit sobre união colapsa para chaves comuns e perde reason/attempt/attempts5× TS2353 em external-db/invoke.ts. → trocado por DistributiveOmit.
  3. kill-switch-client.test.ts: mockFrom sem parâmetros → spread tropeçava em TS2556. → rest param.

Resultado (validado com node_modules instalado)

  • tsc: 521 → 502 erros (6 abaixo do baseline antigo), sem regressões
  • Baselines atualizados: .tsc-baseline.json (502) e .eslint-baseline.json (131) → Gate 1 (Lint+TypeScript) e Lint/Typecheck & Test passam ✅

Notas

  • Os 4 itens de ESLint absorvidos no baseline são drift pré-existente em arquivos de kill-switch (useKillSwitchBanner, kill-switch-client, kill-switch-telemetry) — não tocados aqui (território da sessão concorrente); ficam visíveis no diff para correção futura.
  • Não regenerei types.ts (a substituição integral piora o gate; seria um refactor dedicado para alinhar o frontend ao schema real de prod).

https://claude.ai/code/session_01MBTzmQYmrgwLnwfxRS3PNU


Generated by Claude Code


Summary by cubic

Fixes the failing TypeScript CI gate by decoding the base64-committed supabase-untyped file and correcting emitBridgeStatus typing. TS errors drop to 502 and Gate 1 (Lint+TypeScript) passes again.

  • Bug Fixes
    • Decoded src/lib/supabase-untyped.ts and restored untypedFrom<T>() for untyped tables.
    • Replaced Omit<Union, 'ts'> with a distributive Omit in bridge-status-events.ts to keep variant fields; fixes TS2353s in external-db/invoke.ts.
    • Updated mockFrom to accept rest args in kill-switch-client.test.ts to resolve TS2556.
    • Refreshed baselines: .tsc-baseline.json to 502 errors, .eslint-baseline.json to 131.

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

…fix bridge Omit

The TS gate was red on main (521 errs vs 508 baseline, +13). Root causes:

- src/lib/supabase-untyped.ts was committed as a base64 blob instead of TS, so
  it exported nothing -> 8x TS2305 "no exported member 'untypedFrom'" across
  personalization/intelligence/products/trends + 3x TS2304 in the file. Decoded
  back to the real TypeScript.
- bridge-status-events.ts: emitBridgeStatus used Omit<Union,'ts'>, which
  collapses the discriminated union to common keys and drops variant props
  (reason/attempt/attempts) -> 5x TS2353 in external-db/invoke.ts. Switched to a
  DistributiveOmit.
- kill-switch-client.test.ts: mockFrom had no params, so spread args tripped
  TS2556. Gave it a rest param.

Result: tsc drops to 502 errors (6 under the old baseline), no regressions.
Both baselines refreshed (.tsc-baseline.json 502, .eslint-baseline.json 131) so
Gate 1 (Lint+TypeScript) and Lint/Typecheck&Test pass. The 4 absorbed eslint
items are pre-existing drift in kill-switch files (not touched here).

https://claude.ai/code/session_01MBTzmQYmrgwLnwfxRS3PNU
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 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 May 25, 2026 1:10am

@supabase
Copy link
Copy Markdown

supabase Bot commented May 25, 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 May 25, 2026

Warning

Review limit reached

@adm01-debug, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 5 reviews of capacity. Refill in 26 minutes.

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 @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 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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3e80915b-498a-4af7-8238-5d31aa5bb638

📥 Commits

Reviewing files that changed from the base of the PR and between 2cc5c34 and ea95780.

📒 Files selected for processing (5)
  • .eslint-baseline.json
  • .tsc-baseline.json
  • src/lib/external-db/__tests__/kill-switch-client.test.ts
  • src/lib/external-db/bridge-status-events.ts
  • src/lib/supabase-untyped.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-ts-lint-gates

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

@adm01-debug adm01-debug marked this pull request as ready for review May 25, 2026 01:20
Copilot AI review requested due to automatic review settings May 25, 2026 01:20
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 aims to get the CI TypeScript “baseline gate” back to green by addressing root causes of new TS errors (rather than regenerating the full Supabase types.ts) and then updating the stored baselines accordingly.

Changes:

  • Decodes/restores src/lib/supabase-untyped.ts (previously committed as base64) so untypedFrom() is actually exported and typechecking can proceed.
  • Fixes emitBridgeStatus typing for a discriminated-union event by using a distributive omit pattern, eliminating invalid property errors downstream.
  • Adjusts a Supabase mock in kill-switch-client tests to accept rest args, fixing a TS spread/args error; refreshes .tsc-baseline.json and .eslint-baseline.json.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/supabase-untyped.ts Restores readable TS source and untypedFrom() export; adds explanatory header comment.
src/lib/external-db/bridge-status-events.ts Fixes union-typing issue in emitBridgeStatus via distributive omit; minor formatting cleanup.
src/lib/external-db/tests/kill-switch-client.test.ts Updates mocked .from() to accept rest args to satisfy TS.
.tsc-baseline.json Updates TS error baseline totals and per-file counts to match new tsc output.
.eslint-baseline.json Updates ESLint baseline totals/counts to match current lint output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +27
* CI guard: `.github/workflows/lint-untyped-from.yml` fails the build if
* any `untypedFrom("X")` call references a table NOT in types.ts —
* which is the precise condition that caused a 2026-05-24 silent
* failures (tables missing from the database).
@adm01-debug
Copy link
Copy Markdown
Owner Author

🚪 Fechando esta PR — duplicada de #332

Após auditoria comparativa, esta PR é subconjunto estrito da #332. Detalhamento:

Arquivos sobrepostos (exatamente os mesmos)

Arquivo #326 (esta) #332
src/lib/external-db/bridge-status-events.ts DistributiveOmit DistributiveOmit (versão idêntica)
src/lib/external-db/__tests__/kill-switch-client.test.ts mock rest param mock rest param (versão equivalente)
src/lib/supabase-untyped.ts decode base64 já em main (PR anterior absorveu)
.tsc-baseline.json 502 erros 498 erros (10 a menos — superset)
.eslint-baseline.json 131 erros 136 erros (compatível)

O que o #332 traz a mais

Conclusão

Manter as duas PRs abertas com o mesmo fix de bridge-status-events.ts gera conflito garantido no merge da segunda. Fechando esta para evitar retrabalho.

Validação: o fix de TS gate (a motivação desta PR) será entregue em produção pelo #332, com mais 10 bugs reais juntos.


🤖 Decisão tomada via plano master coordenado — ver #332 para o bloco completo.

@adm01-debug adm01-debug deleted the claude/fix-ts-lint-gates branch May 25, 2026 18:17
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