Skip to content

feat(main): Phase 4.6 writer wiring — populate universe-provenance in forward cron#276

Merged
dackclup merged 1 commit into
mainfrom
claude/phase-4.6-metadata-writer-wiring
May 27, 2026
Merged

feat(main): Phase 4.6 writer wiring — populate universe-provenance in forward cron#276
dackclup merged 1 commit into
mainfrom
claude/phase-4.6-metadata-writer-wiring

Conversation

@dackclup
Copy link
Copy Markdown
Owner

Summary

Closes the last leg of the Phase 4.6 chain. After this PR, the next weekday cron's metadata.json will 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)

Layer PR What landed
Module #274 members_at() + CSV + 20 tests
Schema #274 Metadata.universe_membership_as_of + survivorship_bias_corrected (nullable)
Validation gate #275 universe_provider kwarg in pbo_dsr.factor_passes_gates()
Writer this PR forward cron populates Metadata fields

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.

Hard rules preserved

Verification

Check Result
ruff check ✅ clean
python -m compute.output.schema_check ✅ Schema snapshot in sync
pytest tests/test_output/test_writer.py -k metadata ✅ 4 passed (2 existing + 2 new)
Test count delta +2

Test plan

  • Round-trip happy path: universe_membership_as_of="2026-05-27" + survivorship_bias_corrected=True survive Pydantic → JSON
  • Legacy snapshot compat: pre-0.10.7 callers (no new kwargs) → JSON nulls
  • CI (Python lint+test, Frontend build, simulate) — expected green; simulate fires because compute/main.py touched
  • Vercel preview — N/A (no frontend touched)

NOT in this PR (next follow-ups per priority queue)

  1. Honest re-validation of existing pillars + manipulation_index with historical universe (~2-3d) — likely shifts PBO/DSR baselines DOWN 5-15%; explicit honest-correction PR
  2. Verify-helper Section M for universe-provenance accounting equation
  3. Larcker 10b5-1 (Feature 3 from Research Report v1.0) — gated on edgartools <aff10b5One> mini-parser first

Subscribe-after-open suggestion: same pattern as #271-#275.


Generated by Claude Code

…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
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quantrank Ready Ready Preview, Comment May 27, 2026 12:36pm

@github-actions
Copy link
Copy Markdown
Contributor

Pre-merge production simulation

Field Value
Duration 377s
Universe size 502
Schema version 0.10.7-phase4.6
Compute commit 39028dd9783010e0e3802b66f8df6827ad09a908
PR-branch output pr-276-compute-output (14-day retention)

Diff vs main

Field Main PR Δ
Universe size 502 502 +0
Schema version 0.10.6-phase4.5e 0.10.7-phase4.6 ⚠️ bumped

Main baseline: 2026-05-26T23:19:25Z (0.6 days old)

Top-10 movers (sorted by |Δcomposite_score|)

Ticker PR rank main rank Δrank PR score main score Δscore
ATO 374 378 +4 44.23 43.92 +0.31
PH 143 147 +4 55.72 55.49 +0.23
ES 284 285 +1 49.43 49.25 +0.18
ED 215 210 -5 52.10 52.22 -0.12
EQIX 367 368 +1 45.48 45.38 +0.10
RJF 160 160 +0 54.68 54.59 +0.09
RMD 21 18 -3 65.76 65.85 -0.09
WEC 361 362 +1 45.81 45.73 +0.08
HD 255 255 +0 50.74 50.82 -0.08
AVB 72 73 +1 59.84 59.77 +0.07

@dackclup dackclup marked this pull request as ready for review May 27, 2026 12:46
@dackclup dackclup merged commit 7480734 into main May 27, 2026
5 checks passed
@dackclup dackclup deleted the claude/phase-4.6-metadata-writer-wiring branch May 27, 2026 12:47
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.

2 participants