Skip to content

feat(fixers): Go module + Cargo crate static fixers#59

Merged
wesleysimplicio merged 1 commit into
masterfrom
claude/fastest-file-editing-nr5Zt
Jun 2, 2026
Merged

feat(fixers): Go module + Cargo crate static fixers#59
wesleysimplicio merged 1 commit into
masterfrom
claude/fastest-file-editing-nr5Zt

Conversation

@wesleysimplicio
Copy link
Copy Markdown
Owner

Contexto

Segunda fatia do #57 (Alavanca C — static fixers no verify-loop). Os fixers existentes (simplicio/pipeline_fixers.py) só resolviam dependência faltante em pip e npm. As stacks piloto go-gin e rust-axum não tinham fixer de dependência — toda falha de módulo/crate ausente pagava um retry LLM, contrariando o alvo da Alavanca C ("≥80% das falhas de install/import resolvidas por fixer antes do LLM retry").

O que muda

Dois fixers novos, espelhando o contrato já provado de pip/npm (parse do log → validação → package manager atualiza o manifesto):

Fixer Trigger (regex) Ação
MissingGoModuleFixer no required module provides package … / cannot find package "…" go get <module> (atualiza go.mod)
MissingCargoCrateFixer use of undeclared crate or module \…`/maybe a missing crate `…`` cargo add <crate> (atualiza Cargo.toml)

Mais simples que o fixer de pip (que edita pyproject.toml à mão): go get/cargo add atualizam o manifesto sozinhos.

Segurança / conservadorismo

  • _safe_go_module exige path com host/owner (ponto ou barra) → nunca passa um nome de stdlib bare (fmt, os) pro go get; rejeita paths relativos (../secret).
  • _safe_cargo_crate rejeita módulos da stdlib (std, core, crate, self, …).
  • Cargo fixer não dispara em unresolved import puro (crate::models) — só em crate/módulo declaradamente ausente, evitando auto-add de import interno.

Aditivo: registrados em STATIC_FIXERS após pip/npm e antes do ruff; padrões distintos, sem colisão entre stacks (validado adversarialmente).

Testes

tests/python/test_pipeline_fixers.py — 5 testes novos:

  • go get happy-path + rejeição de stdlib/path inseguro;
  • cargo add happy-path + rejeição de módulo std;
  • dispatch via try_static_fixers para Go e Cargo sem sequestrar o caminho npm.
pytest tests/python/test_pipeline_fixers.py            -> 10 passed
pytest test_pipeline_fixers.py test_static_fixers_bench -> 19 passed
ruff check pipeline_fixers.py test_pipeline_fixers.py  -> clean

Verificação adversarial: variantes reais de erro de go build/cargo build casam; logs de sucesso, stdlib, npm e import interno do Rust não disparam; dispatch não confunde stacks.

Fora de escopo (segue em #57)

  • Format fixers cross-stack (gofmt/cargo fmt/pint) — deixados de fora de propósito: formatter não conserta syntax error real, e eu não quis shippar fixer que reporta applied=True sem resolver. Entram quando houver sinal de falha de estilo/lint separável.
  • Fixer de ImportError: cannot import name X (grep + ajuste) e composer (php-laravel).

Refs #57

https://claude.ai/code/session_01U5UiaXEjzHDaeKyCvSeVtJ


Generated by Claude Code

Static fixers only resolved missing pip and npm dependencies, so go-gin
and rust-axum verify-loop failures for absent dependencies always paid an
LLM retry. Add MissingGoModuleFixer (go get) and MissingCargoCrateFixer
(cargo add), mirroring the proven pip/npm contract: parse the package
from the failure log, validate it, and let go/cargo update the manifest.

Crate and module name validation rejects stdlib and unsafe paths so a
bare standard-library name is never shipped to the package manager.

Refs #57

https://claude.ai/code/session_01U5UiaXEjzHDaeKyCvSeVtJ
@wesleysimplicio wesleysimplicio marked this pull request as ready for review June 2, 2026 04:14
Copilot AI review requested due to automatic review settings June 2, 2026 04:14
@wesleysimplicio wesleysimplicio merged commit 00234c3 into master Jun 2, 2026
1 check passed
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

Adds two new static fixers to the verify-loop dependency-resolution layer, extending the existing pip/npm coverage to the Go and Rust stacks. This avoids a wasted LLM retry whenever a go build/cargo build fails purely because a module/crate is not declared in the manifest, supporting the LLM-reduction targets tracked in #57.

Changes:

  • New MissingGoModuleFixer (regex on no required module provides package / cannot find package "..."go get), with _safe_go_module rejecting stdlib bare names and relative paths.
  • New MissingCargoCrateFixer (regex on use of undeclared crate or module / maybe a missing cratecargo add), with _safe_cargo_crate rejecting std/core/crate/self/super/alloc.
  • Both fixers registered in STATIC_FIXERS after pip/npm and before ruff; 5 new pytest cases cover happy paths, safety rejections, and try_static_fixers dispatch.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
simplicio/pipeline_fixers.py Adds _safe_go_module/_safe_cargo_crate validators, the two new fixer classes, and registers them in STATIC_FIXERS.
tests/python/test_pipeline_fixers.py Adds 5 unit tests for Go/Cargo fixers (happy path, stdlib/unsafe rejection, dispatch).

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