Restore sweep-test-tiers.sh after intake → editorial-system merge
Browse filesThe weekly test-tier janitor was overlooked when intake/ was merged into
the editorial-system tree on 2026-05-18 (its three sibling smoke-test
scripts moved into intake/scripts/, but sweep was not). Cron on OPi3B
kept invoking the legacy path and failing silently every Sunday since.
Ports the script to intake/scripts/sweep-test-tiers.sh and updates
TEST_REVIEWS to the new editorial-system reviews/test/ path. Cron on
OPi3B repointed (not in repo). Manual catch-up run cleared an 11-dir
backlog (2026-05-26).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
intake/scripts/sweep-test-tiers.sh
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Weekly sweep of stale ICSAC test-tier artifacts. Removes test state dirs,
|
| 3 |
+
# T2 outbox .eml files, and test review markdown older than RETENTION_DAYS.
|
| 4 |
+
# LEAVES audit-log-test.jsonl untouched (durable history) and queue/
|
| 5 |
+
# untouched (active state).
|
| 6 |
+
#
|
| 7 |
+
# Wired to cron on OPi3B: Sunday 04:00 ET.
|
| 8 |
+
# Pain nerve: failure curls /pain on OPi5 so a broken sweep doesn't go silent.
|
| 9 |
+
set -u
|
| 10 |
+
RETENTION_DAYS="${RETENTION_DAYS:-7}"
|
| 11 |
+
TEST_ROOT="${HOME}/icsac-submissions/test"
|
| 12 |
+
TEST_OUTBOX="${TEST_ROOT}/_outbox"
|
| 13 |
+
TEST_REVIEWS="${HOME}/Desktop/icsac/editorial-system/reviews/test"
|
| 14 |
+
PAIN_URL="http://100.117.63.73:8090/pain"
|
| 15 |
+
|
| 16 |
+
deleted_dirs=0
|
| 17 |
+
deleted_eml=0
|
| 18 |
+
deleted_md=0
|
| 19 |
+
|
| 20 |
+
# Test state dirs (ICSAC-SUB-TEST-*) — oldest mtime older than RETENTION_DAYS.
|
| 21 |
+
if [ -d "$TEST_ROOT" ]; then
|
| 22 |
+
while IFS= read -r d; do
|
| 23 |
+
rm -rf "$d" && deleted_dirs=$((deleted_dirs + 1))
|
| 24 |
+
done < <(find "$TEST_ROOT" -maxdepth 1 -type d -name 'ICSAC-SUB-TEST-*' -mtime +"$RETENTION_DAYS")
|
| 25 |
+
fi
|
| 26 |
+
|
| 27 |
+
# T2 outbox .eml files.
|
| 28 |
+
if [ -d "$TEST_OUTBOX" ]; then
|
| 29 |
+
while IFS= read -r f; do
|
| 30 |
+
rm -f "$f" && deleted_eml=$((deleted_eml + 1))
|
| 31 |
+
done < <(find "$TEST_OUTBOX" -maxdepth 1 -type f -name '*.eml' -mtime +"$RETENTION_DAYS")
|
| 32 |
+
fi
|
| 33 |
+
|
| 34 |
+
# Test review markdown.
|
| 35 |
+
if [ -d "$TEST_REVIEWS" ]; then
|
| 36 |
+
while IFS= read -r f; do
|
| 37 |
+
rm -f "$f" && deleted_md=$((deleted_md + 1))
|
| 38 |
+
done < <(find "$TEST_REVIEWS" -maxdepth 1 -type f -name 'ICSAC-SUB-TEST-*' -mtime +"$RETENTION_DAYS")
|
| 39 |
+
fi
|
| 40 |
+
|
| 41 |
+
echo "[$(date -Iseconds)] sweep-test-tiers: dirs=$deleted_dirs eml=$deleted_eml md=$deleted_md retention=${RETENTION_DAYS}d"
|
| 42 |
+
exit 0
|