Skip to content

feat(storage): reconstruct portable inputs and exchange legacy bundles - #130

Merged
stefan-jansen merged 10 commits into
mainfrom
feat/portable-input-snapshots
Oct 21, 2026
Merged

stefan-jansen merged 10 commits into
mainfrom
feat/portable-input-snapshots

Conversation

@stefan-jansen

@stefan-jansen stefan-jansen commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Owning issue

Closes #122

Outcome

Retain and reconstruct explicit market-data input sets independently of mutable storage generations.

  • Add storage.SnapshotTable, InputSnapshot, export_snapshot and read_snapshot. Capture frames or protected committed storage keys, caller-supplied effective configuration, source/as-of/unit/revision declarations and existing Specs artifacts.
  • Copy immutable relative members, flush and verify staged publication, validate all hashes before parsing, and reject changed destinations. Preserve original keys, nulls, nanoseconds, civil labels and explicit calendar selection.
  • Add optional compat.zipline.export_bundle through supported asset/bar/history readers, plus standard-writer make_bundle_ingest for staged migration. Preserve raw daily/minute arrays, supplied factors, dated equities/futures, payout identities/indexes and rename lookup intervals. Reject lossy target price scales before invoking writers.
  • Add a runnable native six-table CSV/Parquet reconstruction example and migration/storage/API documentation. Source pruning, replacement and archive relocation do not change reconstructed preparation outputs.

Compatibility and numerical behavior

Existing provider, storage and adjustment defaults remain unchanged. New interfaces are opt-in; Zipline is required only in the optional conversion environment, never for native snapshots. Shared declarations use Specs and the canonical explicit calendar > feed metadata > NYSE precedence; explicit None disables calendars and 24/7 remains scheduled.

Unknown publication times, quote currency, merger consideration and original listing endpoints are not invented. Source history factors retain their own method. Data prepares inputs, not runtime history, analytical cleaning or broker/account execution. A snapshot hash identifies bytes and declarations, not financial equivalence or authentication.

Verification

Final reviewed head: f14de81177a407969a3ec2ede5923035bf5f91bd.

  • All 28 hosted checks completed: 27 success plus the configured Python 3.15 exception, whose validator succeeded. All supported Python 3.12-3.14/Linux/macOS/Windows, security, documentation, coverage, ecosystem and installed-bundle gates are green.
  • Full local normal lane: 4,531 passed, one optional conversion-environment skip and 292 deselected in 345.63s; coverage 85.75% against the unchanged 85% threshold. Separate ResourceWarning-error lane: 4,531 passed in 362.92s. Ruff, format, ty, strict docs, source-identified rendered docs/internal/external links, builds, actionlint and all hooks passed.
  • Seven contract controls pass on the final head with correct and deliberately violated producing-code runs; zero waivers, findings, unreachable or deferred items. The milestone verification check passes.
  • Actual CSV frame and committed-key exports reproduce omitted implicit/metadata-only calendars on 50bbcf5 (two failures). The final head passes all 39 focused cases, retaining default NYSE, metadata-only null/24/7 and explicit overrides through shared versioned FeedSpec declarations. Unclocked reference tables remain unclocked.
  • Actual standard-writer precision regression fails on d176600 for an incompatible target scale while configured precision passes. The final installed route passes all 13 real standard bundle producer/export/native-factor/re-ingestion cases, including empty selection, stock-dividend recipient identities, daily/minute arrays and dated futures. Interrupted data-flush publication also has failing-base/passing-fix evidence.
  • Clean final wheel and source-distribution installs both match all 177 packaged Git source files. Both pass native reconstruction without any Reloaded runtime, actual installed downstream consumers, all 13 compiled Zipline cases and all 39 selected dependency-floor cases. The dedicated hosted installed-conversion job also passes all 13 tests.
  • Recovered native outputs pass actual Engineer labeling, Diagnostic forward returns and Backtest contract/position quantities. The Backtest assertion is USD500, not corporate-action account-ledger parity.

Qualified Data 0.2.2.dev30+gf14de8117, Specs 0.2.0, Python 3.12. Native latest uses pandas 3.0.6/Polars 2.0.0; selected floors use pandas 2.3.3/Polars 1.36.1/pandas-market-calendars 5.4.0. Optional Zipline Reloaded 3.2.0 is pinned to cf649ac06fddce76f6caa2403cd8494ac84f72ad; Engineer to c69e7badaac012ad98b1c4b8aa9a67a952b08f5c, Diagnostic 0.1.9, Backtest to 12a2c483f8f1fda54244af187db8bf44e6f85fc9. Upstream deprecations remain visible; ResourceWarnings are errors.

Wheel SHA256: e95ed397a1b3a3580b2b6e013cee20418c045c4750a3b1c2e785226300a6b2bc.
Source-distribution SHA256: ae06fdedf276bac0dd19090d7e4082648794f60f4a15e7eeb48053adac25211e.

AI assistance

Codex assisted with implementation, tests, documentation and evidence review. This submission has been substantively reviewed against its public contracts and independently expected values; it is not an import-only parity claim.

Documentation and release

Existing guides are preserved and extended with runnable migration steps, input requirements and ownership/qualification limits. This is unreleased source work. No release, tag, package publication, documentation deployment or announcement is part of this PR; published Data 0.2.1 remains immutable.

Stefan Jansen added 8 commits October 21, 2026 00:11
Capture each source generation and declaration under its actual writer lock. Copy immutable Parquet files, preserve precision and missingness, hash canonical effective input/configuration separately from capture time and generation identifiers, and verify all files before parsing any table. Reject unsafe paths, credentials, incomplete declarations and conflicting immutable destinations without replacing prior valid results. Reuse the acquisition batch atomic-file helper unchanged. Native snapshot and focused Flat/Hive storage checks pass 170 cases with ResourceWarning errors. Batch 122 integration, docs and final gates remain unfinished.
…cation

Three fresh-archive public regressions demonstrate that source-prefixed API keys, access tokens and client secrets escaped the initial declaration filter. Reject normalized credential suffixes before publication. Carry the owning acquisition PR shared helper repair so snapshots also flush writable staging handles on Windows. Focused native snapshot and storage checks pass 173 cases with ResourceWarning errors.
Use supported source readers, the existing history-compatible adjustment reader and Zipline standard writers. Preserve original sid namespaces, raw bars, payouts, source rows and indices, known lifetimes and contract terms; keep unknown publication, currency and merger terms explicit. Preserve distinct exchange identity versus canonical calendar names and right-labeled minute clocks. A real generated equity/minute/two-futures bundle passes native supplied-factor history, unchanged-source hashes and exact writer/reader re-import checks. This is a passing development checkpoint, not final batch 122 qualification.
…tion

Reuse the existing captured CSV/Parquet migration recipes. Export six declared tables with actual source revisions, per-role units, separate identity namespaces and explicit preparation settings. Rebuild the same equity history and contract selections after five source generations prune the capture, the original futures file changes and the archive moves. The standalone workflow and native snapshot checks pass 35 cases; account execution is explicitly outside this recipe.
… publication

Real standard-writer regressions reproduce empty-selection failure and a missing stock-payment recipient identity. Return typed empty tables before invoking readers that require an asset, and capture referenced payment metadata without fabricating its price coverage. Preserve per-table unknown as-of declarations and CSV-produced role/schema/unit/missing-cell facts. A real Parquet descriptor flush-failure control exposes publication before data fsync; reuse the shared atomic-file writer for copied/generated inputs and flush directory entries before publication. Native checks pass 37 cases; the real optional bundle exchange passes 11 cases with ResourceWarning errors.
…ndency

Retain exact-source checks for the optional standard-reader/writer migration route and document the tested reconstruction stack and unknown identity declarations.

Closes #122
Copilot AI balanced review requested due to automatic review settings October 21, 2026 05:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Stefan Jansen added 2 commits October 21, 2026 01:24
An actual isolated wheel run resolves installed files from uv archive layers outside sys.prefix. Validate distribution location, reject editable/source shadowing and retain full Git source and revision checks.
Actual CSV frame and committed-key exports without a separate FeedSpec lost default/declared calendar state and ignored explicit overrides. Capture default timestamp clocks through the shared versioned FeedSpec contract while leaving unclocked reference tables unchanged.
@stefan-jansen
stefan-jansen merged commit c3b9db8 into main Oct 21, 2026
28 checks passed
@stefan-jansen
stefan-jansen deleted the feat/portable-input-snapshots branch October 21, 2026 05:53
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.

Reconstruct portable input snapshots and exchange legacy bundles

2 participants