Skip to content

fix: keep shadow order identities unique across restarts - #122

Closed
stefan-jansen wants to merge 8 commits into
mainfrom
fix/shadow-order-identities
Closed

stefan-jansen wants to merge 8 commits into
mainfrom
fix/shadow-order-identities

Conversation

@stefan-jansen

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

Copy link
Copy Markdown
Contributor

Shadow orders submitted within one clock tick share an ID. The initial sequence-based repair also repeats IDs after a broker restart while the execution journal persists. Generate unique identities for both normal shadow fills and shadow position reductions.

Closes #117. Resolves the shadow-identity part of #111. Retains the original contribution from #112 by quantum-like/Cursor Agent, then corrects its restart collision.

Regression: uv run pytest -q tests/contracts/test_causal_strategy_parity.py::test_shadow_order_identities_do_not_collide_within_ticks_or_after_restart tests/unit/test_safe_broker.py::test_shadow_order_ids_stay_unique_when_the_clock_does_not_advance.

  • Producing base 2ad36a8: the engine workflow produces only two unique IDs for six returned orders.
  • Intermediate sequence repair d435e4d: the unchanged workflow produces only three unique IDs across the two engine runs.
  • Fix 679fe19: both tests pass; six strategy-submitted orders/reductions remain distinct and both engine runs finish flat without venue submission.
  • The failing-base run loads the complete original producing source from git archive and runs the unchanged regression. Ruff and commit hooks, including ty, passed. Full supported-runtime and artifact qualification runs in hosted CI before merge.

Depends on security baseline #109. No release is included.

AI assistance: Cursor prepared the original repair; Codex reproduced the restart failure, revised identity generation, added the public-engine regression and ran checks.

Current qualification head: 54bbca4, integrated with merged IB fix #104. The two identity regressions and all 12 provider-contract cases pass in 3.23s. The latter retain IB-adapter invalidation and shared-safety invalidation for both IB and Alpaca. Security prerequisite #109 is merged. Current-head hosted qualification remains required before merge.

dependabot Bot and others added 4 commits October 7, 2026 02:36
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.7.0...2.8.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.8.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Shadow fills used a millisecond timestamp as the order id. Two orders
accepted in the same millisecond shared an id, so later reconciliation
overwrote the first fill.

Co-authored-by: quantum-like <quantum-like@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 17, 2026 14:07

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 stefan-jansen added type: bug Confirmed or reported incorrect behavior priority: normal Normal planned work status: accepted Accepted for implementation compatibility: affected Has Python, platform, dependency, or cross-library compatibility impact labels Oct 17, 2026
@stefan-jansen

Copy link
Copy Markdown
Contributor Author

Superseded by the combined maintainer-directed maintenance PR #121 to avoid qualifying and merging this queue separately. This PR head and its regression/documentation evidence are preserved in #121 and in a verified recovery archive. The accepted issue remains open until the combined fix lands; this closure does not claim the fix is merged. Follow-up work continues in #121.

@stefan-jansen
stefan-jansen deleted the fix/shadow-order-identities branch October 18, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compatibility: affected Has Python, platform, dependency, or cross-library compatibility impact priority: normal Normal planned work status: accepted Accepted for implementation type: bug Confirmed or reported incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep shadow order identities unique within one clock tick

3 participants