Skip to content

Build the standalone native resting-order state machine - #246

Merged
luisleo526 merged 5 commits into
mainfrom
refactor/native-resting-state-machine-20260912
Sep 12, 2026
Merged

Build the standalone native resting-order state machine#246
luisleo526 merged 5 commits into
mainfrom
refactor/native-resting-state-machine-20260912

Conversation

@luisleo526

@luisleo526 luisleo526 commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Native strategies previously had queued market actions but no persistent resting-order lifecycle. This PR adds that state machine to the standalone C++ host: limit, stop, stop-limit and trailing requests; partial execution with capacity per input point; owner-bound children; and causal group cancellation/reduction through general submit, replace and cancel commands.

Confirmed OHLC and forward ticks use the same working-request core. Matching chooses the earliest remaining price crossing, preserves exact reached prices across rescans, and keeps observed gaps distinct from modeled continuous paths. Committed opening events establish child ownership and quantity. Cycle changes, replacement, exhaustion, group effects and dependency cleanup have deterministic terminal behavior.

The existing physical lot book remains the accounting authority. Scoped closes preserve unrelated lots and historical costs with one current fee per execution. Typed immutable events retain partial quantities, activation, ownership, receipts and failure prefixes; failed runs require discard/replay.

Requests/core/events use native_order_v2; identity values remain v1. Engine, pending, host and consumer C++ boundaries move together to epoch13, with broker/stream hash domains and old return-only native_events() link controls. C ABI4 prefixes and current calendar/session/timezone/DST/timeframe support are preserved. Complete Pine policy lowering remains codegen/adapter work in R4.

Validation on exact final candidate c57e8687d91027df09474b414369162e47b94bbb, tree e209c89035ec884774f8f3e68e1dc118f26aaf51:

  • Full local suite: 326 tests passed, zero failed; one WebSocket test skipped because the selected macOS libcurl lacks WebSocket support. All nine final PR CI checks passed, including Linux/macOS, sanitizers, and the native live runner.
  • Independent native witness ledger maps every v5 V/C/T/O/G/S/P requirement to host, core, or type evidence. Runtime, ABI/hash, test-oracle, and final scope reviews are GREEN. Concrete regression witnesses cover every discovered defect.
  • Cloud experiment exp-native-r2-c57e868-20260912: 72/72 cases, 4,190/4,190 probes, both provider executions successful. Zero full-grade, raw-trade, substantive-verifier, configuration, metadata, or coverage differences against the accepted R2a reference. Raw verifier metadata differences are retained under the existing comparator rules.
  • Actual gate pineforge-pr-gate-n976j: FAIL, target.not-positive only. Unchanged compatibility is accepted under the standing neutral-refactor authorization; no PASS receipt or baseline promotion is claimed.
  • The sanitizer ABI test now supplies historical v12 RTTI without disabling checks. The existing crash-recovery test uses a fresh writer process, preserves abrupt-exit recovery assertions, and passed 50 consecutive runs.

Squash merge must preserve the exact reviewed/measured tree. R3/R3b accounting consolidation, R4 source-policy ownership, final audit, and the later parity campaign remain subsequent roadmap work.

@luisleo526
luisleo526 marked this pull request as ready for review September 12, 2026 17:10
@luisleo526
luisleo526 merged commit e60e571 into main Sep 12, 2026
9 checks passed
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.

1 participant