============================================================ STOCKLAB — CELERY REGISTRATION RC QA ============================================================ RC : /data/files/bmw/stocklab-release-candidate-celery-20260910-124000 IMAGE : localhost/stocklab-backend:screener-percent-final-20260909-194639 LOG : /data/files/bmw/stocklab-celery-qa-20260910-124321.log === 1. VERIFY RC SOURCE === PASS: RC source tree is complete. === 2. VERIFY EXACT PATCH === PASS: explicit Celery imports are present. PASS: old autodiscover_tasks() is absent. === 3. SHOW EXACT DIFF === --- /data/files/bmw/stocklab-release-candidate-celery-20260910-124000/app/workers/celery_app.py.before-celery-fix 2026-09-10 12:40:00.512897430 +0300 +++ /data/files/bmw/stocklab-release-candidate-celery-20260910-124000/app/workers/celery_app.py 2026-09-10 12:40:00.536897625 +0300 @@ -26,8 +26,14 @@ task_acks_late=settings.CELERY_TASK_ACKS_LATE, task_time_limit=settings.CELERY_TASK_TIME_LIMIT_SECONDS, task_soft_time_limit=settings.CELERY_TASK_SOFT_TIME_LIMIT_SECONDS, + imports=( + "app.workers.discovery", + "app.workers.ingest", + "app.workers.peer_groups", + "app.workers.recompute", + "app.workers.token_cleanup", + ), ) -celery_app.autodiscover_tasks(["app.workers"]) celery_app.conf.beat_schedule = { "daily-universe-ingestion": { === 4. PYTHON SYNTAX — READ-ONLY RC === === 5. CELERY TASK REGISTRATION === === 6. CELERY IMPORT CONFIGURATION === === 7. BEAT SCHEDULE REGRESSION === === 8. EXISTING CELERY SAFETY SETTINGS === === 9. PRODUCTION STATE — READ ONLY === --- backend --- Name=stocklab-backend Image=localhost/stocklab-backend:screener-percent-final-20260909-194639 ImageID=6efaac7ac11786530a884f942608c03222ebe725963fd1e1b2aae4892c1b2178 --- worker --- Name=stocklab-worker Image=localhost/stocklab-backend:screener-percent-final-20260909-194639 ImageID=6efaac7ac11786530a884f942608c03222ebe725963fd1e1b2aae4892c1b2178 --- beat --- Name=stocklab-beat Image=localhost/stocklab-backend:screener-percent-final-20260909-194639 ImageID=6efaac7ac11786530a884f942608c03222ebe725963fd1e1b2aae4892c1b2178 NAMES STATUS IMAGE stocklab-backend Up 16 hours (healthy) localhost/stocklab-backend:screener-percent-final-20260909-194639 stocklab-worker Up 16 hours (healthy) localhost/stocklab-backend:screener-percent-final-20260909-194639 stocklab-beat Up 16 hours localhost/stocklab-backend:screener-percent-final-20260909-194639 === 10. PRODUCTION HEALTH — READ ONLY === {"status":"ok"} {"status":"ok","database":true} === 11. PRODUCTION PORTS — READ ONLY === LISTEN 0 2048 127.0.0.1:18000 0.0.0.0:* users:(("uvicorn",pid=1574355,fd=11)) LISTEN 0 511 127.0.0.1:6379 0.0.0.0:* users:(("redis-server",pid=1133711,fd=6)) LISTEN 0 200 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=1141225,fd=6)) LISTEN 0 511 127.0.0.1:13000 0.0.0.0:* users:(("next-server (v1",pid=1497838,fd=18)) ============================================================ CELERY REGISTRATION RC QA: PASS ============================================================ 6/6 Celery tasks registered. 4/4 Beat schedules intact. Celery safety settings preserved. Production was NOT restarted. Production image was NOT rebuilt. Production DB was NOT modified. Production Redis was NOT used. RC : /data/files/bmw/stocklab-release-candidate-celery-20260910-124000 LOG : /data/files/bmw/stocklab-celery-qa-20260910-124321.log ============================================================ [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # [?2004l [?2004hroot@Azeroth ~ # set -euo pipefail RC="/data/files/bmw/stocklab-release-candidate-celery-20260910-124000" FILE="$RC/app/workers/recompute.py" STAMP="$(date +%Y%m%d-%H%M%S)" LOG="/data/files/bmw/stocklab-sl001-qa-${STAMP}.log" test -f "$FILE" exec > >(tee -a "$LOG") 2>&1 echo "============================================================" echo " STOCKLAB — SL-001 FUTURE PERIOD FIX" echo "============================================================" echo "RC : $RC" echo "FILE : $FILE" echo "LOG : $LOG" echo echo "=== 1. BACKUP CURRENT RC FILE ===" cp "$FILE" "$FILE.before-sl001" echo "Before:" sha256sum "$FILE.before-sl001" echo echo "=== 2. VERIFY EXACT TARGET QUERY ===" python3 - "$FILE" <<'PY' from pathlib import Path import sys path = Path(sys.argv[1]) text = path.read_text() target = ''' annual_periods = ( db.execute( select(FinancialPeriod) .where(FinancialPeriod.security_id == security.id, FinancialPeriod.period_type == "FY") .order_by(FinancialPeriod.period_end.desc()) ) .scalars() .all() ) ''' if target not in text: print("FAIL: exact expected annual FinancialPeriod query was not found.") print("Refusing to modify recompute.py.") raise SystemExit(1) print("PASS: exact target query found.") PY echo echo "=== 3. APPLY SL-001 FIX ===" python3 - "$FILE" <<'PY' from pathlib import Path import sys path = Path(sys.argv[1]) text = path.read_text() old = ''' annual_periods = ( db.execute( select(FinancialPeriod) .where(FinancialPeriod.security_id == security.id, FinancialPeriod.period_type == "FY") .order_by(FinancialPeriod.period_end.desc()) ) .scalars() .all() ) ''' new = ''' annual_periods = ( db.execute( select(FinancialPeriod) .where( FinancialPeriod.security_id == security.id, FinancialPeriod.period_type == "FY", FinancialPeriod.period_end <= as_of, ) .order_by(FinancialPeriod.period_end.desc()) ) .scalars() .all() ) ''' count = text.count(old) if count != 1: print(f"FAIL: target occurrence count={count}, expected exactly 1.") print("Refusing to modify recompute.py.") raise SystemExit(1) path.write_text(text.replace(old, new, 1)) print("PASS: SL-001 fix applied exactly once.") PY echo echo "=== 4. EXACT DIFF ===" diff -u "$FILE.before-sl001" "$FILE" || true echo echo "=== 5. VERIFY FIX IS PRESENT ===" grep -n -A12 -B4 \ 'FinancialPeriod.period_end <= as_of' \ "$FILE" echo echo "=== 6. VERIFY OLD UNSAFE QUERY IS GONE ===" python3 - "$FILE" <<'PY' from pathlib import Path import sys text = Path(sys.argv[1]).read_text() unsafe = ''', FinancialPeriod.period_type == "FY") .order_by(FinancialPeriod.period_end.desc()) ''' if unsafe in text: print("FAIL: old unsafe FY query pattern still exists.") raise SystemExit(1) print("PASS: old unsafe FY query pattern is absent.") PY echo echo "=== 7. READ-ONLY PYTHON SYNTAX CHECK ===" IMAGE="localhost/stocklab-backend:screener-percent-final-20260909-194639" podman run --rm \ --network none \ -e PYTHONDONTWRITEBYTECODE=1 \ -v "$RC:/app:ro" \ "$IMAGE" \ python - <<'PY' from pathlib import Path import ast files = [ "/app/app/workers/recompute.py", ] for filename in files: ast.parse(Path(filename).read_text(), filename=filename) print("PASS:", filename) print("PASS: recompute.py syntax.") PY echo echo "=== 8. VERIFY AS-OF CONTRACT ===" podman run --rm \ --network none \ -e PYTHONDONTWRITEBYTECODE=1 \ -v "$RC:/app:ro" \ "$IMAGE" \ python - <<'PY' import sys import inspect sys.path.insert(0, "/app") from app.workers.recompute import build_snapshot_from_db sig = inspect.signature(build_snapshot_from_db) print("Signature:") print(sig) assert "as_of" in sig.parameters assert sig.parameters["as_of"].annotation != inspect.Parameter.empty print("PASS: build_snapshot_from_db() retains explicit as_of parameter.") PY echo echo "=== 9. VERIFY V4.1.1 CONTRACTS STILL PRESENT ===" grep -q 'ANNUAL_PERIODS_FOR_SNAPSHOT' "$FILE" grep -q 'PRICE_HISTORY_YEARS' "$RC/app/core/config.py" echo "PASS: ANNUAL_PERIODS_FOR_SNAPSHOT contract retained." echo "PASS: PRICE_HISTORY_YEARS contract retained." echo echo "=== 10. VERIFY ONLY RECOMPUTE.PY CHANGED IN RC ===" echo "Changed files relative to Celery RC creation cannot be inferred from timestamps." echo "Therefore checking the intentional patch pair directly:" echo echo "Original recompute.py:" sha256sum "$FILE.before-sl001" echo "Patched recompute.py:" sha256sum "$FILE" echo echo "Diff statistics:" diff -U 0 "$FILE.before-sl001" "$FILE" | \  grep -E '^[+-][^+-]' | \  wc -l | \  awk '{print "Changed content lines:", $1}' echo echo "============================================================" echo " SL-001 PATCH RESULT" echo "============================================================" echo "SL-001 fix applied." echo "Future FY periods are now excluded by period_end <= as_of." echo "No production container was restarted." echo "No production database was modified." echo "No production Redis was used." echo echo "RC : $RC" echo "LOG : $LOG" echo "============================================================" sys.path.insert(0, "/app") from app.workers.recompute import build_snapshot_from_db sig = inspect.signature(build_snapshot_from_db) print("Signature:") print(sig) assert "as_of" in sig.parameters assert sig.parameters["as_of"].annotation != inspect.Parameter.empty print("PASS: build_snapshot_from_db() retains explicit as_of parameter.") PY echo echo "=== 9. VERIFY V4.1.1 CONTRACTS STILL PRESENT ===" grep -q 'ANNUAL_PERIODS_FOR_SNAPSHOT' "$FILE" grep -q 'PRICE_HISTORY_YEARS' "$RC/app/core/config.py" echo "PASS: ANNUAL_PERIODS_FOR_SNAPSHOT contract retained." echo "PASS: PRICE_HISTORY_YEARS contract retained." echo echo "=== 10. VERIFY ONLY RECOMPUTE.PY CHANGED IN RC ===" echo "Changed files relative to Celery RC creation cannot be inferred from timestamps." echo "Therefore checking the intentional patch pair directly:" echo echo "Original recompute.py:" sha256sum "$FILE.before-sl001" echo "Patched recompute.py:" sha256sum "$FILE" echo echo "Diff statistics:" diff -U 0 "$FILE.before-sl001" "$FILE" | \ grep -E '^[+-][^+-]' | \ wc -l | \ awk '{print "Changed content lines:", $1}' echo echo "============================================================" echo " SL-001 PATCH RESULT" echo "============================================================" echo "SL-001 fix applied." echo "Future FY periods are now excluded by period_end <= as_of." echo "No production container was restarted." echo "No production database was modified." echo "No production Redis was used." echo echo "RC : $RC" echo "LOG : $LOG" echo "============================================================" [?2004l ============================================================ STOCKLAB — SL-001 FUTURE PERIOD FIX ============================================================ RC : /data/files/bmw/stocklab-release-candidate-celery-20260910-124000 FILE : /data/files/bmw/stocklab-release-candidate-celery-20260910-124000/app/workers/recompute.py LOG : /data/files/bmw/stocklab-sl001-qa-20260910-124447.log === 1. BACKUP CURRENT RC FILE === Before: c11180b688559acaa14b249b5052a2a60a08cb578217eda5b19d4cb5e15b9841 /data/files/bmw/stocklab-release-candidate-celery-20260910-124000/app/workers/recompute.py.before-sl001 === 2. VERIFY EXACT TARGET QUERY === FAIL: exact expected annual FinancialPeriod query was not found. Refusing to modify recompute.py.