You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8e558eb
Browse filesBrowse the repository at this point in the historyBrowse files
Say what the per-bar broker hash is for, where its API is documented (R5 gap lane Q4)
The ruling the preceding commit pinned, stated at the three places the audit
named plus the one sentence elsewhere that contradicted it. Documentation and
comments only; no code, no behaviour, no epoch decision.
* include/pineforge/engine.hpp — set_broker_state_hash_recording's comment
now says what a row is (the run's continuation identity at that bar, not
its trade outcome), that NativeRunPhase is folded into it on purpose, the
two directions of the contract, the measured fact that the broker half
alone is driving-mode invariant, and where the batch<->stream oracle
actually lives.
* include/pineforge/pineforge.h — the same contract in the C doxygen, in the
terms a C caller has: the len identity is what survives across drivings,
the rows are not comparable between a run() and a stream_begin, and what
pins batch<->stream is the outcome itself.
* docs/pages/native-engine.md — the paragraph's "A row is a function of the
run's past only ... which is what makes the array a replay check" replaced
by the qualified statement and a bullet each for same-driving, different-
driving and the invariant broker half; the oracle named by artefact
(tests/test_native_margin_fx_roll.cpp section 8, tests/test_streaming.cpp,
scripts/check_corpus_parity.sh for the adapter).
* include/pineforge/native_c_api.h — "Two runs that folded the same
declarations and the same inputs answer the same value" was false across
drivings and is now qualified to "driven the same way", with the batch-vs-
stream case spelled out. Minimal and local: lane P4 owns this file.
Anchors. The paragraph's own two citations were stale and are corrected:
engine.hpp:2867 (past EOF, the header is 2803 lines) -> engine.hpp:2781, and
native_execution_consumer.cpp:6519 -> :6630, both re-read on this tree. The
engine.hpp and pineforge.h insertions shift the lines below them, so the three
citations that pointed there are re-anchored too (pineforge.h:1029 -> :1043,
:1037 -> :1051, :1063 -> :1077). Pre-existing drift elsewhere — engine.hpp:2897
and :2987 are past EOF, engine.hpp:2803 resolves to a closing brace — is
untouched: it was already wrong and belongs to the documentation lane.
Guards on this tree: check_c_abi_runtime, check_native_c_api_surface,
check_native_cpp_versions, check_broker_state_hash_coverage and
check_adapter_spec_shadowing all exit 0.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 50dd7fb209040322a12a5db8aefa00845135037f)
| i |`pf_pending_order_v1_t` Pine-named fields | pending_order_mirror.hpp:73, pending_order_mirror.hpp:135, pending_order_mirror.hpp:147-156, pending_order_mirror.hpp:164-169; enumerated by pending_order_mirror.cpp:140-174; written only by pine_adapter.cpp:16317-16346 | no change | Freeze (ABI). The neutral view arrives beside it (L7 / L13) | O (single-source) |
213
213
| j | Pine-shaped lot flags |`PyramidEntry::market_pyramid_add` engine.hpp:247 (written only pine_strategy_host.cpp:500, read pine_adapter.cpp:15533, hashed engine_state_hash.cpp:57); `ordinary_market_open`, `pooc_terminal_market_entry`, `ordinary_stop_open`, `bracket_slot_shadowed` engine.hpp:242-283 have no writer in `src/` or `include/` yet are hashed (F); `entry_path_position` engine.hpp:253 is never written, hashed engine_state_hash.cpp:58 (O) | HASH-VISIBLE | Move the live flag to an adapter side table keyed by `entry_incarnation` (the adapter already keeps `PlacementTable` pine_adapter.hpp:297-476) and fold it through `hash_source_extension`; delete the dead ones; update the hash-coverage waivers. Whether a kernel TU beyond the hash reads them is unverified (O) | F O S |
214
214
| k |`margin_call_enabled_`| engine.hpp:606, setter engine.hpp:3294-3298; no kernel reader; forwarded to the adapter pine_strategy_host.cpp:306 | HASH-VISIBLE (R5-8) | After L4 the kernel toggle is the presence of `spec.margin`. Move the flag and its C setter semantics into the source host; the C symbol stays (pinned runtime list) | F O |
215
-
| l | Kernel decodes adapter strings |`closed_trade_close_cause` engine_trade_accessors.cpp:155-167 branches on `"__margin_call__"` and two `"Close Position (…)"` prefixes that only `src/source/**` writes; the stale comment engine_trade_accessors.cpp:145-149 cites the deleted `engine_risk.cpp`; it implements a public C contract pineforge.h:1037, pineforge.h:1063-1065 | HASH-VISIBLE (adds durable state) | Kernel `enum class CloseCause` recorded on the `Trade` at settlement (the kernel sets `MarginCall` when L4 liquidates; a source virtual covers adapter causes). C numbers unchanged. After L4 | O (single-source) |
215
+
| l | Kernel decodes adapter strings |`closed_trade_close_cause` engine_trade_accessors.cpp:155-167 branches on `"__margin_call__"` and two `"Close Position (…)"` prefixes that only `src/source/**` writes; the stale comment engine_trade_accessors.cpp:145-149 cites the deleted `engine_risk.cpp`; it implements a public C contract pineforge.h:1051, pineforge.h:1077-1065 | HASH-VISIBLE (adds durable state) | Kernel `enum class CloseCause` recorded on the `Trade` at settlement (the kernel sets `MarginCall` when L4 liquidates; a source virtual covers adapter causes). C numbers unchanged. After L4 | O (single-source) |
216
216
| m |`request.security` machinery | engine_security.cpp:22, engine_aux_security.cpp:89-140, `SecurityEvalState` engine.hpp:1974-2178 carry Pine semantics (lookahead, gaps, Heikin-Ashi, KI-55 range start) and are driven only by the source layer | HASH-VISIBLE / measured path | F planned to move both TUs and the state into the source host after native HTF. **R5-6 narrows this:** L6 reuses the feed store and routing, so those stay kernel; only the Pine-only evaluator semantics remain candidates. Do last. **Status (lane L12b): done** — the evaluator semantics are `source::PineSecurityEvalState` + `src/source/pine_security_eval.cpp`; the kernel keeps the registry, aggregator, feed store and one generic step | F S |
217
217
| n | S-only proposals, not adopted | A generic `FillModel` interface with a TV model installed by the adapter (for the TV money / tick / path comments and helpers engine.hpp:1125-1348, engine.hpp:1514-1621); "emit generic FIFO facts and let an adapter policy produce the KI-62 scratch" | — | Superseded by R5-3 (price-grid lane) and R5-1 (TV fill specifics stay behind `resolve_execution_terms`); the dead-helper part is item e; there is no scratch code left to re-lower (item d) | S |
218
218
| o | `pineforge::admission` (market-admission journal) — **N14 addition** | `include/pineforge/market_admission.hpp` (275 lines, installed by a kernel-only build) + `src/market_admission.cpp` (kernel TU): the observation journal of TradingView admission reviews; every `Configuration` field is a `strategy()` declaration parameter. No kernel TU consumed it (engine.hpp included it and used nothing; the hash helper in `src/broker_state_hash_internal.hpp` had one caller, `src/source/pine_state_hash.cpp`) | NEUTRAL (pure move; the fold is unchanged, so no hash domain moves) | **Status (N14): done** — moved whole to `include/pineforge/source/market_admission.hpp` + `src/source/market_admission.cpp` (`PINEFORGE_SOURCE_LAYER_SOURCES`); `hash_admission_field` moved verbatim into the source hash TU; `check_market_admission_schema.py` re-pointed; `MarketAdmissionDraft` / `MarketAdmissionJournal` spellings and the `market_admission_v2` inline namespace unchanged. ADR-0001 no longer calls it a generic stem | audit (Opus N14) |
|`strategy.closedtrades`, `strategy.closedtrades.*`|`closed_trade_count()` / `closed_trade(i)` engine.hpp:2395-2396, a `Trade` row; C: `pf_report_t::trades` (`pf_trade_t`) plus `strategy_closed_trade_entry_id` / `_exit_id` / `_exit_comment` / `_close_cause` / `_entry_incarnation` pineforge.h:1029-1089 | Field by field in [Open and closed trades](@ref pine_to_native_map_trades). `report_trade_count()` / `get_report_trade(i)` engine.hpp:2403-2406 span the same rows followed by the range-end rows. |
123
+
|`strategy.closedtrades`, `strategy.closedtrades.*`|`closed_trade_count()` / `closed_trade(i)` engine.hpp:2395-2396, a `Trade` row; C: `pf_report_t::trades` (`pf_trade_t`) plus `strategy_closed_trade_entry_id` / `_exit_id` / `_exit_comment` / `_close_cause` / `_entry_incarnation` pineforge.h:1043-1089 | Field by field in [Open and closed trades](@ref pine_to_native_map_trades). `report_trade_count()` / `get_report_trade(i)` engine.hpp:2403-2406 span the same rows followed by the range-end rows. |
124
124
|`strategy.netprofit`, equity curve, drawdown | partial — `fill_report` engine.hpp:3161 | The trade list and trade statistics are filled; for a bare native host the **equity curve is empty** (the recorders are protected, engine.hpp:2386-2412) so equity metrics degenerate silently engine_metrics.cpp:168, and a position still open at the end has no range-end row engine_run.cpp:191. **Lane L2**. |
125
125
|`strategy.opentrades`, `strategy.opentrades.*`|`native_open_lots(mark)` native_host.hpp:861 → one `NativeOpenLot` native_host.hpp:255 per open physical lot; C: `strategy_native_open_lot_count_v1(s, mark)` / `strategy_native_open_lot_get_v1(s, i, &row)` native_c_api.h:871-879 → `pf_native_open_lot_v1` native_c_api.h:509 | Owning snapshot of the book lot by lot, oldest first, marked at the price you pass (Pine marks at the current `close`; pass the bar's close in `on_native_bar`, the fill price in `on_native_applied`, the print in `on_native_tick`). Observation only: it moves no fill, no hash and no row. Field by field in [Open and closed trades](@ref pine_to_native_map_trades). |
0 commit comments