Skip to content

Commit 50383a5

Browse files
fubhyclaude
authored andcommitted
all: enhance CLAUDE.md with test verification and release build requirements
Add explicit test verification requirements to prevent false test successes: - Verify tests actually ran by checking output for "X passed" where X > 0 - Never trust exit code 0 alone as cargo can exit successfully with 0 tests run - Re-run with corrected filters if no tests were executed Add mandatory cargo build --release step to catch linking/optimization issues that cargo check might miss, preventing CI build failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f593da5 commit 50383a5

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

CLAUDE.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ cargo test -p graph data_source::common::tests
4545
cargo test <specific_test_name>
4646
```
4747

48+
**⚠️ Test Verification Requirements:**
49+
- **ALWAYS verify tests actually ran** - Check the output for "test result: ok. X passed" where X > 0
50+
- **If output shows "0 passed" or "0 tests run"**, the test filter/path was wrong - fix and re-run
51+
- **Never trust exit code 0 alone** - Cargo can exit successfully even when no tests matched your filter
52+
- **For specific test names**, ensure the test name appears in the output as "test {name} ... ok"
53+
4854
### Runner Tests (Integration Tests)
4955

5056
**Prerequisites:**
@@ -66,6 +72,11 @@ cargo test -p graph-tests --test runner_tests -- --nocapture
6672
cargo test -p graph-tests --test runner_tests test_name -- --nocapture
6773
```
6874

75+
**⚠️ Test Verification Requirements:**
76+
- **ALWAYS verify tests actually ran** - Check the output for "test result: ok. X passed" where X > 0
77+
- **If output shows "0 passed" or "0 tests run"**, the test filter/path was wrong - fix and re-run
78+
- **Never trust exit code 0 alone** - Cargo can exit successfully even when no tests matched your filter
79+
6980
**Important Notes:**
7081
- Runner tests take moderate time (10-20 seconds)
7182
- Tests automatically reset the database between runs
@@ -91,6 +102,11 @@ cargo test -p graph-tests --test integration_tests -- --nocapture
91102
TEST_CASE=grafted cargo test -p graph-tests --test integration_tests -- --nocapture
92103
```
93104

105+
**⚠️ Test Verification Requirements:**
106+
- **ALWAYS verify tests actually ran** - Check the output for "test result: ok. X passed" where X > 0
107+
- **If output shows "0 passed" or "0 tests run"**, the TEST_CASE variable or filter was wrong - fix and re-run
108+
- **Never trust exit code 0 alone** - Cargo can exit successfully even when no tests matched your filter
109+
94110
**Important Notes:**
95111
- Integration tests take significant time (several minutes)
96112
- Tests automatically reset the database between runs
@@ -103,11 +119,15 @@ cargo fmt --all
103119

104120
# 🚨 MANDATORY: Check code for warnings and errors - MUST have zero warnings
105121
cargo check
122+
123+
# 🚨 MANDATORY: Build in release mode to catch linking/optimization issues that cargo check misses
124+
cargo check --release
106125
```
107126

108127
🚨 **CRITICAL REQUIREMENTS for ANY implementation**:
109128
- **🚨 MANDATORY**: `cargo fmt --all` MUST be run before any commit
110129
- **🚨 MANDATORY**: `cargo check` MUST show zero warnings before any commit
130+
- **🚨 MANDATORY**: `cargo build --release` MUST complete successfully before any commit
111131
- **🚨 MANDATORY**: The unit test suite MUST pass before any commit
112132

113133
Forgetting any of these means you failed to follow instructions. Before any commit or PR, ALL of the above MUST be satisfied! No exceptions!
@@ -247,5 +267,5 @@ The setup combines built-in services-flake services with custom multiService mod
247267
- **PostgreSQL**: Uses services-flake's postgres service with a helper function (`mkPostgresConfig`) that provides graph-specific defaults including required extensions.
248268

249269
**Custom Services** (located in `./nix`):
250-
- `ipfs.nix`: IPFS (kubo) with automatic initialization and configurable ports
270+
- `ipfs.nix`: IPFS (kubo) with automatic initialization and configurable ports
251271
- `anvil.nix`: Ethereum test chain with deterministic configuration

0 commit comments

Comments
 (0)