validate-and-fix

作成者: openshift

完全な検証パイプライン(make test-unit、make verify、make test-integration)を実行し、blackフォーマット、未使用のインポートなどの軽微な失敗を自動修正します。

npx skills add https://github.com/openshift/lightspeed-service --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

  • Never modify production logic to fix a test. Only fix test expectations, imports, formatting, and lint.
  • 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 0: Ensure Dependencies Are Installed

make install-deps 2>&1 | tail -10

This ensures the virtualenv matches the lockfile. Skipping this step is the most common cause of spurious import errors (e.g. llama-index-embeddings-huggingface not found despite being in requirements.txt).

Step 1: Run Unit Tests

make test-unit 2>&1 | tail -40

If all pass, proceed to Step 3 (integration tests). 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
Missing await on async callAdd await, mark test async def, add @pytest.mark.asyncio
Test asserts old default valueUpdate assertion to match new default

Real failures (do not auto-fix):

  • Logic errors in production code
  • Assertion failures reflecting actual behavior changes
  • Import errors from missing dependencies
  • Failures in code you did not modify

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

Step 3: Run Integration Tests

make test-integration 2>&1 | tail -20

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

Step 4: Run Verify

make verify 2>&1 | tail -30

This runs: black --check, ruff, woke, pylint, mypy.

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

TypeFix
Black formattinguv run black .
Unused import (ruff F401)Remove the import
Unused variable (ruff F841)Remove the assignment
Unused noqa directive (RUF100)Remove the noqa comment
Other ruff-fixableuv run ruff check . --fix
Pylint issues from changed codeFix inline

Re-run make verify after each fix. Proceed to Step 5 when green.

Step 5: Report

Report exactly:

  • make test-unit: X passed / Y failed
  • make verify: pass/fail (list any remaining issues)
  • make test-integration: X passed / Y failed
  • Auto-fixes applied (list each: file, what was fixed)
  • Cycles used: N/3

Do not include unrelated diagnostics or suggestions.

openshiftのその他のスキル

openshift-docs
openshift
OpenShift Container Platformのドキュメントをマークダウン形式で検索および閲覧します。ユーザーがOpenShiftの機能、設定、インストールなどについて質問する場合に使用します。
triage-leaked-infra
openshift
AWS VPCまたはHyperShift CIからのインフラセットが削除しても安全かどうかを評価します。ユーザーがcleanleakedの出力を貼り付け、「これは削除できますか?」「これは…」と尋ねたときに使用します。
openshift-expert
openshift
OpenShiftプラットフォームとKubernetesのエキスパートであり、クラスターアーキテクチャ、オペレーター、ネットワーキング、ストレージ、トラブルシューティング、CI/CDパイプラインに関する深い知識を持つ。使用…
Konflux Archived PipelineRuns
openshift
アーカイブされたKonflux PipelineRun、TaskRun、およびポッドログにKubeArchive経由でアクセスします。Konflux PipelineRunの結果を確認する際や調査時に自動適用されます。
backport
openshift
メインからリリースブランチへのコミットやPRをバックポートします。ユーザーがバックポート、チェリーピック、ブランチ間の変更の移植を依頼した場合、または解決中に使用します。
rebase
openshift
現在のブランチをベースブランチにリベースし、すべてのコンフリクトを解決して、lint、i18n、ビルドが通ることを確認します。ユーザーがリベース、更新、同期を依頼した場合に使用します…
Build CPO Image
openshift
コントロールプレーンオペレーターのコンテナイメージをビルドしてプッシュします。CPOの変更をライブクラスターにデプロイしてテストする際に自動適用されます。
find-complexity
openshift
サイクロマティック複雑度が高い、長すぎる、またはパラメータが多すぎる関数やメソッドを見つけます。ユーザーが複雑なコードや複雑性を探すよう依頼した場合に使用します。