Skip to content

Engine train: margin state of a full-margin long, and negative-limit exit reservation - #859

Merged
luisleo526 merged 2 commits into
mainfrom
train/engine-20261113e
Nov 13, 2026
Merged

luisleo526 merged 2 commits into
mainfrom
train/engine-20261113e

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

One commit on main (a9c58cf) carrying two reviewed members, merged in order:

The two new test registration files sit in tests/lanes.d. Documentation line anchors that the two code changes moved are re-pointed by line number only; no sentence text changes, and the anchor checker resolves every citation.

Fixes #812
Fixes #826

🤖 Generated with Claude Code

…anchors re-pointed

Members, merged in order on main a9c58cf:
- #812: the long-tick margin state of a full-margin long, with the measured x86_64 layout pins (heads 102ffb6, bca5a47)
- #826: a strategy.exit whose limit price is negative reserves its quantity (heads 8b77a164, 4808823d, take-main bbc529d7)

The two new test registration files sit in tests/lanes.d. Documentation line anchors that the two code changes moved are re-pointed by line number only; no sentence changes. Introducing commits of the re-pointed citations: 8b77a164, 4808823d, bca5a47, 102ffb6.

Fixes #812
Fixes #826

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@graphify-labs graphify-labs Bot 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.

Graphify reviewed this change.

No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.

Not checked: tests were not run; no formal proof of the changed code.


Graphify review — findings

Adds chart-tick margin calls for qualifying full-margin long positions (unleveraged, one long lot opened at a bar's open, no slippage, bracket or limit orders). They re-check once after a call and carry any further sale to the next waypoint unless that waypoint makes its own call. Every margin requirement and deficit, long or short, is now rounded to ten significant digits but never more coarsely than one currency unit, and other positions keep their old behaviour apart from that rounding above 10^10. Fixes strategy.exit on a short position whose limit computes negative so the order keeps resting and reserves its qty_percent share, and a later partial exit sizes from what is left. The resting order has a zero trigger, so a feed with prices at or below zero would fill it at 0 where TradingView would not. Refreshes the ADR line references and the native-parity design and migration docs for the new margin-call scope, and makes the pre-open margin scheduling branch in on_applied an else if of the opening-check chain.

Review partial — this diff was larger than one review pass covers, so later files were not reviewed; some findings may be missing.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 2269 functions depend on the 2139 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: find() — 10 callers, 4 callees
  • worse: observe() — 4 callers, 5 callees

Verification — 2269 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 2220 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

1434 of 1434 test file(s) selected (100%) via static blast radius.

Escalated to a full run for safety (noncode-change, uncovered-code) — the selection is not trustworthy on its own (see below). CI should run the whole suite.

  • benchmarks/tests/test_aggregate.py — full-run-safety
  • benchmarks/tests/test_check_provenance.py — full-run-safety
  • benchmarks/tests/test_compare.py — full-run-safety
  • benchmarks/tests/test_public_names.py — full-run-safety
  • benchmarks/tests/test_run_all.py — full-run-safety
  • benchmarks/tests/test_run_strategy_feeds.py — full-run-safety
  • docker/pineforge_sink_finalize_test.py — full-run-safety
  • docker/pineforge_sink_replay_rq_test.py — full-run-safety
  • docker/pineforge_sink_replay_test.py — full-run-safety
  • docker/pineforge_sink_to_json_test.py — full-run-safety
  • docker/quota_columns_test.py — full-run-safety
  • docker/quota_convert_test.py — full-run-safety
  • docker/quota_finalize_test.py — full-run-safety
  • docker/replay_rq_engine_test.py — full-run-safety
  • docker/run_json_artifact_window_test.py — full-run-safety
  • docker/run_json_bin_test.py — full-run-safety
  • docker/run_json_bounded_transport_test.py — full-run-safety
  • docker/run_json_bulk_equity_fuzz_test.py — full-run-safety
  • docker/run_json_bulk_equity_test.py — full-run-safety
  • docker/run_json_codes_test.py — full-run-safety
  • docker/run_json_converter_metadata_test.py — full-run-safety
  • docker/run_json_converter_session_test.py — full-run-safety
  • docker/run_json_diagnostics_test.py — full-run-safety
  • docker/run_json_equity_scan_test.py — full-run-safety
  • docker/run_json_fused_test.py — full-run-safety
  • docker/run_json_harnesses_test.py — full-run-safety
  • docker/run_json_metrics_only_test.py — full-run-safety
  • docker/run_json_misc2_test.py — full-run-safety
  • docker/run_json_misc_test.py — full-run-safety
  • docker/run_json_pfbar_test.py — full-run-safety
  • docker/run_json_provenance_test.py — full-run-safety
  • docker/run_json_quota_supervisor_test.py — full-run-safety
  • docker/run_json_replay_test.py — full-run-safety
  • docker/run_json_selected_sink_test.py — full-run-safety
  • docker/run_json_sink_lexical_test.py — full-run-safety
  • docker/run_json_sink_summary_test.py — full-run-safety
  • docker/run_json_sink_test.py — full-run-safety
  • docker/run_json_sink_vectors_test.py — full-run-safety
  • docker/run_json_spool_work_test.py — full-run-safety
  • docker/run_json_stringio_test.py — full-run-safety
  • docker/run_json_symbol_feeds_test.py — full-run-safety
  • docker/run_json_syminfo_test.py — full-run-safety
  • docker/run_json_trade_scan_test.py — full-run-safety
  • docker/run_json_window_budget_test.py — full-run-safety
  • docker/run_json_wrapper_work_test.py — full-run-safety
  • include/pineforge/native_run_spec.hpp — full-run-safety
  • scripts/derive_corpus_feeds_self_test.py — full-run-safety
  • scripts/fingerprint_self_test.py — full-run-safety
  • scripts/run_corpus_self_test.py — full-run-safety
  • scripts/test_abi_receipt_skips.py — full-run-safety
  • … and 1384 more

non-code file(s) changed (CHANGELOG.md, ci/cr150-source-sites.json, docs/adr/0001-kernel-adapter-boundary.md, docs/design/arena-bound.md, docs/design/cr150-contracts.md …) → running the full suite for safety (a code graph can't see config/fixture/data deps)

changed code file(s) with no mapped test (CHANGELOG.md, docs/adr/0001-kernel-adapter-boundary.md, docs/design/arena-bound.md, docs/design/cr150-contracts.md, docs/design/native-feature-parity.md …) — a coverage gap or a missing link — running the full suite rather than only the selected tests

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

· 2 more finding(s) on lines outside this diff (see the check run).

The #812 margin-state re-pin moves observe_long_tick_margin_bar into the pinned source window; keep the gate assertion exact on the train head.
@luisleo526
luisleo526 merged commit 14e63bb into main Nov 13, 2026
16 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

1 participant