Repository navigation
fix: cancel in-flight children before terminal sweeps - #9
Merged
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.
A child decided before the parent deadline but still in flight was absent from
Oms.open_orders, so window cancellation missed it. Its arrival later filled alongside the replacement terminal sweep: a 100-unit parent could fill 150 units. Thecancelmode could also fill 50 units after reporting that its window had closed.Cancel all non-terminal submitted children, including orders not yet accepted by the venue. Permit the existing OMS cancellation API's NEW → CANCELLED transition and ignore arrival callbacks for terminal children. Count live children for the open-order guard so a cancelled callback does not consume capacity and block its replacement.
Eight normalized-CSV harness cases cover cancel, sweep, explicit leave, arrival exactly at the deadline, and both one-order and ten-order capacity limits. They reconcile child statuses, cancellation timestamps and fill totals; configured latency still applies to a newly submitted terminal sweep. The execution guide documents these semantics.
Validation: the complete local suite passed 836 tests with 152 skipped. Ruff lint and format passed for 134 Python files, mypy passed for 101 source files, and the eight-policy/style deterministic demo retained its recorded output. Targeted harness/domain/architecture checks also passed. The simulator remains within the 600-line architecture limit. Required remote Python 3.11–3.13, C++ differential, ASan/UBSan and reproducibility checks are tracked at https://github.com/dev-belly/TradeForge/actions/runs/37772324785 .