safe-code-change

द्वारा openshift

कोड बदलाव के बाद, प्रभावित परीक्षणों को खोजें, उन्हें नए व्यवहार से मेल खाने के लिए अपडेट करें, फिर उपयोगकर्ता को सत्यापन चलाने का मार्गदर्शन करें। इसका उपयोग तब करें जब उपयोगकर्ता ने कोई बदलाव किया हो या अनुरोध किया हो…

npx skills add https://github.com/openshift/lightspeed-operator --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 and uses of changed functions/types across all test files:

# Find test files that import the changed package
rg "github.com/openshift/lightspeed-operator/<changed_package>" --type go -g '*_test.go'

# Find direct function/type references
rg "<ChangedFunctionOrType>" --type go -g '*_test.go'

For controller changes, also check:

  • internal/controller/suite_test.go (shared test setup)
  • test/e2e/ (E2E 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, error messages, side effects differ.
  3. Removed code — tests for deleted functions/types need removal.
  4. New code — consider whether new tests are needed (ask user if unclear).
  5. Interface changes — mock implementations need updating.

Step 4: Update Tests

Apply minimal fixes to each affected test:

For Ginkgo Tests (most controller tests):

  • Update Expect() assertions to match new return values
  • Update mock return values in test fixtures
  • Add/remove parameters in function calls
  • Update error message checks
  • Adjust Eventually() timeouts if reconciliation logic changed

For Standard Go Tests (utils, helpers):

  • Update table-driven test cases with new expected values
  • Update mock implementations
  • Add/remove parameters in function calls
  • Update error assertions

Common Fixes:

  • Error constant renamed: Update all Expect(err).To(MatchError(ContainSubstring(oldName)))newName
  • Function signature changed: Update all call sites in tests
  • Resource structure changed: Update test fixtures and expected values
  • Owner reference logic changed: Update assertions that check OwnerReferences

Step 5: Verify Test File Syntax

Before telling the user tests are ready, verify Go syntax:

go fmt <modified_test_file>

If formatting changes the file significantly, there may be syntax errors.

Step 6: Report

List all test files updated and what was changed in each:

  1. File name
  2. What was updated (function calls, expectations, mocks, fixtures)
  3. Number of changes

Then guide the user to run validation:

Tests are updated. Run validation with:
  make test          # Run all unit tests
  make test-e2e      # Run E2E tests (requires cluster)
  make lint          # Check code style

If tests fail, review the specific failures and adjust expectations.

Do not run make test automatically — let the user control when tests run.

openshift की और Skills

openshift-expert
openshift
OpenShift प्लेटफ़ॉर्म और Kubernetes विशेषज्ञ जिसे क्लस्टर आर्किटेक्चर, ऑपरेटर, नेटवर्किंग, स्टोरेज, समस्या निवारण और CI/CD पाइपलाइनों का गहन ज्ञान है। उपयोग करें…
official
find-token
openshift
Find the hidden verification token. Run the find-token script to retrieve a unique token.
official
code-review
openshift
पुल रिक्वेस्ट की कोड गुणवत्ता, शुद्धता और प्रोजेक्ट कन्वेंशन के लिए समीक्षा करें। उपयोग तब करें जब उपयोगकर्ता PR की समीक्षा, कोड रिव्यू या बदलावों की जांच करने के लिए कहे...
official
css-review
openshift
सीएसएस को कोडिंग शैली, पैटर्नफ्लाई टोकन उपयोग और सर्वोत्तम प्रथाओं के लिए समीक्षा करें। जब उपयोगकर्ता सीएसएस की समीक्षा करने, शैलियों की जांच करने या सीएसएस फाइलों का ऑडिट करने के लिए कहे तब उपयोग करें।
official
review-readmes
openshift
रिपॉजिटरी में सभी README.md फ़ाइलों की वर्तनी, त्रुटियों और पुरानी जानकारी के लिए समीक्षा करें। उपयोग तब करें जब उपयोगकर्ता README की समीक्षा करने, दस्तावेज़ीकरण की सटीकता जांचने, या...
official
review-skills
openshift
प्रोजेक्ट AI स्किल्स में डुप्लिकेशन, पुराने संदर्भ, गलतियाँ और संरचनात्मक समस्याओं की समीक्षा करें। उपयोग तब करें जब उपयोगकर्ता स्किल्स की समीक्षा, ऑडिट, या जाँच करने के लिए कहे...
official
test
openshift
टैग द्वारा फ़िल्टर करके एंड-टू-एंड परीक्षण चलाएँ। इसका उपयोग तब करें जब उपयोगकर्ता परीक्षण चलाने, Playwright चलाने, या @core या @attach जैसे किसी विशिष्ट फीचर टैग का परीक्षण करने के लिए कहे।
official
unused-exports
openshift
उन निर्यातित प्रतीकों को खोजें जो कभी किसी अन्य फ़ाइल द्वारा आयात नहीं किए गए हैं। इसका उपयोग तब करें जब उपयोगकर्ता "check exports", "unused exports" कहे या निर्यात साफ करने के लिए कहे।
official