From 50383a59f5b8f377d05ddd32ee8450548817c6ee Mon Sep 17 00:00:00 2001 From: Sebastian Lorenz Date: Wed, 20 Aug 2025 18:02:52 +0200 Subject: [PATCH] all: enhance CLAUDE.md with test verification and release build requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CLAUDE.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 4132af3a750..8645e579880 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -45,6 +45,12 @@ cargo test -p graph data_source::common::tests cargo test ``` +**⚠️ Test Verification Requirements:** +- **ALWAYS verify tests actually ran** - Check the output for "test result: ok. X passed" where X > 0 +- **If output shows "0 passed" or "0 tests run"**, the test filter/path was wrong - fix and re-run +- **Never trust exit code 0 alone** - Cargo can exit successfully even when no tests matched your filter +- **For specific test names**, ensure the test name appears in the output as "test {name} ... ok" + ### Runner Tests (Integration Tests) **Prerequisites:** @@ -66,6 +72,11 @@ cargo test -p graph-tests --test runner_tests -- --nocapture cargo test -p graph-tests --test runner_tests test_name -- --nocapture ``` +**⚠️ Test Verification Requirements:** +- **ALWAYS verify tests actually ran** - Check the output for "test result: ok. X passed" where X > 0 +- **If output shows "0 passed" or "0 tests run"**, the test filter/path was wrong - fix and re-run +- **Never trust exit code 0 alone** - Cargo can exit successfully even when no tests matched your filter + **Important Notes:** - Runner tests take moderate time (10-20 seconds) - Tests automatically reset the database between runs @@ -91,6 +102,11 @@ cargo test -p graph-tests --test integration_tests -- --nocapture TEST_CASE=grafted cargo test -p graph-tests --test integration_tests -- --nocapture ``` +**⚠️ Test Verification Requirements:** +- **ALWAYS verify tests actually ran** - Check the output for "test result: ok. X passed" where X > 0 +- **If output shows "0 passed" or "0 tests run"**, the TEST_CASE variable or filter was wrong - fix and re-run +- **Never trust exit code 0 alone** - Cargo can exit successfully even when no tests matched your filter + **Important Notes:** - Integration tests take significant time (several minutes) - Tests automatically reset the database between runs @@ -103,11 +119,15 @@ cargo fmt --all # 🚨 MANDATORY: Check code for warnings and errors - MUST have zero warnings cargo check + +# 🚨 MANDATORY: Build in release mode to catch linking/optimization issues that cargo check misses +cargo check --release ``` 🚨 **CRITICAL REQUIREMENTS for ANY implementation**: - **🚨 MANDATORY**: `cargo fmt --all` MUST be run before any commit - **🚨 MANDATORY**: `cargo check` MUST show zero warnings before any commit +- **🚨 MANDATORY**: `cargo build --release` MUST complete successfully before any commit - **🚨 MANDATORY**: The unit test suite MUST pass before any commit 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 - **PostgreSQL**: Uses services-flake's postgres service with a helper function (`mkPostgresConfig`) that provides graph-specific defaults including required extensions. **Custom Services** (located in `./nix`): -- `ipfs.nix`: IPFS (kubo) with automatic initialization and configurable ports +- `ipfs.nix`: IPFS (kubo) with automatic initialization and configurable ports - `anvil.nix`: Ethereum test chain with deterministic configuration