upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/AGENTS.md
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-05 12:05:38 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-05 12:05:38 +0000
commit1e267c282d07c68dbee4682c66d3933032ed7fec (patch)
tree54b24878684ad2a569cb939508d48faaa24c3758 /AGENTS.md
parentd9c9ef2ff92b687f5ff5585b08b2eead8f139a02 (diff)
feat(grasp-audit): standardize testing with test-ngit-relay.sh
Establish test-ngit-relay.sh as the canonical testing approach for GRASP-01 compliance tests, eliminating manual relay setup and ensuring consistent, reproducible test environments. **Enhanced test-ngit-relay.sh:** - Add command-line argument parsing (--mode, --spec, --help) - Support both audit and test execution modes - Comprehensive inline documentation - Backward compatible (default behavior unchanged) **Documentation updates:** - AGENTS.md: Add "Standard Testing Process" section - AGENTS.md: Update Quick Reference to prioritize test-ngit-relay.sh - AGENTS.md: Add Critical Gotcha #7 about using the test script - grasp-audit/README.md: Add prominent Quick Start section - grasp-audit/README.md: Reorganize testing documentation **Benefits:** - Automatic relay lifecycle management (start, cleanup) - Random port selection prevents conflicts - Isolated temporary directories per run - Guaranteed cleanup on success or failure - Consistent test environment across all developers All changes tested and verified working.
Diffstat (limited to 'AGENTS.md')
-rw-r--r--AGENTS.md45
1 files changed, 40 insertions, 5 deletions
diff --git a/AGENTS.md b/AGENTS.md
index ec1ec60..d00d7fb 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -44,6 +44,39 @@ Tests marked `#[ignore]` need relay - unit tests don't.
44 44
45**Note:** Always use a random available port for the relay to avoid conflicts with existing services. 45**Note:** Always use a random available port for the relay to avoid conflicts with existing services.
46 46
47### Standard Testing Process (Recommended)
48
49**Use test-ngit-relay.sh for automated relay management:**
50
51This script handles all relay lifecycle management automatically:
52- Starts ngit-relay in isolated Docker container
53- Uses random port to avoid conflicts
54- Creates isolated temporary directories
55- Ensures cleanup on exit (success or failure)
56- Supports both audit and test modes
57
58**Basic Usage:**
59
60```bash
61# Run cargo test suite (recommended for GRASP-01 development)
62cd grasp-audit && nix develop -c bash test-ngit-relay.sh --mode test
63
64# Run audit CLI tool (for quick validation)
65cd grasp-audit && nix develop -c bash test-ngit-relay.sh
66
67# Get help
68cd grasp-audit && ./test-ngit-relay.sh --help
69```
70
71**Benefits:**
72- No manual relay startup required
73- Automatic cleanup prevents leftover containers
74- Random port selection avoids conflicts
75- Consistent environment across all runs
76- Proper test isolation
77
78**Note:** Manual relay setup is still available but test-ngit-relay.sh is recommended for development workflows.
79
47### Running Single Test 80### Running Single Test
48 81
49```bash 82```bash
@@ -140,6 +173,7 @@ See `docs/archive/2025-11-04-nostr-sdk-upgrade.md` for full migration.
1404. **Test isolation:** Integration tests need relay, marked with `#[ignore]` 1734. **Test isolation:** Integration tests need relay, marked with `#[ignore]`
1415. **Work directory:** All session docs go in `work/`, NOT root 1745. **Work directory:** All session docs go in `work/`, NOT root
1426. **Archive naming:** Use `YYYY-MM-DD-description.md` format 1756. **Archive naming:** Use `YYYY-MM-DD-description.md` format
1767. **Use test-ngit-relay.sh**: Always use the test script for GRASP-01 tests - it handles cleanup and port management automatically
143 177
144## File Restrictions by Mode 178## File Restrictions by Mode
145 179
@@ -152,18 +186,19 @@ Code mode can only edit files matching specific patterns (enforced by system):
152## Quick Reference 186## Quick Reference
153 187
154```bash 188```bash
189# Recommended: Use test-ngit-relay.sh for all testing
190cd grasp-audit && nix develop -c bash test-ngit-relay.sh --mode test
191
155# Build grasp-audit 192# Build grasp-audit
156cd grasp-audit && nix develop -c cargo build 193cd grasp-audit && nix develop -c cargo build
157 194
158# Run all tests (requires relay running, set RELAY_URL to match your port) 195# Manual relay testing (if needed)
159cd grasp-audit && RELAY_URL="ws://localhost:18081" nix develop -c cargo test --ignored 196# 1. Start relay: docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest
197# 2. Run tests: RELAY_URL="ws://localhost:18081" nix develop -c cargo test --ignored
160 198
161# Run single test 199# Run single test
162cd grasp-audit && nix develop -c cargo test --lib test_name -- --nocapture 200cd grasp-audit && nix develop -c cargo test --lib test_name -- --nocapture
163 201
164# Verify GRASP-01 tests (cleaner output)
165cd grasp-audit && RELAY_URL="ws://localhost:18081" nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture 2>&1 | tail -60
166
167# Check session files 202# Check session files
168ls work/ # Should only have README.md when clean 203ls work/ # Should only have README.md when clean
169``` 204```