Repository navigation
Commit 65c69b0
Stable run-failure codes: C ABI getters, coded failure line, published catalog (#351)
* Run failure codes: the channel, the registry and the C getters
A closed RunFailureCode vocabulary (docker/run_failure_codes.json, schema
pineforge-run-failure-catalog/v1; the enum and registry are generated from
it), the coded<Base> mixin, one classifier, the record beside last_error_
in the execution consumer, and strategy_get_last_error_code / _args.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: every kernel-side failure writes its code beside its text
The execution consumer renders each failure with its code: a caught
exception is classified (its carried code, else the type safety net), a
catch (...) is engine_unclassified_error, and the literal refusals name
theirs (stream_input_rejected, run_mode_unsupported, run_options_rejected,
symbol_metadata_rejected, chart_bars_rejected with the request's row, field
and reason, out_of_memory, run_aborted). Clearing the text clears the code.
The five catch (...) sites that latched a failure without any text now write
one (native settlement / current execution / recalculation callback /
sub-bar callback / applied callback exception). The native-security-feed
setters, the C host's refusal clear and the native-module boundary write
through note_run_failure; a pf_cabi_int entry point that throws now leaves
that exception's text and code. Literal texts and argument values are handed
over by address so they stay whole in the kernel archive. English, control
flow, latching and run status are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: the source layer and the Pine library code every throw
Every strategy-reachable throw carries its code at its site, with the same
exception type and English: pine_matrix_error (matrix.add_col on an empty
matrix was a std::logic_error the safety net would have called an engine
fault), pine_na_reference, pine_runtime_limit, pine_invalid_argument (the TA
length checks, the pivot type, line.get_price, an unparseable series
timeframe or timezone), recalc_cap, chart_bars_rejected, run_mode_unsupported,
the request.security refusals and the symbol-data setters. The spec-field
refusal takes its code from the field (run_spec_field_failure). A failed
configure's refusal carries the cause configure recorded; a preparation
failure is recorded with its code; a latched legacy setter failure is
setting_rejected. Engine invariants are coded engine_invariant or listed in
scripts/run_failure_throw_allowlist.txt, which check_run_failure_codes.py
holds every uncoded throw to.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* run_json: one coded failure line, the run status, and checked settings
Every failure leaves one line, {"engine":"pineforge","error":"<text>",
"code":"<code>","args":{...}}: the code and arguments come only from the
engine's getters or from run_json's own refusals (a library without the
getters keeps the earlier line, byte for byte). A run fails when the code or
the text is non-empty or strategy_last_run_status() is 1, so a script that
stops with an empty runtime.error() message no longer reads as a success.
The text is capped at 16 KiB and each string argument at 1 KiB on a UTF-8
boundary; a NULL strategy_create handle is strategy_create_failed before any
setter runs; tracebacks, stderr-only exits and argparse errors become coded
lines (argparse keeps exit 2). With a library that exports the checked
settings API the harness uses it, so an unknown input title or override key,
an option outside its list or an unparseable value fails as setting_rejected
instead of being dropped. The other harnesses show the code beside the text.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: the catalog diff, the CI guards and the release assets
scripts/gen_run_failure_catalog_diff.py writes and checks
docker/run_failure_codes_diff.json (schema
pineforge-run-failure-catalog-diff/v1: from the newest release tag to the
unreleased catalog), and stamps or resets it at a release. Preflight and every
ci_verify profile run check_run_failure_codes.py and the diff check;
release.yml attaches run_failure_codes-<tag>.json and
run_failure_codes_diff-<tag>.json and commits the reset diff with the version
bump. ADR-0001 rules the run-failure wire vocabulary the kernel archive now
carries (the code names, argument values and generated-code helpers); the
ruled floors rise to 193 identifiers and 59 texts.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: tests through generated strategies and the C ABI
tests/test_run_failure_codes.cpp drives six generated strategies and four
native hosts through the C ABI and pins, per row, the code, the canonical
arguments and the English the base engine printed for the same run: the
forged runtime.error texts and an empty message read strategy_runtime_error;
an unparseable session, a duplicate chart timestamp, an aggregated foreign
chart, a preparation failure, matrix.add_col on an empty matrix and the
generated-code helpers read their own codes; the record clears with the next
good run. It also pins the spec field to code table for every field and the
registry against the catalog.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* docs: run-failure codes, the getters and the catalog
A page lists every code (its class, retry flag and arguments, generated from
the catalog) and the rules: the getters' semantics, how arguments are chosen,
the type safety net, the catalog and its per-release diff, versioning, and
the generated-code helpers. The public contract, the lifecycle and Python
FFI pages and the symbol tables name the two getters; the export counts move
to 81 public declarations and 64 runtime implementations. CHANGELOG records
the getters, the catalog, the helpers, run_json's coded line and checked
settings, and the fixed silent success of a run stopped by an empty
runtime.error() message.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* docs: refresh the anchors the run-failure codes moved
Every anchor citing a file this change edited is carried through the exact
line map from 7a1f01c (482 moved); four whose cited line itself changed are
set by hand (the COOF loop guard, the broker fill sequence check, the
overrides cast) and five content pins are refreshed: the include block of
engine_aux_security.cpp now also pulls run_failure.hpp (its two sentences
say so), and three c_abi.cpp windows now hold the getters and the setters'
refusal recording.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: review fixes
The five catch (...) handlers that used to leave no text add theirs only
where the run has none yet, so an earlier, more specific failure keeps its
text and code. A bar the preflight refuses with a valid volume (a
non-positive price on a canonical spec) keeps its English but is coded
reason structural, not volume_invalid. The uncoded-throw scan reads a C++14
digit separator (50'000) and a raw string as what they are, so neither hides
code from it. The harness comments and the CHANGELOG say what ships: the
getters arrive with engine 1.4.0, and array, string and request stops of
generated code read their own codes once a matching codegen calls the
helpers.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: the diff from v1.3.0, and the anchors the review fixes moved
v1.3.0 is now the newest release tag on main, and its tree carries no
catalog: docker/run_failure_codes_diff.json is regenerated from it (every code
added, since 1.4.0). The documentation anchors that cite the execution
consumer are carried through the review fixes' exact line map.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: pin the latched legacy setter failure
A generated strategy's legacy override setter that latched a refusal
(std::stod cannot read the value) fails the run where the script is
prepared: the latched text, now coded setting_rejected, run status 1 and an
empty report.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: rebase onto the symbol-feed copy change (#349)
back at a door. Its three new invariant throws in pine_security_eval.cpp are
coded engine_invariant (the uncoded-throw scan holds the source layer to
it), and a door that cannot copy the feeds back refuses as
symbol_feeds_refused / recorded_request_refused {reason: restore_failed}
with #349's own text. The documentation anchors are carried from 90a3714
through the exact line map; four set by hand (the COOF loop guard, the
broker fill sequence check, the overrides cast, a CMakeLists.txt line) and
five content pins refreshed, with the sentences that name engine_aux_security's
includes saying run_failure.hpp. The catalog diff and the page's tables are
regenerated for the two new closed values.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: each text under the code it is raised with, and a run keeps its own failure
Review fixes (AR-R5 final review, Phase B) in the engine, the catalog and the test.
- F3: the catalog listed about thirty texts under engine_invariant whose
throws are uncoded std::runtime_error or std::overflow_error, which the
classifier answers engine_unclassified_error. 28 templates are now listed
under engine_unclassified_error (20 moved; 8 listed under both codes because
another site renders them engine_invariant first). The consumer's own
counter (native timeline ordinal exhausted) is coded engine_invariant at
its site, as pinned decision 3 asks; counters in sources this change does
not open stay engine_unclassified_error. The two coded invariants of the
symbol-feed copy change's request-data path are listed.
- F10: a frame of execute_current that fails after an inner site recorded
its cause carries that cause's code under its own text (run_aborted after
an abort whose report was cleared, engine_invariant when nothing was
recorded); the text is unchanged.
- F14: a C entry point that throws on a handle whose run already failed keeps
that run's text and code (a recorded code with an empty text included).
- F15: the five catch-all texts are written only when the run reports no
failure yet and was not aborted.
- F16: pine_collection_stop takes only array and matrix.
- F9: the codegen contract in run_failure.hpp names everything the generated
settings code uses (RunFailureInfo as a base and a member, its (code, args)
constructor, run_failure(), RunFailureValue, the none, setting_rejected and
out_of_memory codes, note_run_failure with a value).
- F25: native_module.hpp keeps the text-only note_error forms.
- F17, F23: class descriptions name no service; the four setter templates
spell their varying part {explanation}; the configure refusal's template
is listed.
- F11: tests/test_run_failure_codes.cpp adds rows for the getters'
uncoded-writer branch, the codegen's coded latched setter failure, a host
that records then throws a non-standard exception (empty text included),
a setter on a failed host, std::bad_alloc and std::logic_error from a bar
callback, the current-execution cause, the text-only note_error, a stream
refusal, one handle that prints an earlier refusal's English, and the
canonical escaping. 1636 checks, 0 failed; with the F10, F14, F15 and F16
fixes reverted the same test fails 6.
The catalog also gains what the run_json fixes of the next commit raise
(strategy_library_incompatible's settings_api_mismatch and three templates),
and the diff is regenerated. The English of every existing failure is
unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* run_json: review fixes to the failure line, the settings path and the other harnesses
Review fixes (AR-R5 final review, Phase B).
- F7: a library that exports part of the checked settings API, or another
version, is refused (strategy_library_incompatible, reason
settings_api_mismatch) before any strategy is created; a library with none
of it keeps the legacy setters.
- F8: a JSON integer past Python's digit cap in --inputs or --overrides is
run_request_invalid.
- F12: true, false, null, arrays and objects in --inputs or --overrides are
run_request_invalid; numbers are passed as str() spells them, as before.
docker/README.md lists the checked path's other refusals.
- F13: scripts/run_strategy.py, scripts/run_stream_corpus.py and the
tutorial runners fail a run on a code, a text or run status 1.
- F17: "a consumer", not "the app".
- F19: a library without the code getter prints a status-1 run with no text
without code or args, with the fixed text.
- F20: oversized args are dropped before the English is cut; a write error
during the success report appends no failure line; non-UTF-8 options, a
NUL or unencodable feed path and a tape timestamp outside the calendar get
their own codes (the calendar is checked after the run, so the engine's
own refusal of the same tape keeps its line); lone surrogates print as
U+FFFD; a test pins the getters' ctypes signatures.
docker/ pytest: 331 passed (macOS and Linux).
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* Run failure codes: tag-less catalog checks, release diffs and a CI stage for the harness tests
Review fixes (AR-R5 final review, Phase B).
- F1, F4 (Proposal A): in a clone without release tags both guards rebuild
the catalog the newest release published by running the checked-in diff
backwards and require its sha256; the diff must start at v + VERSION (the
release commit writes both); a null from.catalogSha256 is legal only for a
release older than 1.4.0; PINEFORGE_REQUIRE_RELEASE_TAGS=1 (set in
ci.yml, native-live.yml and release.yml) keeps the tag requirement.
check_run_failure_codes.py imports the generator's function. Catalog keys
holding a dot are refused.
- F2 (Proposal B): ci_preflight stage run-json-harness-tests runs pytest over
docker/run_json_*_test.py and fails when pytest is missing; CI installs
pytest 9.1.1 from the hash-pinned scripts/requirements-preflight.txt (the
remote verifier's toolchain has the same version).
- F5: a final release that follows release candidates attaches its diff
against the previous final release, and the chain step from its last
candidate as run_failure_codes_diff-<tag>-from-<candidate>.json;
--stamp --to-tag rebuilds either from git alone.
- F6: a release that adds or changes codes must be a minor or major one
(one line says so); since never changes on a published code; --check
requires each added code's since to be later than the diff's start.
- F22: the release commit and tag are pushed atomically; the recovery after
a failed release is documented; the stamp base must be where the notes
start or a candidate after it.
- F21: the throw scan reads prefixed raw strings, counts throw_with_nested
and rethrow_exception, states its limits, and each allowlist row carries
the number of throws it admits (pine_strategy_host.cpp has 5 rethrows).
- docs/ci.md: the pytest install and the release-tag variable.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* docs: run-failure codes review fixes, and the anchors they moved
Review fixes (AR-R5 final review, Phase B).
- docs/pages/run-failure-codes.md: the codegen contract names everything the
generated settings code uses (F9) and the collections pine_collection_stop
takes (F16); the English templates are descriptive and a frame's text can
carry the code of the failure recorded before it (F23, F10); run each
request on a fresh handle (F24); the diff example starts at v1.3.0 (F18);
the tag-less checks, the release assets of a final release after
candidates, the minor-release rule, since and the recovery of a failed
release (F1, F4, F5, F6, F22). The class table follows the catalog (F17):
"Other symbols' bars the service installed; terminal." and "The symbol's
catalog metadata; retryable after a resync." name no service any more.
While from.catalogSha256 is null the check still recomputes the whole diff
and says so: that sentence gave way to the three tag-less cases.
- docs/pages/public-contract.md: a code keeps its since; what --stamp refuses.
- CHANGELOG.md: the release assets (F5), the catch-all texts and the C setter
that keep a run's own failure (F14, F15), the other harnesses (F13), the
settings refusals (F7, F12), native_module's text-only note_error (F25).
- The anchors the code changes moved, carried by exact line map.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
* docs: carry the anchors onto the global-exit change (#350)
The rebase onto #350 replayed this branch's pages over main's. Every anchor
of the four pages both sides changed is carried by exact line map: each line
of a 3-way digit-masked merge (main b9a7613, the old base 90a3714, this
branch's former head aad977374) takes its own side's digits, mapped from that
side's tree to this one. Digits only: no sentence and no content pin changed.
Six anchors cite lines this branch rewrote, so no exact map carries them;
they are set by hand to the rewritten statements:
pine_scheduler_native.cpp:790 -> 792 (three times), pine_strategy_host.cpp:651
-> 696, pine_strategy_host.cpp:259-262 -> 285-290 and
engine_aux_security.cpp:76-127 -> 77-131. The last two were stale since the
run-failure codes first moved them (the check accepted them because the
cited symbol stayed inside the window).
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>1 parent b9a7613 commit 65c69b0
99 files changed
Lines changed: 17283 additions & 992 deletions
File tree
- .github/workflows
- docker
- docs
- adr
- design
- pages
- include/pineforge
- scripts
- src
- compat/pine
- source
- tests
- fixtures/run_failure_codes
- coof_runaway
- finer_security
- foreign_chart_input
- forged_runtime_error
- helper_stops
- matrix_add_col
- tutorial
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
14 | 28 | | |
15 | 29 | | |
16 | 30 | | |
| |||
26 | 40 | | |
27 | 41 | | |
28 | 42 | | |
29 | | - | |
| 43 | + | |
| 44 | + | |
30 | 45 | | |
31 | 46 | | |
32 | 47 | | |
| |||
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
57 | 78 | | |
58 | 79 | | |
59 | 80 | | |
| |||
113 | 134 | | |
114 | 135 | | |
115 | 136 | | |
116 | | - | |
117 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
118 | 156 | | |
119 | 157 | | |
120 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
121 | 211 | | |
122 | 212 | | |
123 | 213 | | |
124 | | - | |
| 214 | + | |
| 215 | + | |
125 | 216 | | |
126 | 217 | | |
127 | | - | |
128 | | - | |
| 218 | + | |
| 219 | + | |
129 | 220 | | |
130 | 221 | | |
131 | 222 | | |
| |||
137 | 228 | | |
138 | 229 | | |
139 | 230 | | |
| 231 | + | |
| 232 | + | |
140 | 233 | | |
141 | 234 | | |
142 | 235 | | |
| |||
157 | 250 | | |
158 | 251 | | |
159 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
160 | 262 | | |
161 | 263 | | |
162 | 264 | | |
| |||
169 | 271 | | |
170 | 272 | | |
171 | 273 | | |
| 274 | + | |
172 | 275 | | |
173 | 276 | | |
174 | 277 | | |
175 | 278 | | |
| 279 | + | |
176 | 280 | | |
177 | 281 | | |
178 | 282 | | |
179 | 283 | | |
180 | | - | |
| 284 | + | |
| 285 | + | |
181 | 286 | | |
182 | 287 | | |
183 | 288 | | |
| |||
189 | 294 | | |
190 | 295 | | |
191 | 296 | | |
| 297 | + | |
| 298 | + | |
192 | 299 | | |
193 | 300 | | |
194 | 301 | | |
195 | 302 | | |
196 | 303 | | |
197 | | - | |
| 304 | + | |
198 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
199 | 310 | | |
200 | 311 | | |
201 | 312 | | |
202 | 313 | | |
203 | 314 | | |
204 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
205 | 324 | | |
206 | 325 | | |
207 | 326 | | |
| |||
0 commit comments