From 095bcae915ad02e3bd27d874c890ab6d6e563ff3 Mon Sep 17 00:00:00 2001 From: Tobi Date: Sat, 16 May 2026 08:05:34 +0200 Subject: [PATCH] fix(check-config): normalize EXCLUDE_SOURCES (lowercase + whitespace) before matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bash banner accounting used raw substring matching while pipeline.py normalises EXCLUDE_SOURCES via .strip().lower(). With EXCLUDE_SOURCES=TikTok,Instagram (or with surrounding spaces), pipeline correctly excludes the sources but the banner did not deduct them — count showed 1-2 higher than what the pipeline actually runs. Normalisation now mirrors the Python side (lowercase, collapse whitespace around commas, strip outer whitespace). Reproducer (clean HOME with config EXCLUDE_SOURCES=TikTok,Instagram): before: /last30days: Ready — 7 sources active. after: /last30days: Ready — 5 sources active. Addresses Greptile review comment P1 on #399. --- hooks/scripts/check-config.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hooks/scripts/check-config.sh b/hooks/scripts/check-config.sh index 81da6d2..85403cc 100755 --- a/hooks/scripts/check-config.sh +++ b/hooks/scripts/check-config.sh @@ -97,13 +97,17 @@ if [[ -n "$HAS_BSKY" ]]; then SOURCE_COUNT=$((SOURCE_COUNT + 1)) fi if [[ -n "$HAS_SCRAPECREATORS" ]]; then - # Start with Reddit comments + TikTok + Instagram, subtract any in EXCLUDE_SOURCES + # Start with Reddit comments + TikTok + Instagram, subtract any in EXCLUDE_SOURCES. + # Normalise EXCLUDED (lowercase + collapse whitespace around commas + strip outer + # whitespace) so the matching mirrors pipeline.py's .strip().lower() parsing. SC_ADD=3 EXCLUDED="${ENV_EXCLUDE_SOURCES:-${EXCLUDE_SOURCES:-}}" - if [[ ",$EXCLUDED," == *",tiktok,"* ]]; then + EXCLUDED_NORM=$(printf '%s' "$EXCLUDED" | tr '[:upper:]' '[:lower:]' \ + | sed -E 's/[[:space:]]*,[[:space:]]*/,/g; s/^[[:space:]]+//; s/[[:space:]]+$//') + if [[ ",$EXCLUDED_NORM," == *",tiktok,"* ]]; then SC_ADD=$((SC_ADD - 1)) fi - if [[ ",$EXCLUDED," == *",instagram,"* ]]; then + if [[ ",$EXCLUDED_NORM," == *",instagram,"* ]]; then SC_ADD=$((SC_ADD - 1)) fi SOURCE_COUNT=$((SOURCE_COUNT + SC_ADD))