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 c9ba507
Browse filesBrowse the repository at this point in the historyBrowse files
report: fail with report_result_invalid when a report metric overflows (CR-202)
Report metrics that overflowed (buy_hold_return, cagr and every other
product, ratio, sum or annualisation in engine_metrics.cpp, engine_report.cpp,
runner/report.hpp and docker/run_json.py) were silently serialised as null.
Revision 3 Appendix A:82-83 and :93 allow null only for a defined absence, so
an overflowed value now raises the typed report_result_invalid
(reason nonfinite) at the computation that produced it.
- src/report_value_invalid.hpp: one finite-value guard on the existing
coded-failure mechanism.
- engine_metrics.cpp / engine_report.cpp / runner/report.hpp / run_json.py:
checked reductions and ratios; defined-domain nulls unchanged.
- tests/ownership/probes/report/buy_hold_return_overflow: the c18_3 probe,
pinned in the manifest and its checker.
- tests/test_metrics_overflow.cpp: native boundary and absence controls for
all 87 floating metrics; Python serializer expectations updated.
Not yet run on the lab: the red-first proof and the gate follow.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
`KernelRecordedAtHostMarks` records the same series at the host's own marks.
182
182
`report_open_position_at_end` books the still-open position as a mark-to-market row under
183
183
`KernelRecorded`. Under `HostRecorded` an unrecorded curve still degenerates —
184
-
`compute_equity_stats` answers its all-NaN value with no error (`src/engine_metrics.cpp:203`,
185
-
consumed by `fill_metrics_section`, `src/engine_report.cpp:138-145`) — which is why the policy exists.
184
+
`compute_equity_stats` answers its defined empty-curve metrics (`src/engine_metrics.cpp:221`,
185
+
consumed by `fill_metrics_section`, `src/engine_report.cpp:203`) — which is why the policy exists.
186
186
-**Reproducibility.** Two digests, one wrapping the other. `native_continuation_hash()`
187
187
(`native_host.hpp:1376`) returns the consumer's event/continuation hash. **A digest names
188
188
the run's inputs** (rule 2): the timezone identity enters it as the zone's *content* —
@@ -764,7 +764,7 @@ number names its symbol on this tree.
764
764
|`strategy_configure_native_v1` (`c_abi.cpp:980`) versus `strategy_configure_native_ext_result_v1` (`native_c_host.cpp:4066`) |**retained legacy base plus typed additive route**| A base specification the kernel rejects still returns `-1` and latches `Failed`, preserving its frozen caller contract; a Ready misuse retains that Contract latch. The C boundary refuses arguments, a Running phase and a Completed hash hook without entering kernel configure, so a read cannot reconfigure its host. The extended result call validates before its first configure, writes `pf_native_spec_error_t` / `pf_native_spec_field_t`, and names reused-host session-key and run-number refusals; no old signature or layout moved. |
765
765
|`strategy_configure_native_fx_curve_v1` (`pineforge.h:546`) |**typed additive route**|`strategy_configure_native_fx_curve_ext_v1` writes the C twin of `NativeFxCurveValidation` and its offending index. The old `-1` route remains unchanged, while a C caller can now distinguish a decreasing timestamp, non-positive rate, allocation failure or wrong phase. |
766
766
|`on_native_timeframe_bar` (`native_host.hpp:885`) and `NativeTimeframeBarContext::interval` (`native_host.hpp:809`) |**query routed**| The callback signature stays frozen. `strategy_native_timeframe_bar_interval_v1` is valid only during that callback and copies the kernel calendar interval without deriving it from the delivered bar or delivery timestamp. |
767
-
|`magnifier_sub_bars_total` / `magnifier_sample_ticks_total` (`engine_report.cpp:75-76`) |**kernel-owned report facts**| The generic intrabar driver already increments `NativeDriverStatistics::sub_bars_processed` / `sample_ticks_processed` for every retained path (`native_execution_consumer.cpp:8681-8693`); the kernel now publishes those same counters for bare hosts. They are report fields, not new durable state: the existing `native_continuation_hash` fold of `NativeDriverStatistics` (`native_execution_consumer.cpp:1125-1130`) sees the same values, so no hash contract moves. |
767
+
|`magnifier_sub_bars_total` / `magnifier_sample_ticks_total` (`engine_report.cpp:77-78`) |**kernel-owned report facts**| The generic intrabar driver already increments `NativeDriverStatistics::sub_bars_processed` / `sample_ticks_processed` for every retained path (`native_execution_consumer.cpp:8681-8693`); the kernel now publishes those same counters for bare hosts. They are report fields, not new durable state: the existing `native_continuation_hash` fold of `NativeDriverStatistics` (`native_execution_consumer.cpp:1125-1130`) sees the same values, so no hash contract moves. |
768
768
|`pf_native_lot_excursion_v1` (`native_c_api.h:1912`) |**additive fee tail**|`entry_commission` carries the C++ `ClosedLotExcursionFacts::entry_commission` in account currency. The callback table publishes a trailing layout marker so F4 callers still receive the base facts length; current callers receive the fee tail without changing `PF_NATIVE_API_VERSION`. |
769
769
|`strategy_outputs_set_enabled` and the eight `strategy_outputs_*` readers (`pineforge.h`, group `pf_outputs`) |**additive runtime exports**| Recording is off by default, and nothing a run computes reads the record. The event copy is size-prefixed like `strategy_pending_order_get`, and `PF_ABI_VERSION` stays 4. The writers are C++ only in this version (the BASE-CLASS SEAMS rows of `native_c_api.h`): a C host declares no outputs, so its handle answers every reader as empty. |
| ID | Feature (adapter mechanism) | Native today | Class | Lane | Sources | Notes |
157
157
|---|---|---|---|---|---|---|
158
158
| RP1 | Per-lot MFE / MAE, kernel-sampled or host-owned | **yes** — sampler `apply_excursion` native_execution_consumer.cpp:3280, closing-row fold `max_runup` engine_orders.cpp:157-171; `owns_lot_excursions` native_host.hpp:1021-1025 | K+A | — | F:H1 O:I1 O:I2 S:X1 | **Disagree:** S partial + its P8 excursion-mode enum (single-source, not adopted, Appendix A.9). **Lowered by R5 lane H-THIN:** the Pine host keeps the kernel's `owns_lot_excursions()` default, so the sampler is the Pine excursion; the host model, its entry-bar masks and its caches are deleted, and the source layer's fold no longer carries them. **Measured against TradingView first (R5 lane H-MEASURE, `tests/test_e19_excursion_tape.cpp`):** the host-owned model was `ab9714be`'s, not TradingView's — where it and the kernel sampler differ the kernel's number is TradingView's (entry-bar over-mask, exit-bar over-fold after an at-open exit, a `calc_on_order_fills` scratch TradingView reports as 0 / 0); both miss a bar's open print ahead of a same-bar stop fill. On the corpus the two models differ on 341 of 431 390 trades, and of the 326 of those a TradingView export identifies, the kernel's number is TradingView's on 315 and the host's on none. The lowering moved the cells of 335 trades in 19 corpus probes: 324 now equal TradingView's, 11 moved closer, none farther; the all-in residual's own entry-bar call is the tape of the private fixture set `e19_allin_trim`. |
| RP3 | Equity curve |**no** — `update_equity_extremes` engine.hpp:1362 / `record_equity_point` engine.hpp:1380 are protected and were called only by the adapter **Closed:**`NativeReportPolicy::KernelRecorded` native_run_spec.hpp:63 has the consumer fold the extremes and append one point per script calculation, labelled with the script interval's open; `KernelRecordedAtHostMarks` records the same series at the host's own marks (`tests/test_native_report_truth.cpp`). | K | L2 | F:H3 O:I4 S:X2| S's "partial" folds RP2 in |
161
-
| RP4 | Equity metrics (drawdown, run-up, Sharpe / Sortino, CAGR, time in market) |**no** — `compute_equity_stats` exits early on an empty curve engine_metrics.cpp:203; `fill_metrics_section` engine_report.cpp:138-145**Closed:** with a recorded curve the drawdown / run-up walk is finite and every equity metric is computed over a real series; `report_open_position_at_end` adds the still-open position as a mark-to-market row (`tests/test_native_report_truth.cpp`). | K | L2 | F:H3 O:I5| silent degenerate metrics, no error (O) |
161
+
| RP4 | Equity metrics (drawdown, run-up, Sharpe / Sortino, CAGR, time in market) |**no** — `compute_equity_stats` exits early on an empty curve engine_metrics.cpp:221; `fill_metrics_section` engine_report.cpp:203**Closed:** with a recorded curve the drawdown / run-up walk is finite and every equity metric is computed over a real series; `report_open_position_at_end` adds the still-open position as a mark-to-market row (`tests/test_native_report_truth.cpp`). | K | L2 | F:H3 O:I5| silent degenerate metrics, no error (O) |
162
162
| RP5 | Range-end row for a position still open at the end (`scheduler_record_range_end` pine_strategy_host.cpp:1982) | **yes, shared** — one generic producer `NativeExecutionConsumer::append_open_position_report_rows`, called by the kernel's run-end `record_open_position_report_rows` (`KernelRecorded` + `report_open_position_at_end`) and by the adapter at TradingView's mark; `report_trade_count()` engine.hpp:1831 includes the rows | K + A report shape | L2, Q6 | F:H4 O:I6 S:X2 | **Disagree:** S says kernel range-end rows exist (storage only). The ROWS are now the kernel's (§3.7 part 1); TV report shape — the equity re-mark, the extreme re-fold, the same-bar re-sort, three marks — stays A, measured in §3.7 part 2. The short-seed swaps (`project_short_seed_report_rows` pine_strategy_host.cpp:1444) stay A as well: a projection of two rows' `entry_incarnation` onto `ab9714be`'s numbering, which TradingView does not export; measured against the kernel's own lot identities by `tests/test_short_seed_report_swap.cpp` (R5 lane H-MEASURE), and pinned by `test_native_oracle_short_seed_percent_full_l2`, whose two incarnation checks fail when the swap is skipped. The swap runs only when a later close of the seed id closes a remnant; a flat collision keeps the kernel's numbering. |
163
163
| RP6 | Per-trade accessors |**partial** — `get_trade` is public; the `closed_trade_*` family is protected engine.hpp:1391 **Closed:**`closed_trade_count()` / `closed_trade(i)` and `report_trade_count()` / `get_report_trade(i)` are public, and `closed_trade_close_cause(i)` engine.hpp:1849 answers the typed `execution::CloseCause` the closer recorded (`tests/test_native_report_truth.cpp`). | K | L2 | F:H6| (single-source) |
164
164
| RP7 | Live order-action stream (runner ledger / webhook) |**yes** — `stream_observe_actions_` engine_execution.cpp:1383, enabled `stream_observe_actions_` native_execution_consumer.cpp:10589, C ABI `strategy_stream_order_actions_len` c_abi.cpp:737-754 | K | — | F:H5| (single-source) |
0 commit comments