Skip to content

Commit 65c69b0

Browse files
luisleo526claude
andauthored
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

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ env:
2121
CCACHE_COMPILERCHECK: content
2222
CCACHE_COMPRESS: "1"
2323
CCACHE_MAXSIZE: 500M
24+
# The run-failure source guards read the newest release tag. Every job that
25+
# runs them fetches it (fetch-depth: 0), so here a missing tag fails them
26+
# instead of taking their tag-less offline path (rebuilding the published
27+
# catalog from the checked-in diff), which only a clone without tags needs.
28+
PINEFORGE_REQUIRE_RELEASE_TAGS: "1"
2429

2530
# The heavy jobs run on the organization's 16-core larger runner, and the macOS
2631
# legs on GitHub's M2 runner for the macos-26 image, for a push, the schedule, a
@@ -83,6 +88,13 @@ jobs:
8388
with:
8489
python-version: '3.12'
8590

91+
# pytest for the run-json-harness-tests stage (docker/run_json_*_test.py),
92+
# every wheel pinned by version and sha256 like actionlint below.
93+
- name: Install the harness test runner
94+
run: |
95+
python3 -m pip install --disable-pip-version-check --no-input \
96+
--require-hashes --only-binary ':all:' -r scripts/requirements-preflight.txt
97+
8698
- name: Install workflow linters
8799
shell: bash
88100
env:

‎.github/workflows/native-live.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ env:
2424
CCACHE_COMPILERCHECK: content
2525
CCACHE_COMPRESS: "1"
2626
CCACHE_MAXSIZE: 500M
27+
# The run-failure source guards in every ci_verify profile read the newest
28+
# release tag, which this checkout fetches (fetch-depth: 0): a missing tag
29+
# fails them rather than taking their tag-less offline path. A called
30+
# workflow does not inherit CI's env, so it says so itself.
31+
PINEFORGE_REQUIRE_RELEASE_TAGS: "1"
2732

2833
# The organization's 16-core larger runner for a push, the schedule, a
2934
# dispatch and a pull request from a branch of this repository; every other

‎.github/workflows/release.yml‎

Lines changed: 131 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
name: Release
22

33
# Bump VERSION, tag, cut a GitHub Release with generated notes, attach the
4-
# prebuilt static-lib tarballs, and notify the pineforge-release hub — all
4+
# prebuilt static-lib tarballs and the run-failure code catalog with its diff
5+
# against the previous release, and notify the pineforge-release hub — all
56
# from a single workflow_dispatch click. This workflow publishes no container
67
# image: the GHCR image is the hub's, built from these tarballs.
78
#
89
# Trigger: GitHub UI → Actions → Release → "Run workflow" → pick bump, or
910
# name the exact version in `override` (a release candidate is
1011
# X.Y.Z-rc.N, then the final release is override X.Y.Z). Tick `dry_run` to
11-
# rehearse: it computes the version, builds, installs, verifies and packs
12-
# every tarball (kept as workflow artifacts), and commits, tags, releases,
13-
# uploads and dispatches nothing.
12+
# rehearse: it computes the version, stamps and resets the run-failure
13+
# catalog diff, builds, installs, verifies and packs every tarball (the
14+
# tarballs and the catalog assets are kept as workflow artifacts), and
15+
# commits, tags, releases, uploads and dispatches nothing.
16+
#
17+
# The run-failure catalog (docker/run_failure_codes.json) ships as release
18+
# assets: run_failure_codes-<tag>.json, the catalog itself, and
19+
# run_failure_codes_diff-<tag>.json, its changes since the release the notes
20+
# start at (for a final release, the previous final release), stamped with
21+
# this version by scripts/gen_run_failure_catalog_diff.py --stamp. A final
22+
# release that follows its candidates also attaches the chain step,
23+
# run_failure_codes_diff-<tag>-from-<candidate tag>.json: the checked-in diff
24+
# (docker/run_failure_codes_diff.json), which starts at the newest release
25+
# tag, stamped. The diff reset to the new tag (--reset) is committed with the
26+
# VERSION bump, so main's source guard (--check) holds from the release
27+
# commit on.
1428
#
1529
# A release candidate (X.Y.Z-rc.N) is created as a GitHub prerelease, and
1630
# the hub dispatch carries it: client_payload = {version: "vX.Y.Z-rc.N",
@@ -26,7 +40,8 @@ name: Release
2640
# scripts/release_version.py, through an `env:` block, which refuses
2741
# anything but X.Y.Z or X.Y.Z-rc.N before any later step reads it.
2842
# - All other interpolations are GitHub-controlled context (repo, actor,
29-
# sha, secrets) or values the script computed from VERSION and the tags.
43+
# sha, secrets) or values the scripts computed from VERSION, the tags and
44+
# the checked-in catalog; every one reaches a `run:` through `env:`.
3045

3146
on:
3247
workflow_dispatch:
@@ -54,6 +69,12 @@ on:
5469
permissions:
5570
contents: write
5671

72+
# The run-failure guards this workflow runs (--stamp, --check) read the tags
73+
# its full-history checkout fetches: here a missing tag fails them, never their
74+
# tag-less offline path.
75+
env:
76+
PINEFORGE_REQUIRE_RELEASE_TAGS: "1"
77+
5778
jobs:
5879
release:
5980
runs-on: ubuntu-latest
@@ -113,19 +134,89 @@ jobs:
113134
exit 1
114135
fi
115136
116-
- name: Write bumped VERSION, commit, tag, push
117-
if: ${{ !inputs.dry_run }}
137+
# The run-failure catalog's assets, before anything is committed. PREV
138+
# is where the release notes start (scripts/release_version.py's
139+
# previous: the previous final release for a final one); BASE, the
140+
# newest release tag HEAD reaches, is where the checked-in diff starts
141+
# (its --check). When BASE is PREV, run_failure_codes_diff-<tag>.json is
142+
# the checked-in diff stamped. When BASE is a release candidate after
143+
# PREV -- a final release that follows its candidates -- it is a fresh
144+
# diff from the catalog PREV published, so the stable channel sees every
145+
# code the candidates added, and the checked-in diff stamped is the chain
146+
# step, run_failure_codes_diff-<tag>-from-<BASE>.json, which keeps the
147+
# chain through every release, candidates included, unbroken. --stamp
148+
# refuses any other BASE (a PREV that HEAD does not reach), a catalog
149+
# changed after the checked-in diff was generated, a removed code, a
150+
# release that adds or changes codes but is no minor or major release,
151+
# and an added code whose `since` is not this release (a candidate's
152+
# X.Y.Z). --reset computes the diff main starts from after this release:
153+
# from this tag and this catalog, nothing added.
154+
- name: Stamp the run-failure catalog diff
155+
id: catalog
118156
env:
119157
NEXT: ${{ steps.bump.outputs.next }}
120158
TAG: ${{ steps.bump.outputs.tag }}
159+
PREV: ${{ steps.bump.outputs.previous }}
160+
run: |
161+
set -euo pipefail
162+
base="$(git describe --tags --abbrev=0 --match 'v[0-9]*' HEAD)"
163+
assets="${RUNNER_TEMP}/run-failure-catalog"
164+
chain="run_failure_codes_diff-${TAG}-from-${base}.json"
165+
mkdir -p "${assets}"
166+
python3 scripts/gen_run_failure_catalog_diff.py --stamp \
167+
--to-version "${NEXT}" --previous-tag "${PREV}" \
168+
--output "${assets}/run_failure_codes_diff-${TAG}.json" \
169+
--chain-output "${assets}/${chain}"
170+
if [[ ! -f "${assets}/${chain}" ]]; then chain=""; fi
171+
cp docker/run_failure_codes.json "${assets}/run_failure_codes-${TAG}.json"
172+
python3 scripts/gen_run_failure_catalog_diff.py --reset --tag "${TAG}" \
173+
--output "${RUNNER_TEMP}/run_failure_codes_diff.reset.json"
174+
{
175+
echo "base=${base}"
176+
echo "assets=${assets}"
177+
echo "chain=${chain}"
178+
echo "reset=${RUNNER_TEMP}/run_failure_codes_diff.reset.json"
179+
} >> "${GITHUB_OUTPUT}"
180+
181+
# The reset diff rides the VERSION bump's commit, and the guard main runs
182+
# from now on (--check: the diff starts at the newest tag HEAD reaches)
183+
# must pass on the tagged commit before anything is pushed. The commit
184+
# and the tag go up in one atomic push: both land or neither does, so
185+
# main never holds a diff reset to a tag the remote lacks.
186+
#
187+
# When a step fails after this push (gh release create, say), the tag
188+
# exists and re-running this run stops at "Compute next version" (tag
189+
# vX already exists); the tagged tree holds the reset diff, which stamps
190+
# nothing. Rebuild the
191+
# assets from git alone, byte for byte what the stamp step wrote, in any
192+
# checkout with the tags (PREV is the run's "Compute next version"
193+
# previous; the stamp step's log names the start of each diff it wrote):
194+
# python3 scripts/gen_run_failure_catalog_diff.py --stamp --to-tag <tag> \
195+
# --previous-tag <PREV> --output run_failure_codes_diff-<tag>.json
196+
# git show <tag>:docker/run_failure_codes.json > run_failure_codes-<tag>.json
197+
# and, when the run wrote a chain step from <BASE>, the same --stamp
198+
# --to-tag with --previous-tag <BASE> --output
199+
# run_failure_codes_diff-<tag>-from-<BASE>.json. (Equivalently, check
200+
# out <tag>^, the dispatched commit, and run the stamp step's own
201+
# --stamp --to-version there.) Then create the release by hand with
202+
# those assets (gh release create <tag> --verify-tag), its notes as the
203+
# notes step writes them; the prebuilt and notify-hub jobs need it and
204+
# did not run.
205+
- name: Write bumped VERSION, commit, tag, push
206+
if: ${{ !inputs.dry_run }}
207+
env:
208+
NEXT: ${{ steps.bump.outputs.next }}
209+
TAG: ${{ steps.bump.outputs.tag }}
210+
RESET: ${{ steps.catalog.outputs.reset }}
121211
run: |
122212
set -euo pipefail
123213
printf '%s\n' "${NEXT}" > VERSION
124-
git add VERSION
214+
cp "${RESET}" docker/run_failure_codes_diff.json
215+
git add VERSION docker/run_failure_codes_diff.json
125216
git commit -m "chore(release): ${TAG}"
126217
git tag -a "${TAG}" -m "Release ${TAG}"
127-
git push origin HEAD
128-
git push origin "${TAG}"
218+
python3 scripts/gen_run_failure_catalog_diff.py --check
219+
git push --atomic origin HEAD "${TAG}"
129220
130221
# The range starts at scripts/release_version.py's `previous`: the last
131222
# tag below this release in semver order (git's v:refname sort puts
@@ -137,6 +228,8 @@ jobs:
137228
TAG: ${{ steps.bump.outputs.tag }}
138229
PREV: ${{ steps.bump.outputs.previous }}
139230
RANGE_END: ${{ inputs.dry_run && github.sha || steps.bump.outputs.tag }}
231+
BASE: ${{ steps.catalog.outputs.base }}
232+
CHAIN: ${{ steps.catalog.outputs.chain }}
140233
run: |
141234
set -euo pipefail
142235
{
@@ -157,6 +250,15 @@ jobs:
157250
echo
158251
echo "Per-arch static-lib + headers tarballs are attached below (C ABI)."
159252
echo "For the full PineScript -> backtest image, use \`ghcr.io/pineforge-4pass/pineforge-release\`."
253+
echo
254+
echo "### Run-failure codes"
255+
echo
256+
echo "\`run_failure_codes-${TAG}.json\` is the run-failure code catalog this release publishes;"
257+
echo "\`run_failure_codes_diff-${TAG}.json\` lists its changes since ${PREV}."
258+
if [[ -n "${CHAIN}" ]]; then
259+
echo "\`${CHAIN}\` lists them since ${BASE}, the release candidate before this release:"
260+
echo "the step in the chain of diffs through every release, candidates included."
261+
fi
160262
} > RELEASE_NOTES.md
161263
echo "path=RELEASE_NOTES.md" >> "$GITHUB_OUTPUT"
162264
@@ -169,15 +271,18 @@ jobs:
169271
TAG: ${{ steps.bump.outputs.tag }}
170272
NOTES: ${{ steps.notes.outputs.path }}
171273
PRERELEASE: ${{ steps.bump.outputs.prerelease }}
274+
ASSETS: ${{ steps.catalog.outputs.assets }}
172275
run: |
173276
set -euo pipefail
174277
prerelease=()
175278
if [[ "${PRERELEASE}" == "true" ]]; then prerelease=(--prerelease); fi
279+
# The catalog, its diff, and the chain step when there is one.
176280
gh release create "${TAG}" \
177281
--title "${TAG}" \
178282
--notes-file "${NOTES}" \
179283
--verify-tag \
180-
"${prerelease[@]}"
284+
"${prerelease[@]}" \
285+
"${ASSETS}"/*.json
181286
182287
- name: Dry run summary
183288
if: ${{ inputs.dry_run }}
@@ -189,19 +294,33 @@ jobs:
189294
PREV: ${{ steps.bump.outputs.previous }}
190295
NOTES: ${{ steps.notes.outputs.path }}
191296
RUN_ID: ${{ github.run_id }}
297+
BASE: ${{ steps.catalog.outputs.base }}
298+
CHAIN: ${{ steps.catalog.outputs.chain }}
192299
run: |
193300
set -euo pipefail
194301
{
195302
echo "## Dry run: ${CURRENT} -> ${NEXT}"
196303
echo
197-
echo "- would commit VERSION=${NEXT} and push the tag ${TAG}"
304+
echo "- would commit VERSION=${NEXT} and the run-failure catalog diff reset to ${TAG}, and push it with the tag ${TAG} in one atomic push"
198305
echo "- would create the GitHub release ${TAG} (prerelease: ${PRERELEASE}), notes since ${PREV:-the first commit}"
306+
echo "- would attach run_failure_codes-${TAG}.json and run_failure_codes_diff-${TAG}.json (stamped ${PREV} -> ${NEXT}; kept as a workflow artifact)"
307+
if [[ -n "${CHAIN}" ]]; then
308+
echo "- and the chain step ${CHAIN} (stamped ${BASE} -> ${NEXT}; kept too)"
309+
fi
199310
echo "- would dispatch engine-release to pineforge-release with client_payload {\"version\": \"${TAG}\", \"prerelease\": ${PRERELEASE}, \"run_id\": ${RUN_ID}}"
200311
echo
201312
cat "${NOTES}"
202313
} >> "${GITHUB_STEP_SUMMARY}"
203314
cat "${GITHUB_STEP_SUMMARY}"
204315
316+
- name: Keep the dry run's run-failure catalog assets as a workflow artifact
317+
if: ${{ inputs.dry_run }}
318+
uses: actions/upload-artifact@v4
319+
with:
320+
name: run-failure-catalog-${{ steps.bump.outputs.tag }}
321+
path: ${{ steps.catalog.outputs.assets }}
322+
retention-days: 7
323+
205324
# Prebuilt static-lib + headers tarballs, one per (os, arch). Attached
206325
# to the GitHub Release created above. Tarball layout:
207326
# pineforge-vX.Y.Z-{triple}/

0 commit comments

Comments
 (0)