From cbb0e768641a6ca0cbd7e7013437cc71b920004d Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 23 Jan 2026 16:59:24 +0000 Subject: Capture invalid announcement rejections in Phase 4 Update parse failures script to also extract 'Invalid announcement' rejections from logs. These are announcement events that failed validation (e.g., multiple clone tags instead of single tag with multiple values). Changes: - Search for 'Event rejected by write policy' pattern with 'Invalid announcement' - Search for 'Rejected repository announcement' pattern from builder - Extract event_id, kind, and reason from rejection logs - Combine with [PARSE_FAIL] entries in output - Deduplicate entries by event_id - Update header to clarify both patterns are captured - Update migration guide to document this - Fix SIGPIPE handling in purgatory script (minor) This captures the ~446 unique announcements rejected for NIP-34 format violations (multiple clone tags), which were previously unexplained in the migration analysis. --- .../migration-scripts/31-extract-purgatory-expiry.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh') diff --git a/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh b/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh index a603a1e..a0c8ad0 100755 --- a/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh +++ b/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh @@ -356,7 +356,7 @@ main() { parsed=$(parse_log_line "$line") if [[ -n "$parsed" ]]; then echo "$parsed" >> "$output_file" - ((count++)) + count=$((count + 1)) fi done <<< "$raw_lines" @@ -374,9 +374,10 @@ main() { if [[ $count -gt 0 ]]; then echo "" log_info "Sample entries (first 5):" - tail -n +5 "$output_file" | head -5 | while IFS=$'\t' read -r repo npub timestamp reason; do + # Use a subshell to avoid SIGPIPE issues with set -e + (tail -n +5 "$output_file" | head -5 | while IFS=$'\t' read -r repo npub timestamp reason; do echo " repo=$repo npub=${npub:0:20}... timestamp=$timestamp" - done + done) || true fi # Show unique repos affected @@ -388,9 +389,10 @@ main() { echo "" log_info "Repositories with purgatory expiry:" - tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort | uniq -c | sort -rn | head -10 | while read -r cnt repo; do + # Use a subshell to avoid SIGPIPE issues with set -e + (tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort | uniq -c | sort -rn | head -10 | while read -r cnt repo; do echo " $repo: $cnt expiry events" - done + done) || true local total_repos total_repos=$(tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort -u | wc -l) @@ -398,6 +400,9 @@ main() { echo " ... and $((total_repos - 10)) more repositories" fi fi + + # Explicit success exit + exit 0 } main "$@" -- cgit v1.2.3