validate-and-fix

Ejecuta el pipeline completo de validación (make test, make lint, opcionalmente make test-e2e) y corrige automáticamente fallos triviales como problemas de formato e importaciones. Úsalo cuando el…

npx skills add https://github.com/openshift/lightspeed-operator --skill validate-and-fix

Validate & Auto-Fix

Run the project validation pipeline, auto-fix trivial issues, and re-run until green or a real failure is found.

Rules

  • CRITICAL: Never use go test directly - ALWAYS use make test (handles envtest, CRDs, build flags)
  • Never modify production logic to fix a test. Only fix test expectations, imports, formatting.
  • Never skip or delete a failing test.
  • Stop after 3 auto-fix cycles to avoid loops.
  • Report real failures clearly; do not attempt speculative fixes.

Step 1: Run Unit Tests

make test 2>&1 | tail -60

Important: The Makefile handles essential setup (envtest, CRDs, build flags) that go test doesn't.

If all pass, proceed to Step 3 (linting). If failures occur, classify each failure (see Step 2).

Step 2: Classify and Fix Failures

For each failure, determine its type:

Auto-fixable (fix immediately, then re-run Step 1):

TypeFix
Test expects old constant valueUpdate assertion to match new value
Test uses renamed functionUpdate function name in test
Import error from refactorUpdate import path
Missing cleanup in testAdd cleanup or use existing cleanup helpers

Real failures (do not auto-fix):

  • Logic errors in production code
  • Assertion failures reflecting actual behavior regressions
  • Reconciliation loop failures
  • Context cancellation issues
  • Failures in code you did not modify

For real failures: report the test name, file, error message, and stop.

Step 3: Run Linting

make lint 2>&1 | tail -40

This runs: golangci-lint, go fmt, go vet, and custom checks.

If failures occur, apply the same classify-and-fix logic from Step 2. Common fixes at this stage:

TypeFix
gofmt formattinggo fmt ./...
Unused importRemove the import
Unused variableRemove the variable or use _ = variable if intentional
Missing error checkAdd if err != nil { return err }
Ineffectual assignmentRemove or fix the assignment

Re-run make lint after each fix. Proceed to Step 4 when green.

Step 4: Run E2E Tests (Optional)

Only if the user explicitly asks or if changes affect reconciliation logic:

make test-e2e 2>&1 | tail -30

Requirements: Requires a running OpenShift/Kubernetes cluster with operator deployed.

E2E test failures are almost always real failures. Report and stop.

Step 5: Check Bundle and Manifests

If API changes were made (api/v1alpha1/), regenerate manifests:

make generate
make manifests
git diff

If there are differences, commit them:

git add api/ config/
git commit -m "Regenerate manifests"

Step 6: Report

Report exactly:

  • make test: X passed / Y failed
    • List any failing tests with brief error summary
  • make lint: pass/fail
    • List any remaining lint errors
  • make test-e2e: (if run) X passed / Y failed
  • Auto-fixes applied:
    • File: what was fixed (e.g., "internal/controller/utils/utils_test.go: updated assertion")
  • Cycles used: N/3

If all green:

✅ All validation passed:
  - make test: all tests passing
  - make lint: no issues
  
Ready to commit or push.

Do not include unrelated diagnostics or suggestions.

Más skills de openshift

openshift-docs
openshift
Busca y lee la documentación de OpenShift Container Platform en formato markdown. Úsalo cuando el usuario pregunte sobre funciones, configuración, instalación de OpenShift, etc.
triage-leaked-infra
openshift
Evalúa si una VPC de AWS o un conjunto de infraestructura de HyperShift CI es seguro de eliminar. Úsalo cuando el usuario pegue la salida de cleanleaked y pregunte '¿puedo eliminar esto?', '¿es…
openshift-expert
openshift
Experto en la plataforma OpenShift y Kubernetes con profundo conocimiento de arquitectura de clústeres, operadores, redes, almacenamiento, resolución de problemas y pipelines de CI/CD. Utilice…
Konflux Archived PipelineRuns
openshift
Accede a los PipelineRuns, TaskRuns y registros de pods de Konflux archivados a través de KubeArchive. Se aplica automáticamente al verificar los resultados de PipelineRun de Konflux, investigar…
backport
openshift
Hacer backport de commits o PRs desde main a una rama de release. Usar cuando el usuario solicite hacer backport, cherry-pick o portar cambios entre ramas, o al resolver…
rebase
openshift
Rebasar la rama actual sobre su rama base, resolver todos los conflictos y verificar que lint, i18n y build pasen. Usar cuando el usuario solicite rebasar, actualizar o sincronizar…
Build CPO Image
openshift
Construir y enviar la imagen del contenedor control-plane-operator. Se aplica automáticamente al probar cambios en CPO que requieren implementación en un clúster en vivo.
find-complexity
openshift
Encuentra funciones y métodos con alta complejidad ciclomática, longitud excesiva o demasiados parámetros. Úsalo cuando el usuario pida encontrar código complejo, complejidad…