safe-code-change

After a code change, find affected tests, update them to match new behavior, then run the full validation pipeline once. Use when the user has made or asked…

npx skills add https://github.com/openshift/lightspeed-service --skill safe-code-change

Safe Code Change

After a code change is made, find and fix affected tests before running validation.

Rules

  • The code change is already done. Do not modify production code.
  • Only update tests to match the new behavior, not the other way around.
  • Do not reformat or lint-fix during test updates. Save that for validation.
  • If a test change is ambiguous (unclear what the new expected behavior is), ask the user.

Step 1: Identify What Changed

git diff --name-only
git diff --stat

List the modified production files (ignore test files, configs, docs).

Step 2: Find Affected Tests

Search for imports of changed functions/classes across all test files:

rg "from ols\.<changed_module> import" tests/

Step 3: Analyze Impact on Tests

For each affected test file, check whether the change breaks existing tests:

  1. Signature changes — function renamed, parameters added/removed/reordered.
  2. Behavior changes — return value, side effects, exceptions differ.
  3. Removed code — tests for deleted functions/classes need removal.
  4. New code — consider whether new tests are needed (ask user if unclear).

Step 4: Update Tests

Apply minimal fixes to each affected test:

  • Update function names, parameters, expected values.
  • Add async/await and @pytest.mark.asyncio if sync changed to async.
  • Remove tests for deleted functionality.
  • Do not add new tests unless the user asks.

Step 5: Done

Report what was updated. The user can invoke validate-and-fix when ready.

Lebih banyak skill dari openshift

openshift-expert
openshift
Pakar platform OpenShift dan Kubernetes dengan pengetahuan mendalam tentang arsitektur klaster, operator, jaringan, penyimpanan, pemecahan masalah, dan pipeline CI/CD. Gunakan…
official
find-token
openshift
Temukan token verifikasi yang tersembunyi. Jalankan skrip find-token untuk mengambil token unik.
official
code-review
openshift
Tinjau permintaan pull untuk kualitas kode, kebenaran, dan konvensi proyek. Gunakan saat pengguna meminta untuk meninjau PR, tinjauan kode, atau memeriksa perubahan pada suatu…
official
css-review
openshift
Tinjau CSS untuk gaya penulisan kode, penggunaan token PatternFly, dan praktik terbaik. Gunakan saat pengguna meminta untuk meninjau CSS, memeriksa gaya, atau mengaudit file CSS.
official
review-readmes
openshift
Tinjau semua file README.md di repositori untuk mencari kesalahan ketik, kesalahan, dan informasi yang sudah usang. Gunakan saat pengguna meminta untuk meninjau README, memeriksa keakuratan dokumentasi, atau…
official
review-skills
openshift
Tinjau keterampilan AI proyek untuk duplikasi, referensi usang, kesalahan, dan masalah struktural. Gunakan saat pengguna meminta untuk meninjau keterampilan, mengaudit keterampilan, memeriksa…
official
test
openshift
Jalankan pengujian ujung-ke-ujung yang difilter berdasarkan tag. Gunakan saat pengguna meminta untuk menjalankan pengujian, menjalankan Playwright, atau menguji tag fitur tertentu seperti @core atau @attach.
official
unused-exports
openshift
Temukan simbol yang diekspor tetapi tidak pernah diimpor oleh file lain. Gunakan saat pengguna mengatakan "periksa ekspor", "ekspor tidak terpakai" atau meminta untuk membersihkan ekspor.
official