بنقرة واحدة
safe-code-change
// After a code change, find affected tests, update them to match new behavior, then guide the user to run validation. Use when the user has made or asked for a code change and wants to make sure nothing is broken.
// After a code change, find affected tests, update them to match new behavior, then guide the user to run validation. Use when the user has made or asked for a code change and wants to make sure nothing is broken.
| name | safe-code-change |
| description | After a code change, find affected tests, update them to match new behavior, then guide the user to run validation. Use when the user has made or asked for a code change and wants to make sure nothing is broken. |
| disable-model-invocation | true |
After a code change is made, find and fix affected tests before running validation.
git diff --name-only
git diff --stat
List the modified production files (ignore test files, configs, docs).
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)For each affected test file, check whether the change breaks existing tests:
Apply minimal fixes to each affected test:
Expect() assertions to match new return valuesEventually() timeouts if reconciliation logic changedExpect(err).To(MatchError(ContainSubstring(oldName))) → newNameOwnerReferencesBefore 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.
List all test files updated and what was changed in each:
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.
Find code duplication in the codebase. Supports two modes - scoped to current branch changes or a full codebase sweep. Use when the user asks to find duplicated code, copy-paste, repeated patterns, or wants to deduplicate before a PR.
Find functions with high cyclomatic complexity, excessive length, or too many parameters. Use when the user asks to find complex code, complexity hotspots, refactoring candidates, or wants to improve code maintainability.
Find unused functions, types, constants, imports, and unreachable code paths. Use when the user asks to find dead code, unused code, cleanup candidates, or wants to reduce codebase size.
Performs a strict clean rebase of a feature branch onto main with minimal conflict resolution and full validation. Use when the user asks to rebase carefully, avoid extra branches, avoid exploratory edits, and run make test and make lint until green.
Review PR with structured approach covering architecture, naming, patterns, and critical questions
Run the full validation pipeline (make test, make lint, optionally make test-e2e) and auto-fix trivial failures like formatting and import issues. Use when the user asks to validate, run tests, check the pipeline, or verify changes are clean.