Fix deterministic ordering for multi-instrument market shards - #89
Merged
Conversation
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.
Closes #88.
Root cause
The Development manifest is valid producer output: 8 immutable shards, 7 empty, and shard 04 contains 546 rows for 2 instruments ordered by
(instrument_id, bar_start_at). The consumer incorrectly required timestamps alone to increase across every row and object, so the timestamp reset at the second instrument was rejected asINPUT_DATASET_UNREADABLE.Fix
(instrument_id, bar_start_at)or the existing(bar_start_at, instrument_id)layout;iter_batches -> bar_events_from_batches -> MarketEventClock, including shard-local schema metadata and empty shards.Verification
python -m mypy: passed;python -m ruff check src tests: passed;7a907241eddea0c24742470e8ee99753dea83f19cb2ad992cccad34c78134c60:ecceb57f-b345-4a58-a96d-ea827ed6d115: COMPLETED;2f4dbde9-2c35-4c36-97ba-4ca29dfe3ab5: COMPLETED;7f7113c9-3b02-4098-97ec-0baa07e2b3b0, policydevelopment-official-backtest-2026-q3-v2, all 8 exact S3 versions, 546 rows, 273 evaluation steps, and produced replay digesta09631d8037d774297dd0da75223e3b8774e1c5d3e6426b418d7ecc227121499;The failed public run and all existing DLQ messages remain untouched. This PR intentionally does not update the root submodule pointer or deploy Development.