feat(fixers): Go module + Cargo crate static fixers#59
Merged
Conversation
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
There was a problem hiding this comment.
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 onno required module provides package/cannot find package "..."→go get), with_safe_go_modulerejecting stdlib bare names and relative paths. - New
MissingCargoCrateFixer(regex onuse of undeclared crate or module/maybe a missing crate→cargo add), with_safe_cargo_craterejectingstd/core/crate/self/super/alloc. - Both fixers registered in
STATIC_FIXERSafter pip/npm and before ruff; 5 new pytest cases cover happy paths, safety rejections, andtry_static_fixersdispatch.
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
MissingGoModuleFixerno required module provides package …/cannot find package "…"go get <module>(atualizago.mod)MissingCargoCrateFixeruse of undeclared crate or module \…`/maybe a missing crate `…``cargo add <crate>(atualizaCargo.toml)Mais simples que o fixer de pip (que edita
pyproject.tomlà mão):go get/cargo addatualizam o manifesto sozinhos.Segurança / conservadorismo
_safe_go_moduleexige path com host/owner (ponto ou barra) → nunca passa um nome de stdlib bare (fmt,os) progo get; rejeita paths relativos (../secret)._safe_cargo_craterejeita módulos da stdlib (std,core,crate,self, …).unresolved importpuro (crate::models) — só em crate/módulo declaradamente ausente, evitando auto-add de import interno.Aditivo: registrados em
STATIC_FIXERSapó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:try_static_fixerspara Go e Cargo sem sequestrar o caminho npm.Verificação adversarial: variantes reais de erro de
go build/cargo buildcasam; logs de sucesso, stdlib, npm e import interno do Rust não disparam; dispatch não confunde stacks.Fora de escopo (segue em #57)
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 reportaapplied=Truesem resolver. Entram quando houver sinal de falha de estilo/lint separável.ImportError: cannot import name X(grep + ajuste) e composer (php-laravel).Refs #57
https://claude.ai/code/session_01U5UiaXEjzHDaeKyCvSeVtJ
Generated by Claude Code