Skip to content

test(live-smoke): paths-filtered Polygon + FRED + ArcticDB smokes (L258)#327

Merged
cipher813 merged 2 commits into
mainfrom
feat-l258-live-api-smoke-260527
May 27, 2026
Merged

test(live-smoke): paths-filtered Polygon + FRED + ArcticDB smokes (L258)#327
cipher813 merged 2 commits into
mainfrom
feat-l258-live-api-smoke-260527

Conversation

@cipher813
Copy link
Copy Markdown
Owner

Summary

Closes the mocked-test scope-shape gap for the three external services alpha-engine-data depends on (ROADMAP L258 P0 retrospective). Mirrors the morning-signal #34 pattern shipped 2026-05-26 for the same class of bug: unit tests mock the external client, so payload-shape drift is invisible to CI until production fires.

Each smoke is its own paths-filtered workflow + skip-on-no-credentials script, so PRs that don't touch the relevant module skip the workflow entirely and forks without secrets get a clean skip rather than a failing CI status.

Smoke Triggers on Cost/run Secret
Polygon polygon_client.py, collectors/daily_closes.py, collectors/nasdaq_snapshot.py ~$0.01 POLYGON_API_KEY
FRED collectors/fred_history.py, collectors/daily_closes.py free FRED_API_KEY
ArcticDB store/arctic_store.py, builders/{daily_append,backfill,_price_cache_writeboth}.py ~$0.0001 (read-only) OIDC role

Each smoke skips cleanly when its credential is absent — verified locally.

IAM grant (operator step on merge)

Two new scoped Statements added to infrastructure/iam/github-actions-lambda-deploy.json:

  • ArcticDBSmokeReadObjects3:GetObject on arcticdb/* (read-only)
  • ArcticDBSmokeListBuckets3:ListBucket with prefix condition scoped to arcticdb

On merge, the IAM drift check will fail until the operator runs:

```bash
./infrastructure/iam/apply.sh github-actions-lambda-deploy
```

Secrets to add in GHA repo settings

  • `POLYGON_API_KEY` — repo secret (mirror of the SSM param at `/alpha-engine/POLYGON_API_KEY`)
  • `FRED_API_KEY` — repo secret (mirror of the SSM param at `/alpha-engine/FRED_API_KEY`)

Until both secrets are added, those two workflows take the clean-skip path on every PR; once added, the smoke fires on the next PR touching the path-filtered files.

Test plan

  • All three smoke scripts skip cleanly when their credential is absent (verified locally — POLYGON_API_KEY not set; skipping. / FRED_API_KEY not set; skipping. / no AWS credentials in env; skipping.)
  • Full pytest suite passes (1557 passed, 1 skipped)
  • Pytest doesn't pick up the live_smoke scripts (no test_*.py match, no collection)
  • IAM JSON validates as well-formed JSON
  • Operator adds POLYGON_API_KEY + FRED_API_KEY GHA secrets
  • Operator runs ./infrastructure/iam/apply.sh github-actions-lambda-deploy to push the new policy
  • First post-secret PR touching polygon_client.py exercises the live-Polygon smoke green
  • First post-IAM-apply PR touching store/arctic_store.py exercises the live-ArcticDB smoke green

Composes with morning-signal #34, alpha-engine-lib #78 (anthropic_payload chokepoint), and the L258 P0-retrospective entry in ROADMAP.

🤖 Generated with Claude Code

cipher813 and others added 2 commits May 27, 2026 06:28
Closes the mocked-test scope-shape gap for the three external services
alpha-engine-data depends on. Mirrors the morning-signal #34 pattern
shipped 2026-05-26 for the same class of bug: unit tests mock the
external client, so payload-shape drift (field renames, schema
deprecations, status-code semantics) is invisible to CI until
production fires.

Each smoke is its own paths-filtered workflow + skip-on-no-credentials
script, so PRs that don't touch the relevant module skip the workflow
entirely and forks without secrets get a clean skip rather than a
failing CI status.

Smokes:
- Polygon: get_grouped_daily for the most recent US weekday; asserts
  every bar carries the {open, high, low, close, volume, vwap} keys
  the consumer reads. ~$0.01/run, gated on POLYGON_API_KEY.
- FRED: fetch_fred_history("DGS2", period_years=1); asserts >=50
  observations and "value" column present. Free tier, gated on
  FRED_API_KEY.
- ArcticDB: read tail of SPY from universe library; asserts the
  canonical OHLCV_COLS + PROVENANCE_COL schema. Read-only, no writes.
  Gated on OIDC role assumption (github-actions-lambda-deploy).

IAM grant: adds two scoped Statements to
infrastructure/iam/github-actions-lambda-deploy.json:
- ArcticDBSmokeReadObject: s3:GetObject on arcticdb/* (read-only)
- ArcticDBSmokeListBucket: s3:ListBucket with prefix condition

Operator-step on merge: `./infrastructure/iam/apply.sh
github-actions-lambda-deploy` to push the new policy to AWS. The
IAM drift check will fail until that runs.

Secrets to add in GHA repo settings: POLYGON_API_KEY, FRED_API_KEY.

Composes with morning-signal #34, alpha-engine-lib #78 (anthropic_payload
chokepoint), and the L258 P0-retrospective entry in ROADMAP.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit 60c4d90 into main May 27, 2026
6 of 8 checks passed
@cipher813 cipher813 deleted the feat-l258-live-api-smoke-260527 branch May 27, 2026 13:44
cipher813 added a commit that referenced this pull request May 27, 2026
alpha_engine_lib.alerts.publish's S3-backed dedup uses HeadObject +
conditional PUT semantics that require s3:ListBucket on the bucket
itself (scoped via the s3:prefix condition). The watchdog role
previously had only s3:GetObject + s3:PutObject on the dedup-marker
prefix; the missing ListBucket caused dedup probes to error with
AccessDenied, and the lib's fail-safe-to-publish path correctly fired
the alert anyway — but with dedup non-functional, every cron firing
during a persistent outage re-paged the operator instead of collapsing
under the 12h dedup window.

The grant is scoped by an s3:prefix Condition to ``_alerts/_dedup`` +
``_alerts/_dedup/*`` so the watchdog can't enumerate other prefixes
on the bucket. Mirrors the alpha-engine-data #327 (L258) precedent
where ArcticDBSmokeListBucket added the same Condition-scoped grant
for the OIDC role's ArcticDB smoke.

Applied via ``aws iam put-role-policy`` against
``alpha-engine-pipeline-watchdog-role`` (verified live). The deploy.sh
already re-applies the policy on every run, so the codified change
is in lockstep with the live state.

ROADMAP L295 (P2, 2026-05-26 PM audit finding).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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