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 cdb8ae8
Browse filesBrowse the repository at this point in the historyBrowse files
Fail the run when str.match or a calendar lookup meets a memory failure (#831)
str.match returned the empty string after any exception it met, and the
four session-calendar lookups of the native path (the entry session
point, the risk day, and the day and ordinal reads of the C callback
host) answered "out of session" or "no day" after any exception. A
memory failure, or a regular-expression resource limit, therefore let a
run finish with a wrong result instead of failing.
A std::bad_alloc now reaches the run's out_of_memory failure (status 1).
Container length errors and the system errors that mean "out of memory
or resources" carry the same code. Every other exception keeps its
fallback.
The regex library's error_space, error_complexity and error_stack depend
only on the pattern and the input, never on memory, so they are not
out_of_memory and not retryable: they stop the run with pine_string_error
and the new reason regex_resource_limit. One inline function maps the 13
standard error codes to that outcome or to an invalid pattern.
An invalid regular expression now stops the run with pine_string_error
(reason invalid_regex_pattern), as TradingView does, instead of returning
an empty string. Patterns the engine's regular-expression library does
not support stop the run too, with the same error; on the Linux build
these include lookbehind, named groups, inline flags, comment groups,
atomic groups, conditionals, \p{...} classes and {,n} repeats. The message
is TradingView's text with the engine's bar prefix, "Error on bar N: ",
or "Error before the first bar: " when no bar is being executed; one
function, run_error_bar_prefix, builds the prefix from the ambient bar
context. The catalog gains the two reasons and their message templates;
its diff reads one changed entry, so a release that carries this change
is a minor one.
The new tests use a counting replacement of the global operator new
(tests/fail_alloc_seam.hpp) to refuse each allocation of a run in turn:
every allocation must end in the out_of_memory failure or in a
closed-trade list (and its totals) identical to the clean run, never in a
different completed result, and the sweeps print the indexes at which a
run completed. They fail on the base tree at the allocations the old code
swallowed. The table of the 13 regex error codes is its own small test:
a one-line change of the mapping turns the expected rows red.
docs/coverage.md: the pine_str_match row replaces the sentence "Empty
string on no match or regex error." (introduced by cc4a56e) because an
invalid pattern now stops the run instead of returning an empty string.
ADR-0001 gets one row for the kernel's literal of TradingView's
invalid-pattern text, which the residuals gate requires for a text that
spells a Pine namespace, and the two pinned phrase counts of its unit
tests move by one. The allocation-bound manifest lists the two
declarations of the new function (ceiling 1413 -> 1415, pinned count
1597 -> 1599) and its site inventory is re-emitted. The lines added to
the sources move the lines the documentation cites below them; the
anchors that follow them are re-pointed by the number of lines added
(digits only, no sentence changes).
ADR-0001: give pine_string_stop a row of its own.
The kernel's two regular-expression stop helpers in src/str_utils.cpp
call pine_string_stop, so libpineforge_kernel.a now carries its weak
symbol. The ADR still listed it among the codegen helpers marked "no
archive symbol", and the kernel-residuals check on the built archive
rejects that (hosted build-arm, ctest row test_kernel_residuals:
"unruled 'pine_string_stop': ruled for the installed headers only ...
but nm carries it"). The helper moves out of that row into a row of its
own that says the kernel calls it; the other helpers keep their row.
Only docs/adr/0001-kernel-adapter-boundary.md changes. The check that
failed is the one that runs on the real archive, which the static
preflight and the checker's own self-tests do not build.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,11 @@ version number follows semantic versioning over the surfaces the
7
7
8
8
## Unreleased
9
9
10
+
-`str.match` no longer reports "no match" after a memory failure; the failure now reaches `out_of_memory`.
11
+
A pattern over the limits of the engine's regular-expression library stops the run with `pine_string_error` and reason `regex_resource_limit`, which is not retryable.
12
+
An invalid regular expression now stops the run with a typed error, as TradingView does; it used to return an empty string. The message is TradingView's text with the engine's bar prefix, `Error on bar N: `, or `Error before the first bar: ` when no bar is being executed.
13
+
Patterns the engine's regular-expression library does not support also stop the run now, with the same error. On the Linux build these include lookbehind, named groups, inline flags such as `(?i)`, comment groups, atomic groups, conditionals, `\p{...}` classes and `{,n}` repeats; lookahead, lazy quantifiers, back-references, POSIX classes and `\b` are accepted.
14
+
- A memory failure during a session-calendar lookup now fails the run with a typed error instead of reading the bar as out of session.
10
15
- A percent-of-equity default quantity above 100 percent is now capped at 100 percent of equity when `margin_long` and `margin_short` are both 0 (#805).
11
16
- With `process_orders_on_close` and the default FIFO close rule, the named `strategy.exit` calls of a reversing `strategy.entry` with an explicit quantity, placed in the same execution after a `strategy.close` of the old position, are now sized from the new entry's own quantity: a percentage exit takes its share of the new entry and an absolute-quantity exit keeps its quantity, instead of being sized from a basis reduced by the old position (#803).
12
17
- Without `process_orders_on_close`, the named `strategy.exit` calls placed with a reversing `strategy.entry` of explicit quantity now take their percentage from the new entry when its size differs from the position it replaces, and a take-profit given as an absolute quantity now fires; before, the percentage was taken from the position being replaced and an absolute-quantity take-profit never fired (#803).
0 commit comments