feat(main): Phase 4.6 writer wiring — populate universe-provenance in forward cron#276
Merged
Merged
Conversation
…tadata in forward cron Closes the last leg of the Phase 4.6 chain. PR #274 landed the `historical_universe.members_at()` module + 2 nullable Metadata fields. PR #275 wired `universe_provider` into `pbo_dsr.factor_passes_gates()` so validation gates carry honest provenance. This PR makes the forward-cron `metadata.json` output ACTUALLY populate those fields instead of leaving them None. ## What changed - `compute/main.py` — `Metadata(...)` construction now passes: - `universe_membership_as_of=now.date().isoformat()` (today's date — forward cron scores as-of today) - `survivorship_bias_corrected=True` (today's S&P 500 IS the honest universe for an as-of-today query, per the PR #274 schema docstring semantic — True means "this output's universe assumption is honest for its as_of_date") - `tests/test_output/test_writer.py` — 2 new round-trip tests: - Phase 4.6 happy path: both fields survive Pydantic → JSON - Legacy snapshot back-compat: when neither field is passed (pre-0.10.7 caller pattern), Pydantic defaults to None and JSON writes nulls ## Hard rules preserved - ✅ Rule 9 (schema triple) — no schema change in this PR (fields already in schemas.py + types.ts + snapshot from PR #274) - ✅ Rule 16 — N/A (no scoring change) - ✅ Rule 18 — observability surface from PR #274 is now actually populated; consumers can branch on it - ✅ No new deps - ✅ No new env-vars ## Verification - `ruff check compute/main.py tests/test_output/test_writer.py` — clean - `python -m compute.output.schema_check` — Schema snapshot in sync - `python -m pytest tests/test_output/test_writer.py -k metadata` — 4 passed (2 existing + 2 new) ## What goes live on next cron Next weekday cron (Wed 2026-05-28 22:00 UTC) writes: metadata.json: ... universe_membership_as_of: "2026-05-28" survivorship_bias_corrected: true Backward compat: legacy snapshots (pre-0.10.7) still have these fields as null per the Pydantic optional default. ## Closes the Phase 4.6 chain | Layer | PR | Status | |---|---|---| | Module | #274 | members_at() + CSV + tests | | Schema | #274 | Metadata fields + types.ts + snapshot | | Validation gate | #275 | universe_provider kwarg in pbo_dsr | | **Writer** | **this PR** | **forward cron populates Metadata** | ## NOT in this PR (next follow-ups) - Honest re-validation of existing pillars + manipulation_index with historical universe (likely shifts PBO/DSR baselines DOWN 5-15%) - Verify-helper Section M for universe-provenance accounting equation - Backtest harness that consumes the new universe_provider end-to-end
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Pre-merge production simulation
Diff vs main
Main baseline: Top-10 movers (sorted by |Δcomposite_score|)
|
This was referenced May 27, 2026
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
Closes the last leg of the Phase 4.6 chain. After this PR, the next weekday cron's
metadata.jsonwill actually populate the two universe-provenance fields (universe_membership_as_of+survivorship_bias_corrected) instead of leaving them None.Tiny 51-line PR — single Metadata kwarg addition in
compute/main.py+ 2 round-trip writer tests.The chain (after this PR)
members_at()+ CSV + 20 testsMetadata.universe_membership_as_of+survivorship_bias_corrected(nullable)universe_providerkwarg inpbo_dsr.factor_passes_gates()What goes live on next cron
Next weekday cron (Wed 2026-05-28 22:00 UTC) writes:
Backward compat: legacy snapshots (pre-0.10.7) still have these fields as null per the Pydantic optional default.
Hard rules preserved
Verification
ruff checkpython -m compute.output.schema_checkpytest tests/test_output/test_writer.py -k metadataTest plan
universe_membership_as_of="2026-05-27"+survivorship_bias_corrected=Truesurvive Pydantic → JSONcompute/main.pytouchedNOT in this PR (next follow-ups per priority queue)
manipulation_indexwith historical universe (~2-3d) — likely shifts PBO/DSR baselines DOWN 5-15%; explicit honest-correction PR<aff10b5One>mini-parser firstSubscribe-after-open suggestion: same pattern as #271-#275.
Generated by Claude Code