Skip to content

fix(scanner): key candidates.json by trading day, not calendar date (L4464 recovery)#257

Merged
cipher813 merged 1 commit into
mainfrom
fix/scanner-candidates-trading-day-key
May 30, 2026
Merged

fix(scanner): key candidates.json by trading day, not calendar date (L4464 recovery)#257
cipher813 merged 1 commit into
mainfrom
fix/scanner-candidates-trading-day-key

Conversation

@cipher813
Copy link
Copy Markdown
Owner

The 2026-05-30 recovery (post-#256) failed at Research — but the cutover's fail-loud worked exactly as designed, catching a real producer/consumer date-axis mismatch:

Research read candidates/2026-05-29/candidates.json (its trading day), Scanner wrote candidates/2026-05-30/candidates.json (the calendar date = date(Execution.StartTime)).

Everything else in the system keys trade artifacts by the trading day (signals.json, sector_team_runs, scanner_evaluations, the Research run itself via most_recent_trading_day(today)) — and ARTIFACT_REGISTRY already expects scanner_candidates_json on the trading-day axis (config #356). The standalone Scanner was the lone calendar-keyed producer; it never mattered until the Phase-5 cutover made Research the first consumer.

Fix

scanner_handler normalizes run_date to the trading day via the alpha_engine_lib.trading_calendar chokepoint (on-or-before: Sat/Sun/holiday → most recent trading day; trading day → unchanged). Scanner and Research now key off the identical date.

Tests

test_run_date_normalized_to_trading_day (Sat→Fri, Sun→Fri, Fri→Fri) + updated happy/threading assertions. Suite 1672 → 1673.

Deploy / next

Scanner Lambda auto-rebuilds on merge (touches lambda/). After merge + redeploy I'll re-run the scoped recovery (Scanner → Research → Backtester). Held for review.

🤖 Generated with Claude Code

…L4464 recovery)

The 2026-05-30 L4464 recovery failed at Research: the standalone Scanner
wrote candidates/2026-05-30/ (calendar date, from the SF's
date(Execution.StartTime)), but Research reads candidates/2026-05-29/
(its trading day, most_recent_trading_day(today)) — the same axis used by
signals.json, sector_team_runs, and scanner_evaluations. The Phase-5
cutover's fail-loud (research #256) correctly caught the producer/consumer
date-axis mismatch instead of silently producing nothing.

Fix: scanner_handler normalizes run_date to the trading day via the
alpha_engine_lib.trading_calendar chokepoint (on-or-before semantics:
Sat/Sun/holiday → most recent trading day; trading day → unchanged). Now
the Scanner and Research key off the identical date, and the write matches
what ARTIFACT_REGISTRY already expects (scanner_candidates_json was flipped
to the trading_day axis in config #356).

Per DATE_CONVENTIONS — every trade artifact keys by trading day.

Tests: test_run_date_normalized_to_trading_day (Sat→Fri, Sun→Fri,
Fri→Fri) + existing happy/threading assertions updated. Suite 1672 → 1673.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit d9d1dee into main May 30, 2026
1 check passed
@cipher813 cipher813 deleted the fix/scanner-candidates-trading-day-key branch May 30, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant