validate-and-fix

작성자: openshift

전체 검증 파이프라인(make test, make lint, 선택적으로 make test-e2e)을 실행하고 포맷팅 및 임포트 문제와 같은 사소한 실패를 자동 수정합니다. 다음의 경우에 사용하세요…

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.

openshift의 다른 스킬

openshift-expert
openshift
OpenShift 플랫폼 및 Kubernetes 전문가로, 클러스터 아키텍처, 오퍼레이터, 네트워킹, 스토리지, 문제 해결 및 CI/CD 파이프라인에 대한 깊은 지식을 보유하고 있습니다. 사용…
official
find-token
openshift
숨겨진 인증 토큰을 찾습니다. find-token 스크립트를 실행하여 고유 토큰을 검색하세요.
official
code-review
openshift
풀 리퀘스트의 코드 품질, 정확성, 프로젝트 규칙을 검토합니다. 사용자가 PR 검토, 코드 리뷰, 또는 변경 사항 확인을 요청할 때 사용하세요.
official
css-review
openshift
CSS 코딩 스타일, PatternFly 토큰 사용, 모범 사례를 검토합니다. 사용자가 CSS 검토, 스타일 확인, 또는 CSS 파일 감사를 요청할 때 사용하세요.
official
review-readmes
openshift
리포지토리의 모든 README.md 파일을 검토하여 오타, 오류, 오래된 정보를 찾습니다. 사용자가 README 검토, 문서 정확성 확인 등을 요청할 때 사용합니다.
official
review-skills
openshift
프로젝트 AI 스킬의 중복, 오래된 참조, 오류 및 구조적 문제를 검토합니다. 사용자가 스킬 검토, 스킬 감사, 확인 등을 요청할 때 사용하세요.
official
test
openshift
태그로 필터링된 종단 간 테스트를 실행합니다. 사용자가 테스트 실행, Playwright 실행, 또는 @core나 @attach 같은 특정 기능 태그를 테스트하도록 요청할 때 사용하세요.
official
unused-exports
openshift
다른 파일에서 가져오지 않은 내보낸 심볼을 찾습니다. 사용자가 "내보내기 확인", "사용되지 않는 내보내기"라고 말하거나 내보내기를 정리하도록 요청할 때 사용하세요.
official