feat: DataPhase1 preflight — fail-fast credential + dependency checks#55
Merged
Conversation
Complements postflight (PR #52) which validates output contracts AFTER writes. Preflight runs at the START of _run_phase1 before any collector executes, catching the failure class where a credential drift, external- API outage, or misconfiguration would otherwise burn ~55min of spot-EC2 time before failing on the 40th collector call. Five fail-fast checks (cheapest-first ordering, total ~10s wall-time): 1. Required env vars present + non-empty (POLYGON_API_KEY, FRED_API_KEY) 2. S3 bucket HEAD + sentinel PUT/DELETE (validates IAM beyond list) 3. ArcticDB connect + universe/macro libraries present 4. FRED reachable + auth valid (DFF observation call) 5. polygon.io reachable + auth valid (reference-data call) Failure semantics match postflight: PreflightError → results["status"] = "preflight_failed" → SystemExit(1) → SSM → SF HandleFailure → alpha-engine-saturday-sf-failed alarm. Single named failure surface, same blast radius as postflight (one alarm, not three downstream). Skipped on --only single-collector runs (avoids preflight overhead for local debug invocations like `python weekly_collector.py --only macro`). Skipped on --phase 2 (Lambda has different dependency surface; gets its own preflight when needed). Tests: 24 new unit tests covering each check + end-to-end run() ordering + short-circuit on first failure. Full data-module suite: 84 passed. ROADMAP: adds P2 (per-collector value-range outlier guard) and P3 (data contract registry / Pydantic schema-first validation) as the natural follow-ups for pushing validation further upstream/centralizing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five checks (cheapest-first)
Failure surface
`PreflightError` → `results["status"] = "preflight_failed"` → `SystemExit(1)` → SSM → SF HandleFailure → `alpha-engine-saturday-sf-failed` alarm. One named failure, one alarm.
Scope-out
Test plan
Composes with
🤖 Generated with Claude Code