3.7 KiB
Prompt
The human requested: first freeze a commit-plan for the existing close-copy/null-repair changes, then implement ib_async historical schedule support with tests, use it for datad.ib history-buffer gap spacing, and plan a common on-demand segment interface for CLI and chart selection. Avoid reindexing in this first pass and record fallback insertion only as a TODO.
Response summary
Implemented historical schedule normalization, bounded startup reservations, explicit actor-local synthetic ranges, and two read RPC functions. Added deterministic adapter tests and real SHM/parquet startup coverage. Wrote the segment-backfill interface plan.
This entry covers the new schedule work only. The earlier frozen null-repair plan has its own provenance. The shared _history.py file contains changes from both scopes until the earlier commit is made.
Human edits
The human identified cancellation during backfill as the reproducible trigger, explained the packed-index insertion tradeoff, requested reuse of venue closure knowledge, and chose placeholders to avoid expensive rewrites. They required explicit placeholder annotation, proposed later graphics compression, and asked to defer insertion fallbacks. They also requested the existing null-repair commit plan before the new schedule work. These are human-directed architecture and scope choices; no acceptance or task completion state is inferred.
Validation and limits
55 targeted tests passed; Ruff and diff checks passed. No live IB qualification was performed. Reservations are synthetic, not recovered observations. Repair execution, persistence of unfinished requests, chart compression, FSP handling, export filtering, and request-level IB cancellation remain follow-up work documented in the plan.
Files changed
piker/brokers/ib/venues.pypiker/brokers/ib/api.pypiker/brokers/ib/feed.pypiker/tsp/_reserve.pypiker/tsp/_history.pytests/providers/test_ib_schedule.pytests/providers/test_history_reservations.pydocs/history_segment_backfill.rst
Pre-commit module review
The human requested placing historical schedule normalization in the existing venues.py module, naming the allocation module _reserve.py, and adding the missing project license headers. Applied those moves, updated imports and test patch targets, and added the standard AGPL headers to the new allocation module and both new test modules.
Local tuicr review follow-up
The human supplied eleven comments requesting a configurable newest gap count, caller and metadata references, explanations of guards and provider-specific limits, multiline boolean style, capacity fallback rationale, an explanation of numpy split boundaries, and clearer test cases, fixture types, and module docstrings.
Added newest_gaps=32, with zero disabling queries and negative values rejected. Documented tsdb_backfill ownership and the local/RPC range accessors. Explained recoverable overflow and half-open synthetic range grouping. Typed tmp_path as pathlib.Path and monkeypatch as pytest.MonkeyPatch. Added four request-budget cases.
Verification: reservation tests 11 passed; schedule tests 7 passed; Ruff and git diff –check passed. Changes remain unstaged for review. No forge review or CI state was queried; this was local feedback.
Provider-test layout review
The human requested grouping both new history/schedule test modules under tests/providers. Moved both files without changing test logic; they retain the shared tests/conftest.py fixtures.