upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-23 16:59:24 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-27 20:38:06 +0000
commitcbb0e768641a6ca0cbd7e7013437cc71b920004d (patch)
tree3d350eec31ea2fcd2c533f949bb136498ea45767 /docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh
parent0b9527ede03521a40f1174a5a6e40a943bf27e2d (diff)
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.
Diffstat (limited to 'docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh')
-rwxr-xr-xdocs/how-to/migration-scripts/31-extract-purgatory-expiry.sh15
1 files changed, 10 insertions, 5 deletions
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() {
356 parsed=$(parse_log_line "$line") 356 parsed=$(parse_log_line "$line")
357 if [[ -n "$parsed" ]]; then 357 if [[ -n "$parsed" ]]; then
358 echo "$parsed" >> "$output_file" 358 echo "$parsed" >> "$output_file"
359 ((count++)) 359 count=$((count + 1))
360 fi 360 fi
361 done <<< "$raw_lines" 361 done <<< "$raw_lines"
362 362
@@ -374,9 +374,10 @@ main() {
374 if [[ $count -gt 0 ]]; then 374 if [[ $count -gt 0 ]]; then
375 echo "" 375 echo ""
376 log_info "Sample entries (first 5):" 376 log_info "Sample entries (first 5):"
377 tail -n +5 "$output_file" | head -5 | while IFS=$'\t' read -r repo npub timestamp reason; do 377 # Use a subshell to avoid SIGPIPE issues with set -e
378 (tail -n +5 "$output_file" | head -5 | while IFS=$'\t' read -r repo npub timestamp reason; do
378 echo " repo=$repo npub=${npub:0:20}... timestamp=$timestamp" 379 echo " repo=$repo npub=${npub:0:20}... timestamp=$timestamp"
379 done 380 done) || true
380 fi 381 fi
381 382
382 # Show unique repos affected 383 # Show unique repos affected
@@ -388,9 +389,10 @@ main() {
388 389
389 echo "" 390 echo ""
390 log_info "Repositories with purgatory expiry:" 391 log_info "Repositories with purgatory expiry:"
391 tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort | uniq -c | sort -rn | head -10 | while read -r cnt repo; do 392 # Use a subshell to avoid SIGPIPE issues with set -e
393 (tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort | uniq -c | sort -rn | head -10 | while read -r cnt repo; do
392 echo " $repo: $cnt expiry events" 394 echo " $repo: $cnt expiry events"
393 done 395 done) || true
394 396
395 local total_repos 397 local total_repos
396 total_repos=$(tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort -u | wc -l) 398 total_repos=$(tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort -u | wc -l)
@@ -398,6 +400,9 @@ main() {
398 echo " ... and $((total_repos - 10)) more repositories" 400 echo " ... and $((total_repos - 10)) more repositories"
399 fi 401 fi
400 fi 402 fi
403
404 # Explicit success exit
405 exit 0
401} 406}
402 407
403main "$@" 408main "$@"