Skip to content

test(artifact-registry-coverage): Phase 4 PR 4 — ae-data producer-side CI guard#336

Merged
cipher813 merged 2 commits into
mainfrom
feat/artifact-registry-coverage-ci-guard
May 27, 2026
Merged

test(artifact-registry-coverage): Phase 4 PR 4 — ae-data producer-side CI guard#336
cipher813 merged 2 commits into
mainfrom
feat/artifact-registry-coverage-ci-guard

Conversation

@cipher813
Copy link
Copy Markdown
Owner

Summary

Phase 4 of the artifact-freshness-monitor arc (plan doc at ~/Development/alpha-engine-docs/private/artifact-freshness-monitor-260527.md; ROADMAP P1 entry in alpha-engine-config #342 / #344). PR 4 of the 4-PR cascade across ae-data / ae-research / ae-predictor / ae-backtester. Mirrors the tests/test_schema_contract.py::_GRANDFATHERED_BARE_FIELDS precedent — force operator attention at every new producer addition so the absence-of-artifact bug class can't slip through new code without an explicit register-or-grandfather decision.

PRs 5-7 (ae-research / ae-predictor / ae-backtester) mirror this pattern in a follow-up session per the plan §8 estimate (~2 sessions for PRs 4-7).

Depends on:

Changes

tests/test_artifact_registry_coverage.py (new):

  • _enumerate_put_sites()git grep for every s3.put_object( / s3.upload_file( literal in ae-data production code (excludes tests/, infrastructure/lambdas/, .claude/, .venv/, build/).
  • EXPECTED_PER_FILE_PUT_COUNTS — hand-curated pin of 44 PUT sites across 29 files as of 2026-05-27. Bumped on every legitimate PUT-site change.
  • 3 tests:
    • test_every_producer_file_is_pinned — new file with a PUT site fails with a clear resolution path (register in ae-config registry → bump the pinned set).
    • test_every_pinned_file_still_exists — file removed without bumping the pin fails (stale-pin detection).
    • test_pinned_counts_match_actual — PUT-site count drift in an existing file fails (the typical add-a-new-PUT case).

Design choice — per-file count rather than per-key-template extraction

Statically extracting key templates from arbitrary f-string put_object(Key=...) calls is fragile (keys are often constructed from surrounding context: loop variables, function args, config values). Per-file count is stable across refactors and sufficient to force operator review at every new addition. The operator is the source of truth for "which key does this PUT emit"; the test's job is to ensure the operator can't sleepwalk past adding one without thinking.

This is the lighter-touch alternative to the plan's "per-key extraction + match against registered prefix" specification. Bias toward chokepoint robustness — the test should be noisy in the right way, never silent in the wrong way.

Sister coverage

  • alpha-engine-config #344scripts/validate_artifact_registry.py — PR-time SoT schema validator (registry side).
  • alpha-engine-data #335infrastructure/lambdas/freshness-monitor/index.py::load_registry — Lambda-runtime registry parse + spec validation (deploy side).
  • This PR — producer-side coverage CI guard (PR-time).

Test plan

  • pytest tests/test_artifact_registry_coverage.py -v — 3 passing
  • Stress-test: add a synthetic s3.put_object(...) line to any existing producer file → test fails with the operator-resolution message
  • Stress-test: add a synthetic new file with a put_object call → test_every_producer_file_is_pinned fails

Composes with

  • [[feedback_lift_invariants_to_chokepoint_after_second_recurrence]] — this IS the chokepoint cascade for the absence-of-artifact bug class.
  • [[feedback_no_silent_fails]] — operationalized at PR time for new producers.
  • [[feedback_sota_institutional_default_no_shortcuts]] — operator-attention chokepoint over heuristic key extraction.

🤖 Generated with Claude Code

cipher813 and others added 2 commits May 27, 2026 14:42
…e CI guard

Phase 4 of the artifact-freshness-monitor arc (plan doc:
~/Development/alpha-engine-docs/private/artifact-freshness-monitor-260527.md).
PR 4 of the 4-PR cascade across ae-data / ae-research /
ae-predictor / ae-backtester. Mirrors the
tests/test_schema_contract.py::_GRANDFATHERED_BARE_FIELDS precedent
— force operator attention at every new producer addition so the
absence-of-artifact bug class can't slip through new code without
an explicit register-or-grandfather decision.

What this catches: a new s3.put_object(...) or s3.upload_file(...)
in ae-data production code that hasn't been registered in
alpha-engine-config/private-docs/ARTIFACT_REGISTRY.yaml (or
explicitly grandfathered). The producer chokepoint at PR time
means the silent absence-of-artifact bug class (e.g.,
2026-05-17→27 pit_parity.json) can't reach production without
the operator first deciding whether the artifact is load-bearing
enough to warrant an SLA.

Design choice — per-file PUT-site count rather than per-key-template
extraction. Statically extracting key templates from arbitrary
f-string put_object(Key=...) calls is fragile (keys are often
constructed from surrounding context). Per-file count is stable
across refactors and sufficient to force operator review at every
new addition. The operator is the source of truth for "which key
does this PUT emit"; the test's job is to ensure the operator
can't sleepwalk past adding one without thinking.

Three tests:
- test_every_producer_file_is_pinned — new file with a PUT site
  fails the test with a clear resolution path.
- test_every_pinned_file_still_exists — file removed without
  bumping the pin fails (stale-pin detection).
- test_pinned_counts_match_actual — PUT-site count drift in an
  existing file fails (the typical add-a-new-PUT case).

Initial pin: 44 PUT sites across 29 files in ae-data production
code as of 2026-05-27.

Sister coverage:
- alpha-engine-config/scripts/validate_artifact_registry.py — PR-time
  SoT schema validator (registry side).
- infrastructure/lambdas/freshness-monitor/index.py::load_registry —
  Lambda-runtime registry parse + spec validation (deploy side).

PRs 5-7 (ae-research / ae-predictor / ae-backtester) mirror this
pattern in a follow-up session per the plan §8 estimate (~2 sessions
for PRs 4-7).

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