PineForge
unreleased
Deterministic PineScript v6 backtest runtime — C ABI reference
Loading...
Searching...
No Matches
query_refusal.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <exception>
4
5
namespace
pineforge
{
6
7
/// The refusal of a read-only state query, or of a report-only write, that may
8
/// no longer be answered.
9
///
10
/// BacktestEngine::broker_state_hash() and BacktestEngine::stream_state_hash()
11
/// throw it, before they project or fold anything, when the engine carries
12
/// selected-window provenance and its selected run has sealed: a post-seal read
13
/// is refused by name instead of answering from state the window no longer
14
/// owns. An engine without that provenance never throws it, and an engine has
15
/// it only when its run was admitted as a selected window. The check reads
16
/// only the engine's own execution slot and its consumer's open flag, so it
17
/// allocates nothing, runs no host code and is no input of any hash.
18
///
19
/// A caller that needs a selected run's terminal witness asks for it before the
20
/// run: enable set_broker_state_hash_recording(true), run, and read the last
21
/// recorded broker-state row (pf_report_t::broker_state_hash). A broker-state
22
/// row is not a stream-token value: stream_state_hash() has no recorded
23
/// counterpart, and no row means no witness.
24
///
25
/// Report-only writes. The same condition, the same predicate and this same
26
/// exception also fence the writers of the report-only terminal quote
27
/// (docs/report-terminal-quote.md), whose values the sealed capture can no
28
/// longer use: once the selected run has sealed (completed, failed or aborted),
29
/// source::PineStrategyHost::set_syminfo_metadata for the two reserved keys
30
/// report_terminal_quote_time_ms and report_terminal_quote_close, and
31
/// source::PineStrategyHost::clear_report_terminal_quote, throw it before any
32
/// store, whatever the value; the bool
33
/// source::PineStrategyHost::set_report_terminal_quote returns false instead,
34
/// also with no store. A preset before the first admitted begin, and every
35
/// handle without selected-window provenance, keep their original behaviour. The
36
/// refusal latches no run failure, leaves the captured report as it was and
37
/// changes nothing a read of the run's error, status or first cause would show.
38
///
39
/// The C exports never throw it. strategy_state_query_status_v1() reports
40
/// whether both queries would be refused, and strategy_broker_state_hash() and
41
/// strategy_stream_state_hash() return 0 for a refused read without entering
42
/// the C++ path. The C export strategy_set_syminfo_metadata() is void and
43
/// swallows every exception, so its refusal of a quote key is observed through
44
/// strategy_state_query_status_v1(): SELECTED_WINDOW_AFTER_SEAL means the write
45
/// stored nothing. Neither route changes a run's error, status or first cause.
46
/// Proof: tests/test_selected_quote_seal.cpp forces every writer after a
47
/// selected seal and compares the host object's bytes across the rejected call.
48
///
49
/// what() is the fixed literal "selected_window_query_after_seal"; the class
50
/// holds no string and allocates nothing.
51
class
SelectedWindowQueryAfterSeal
:
public
std::exception {
52
public
:
53
const
char
*
what
() const noexcept
override
{
54
return
"selected_window_query_after_seal"
;
55
}
56
};
57
58
}
// namespace pineforge
pineforge::SelectedWindowQueryAfterSeal
The refusal of a read-only state query, or of a report-only write, that may no longer be answered.
Definition
query_refusal.hpp:51
pineforge::SelectedWindowQueryAfterSeal::what
const char * what() const noexcept override
Definition
query_refusal.hpp:53
pineforge
Definition
array.hpp:42
include
pineforge
query_refusal.hpp
PineForge unreleased — Apache-2.0 —
github.com/pineforge-4pass/pineforge-engine
—
pineforge.dev