[testify-expert] Improve Test Quality: pkg/workflow/unquote_uses_test.go
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Empieza leyendo pkg/workflow/unquote_uses_test.go junto con el código fuente pkg/workflow/compiler_yaml_step_conversion.go, especialmente unquoteUsesWithComments e injectZizmorUnverifiedCreatorAnnotations. Ejecuta go test ./pkg/workflow/ -run 'UnquoteUses|Zizmor' para establecer la línea base, luego trabaja a través de la lista de verificación de aceptación: cambia t.Errorf manual por testify assert/require, añade los casos faltantes de formatStepEnvValueForYAML y ConvertStepToYAML, genera la tabla de prefijos a partir de unverifiedCreatorActionPrefixes y renombra el archivo. Terminado cuando make test-unit pasa con todos los casos nuevos presentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Current State
- Test file:
pkg/workflow/unquote_uses_test.go(280 LOC, 4 test functions, 0assert/requireusages; all checks useif got != want { t.Errorf }) - Source file:
pkg/workflow/compiler_yaml_step_conversion.go(functions:injectZizmorUnverifiedCreatorAnnotations,ConvertStepToYAML,unquoteUsesWithComments,(*Compiler).renderStepFromMap,formatStepEnvValueForYAML)
Strengths
- Already table-driven with descriptive case names.
- Good edge cases for malformed/unclosed quotes and hash-without-space.
- Realistic multi-step YAML inputs.
Prioritized Improvements
1. Missing / high-value tests
injectZizmorUnverifiedCreatorAnnotationshas only 3 cases. Add:- every entry in
unverifiedCreatorActionPrefixes(iterate the slice so new prefixes are auto-covered), - a verified action (
actions/checkout@...) gets no annotation, - tab indentation and
- uses:(list-item form; currentlyTrimLeft+CutPrefix("uses: ")would NOT match- uses: safedep/..., so document or fix the expected behaviour), - a quoted value (
uses: "safedep/pmg@sha") — does it match the prefix?, - empty input and idempotency (running twice should not double-inject, or the test should pin that it does).
- every entry in
ConvertStepToYAMLandformatStepEnvValueForYAMLhave no direct tests in this file (only indirect ones incompiler_generation_test.go/multiline_test.go). Add a small table forformatStepEnvValueForYAML(string, bool, int, multi-line, string needing quoting) and aConvertStepToYAMLcase checking thatuseswith a# v6comment ends up unquoted end-to-end.unquoteUsesWithComments: add CRLF input,uses: 'single-quoted # v1', anduses: "..."with extra spaces. The "multiple quotes on same line" case pins a questionable behaviour; add a comment saying it is intentional.
2. Testify assertion upgrades
Before / after
// Before
if result != tt.expected {
t.Errorf("unquoteUsesWithComments() = %q, want %q", result, tt.expected)
}
// After
assert.Equal(t, tt.expected, unquoteUsesWithComments(tt.input), "unquoteUsesWithComments should produce expected YAML")
Add "github.com/stretchr/testify/assert" to imports; use require.NoError for ConvertStepToYAML errors. Replacing the multi-line Got/Want messages also yields better diffs.
3. Table-driven refactors
- The three
unquoteUsesWithCommentstests (TestUnquoteUsesWithComments,...EdgeCases,...RealWorldExamples) share an identical struct and loop. Merge into one table (or keep three with a shared helper) andt.Parallel()per subtest. - Build
unverifiedCreatorActionPrefixescases from the slice rather than hard-coding.
4. Organization / readability
- File name
unquote_uses_test.goalso testsinjectZizmorUnverifiedCreatorAnnotations; rename tocompiler_yaml_step_conversion_test.goto match the source file. - Use named raw-string constants for the repeated SHA pins to shorten cases.
Acceptance Checklist
- testify
assert/requireused instead of manualt.Errorfcomparisons - New tests for the gaps listed in section 1
- Tables merged / generated from
unverifiedCreatorActionPrefixes - File renamed to match source file
-
make test-unitpasses
Generated by 🧪 Daily Testify Uber Super Expert · copilot · auto · 15.3 AIC · ⌖ 9.64 AIC · ⊞ 7.3K · ◷
- expires on Oct 6, 2026, 10:22 AM UTC-08:00
- Lenguaje dominante
- Go
- Estrellas
- 5.3k
- Forks
- 568
- Merge medio
- 8 h 59 min
- PR fusionados (30 d)
- 722
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/gh-aw
-
ai-inspected
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
ai-inspected
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
automation code-quality cookie improvement quick-win task-mining
Dificultad 2/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
cookie maintenance step-naming
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows automation code-quality cookie documentation improvement quick-win task-mining
Dificultad 2/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de github/gh-aw
Issues similares
-
Project submission: 5diveAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
slavakurilyak/awesome-ai-agents#710 ·
Los mantenedores suelen responder en 1 día
-
`renderLinkedIssues` overshoots its byte budget: unresolved and omitted lists are never boundedAbiertoagent-butler-finding agent-research-recommend bug ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
jordansmall/spindrift#4614 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
weaviate/weaviate-go-client#485 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Auth server panics in GetProjectById when FindUsersByUID returns an errorPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
litmuschaos/litmus#5641 ·
Los mantenedores suelen responder en 6 días