Fix production-sync-testing.md guide and sanitize-logs.sh script

- Fix shebang in sanitize-logs.sh from #!/bin/bash to #!/usr/bin/env bash for NixOS compatibility
- Update sanitizer defaults from 100/20 to 200/100 chars for better log readability
- Fix CLI argument names in guide: --sync-bootstrap-relay -> --sync-bootstrap-relay-url
- Fix CLI argument names in guide: --git-path -> --git-data-path

These issues were discovered during first-time testing of the production sync testing guide.
This commit is contained in:
DanConwayDev
2026-01-09 21:51:52 +00:00
parent 6a8346441e
commit 5570b9631e
2 changed files with 14 additions and 14 deletions
+9 -9
View File
@@ -38,7 +38,7 @@ This domain has few repo announcements listing it, so sync stays manageable.
The bootstrap relay provides the initial set of announcements to discover repos:
```bash
--sync-bootstrap-relay wss://git.shakespeare.diy
--sync-bootstrap-relay-url wss://git.shakespeare.diy
```
### 3. Run with Time Limit
@@ -51,9 +51,9 @@ rm -rf /tmp/ngit-test-*
# Run for 30 seconds with sanitized output
timeout 30s cargo run -- \
--sync-bootstrap-relay wss://git.shakespeare.diy \
--sync-bootstrap-relay-url wss://git.shakespeare.diy \
--domain ngit.danconwaydev.com \
--git-path /tmp/ngit-test-git \
--git-data-path /tmp/ngit-test-git \
--relay-data-path /tmp/ngit-test-relay \
2>&1 | ./scripts/sanitize-logs.sh | tee sync-test.log
```
@@ -72,8 +72,8 @@ cargo run -- [args] 2>&1 | ./scripts/sanitize-logs.sh
```
**Options:**
- `--head-chars N` - First N characters to show (default: 100)
- `--tail-chars N` - Last N characters to show (default: 20)
- `--head-chars N` - First N characters to show (default: 200)
- `--tail-chars N` - Last N characters to show (default: 100)
Example output:
```
@@ -245,9 +245,9 @@ tracing::trace!("Per-event detail that's too noisy");
```bash
timeout 30s cargo run -- \
--sync-bootstrap-relay wss://git.shakespeare.diy \
--sync-bootstrap-relay-url wss://git.shakespeare.diy \
--domain ngit.danconwaydev.com \
--git-path /tmp/ngit-test-git \
--git-data-path /tmp/ngit-test-git \
--relay-data-path /tmp/ngit-test-relay \
2>&1 | ./scripts/sanitize-logs.sh
```
@@ -256,9 +256,9 @@ timeout 30s cargo run -- \
```bash
timeout 30s cargo run -- \
--sync-bootstrap-relay wss://git.shakespeare.diy \
--sync-bootstrap-relay-url wss://git.shakespeare.diy \
--domain ngit.danconwaydev.com \
--git-path /tmp/ngit-test-git \
--git-data-path /tmp/ngit-test-git \
--relay-data-path /tmp/ngit-test-relay \
--metrics-address 127.0.0.1:9090 \
2>&1 | ./scripts/sanitize-logs.sh
+5 -5
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# sanitize-logs.sh - Truncates verbose log lines for LLM analysis
#
# Usage:
@@ -9,8 +9,8 @@
set -euo pipefail
# Default settings
HEAD_CHARS=100
TAIL_CHARS=20
HEAD_CHARS=200
TAIL_CHARS=100
MAX_LINE_LENGTH=$((HEAD_CHARS + TAIL_CHARS + 20)) # buffer for the ellipsis marker
# Parse arguments
@@ -35,8 +35,8 @@ while [[ $# -gt 0 ]]; do
echo "Reads from stdin, writes to stdout."
echo ""
echo "Options:"
echo " --head-chars N Show first N chars of long lines (default: 100)"
echo " --tail-chars N Show last N chars of long lines (default: 20)"
echo " --head-chars N Show first N chars of long lines (default: 200)"
echo " --tail-chars N Show last N chars of long lines (default: 100)"
echo " --max-line N Lines shorter than this are unchanged (default: head+tail+20)"
echo " -h, --help Show this help"
echo ""