diff --git a/smoke.sh b/smoke.sh index e9d961c..498b4c2 100755 --- a/smoke.sh +++ b/smoke.sh @@ -60,6 +60,12 @@ echo [[ -x "${CHROME_BIN}" ]] || { red "FAIL: ${CHROME_BIN} not found (set CHROME_BIN=...)"; exit 1; } command -v ffprobe >/dev/null || { red "FAIL: ffprobe not installed"; exit 1; } command -v unzip >/dev/null || { red "FAIL: unzip not installed"; exit 1; } +# WR-04 fix: python3 is REQUIRED for URL encoding of the smoke-tab data: URL. +# Previously a fallback `|| printf '%s' "${SMOKE_HTML}"` would emit raw HTML +# into the data URL on python3-missing systems — Chrome silently failed to +# parse those URLs (containing literal `<`, `>`, spaces, quotes) and the +# operator saw a blank tab with no diagnostic. Better to fail loud early. +command -v python3 >/dev/null || { red "FAIL: python3 not installed (needed for URL encoding the smoke tab data URL)"; exit 1; } grep -q '"desktopCapture"' "${DIST_DIR}/manifest.json" || { red "FAIL: dist/manifest.json missing desktopCapture"; exit 1; } ! grep -q '"tabCapture"' "${DIST_DIR}/manifest.json" || { red "FAIL: dist/manifest.json still has tabCapture"; exit 1; } green "✓ pre-flight checks passed" @@ -71,16 +77,24 @@ echo " downloads: ${DOWNLOADS_DIR}" echo # --- snapshot Downloads --- -BEFORE_LIST=$(find "${DOWNLOADS_DIR}" -maxdepth 1 -name 'session_report_*.zip' 2>/dev/null | wc -l) -echo " existing session_report_*.zip in Downloads: ${BEFORE_LIST}" +# WR-05 fix: snapshot the FULL list of pre-existing zips, not just the +# count. The count-only approach falsely succeeded when an unrelated +# session_report appeared in Downloads (operator running the extension +# in another window, etc.) — the script would then ffprobe the WRONG +# file. comm -13 against the post-recording list yields the genuinely +# new file by identity. The mtime sort below still picks the latest if +# multiple new zips appear (unlikely but defensive). +BEFORE_ZIPS=$(find "${DOWNLOADS_DIR}" -maxdepth 1 -name 'session_report_*.zip' 2>/dev/null | sort) +BEFORE_COUNT=$(printf '%s\n' "${BEFORE_ZIPS}" | grep -c . || true) +echo " existing session_report_*.zip in Downloads: ${BEFORE_COUNT}" echo # --- profile prep --- PROFILE_HAS_EXTENSION=0 if [[ "${KEEP_PROFILE}" != "1" ]]; then - rm -rf "${PROFILE_DIR}" + rm -rf -- "${PROFILE_DIR}" fi -mkdir -p "${PROFILE_DIR}" +mkdir -p -- "${PROFILE_DIR}" # Detect if a previous run already loaded the extension into this profile if [[ -d "${PROFILE_DIR}/Default/Extensions" ]] && \ find "${PROFILE_DIR}/Default/Extensions" -maxdepth 3 -name 'manifest.json' 2>/dev/null | head -1 | xargs -r grep -q 'AI Call Recorder' 2>/dev/null; then @@ -106,7 +120,11 @@ read -r -d '' SMOKE_HTML <<'EOF' || true
The script in your terminal will detect the download and finish the ffprobe gate automatically.