Analyze change impact and discover affected tests. Use after making changes to understand what depends on the modified code, find relevant tests, and determine what to run.
Comprehensive impact analysis and test discovery for Brane SDK changes.
brane-primitives (no deps)
|
v
brane-core (depends on: primitives)
|
v
brane-rpc (depends on: core, primitives)
|
v
brane-contract (depends on: rpc, core, primitives)
|
v
[Consumer modules: examples, benchmark, brane-smoke]
| Changed Module | Must Test | Severity |
|---|---|---|
brane-primitives |
ALL modules | HIGH |
brane-core |
core, rpc, contract | HIGH |
brane-rpc |
rpc, contract | MEDIUM |
brane-contract |
contract only | LOW |
brane-examples |
examples only | LOW |
# Recent commit
git diff --name-only HEAD~1 | grep '\.java$'
# Staged changes
git diff --cached --name-only | grep '\.java$'
# Working changes
git diff --name-only | grep '\.java$'
# Full analysis with recommendations
./.claude/scripts/verify_change.sh
# Analyze specific file or class
./.claude/scripts/verify_change.sh Address
./.claude/scripts/verify_change.sh brane-core/src/main/java/sh/brane/core/types/Address.java
# Run with tests
./.claude/scripts/verify_change.sh --run
Use cclsp MCP tools for precise, semantic impact analysis.
| Aspect | Grep (text-based) | LSP (semantic) |
|---|---|---|
| False positives | Yes (comments, strings) | No |
| Renamed imports | Misses them | Finds them |
| Qualified refs | May miss | Finds all |
| Accuracy | ~80% | ~99% |
# Find all usages of a symbol (MOST USEFUL)
mcp__cclsp__find_references(file_path, symbol_name)
# Find where a symbol is defined
mcp__cclsp__find_definition(file_path, symbol_name)
# Check for compile errors after changes
mcp__cclsp__get_diagnostics(file_path)
Address.from()# Step 1: Find all references to the method
mcp__cclsp__find_references(
file_path="brane-core/src/main/java/sh/brane/core/types/Address.java",
symbol_name="from"
)
ā Returns 47 locations across 12 files
# Step 2: Check if changes broke anything
mcp__cclsp__get_diagnostics(
file_path="brane-core/src/main/java/sh/brane/core/types/Address.java"
)
ā Returns compile errors if signature is incompatible
| Scenario | Use |
|---|---|
| Public API changes | LSP (precise reference count) |
| Method signature changes | LSP (find all callers) |
| Class renames | LSP (safe refactoring) |
| Finding test files by name | Grep (pattern matching) |
| Quick text search | Grep (faster for simple cases) |
CLASS_NAME="Address"
# Direct unit test (same name)
find . -path "*/test/*" -name "*${CLASS_NAME}*Test.java" | grep -v target
# All tests that reference this class (less precise than LSP)
grep -rl "$CLASS_NAME" --include="*Test.java" . | grep -v target
# Integration tests
grep -rl "$CLASS_NAME" --include="*IntegrationTest.java" . | grep -v target
# Examples (integration tests in examples module)
grep -rl "$CLASS_NAME" brane-examples/src/main/java --include="*.java" | grep -v target
| Module Changed | Test Command |
|---|---|
brane-primitives |
./gradlew test (all) |
brane-core |
./gradlew :brane-core:test :brane-rpc:test :brane-contract:test |
brane-rpc |
./gradlew :brane-rpc:test :brane-contract:test |
brane-contract |
./gradlew :brane-contract:test |
| Test Type | Pattern | Location | Requires Anvil | Skip? |
|---|---|---|---|---|
| Unit | *Test.java |
*/src/test/java/ |
No | NO |
| Integration | *IntegrationTest.java |
*/src/test/java/ |
Yes | NO |
| Examples | *Example.java |
brane-examples/src/main/java/ |
Yes | NO |
| Smoke | SmokeApp.java |
brane-smoke/src/main/java/ |
Yes | NO |
ALL THREE TEST LAYERS ARE MANDATORY. NEVER SKIP ANY.
| Layer | Purpose | Command |
|---|---|---|
| Unit | Logic correctness, fast feedback | ./gradlew :module:test |
| Integration | Real RPC calls, real transactions | ./scripts/test_integration.sh |
| Smoke | Full E2E, consumer perspective | ./scripts/test_smoke.sh |
Starting Anvil requires no special permission - just run anvil & in background.
Follow this order for every change:
./gradlew :MODULE:test --tests "*ClassName*"
./gradlew :MODULE:test
./gradlew :downstream-module:test
anvil & # No permission needed
./scripts/test_integration.sh
./scripts/test_smoke.sh
./verify_all.sh
Note: Regardless of severity, ALL test layers (unit, integration, smoke) are MANDATORY.
brane-primitives (foundation)brane-core (types, exceptions)Address, Hash, Wei, HexData)Action:
./gradlew test (all modules)./scripts/test_integration.sh./scripts/test_smoke.shAction:
./scripts/test_integration.sh./scripts/test_smoke.shAction:
./scripts/test_integration.sh./scripts/test_smoke.shAddress (brane-core) ChangesDirect: brane-core/.../types/AddressTest.java
Dependent: brane-core/.../abi/AbiEncoderTest.java
brane-rpc/.../BraneTest.java
brane-contract/.../BraneContractTest.java
Integration: brane-examples/.../TransferExample.java
Brane (brane-rpc) ChangesDirect: brane-rpc/.../BraneTest.java
Dependent: brane-contract/.../BraneContractTest.java
Integration: brane-examples/.../*Example.java
BraneContract (brane-contract) ChangesDirect: brane-contract/.../BraneContractTest.java
Integration: brane-examples/.../ContractExample.java
When asked to analyze impact or find affected tests:
git diff --name-only to find changed filesFor each changed public symbol, use LSP to find precise references:
mcp__cclsp__find_references(file_path, symbol_name)
This is MORE ACCURATE than grep because:
Example workflow:
# Changed file: Address.java, changed method: from()
mcp__cclsp__find_references(
"brane-core/.../Address.java",
"from"
)
ā 47 references in 12 files
# Check for compile errors
mcp__cclsp__get_diagnostics("brane-core/.../Address.java")
ā No errors (or shows what broke)
*Test.java filesfind . -name "*ClassName*Test.java"Produce a report with:
If --run is specified:
./.claude/scripts/verify_change.sh --run
For automated pipelines (all three layers mandatory):
# Determine changed modules
CHANGED_MODULES=$(git diff --name-only origin/main | grep -oE 'brane-[a-z]+' | sort -u)
# Layer 1: Unit tests for affected modules
for MODULE in $CHANGED_MODULES; do
./gradlew ":${MODULE}:test"
done
# Layer 2: Integration tests (always run)
./scripts/test_integration.sh
# Layer 3: Smoke tests (always run)
./scripts/test_smoke.sh
All three layers must pass for CI to be green.