Move PIT scaffolding from nowcast-data to alphaforge - #10
Conversation
Migrate general-purpose PIT abstractions so other alphaforge-dependent packages can reuse them: - Phase 0: Reconcile vintage view layer (FrozenResolver lookahead guard) - Phase 1: Exceptions (PITAdapterError hierarchy) + timestamp utilities - Phase 2: Core models (PITObservation, SeriesMetadata, PITMode) - Phase 3: PITAdapter ABC + SeriesCatalog - Phase 4: Concrete adapters (AlphaForgePITAdapter, FREDALFREDAdapter, stubs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move TargetPolicy dataclass and all release-resolution functions from nowcast-data to alphaforge so other dependent packages can reuse them. Quarter calendar helpers use inline regex logic (no nowcast_calendar dep). New exports: TargetPolicy, resolve_target_from_releases, quarter_end_date, quarter_start_date, quarter_obs_date, resolve_target_obs_date_anchor, list_quarterly_target_releases_asof, list_quarterly_target_releases_asof_multi, resolve_quarterly_final_target, get_quarterly_release_observation_stream. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Widen regex to accept any digit for the quarter field and validate separately, so the error message says "Invalid quarter: 5" instead of a generic format mismatch. Matches the original nowcast-data error semantics that downstream tests rely on. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19d6e433e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not refs: | ||
| return {} | ||
|
|
||
| if hasattr(adapter, "list_pit_observations_asof_multi"): |
There was a problem hiding this comment.
Fall back to single-query path when batch lookup is unsupported
In list_quarterly_target_releases_asof_multi, the hasattr(adapter, "list_pit_observations_asof_multi") check is always true for PITAdapter subclasses because the base class defines this method, even when it only raises NotImplementedError. In that common case, the except NotImplementedError branch currently returns empty frames for all requested quarters instead of calling list_quarterly_target_releases_asof per quarter, which silently drops valid releases for adapters that implement only the single-query API.
Useful? React with 👍 / 👎.
Summary
These modules have zero nowcasting-specific coupling and can now be reused by other alphaforge-dependent packages (e.g., positioning).
Test plan
ruff check .— zero lint errorspytest tests/— 312 passed, 7 skippedmkdocs build --strict— docs build cleantest_pit_target.pycovering all 10 exported symbols🤖 Generated with Claude Code