Skip to content

fix(pr-assistant): rejeita auto-fix que esvazia ou apaga arquivos - #297

Merged
juninmd merged 1 commit into
masterfrom
fix/autofix-deletion-guard
Nov 22, 2026
Merged

juninmd merged 1 commit into
masterfrom
fix/autofix-deletion-guard

Conversation

@juninmd

@juninmd juninmd commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Por quê

No zplint#44 o auto-fix da revisão (commit 9290c1a8) trocou src/fix.rs inteiro (+15/-155) e esvaziou a feature. Depois o pipeline-fix (aec4dde0) adicionou response.json. Os dois passaram por todas as guardas existentes (forbidden, generated, churn, literal, secret scan). A correção manual foi o revert 5c4f3e0c.

O que muda

  • Novo fix-deletions.ts com deletionReason(dir, cached). Ele rejeita:
    • qualquer arquivo rastreado que tenha sido apagado;
    • qualquer arquivo que perca ≥40 linhas e mais de 4× o que ganha.
  • A guarda roda em dois pontos:
    • commitAndPush, no diff staged, antes do commit (destructive-fix:);
    • validateChanges, no fluxo do pipeline-fixer.

Verificação

  • bun test: 292 pass, 0 fail. Isso inclui 5 testes novos que reproduzem o caso do zplint (-140/+1 rejeitado), uma correção focada, uma remoção proporcional, um arquivo apagado e o diff staged.
  • bun run typecheck: ok.

Generated by Claude Code

zplint#44's review fix replaced src/fix.rs (+15/-155) and the pipeline fix
then added response.json; both passed every guard. Reject file deletions and
per-file removals of 40+ lines that exceed 4x the additions, both before
commit (staged diff) and in pipeline-fix validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cn6JQLTFzgs91MBvxY786W
@juninmd juninmd self-assigned this Nov 22, 2026
@juninmd
juninmd merged commit cdc91d9 into master Nov 22, 2026
3 checks passed
@juninmd
juninmd deleted the fix/autofix-deletion-guard branch November 22, 2026 13:16
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