Skip to content

chore(edge): deletar edge function órfã 'github-fix-config' (F1-1.x)#112

Merged
adm01-debug merged 1 commit into
mainfrom
chore/delete-orphan-edge-github-fix-config
May 9, 2026
Merged

chore(edge): deletar edge function órfã 'github-fix-config' (F1-1.x)#112
adm01-debug merged 1 commit into
mainfrom
chore/delete-orphan-edge-github-fix-config

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

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

Plano

Deletar a edge function github-fix-config (170 linhas) que é órfã/zumbi.

Critérios validados

Critério Resultado
Chamadas no front (src/, tests/, e2e/) 0 ❌ órfã
Chamadas em outras edge functions 0 ❌ órfã
Categoria no edge-authz-manifest "dev" (ferramenta de dev, não produção)
Estado funcional após PR #109 semanticamente quebrada (tentava modificar tsconfig.node.json que foi deletado)
Segredos próprios nenhum (usa só GITHUB_TOKEN/REPO/DEFAULT_BRANCH globais)

O que a função fazia

Tentava consertar tsconfig.node.json via GitHub API (PUT em /contents/tsconfig.node.json) com composite:true e sem noEmit. Era código de auditoria que provavelmente foi gerado automaticamente por um Claude/Lovable antigo pra resolver erros de TypeScript no config — algo que eu já fiz manualmente em #109.

Mudanças

Arquivo Tipo Detalhe
supabase/functions/github-fix-config/index.ts DELETED -170 linhas
supabase/functions/_shared/edge-authz-manifest.ts EDIT -1 entry
supabase/functions/_shared/cors-snapshot.json EDIT -1 entry (-8 linhas)
supabase/functions/_shared/authorize.ts EDIT comentário atualizado
scripts/check-edge-structured-logging.mjs EDIT -1 entry no array

Total: 5 arquivos, +2/-181 linhas

NÃO mexido (deliberadamente)

  • github-credentials-test (também categoria "dev") — MANTIDA, tem painel admin chamando ela: src/components/admin/connections/GitHubCredentialsTester.tsx

Risk

🟢 Zero. Função zumbi sem callers. Código já obsoleto após #109.

Test plan

  • 0 refs em src/, scripts/, supabase/, .github/ após patch
  • cors-snapshot.json ainda é JSON válido
  • ESLint baseline passa (1547=1547)
  • Edge typecheck CI verde (com 1 função a menos)
  • CodeRabbit OK

Summary by CodeRabbit

Notas de Lançamento

  • Chores
    • Removida uma função de servidor do sistema
    • Adicionadas três novas funções exclusivas para desenvolvimento
    • Atualizadas configurações de autorização e CORS para refletir as mudanças estruturais
    • Atualizado o script de verificação de logging para aplicar novas regras de conformidade

Review Change Stack

A edge function 'github-fix-config' (170 linhas) era código de auditoria/setup
abandonado. Critérios pra delete:

- ❌ 0 chamadas no front (src/, tests/, e2e/)
- ❌ 0 chamadas em outras edges
- ⚠️ Categoria 'dev' no edge-authz-manifest (claramente ferramenta de dev)
- ⚠️ Tentava modificar tsconfig.node.json via API GitHub — arquivo que foi
  deletado em #109 — então estava semanticamente quebrada de qualquer jeito
- ✅ NÃO tem segredos próprios, só usa GITHUB_TOKEN/REPO/DEFAULT_BRANCH

Mudanças:
- Deletado: supabase/functions/github-fix-config/index.ts (170 linhas)
- supabase/functions/_shared/edge-authz-manifest.ts (-1 entry)
- supabase/functions/_shared/cors-snapshot.json (-1 entry)
- supabase/functions/_shared/authorize.ts (atualizado comentário)
- scripts/check-edge-structured-logging.mjs (-1 entry no array)

Mantida: 'github-credentials-test' (TEM painel admin que usa, em
src/components/admin/connections/GitHubCredentialsTester.tsx).

Risk: 🟢 zero. Função zumbi, código já obsoleto.

Test plan:
- [x] 0 refs restantes em src/ scripts/ supabase/ .github/
- [x] cors-snapshot.json válido
- [x] eslint baseline passa
- [ ] Edge typecheck CI verde (com 1 função a menos)
- [ ] CodeRabbit OK
Copilot AI review requested due to automatic review settings May 9, 2026 16:38
@vercel
Copy link
Copy Markdown

vercel Bot commented May 9, 2026

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

Project Deployment Actions Updated (UTC)
promo-gifts Ready Ready Preview, Comment May 9, 2026 4:38pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9741ca5b-0103-4cdf-a2ed-4c8bdf28d866

📥 Commits

Reviewing files that changed from the base of the PR and between 9d9026b and b5ecd9a.

📒 Files selected for processing (5)
  • scripts/check-edge-structured-logging.mjs
  • supabase/functions/_shared/authorize.ts
  • supabase/functions/_shared/cors-snapshot.json
  • supabase/functions/_shared/edge-authz-manifest.ts
  • supabase/functions/github-fix-config/index.ts
💤 Files with no reviewable changes (3)
  • supabase/functions/_shared/edge-authz-manifest.ts
  • supabase/functions/_shared/cors-snapshot.json
  • supabase/functions/github-fix-config/index.ts

Walkthrough

Este PR remove completamente o edge function github-fix-config do Supabase e limpa todas suas referências: LEGACY_ALLOWLIST, CORS snapshot, manifesto de autorização. A implementação deletada (170 linhas) realizava atualização remota de tsconfig.node.json e package.json via GitHub API com autorização de role dev. Adicionam-se três novos dev-only functions (secrets-manager, connection-tester, github-credentials-test) ao manifesto.

Changes

Remoção do github-fix-config e Consolidação de Manifesto

Layer / File(s) Summary
Limpeza de Registros de Configuração
scripts/check-edge-structured-logging.mjs, supabase/functions/_shared/cors-snapshot.json, supabase/functions/_shared/edge-authz-manifest.ts
Remove github-fix-config do LEGACY_ALLOWLIST, CORS snapshot e EDGE_AUTHZ_MANIFEST. Adiciona secrets-manager, connection-tester, github-credentials-test como dev-only com enforcedBy: "custom" e rationale is_dev().
Remoção da Implementação do Handler
supabase/functions/github-fix-config/index.ts
Deleta 170 linhas: handler Deno.serve com autorização role dev, requisições GitHub Contents API, codificação/decodificação base64, atualização SHA-based de tsconfig.node.json e package.json, respostas HTTP estruturadas (200 sucesso / 500 erro).
Atualização de Comentário
supabase/functions/_shared/authorize.ts
Ajuste textual em comentário de exemplo sobre comportamento sem role check.

Estimated code review effort

🎯 2 (Simples) | ⏱️ ~10 minutos

Possibly related PRs

  • adm01-debug/Promo_Gifts#109: Remove tsconfig.node.json e nota que github-fix-config referencia esse arquivo — escopo complementar de limpeza.
  • adm01-debug/Promo_Gifts#67: Modifica EDGE_AUTHZ_MANIFEST e migra secure-upload para structured logger — mesmo padrão de atualização de manifesto e SSOT compliance.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed O título descreve claramente a ação principal: deletar a edge function órfã 'github-fix-config', sendo totalmente relacionado ao changeset.
Description check ✅ Passed A descrição segue a template com seções bem preenchidas (Plano, Critérios validados, O que a função fazia, Mudanças, Risk, Test plan), mas as checkboxes de validação técnica estão incompletas (Edge typecheck CI e CodeRabbit pendentes).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/delete-orphan-edge-github-fix-config

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

Copy link
Copy Markdown

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

Remove uma Edge Function de dev (github-fix-config) que ficou órfã/zumbi após a remoção do tsconfig.node.json (PR #109), e ajusta os “SSOTs”/gates que listam funções existentes.

Changes:

  • Deleta supabase/functions/github-fix-config/index.ts (função órfã).
  • Remove a função dos snapshots/manifestos compartilhados (AuthZ e CORS).
  • Atualiza o gate de CI de structured logging para não listar uma edge inexistente e ajusta comentário de contexto no authorize.ts.

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
supabase/functions/github-fix-config/index.ts Remove a edge function órfã.
supabase/functions/_shared/edge-authz-manifest.ts Remove a entrada de AuthZ da edge deletada.
supabase/functions/_shared/cors-snapshot.json Remove a entrada de CORS snapshot da edge deletada.
supabase/functions/_shared/authorize.ts Atualiza comentário que citava a edge removida.
scripts/check-edge-structured-logging.mjs Remove a edge deletada da allowlist de legado.

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

Comment on lines 128 to 133
// ---------------- Dev-only ----------------
"secrets-manager": { category: "dev", rationale: "is_dev() inline check", enforcedBy: "custom" },
"connection-tester": { category: "dev", rationale: "is_dev() inline check", enforcedBy: "custom" },
"github-credentials-test": { category: "dev", rationale: "is_dev() inline check", enforcedBy: "custom" },
"github-fix-config": { category: "dev", rationale: "Escreve no repo via PAT — dev only", enforcedBy: "shared-authorize" },
"external-db-inspect": { category: "dev", rationale: "is_dev() inline check", enforcedBy: "custom" },
"rls-audit": { category: "dev", rationale: "Auditoria via service-role + has_role inline", enforcedBy: "custom" },
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5ecd9a8ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"allowOrigin": null
},
{
"name": "health-check",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Regenerate the CORS snapshot metadata

Removing this function entry without regenerating the snapshot leaves cors-snapshot.json internally inconsistent: total and counts.shared still say 85 while the functions array now contains 84 entries. The CI workflow’s “CORS snapshot freshness” step (.github/workflows/ci.yml:155-158) runs node scripts/build-cors-snapshot.mjs --check, which compares those metadata fields against the generated snapshot, so this change should update the generated totals/counts along with the removed function entry.

Useful? React with 👍 / 👎.

@adm01-debug adm01-debug merged commit 73118a5 into main May 9, 2026
18 of 19 checks passed
@adm01-debug adm01-debug deleted the chore/delete-orphan-edge-github-fix-config branch May 9, 2026 16:47
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