feat(research): add strategy catalog and versioned backtest setup

This commit is contained in:
Boki 2026-10-23 21:11:59 -04:00
parent 8cca0ee588
commit d929db707a
44 changed files with 4198 additions and 209 deletions

View file

@ -1,6 +1,6 @@
# Canonical development backlog
**First seventeen waves committed; S05 is validated and awaiting acceptance/commit.** S04 is accepted as `75abae2`. P08 remains deferred at the owner's request. S05 adds a small composable mean-reversion/regime strategy on the canonical runtime; S04 still requires an external producer for operational feed readiness. Consult manifest execution_scope and [current wave](../ROADMAP.md#eighteenth-wave-execution--2026-10-23). ADR-002/003/004/005 are approved; other policies/default cutovers remain gated.
**First twenty-one waves committed; R02 is validated and awaiting acceptance/commit.** R10 is accepted as `8cca0ee`. R02 adds catalog/version browsing and validated saved backtest setups; catalog execution remains gated by R05. Performance work remains paused. See [current handoff](../ROADMAP.md#twenty-second-wave-handoff--2026-10-23) and manifest execution scope.
## One source of truth
@ -73,15 +73,15 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
| Task | Priority / status | Implementation prerequisites | Release gate | Specialist / size |
| --- | --- | --- | --- | --- |
| [R01 Persist immutable strategy versions and parameter schemas](tasks/R01.md) | P1 / done | O01, ADR-006 | — | Full-stack research product / M |
| [R02 Deliver strategy catalog and version-aware backtest setup](tasks/R02.md) | P1 / ready | R01, W03, ADR-006 | W04 | Full-stack research product / M |
| [R03 Add projects, hypotheses and evidence-linked findings APIs](tasks/R03.md) | P1 / blocked | R01, R10, ADR-006 | — | Full-stack research product / M |
| [R02 Deliver strategy catalog and version-aware backtest setup](tasks/R02.md) | P1 / review | R01, W03, ADR-006 | W04 | Full-stack research product / M |
| [R03 Add projects, hypotheses and evidence-linked findings APIs](tasks/R03.md) | P1 / ready | R01, R10, ADR-006 | — | Full-stack research product / M |
| [R04 Deliver research workspace and save-findings flow](tasks/R04.md) | P1 / blocked | R03, W02, ADR-006 | W04 | Full-stack research product / M |
| [R05 Freeze complete provenance and cut over durable canonical runs](tasks/R05.md) | P0 / blocked | F08, S02, R01, R10, D01, W03, C06, ADR-006 | Multi-asset default mark-policy disposition | Full-stack research product / M |
| [R05 Freeze complete provenance and cut over durable canonical runs](tasks/R05.md) | P0 / ready | F08, S02, R01, R10, D01, W03, C06, ADR-006 | Multi-asset default mark-policy disposition | Full-stack research product / M |
| [R06 Create immutable experiments and bounded sweep expansion](tasks/R06.md) | P1 / blocked | R05, ADR-006 | — | Full-stack research product / M |
| [R07 Deliver sweep configuration and comparable-result views](tasks/R07.md) | P1 / blocked | R06, ADR-006 | W04 | Full-stack research product / M |
| [R08 Add bounded chronological and reset-segment validation](tasks/R08.md) | P1 / blocked | R06, ADR-006 | — | Quantitative research integrity / M |
| [R09 Expose validation, cost and regime evidence in the workbench](tasks/R09.md) | P1 / blocked | R07, R08, ADR-006 | S05 when Regime comparison is enabled; R03 when Saving or linking a research finding is enabled | Full-stack research product / M |
| [R10 Protect retained research evidence and artifact integrity](tasks/R10.md) | P1 / review | R01, ADR-006 | — | Full-stack research product / M |
| [R10 Protect retained research evidence and artifact integrity](tasks/R10.md) | P1 / done | R01, ADR-006 | — | Full-stack research product / M |
| [R11 Select and reuse frozen datasets in the workbench](tasks/R11.md) | P1 / done | D01, O01, ADR-003, ADR-006 | W04 | Full-stack market data/research / M |
| [R12 Reproduce an original run separately from rerunning current settings](tasks/R12.md) | P1 / blocked | R05, W04, ADR-006 | — | Full-stack reproducible research / S |
@ -118,4 +118,4 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
Before any wave: unique IDs; existing task/ADR references; acyclic implementation graph; no scheduled task dependent on merged/deferred work; approvals/readiness; actual file locks; isolated native build outputs/workspace dependencies and test databases. Release gates are checked separately at activation.
The first twenty waves are committed, including R01 (`4a2e5ad`). **R10 retention is validated and uncommitted; performance work remains deferred by the owner.** ADR-006 is approved; R02 is ready after R01. The multi-asset mark-policy gate still blocks default activation. No default/paper activation, push or PR is included in this continuation.
The first twenty-one waves are committed, including R10 (`8cca0ee`). **R02 catalog and versioned setup is validated and awaiting acceptance/commit; performance work remains deferred by the owner.** ADR-006 is approved; R03/R05 prerequisites are integrated but those tasks are outside this wave. R05 is next: verified retained-artifact execution through the existing canonical runtime and durable runner. The multi-asset mark-policy gate still blocks default activation. No default/paper activation, push or PR is included in this continuation.

View file

@ -1,16 +1,16 @@
{
"schema_version": 1,
"plan_revision": "2026-10-23.46",
"plan_revision": "2026-10-23.48",
"repository_base": "b7aeca4",
"plan_status": "twenty_first_wave_review",
"plan_status": "twenty_second_wave_review",
"execution_authorized": true,
"execution_scope": {
"authorized_by": "User: commit and continue with backlog (2026-10-23). R01 accepted and committed 4a2e5ad362f7746a45a694dbcd9c51efac390526.",
"authorized_by": "User: commit and continue after validated R10 handoff named R02 next. R10 committed 8cca0ee588b55cf904f46199ccb65942de70ee99.",
"tasks": [
"R10"
"R02"
],
"permissions": [
"R10 isolated implementation, correctness tests, independent review and planning updates; prior R01 commit authorized and completed"
"R02 isolated implementation, correctness tests, independent review and planning updates; prior R10 commit authorized and completed"
],
"excluded": [
"performance_profiling_or_optimization",
@ -1442,7 +1442,7 @@
"epic": "E6",
"priority": "P1",
"severity": "High",
"status": "ready",
"status": "review",
"dependencies": [
"R01",
"W03"
@ -1461,14 +1461,33 @@
"web-backtest-detail",
"web-strategies"
],
"parallel_policy": "Allowed only with satisfied dependencies/approvals and disjoint write locks AND actual files; see agents/integration.md.",
"assignment": null,
"parallel_policy": "Pinned shared DTOs and draft admission contract. Isolated backend and frontend owners; root owns existing fixture/browser integration/planning, independent read-only reviewer.",
"assignment": "/root",
"branch": null,
"pull_request": null,
"completed_commit": null,
"blocker": null,
"release_gates": [
"W04"
],
"integration_state": "validated_uncommitted",
"integration_base": "8cca0ee588b55cf904f46199ccb65942de70ee99",
"worktree": "/home/boki/repos/stock-bot",
"implementation_slices": [
{
"owner": "/root/s04_controls_audit",
"worktree": "/tmp/stock-bot-wave22.fPRkAC/backend",
"scope": "Shared DTOs, saved catalog selection/validation, migration18 and execution gates, new API/PostgreSQL tests"
},
{
"owner": "/root/s04_feed_audit",
"worktree": "/tmp/stock-bot-wave22.fPRkAC/frontend",
"scope": "Catalog/version/clone/comparison/forms and existing backtest draft UI with focused interaction tests"
},
{
"owner": "/root",
"scope": "Existing fixture compatibility, real browser catalog-to-draft workflow, integration/planning"
}
]
},
{
@ -1477,7 +1496,7 @@
"epic": "E6",
"priority": "P1",
"severity": "High",
"status": "blocked",
"status": "ready",
"dependencies": [
"R01",
"R10"
@ -1546,7 +1565,7 @@
"epic": "E6",
"priority": "P0",
"severity": "Critical",
"status": "blocked",
"status": "ready",
"dependencies": [
"F08",
"S02",
@ -1578,7 +1597,9 @@
"pull_request": null,
"completed_commit": null,
"blocker": null,
"release_gates": []
"release_gates": [
"Explicit owner disposition of the simultaneous multi-asset mark/risk policy before canonical default activation"
]
},
{
"id": "R06",
@ -1732,7 +1753,7 @@
"epic": "E6",
"priority": "P1",
"severity": "High",
"status": "review",
"status": "done",
"dependencies": [
"R01"
],
@ -1754,11 +1775,11 @@
"assignment": "/root",
"branch": null,
"pull_request": null,
"completed_commit": null,
"completed_commit": "8cca0ee588b55cf904f46199ccb65942de70ee99",
"blocker": null,
"release_gates": [],
"integration_base": "4a2e5ad362f7746a45a694dbcd9c51efac390526",
"integration_state": "validated_uncommitted",
"integration_state": "validated_committed",
"worktree": "/home/boki/repos/stock-bot",
"implementation_slices": [
{
@ -6855,5 +6876,136 @@
"f90476a79b0df259a204bbc2f2015b2b6a8e582a8771729f48775cb18b4bac65"
],
"next": "After acceptance/commit, R02 delivers the strategy catalog UI and version-aware backtest setup without claiming retained-artifact execution before R05. Performance remains deferred."
},
"twenty_second_wave": [
"R02"
],
"twenty_second_wave_base": "8cca0ee588b55cf904f46199ccb65942de70ee99",
"twenty_second_wave_notes": [
"R10 accepted and committed; R02 catalog and save-only versioned templates authorized.",
"No catalog version execution, run snapshots or default cutover until R05. All versions remain non-runnable independently of review approval.",
"Exact version+normalized parameters persisted separately from execution config; legacy/catalog mode conversion forbidden, current independent legacy workflows remain supported.",
"No performance work, benchmarks, new-wave commits/pushes/PRs or paper/live operations."
],
"twenty_second_wave_validation": {
"status": "validated_uncommitted",
"log_directory": "/tmp/stock-bot-wave22.fPRkAC",
"source_hashes": {
"apps/stock/config/src/contracts/backtest.ts": "6c01dc72f8bde73b0ec4357a0a2293560b749f7246e145c2f3f62e92f383e810",
"apps/stock/config/src/contracts/strategy.ts": "490cf68d955e622a28733452508d540060cc4df341036ecb32269b9c533887b2",
"apps/stock/orchestrator/src/backtest/PostgresBacktestRunRepository.ts": "f15195b3c3108f33e5d78d1a0bdf52c5d923a867b43e02989dadeb9ed428b82f",
"apps/stock/web-api/src/migrations/migration-runner.ts": "c573bf2a7e9eae38f422c0352c9f0f7975a9380841805addf519174bb66dfadc",
"apps/stock/web-api/src/routes/backtests-v2.routes.ts": "ec5610a79d96e92a0f033f336024eff051fe19f2b0d4cdccb4f57a5da6d9f603",
"apps/stock/web-api/src/services/backtest-v2.service.ts": "d81494606741335096f872e872a6b2d64bfb65eac361840ec8556e437717e474",
"apps/stock/web-api/src/services/backtest.service.ts": "c2e8dbedca288be928f3aa68e5b31c8c49776efd2cac8c646ae328d77d8aa5ce",
"apps/stock/web-api/src/services/dataset-catalog.service.ts": "0c12046adaa0ed3886d25f314a5da416e244be0bd21fefe0de8cc23e9a093a41",
"apps/stock/web-api/src/services/strategy-catalog.service.ts": "000b23fa1cbd78c9693c5beaa0cb69b17064c7f8eda5ba5b59fb33f37f5cdfd1",
"apps/stock/web-app/src/app/App.tsx": "abf33f3a675ccbc6c88d5b08b1e5d31efb61e3b25c62cbf6482b327909ede69d",
"apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx": "83db281e6160dc3ed0ae7f34a62ffba27b8021267b48148d91c73a52acaad92a",
"apps/stock/web-app/src/features/backtest/BacktestListPageV2.tsx": "44093e2efb5b5ca2e84a82381ec3495b1df9adf4d2698b66720297ad655beada",
"apps/stock/web-app/src/features/backtest/components/BacktestConfiguration.tsx": "11abd70aec6ac20ffbb3389746d084aca798a5ff284430457a6b6690008ac3af",
"apps/stock/web-app/src/features/backtest/components/CreateBacktestDialog.tsx": "8afd246afe647e08412d14d556a566586cc4cd4e1a0e496c0970d70cead74d32",
"apps/stock/web-app/src/features/backtest/components/RunControlsCompact.tsx": "1dc8619e659670d477d4a411840f0819c65be64b1f4dae86a6128c06fc5ed38c",
"apps/stock/web-app/src/features/backtest/hooks/useBacktestV2.ts": "da35dac1cebaf3e36a5d6a6ccb9d59760187298fc6a4f9e9ac6c94bd184454bd",
"apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts": "d331cefe99209f09e12b79fc313a408087b9f55bcc1d6f97de1a53eb56412e85",
"apps/stock/web-app/src/features/backtest/types/backtest.types.ts": "d7965fc66fd43f65811e50cc4df5ad3fac9655c1bc2cfaa838316a7bb8fe9f4f",
"apps/stock/web-app/src/features/strategies/StrategyDetailPage.tsx": "3d6f4fad802bf2e63d1d730110f5fd76f7cf4da9bd3d4092b5c394e83893fbee",
"apps/stock/web-app/src/features/strategies/StrategyListPage.tsx": "5fedd203ee945f59adb22b01e93eb5b61f5bdebeb5dfa5a3d02c06e01ad20bd4",
"apps/stock/web-app/src/features/strategies/components/StrategyParameterForm.tsx": "d532d8af8dcfc3c6d62424138db4fae2b356704f6143c53b6ce8ecf16d3473f4",
"apps/stock/web-app/src/features/strategies/components/StrategySelection.tsx": "42026ae8c87ef90c617a61917dfd874d5b83f0373b22d74128285007f8553be5",
"apps/stock/web-app/src/features/strategies/components/useUnsavedWarning.ts": "9029a84d183803a4125b7c5808070ad69ad928c0dd4773cf30e376d3e81a326f",
"apps/stock/web-app/src/features/strategies/index.ts": "0d3a6b0010b25f739c2ff2753bbdd8f5cc118e73e1f6b7e95f559cb8336cfacf",
"apps/stock/web-app/src/features/strategies/services/strategyApi.ts": "be7dcd0226ec8c4cd3307643b385540ab060bbeddd1156a547c9845f74d33023",
"database/postgres/init/18-backtest-strategy-versions.sql": "ad60e1d33be3131ddc5df34e3adcdb50c0efa7e12c2adbbbee8d132c92b5d240",
"libs/core/types/src/index.ts": "2b9e3f1cc9f93ad5342a7064a3d8045688f33a8417c0a6e68eeaace01056d5d9",
"libs/core/types/src/strategy-catalog.ts": "8c1ccca63c4c32ebd34f9f2fa2813014a874c4d0378c96512e854e0f4160900e",
"test/e2e/fixture.ts": "0d9360e1eb3bddfb86ba4619d9e20e8c427faba98a67c654377ab286809075bf",
"test/e2e/workbench.test.ts": "472ecf91b5b2f6c591f4cac9ae441243b32f3a2bc0c1fec5226734253b140dfa",
"test/integration/backtest-workflow.test.ts": "7abdfb22370554619946728e9e7e33c4c90839aec7dba7b401e8e8a4981c7cac",
"test/integration/catalog-backtest-contract.test.ts": "df6a15add6305586a483fe52f6bf2253ea3913a4c26d5b8b4f981c1909928d64",
"test/integration/strategy-workbench.test.tsx": "d28f30f773724caa8c628c7b361976bd97df84ec9a7495ffe572be76fbb3a151",
"test/postgres/catalog-backtest-drafts.test.ts": "2e15de1732d0820b3bab5fafa128a7e0cec3b34edfd3ddae9b9dcfe99e71549d",
"test/postgres/dataset-catalog.test.ts": "13e0f3f0256b9bdcc542709e14b83cc85ce9225b49684880b6725c59c94acc91",
"test/postgres/durable-backtest.test.ts": "b5436a2aa3cbbf7fccaf0cc715df113d8abbb746575726d548c9f3455e9df5fd",
"test/postgres/migration-runner.test.ts": "a9a866a8a1054e3bda525d1e9c64826f72ff9f42e8513599ecc82947010adee8",
"test/postgres/research-retention.test.ts": "86560c30b62c0af4664c5d9775594cce294e1b32083bece4566686dd57f1e78b",
"test/postgres/research-runtime-isolation.test.ts": "ca5a84728ee36426a2d1955ff997ac3119d51c61ec605c9157ef7885dd6addc7"
},
"independent_review": {
"owner": "/root/s03_review",
"outcome": "Final G1/G2/G3 signoff from /root/s03_review: no remaining must-fix findings; all 39 final hashes match, no unlisted source changes. Reviewed artifact/parameter custody, admission gates, clone identity, settings reset and suite-owned Chromium/context cleanup. Reviewer inspected green full-check, database and unfiltered browser logs; ran no tests/builds. Integration owner executed all recorded gates.",
"backend_archive_sha256": "8d4f58e353649399ffaf5bbf95720151e6972dae9e5d9a4c9b7427bc31ffc78f",
"frontend_base_archive_sha256": "63dedea37e23368d3c4cd942961773597680bf70a053f4b22f8f74137ec97fba",
"frontend_clone_delta_sha256": "4acccf336fcc50ef6dc9b23fdda8ada972b42ffb7e2114a005bc8d08cc3b5b35",
"frontend_settings_delta_sha256": "b129d4067f13359f0147d079facea5566b2bd9da0a5d55eae855ed08960e4889",
"source_manifest_sha256": "05d8a9fa9ef6d6b99444bf63b4ff5c62a1e2a3baefc44d27fc7d31968467bd84"
},
"checks": [
{
"command": "CARGO_BUILD_JOBS=2 bun run check",
"log": "/tmp/stock-bot-wave22.fPRkAC/check-final.log",
"outcome": "All repository checks passed: build/source/contracts, 93 tooling/12168 assertions, 43 utility/86, 44 calculation/2285, 541 integration/4685, 150 Rust (4 manual ignored), lint and secret audit. No application source changed afterward; final browser-only lifecycle changes passed strict test types, scoped lint/format and the full browser gate."
},
{
"command": "PIPELINE_TEST_DATABASE_URL=postgres://fixture:fixture@127.0.0.1:32827/stock_bot_safety BACKTEST_TEST_REDIS_URL=redis://127.0.0.1:32828/15 bun run test:postgres",
"log": "/tmp/stock-bot-wave22.fPRkAC/postgres-final.log",
"outcome": "137 tests / 1052 assertions passed across all 15 PostgreSQL/Redis files. Catalog draft validation/edit/archive locking and API/repository/SQL admission rejection; additive migration compatibility; existing retention, idempotency, lease/recovery, paper custody and runtime isolation."
},
{
"command": "CARGO_BUILD_JOBS=2 bun run --cwd apps/stock/engine build:napi",
"log": "/tmp/stock-bot-wave22.fPRkAC/native-release-final.log",
"outcome": "Release addon restored; matches checkout release library and prior wave release hash. No Rust source or financial policy changes."
},
{
"command": "PIPELINE_TEST_DATABASE_URL=postgres://fixture:fixture@127.0.0.1:32827/stock_bot_safety BACKTEST_TEST_REDIS_URL=redis://127.0.0.1:32828/15 bun run test:e2e",
"log": "/tmp/stock-bot-wave22.fPRkAC/e2e-isolated-contexts.log",
"outcome": "All 8 workflows / 117 assertions passed unfiltered, without retries, against fresh same-origin UI build and release addon. Catalog create/edit, exact validation, save/reopen, settings save/reset, immutable publication, safe bundle display, clone lineage, and no run/outbox; existing native/frozen-dataset/submission/retention workflows remain green."
},
{
"command": "bunx tsc --project /tmp/stock-bot-wave22.fPRkAC/tests-tsconfig.json --noEmit",
"log": "/tmp/stock-bot-wave22.fPRkAC/strict-tests-final.log",
"outcome": "Passed strict new catalog contract/component/PostgreSQL tests and changed modern migration/dataset/retention/browser fixtures. This is not a broad strict claim for older legacy harnesses."
},
{
"command": "bunx eslint test/postgres/catalog-backtest-drafts.test.ts test/postgres/dataset-catalog.test.ts test/postgres/migration-runner.test.ts test/postgres/research-retention.test.ts test/integration/catalog-backtest-contract.test.ts test/integration/strategy-workbench.test.tsx test/e2e/fixture.ts test/e2e/workbench.test.ts",
"log": "/tmp/stock-bot-wave22.fPRkAC/scoped-lint-final.log",
"outcome": "Passed; final browser lifecycle edits also passed focused ESLint."
},
{
"command": "bunx prettier --check <changed TS/TSX>; git diff --check",
"logs": [
"/tmp/stock-bot-wave22.fPRkAC/scoped-format.log",
"/tmp/stock-bot-wave22.fPRkAC/format-last.log"
],
"outcome": "Passed; final two browser files rechecked after lifecycle fix. Manifest/reference/hash validation recorded separately."
},
{
"command": "Validate manifest IDs/task paths/dependency DAG, exact changed-source/hash inventory, HEAD and release-addon identity; git diff --check",
"outcome": "Passed: 55 unique IDs, valid references, acyclic task graph, 39 matching reviewed implementation/test hashes, 5 planning artifacts, HEAD 8cca0ee, release addon matches checkout library. No unlisted source changes."
}
],
"native_release_sha256": "ef00eed556f5c32332d36a9a00ef710682e90deb00b54552e4b5c8bfdfbe8103",
"scope": "39 application/shared-contract/migration/test files; one additive migration, existing catalog APIs and React backtest workflow. No new service, compiler/editor, financial simulator or engine semantics.",
"limitations": [
"Every catalog version remains non-runnable, including approved built-ins. R05 must verify executable artifact identity and connect durable canonical execution; candidates also require A02 isolation. No catalog request_snapshot, run or outbox is created in R02.",
"Independent legacy name-based runs retain existing economics/provenance qualifications; saving a catalog setup does not certify performance or make it a legacy alias.",
"Source comparison shows retained bundled JavaScript and schema/identity metadata, not reconstructed original TypeScript. Publication remains repository/offline tooling or existing artifact APIs; no upload/editor UI.",
"Version-linked run/deployment histories are explicitly unavailable until integration; no inference from name-based legacy runs.",
"Unsaved warnings cover local discard actions and document unload; no application-wide route-blocking framework. Clone retries preserve a frozen key/body during the mounted detail view, not across reloads.",
"R05 multi-asset default activation still requires explicit owner disposition of simultaneous-mark risk. No trading or default activation in this wave."
],
"environment_notes": [
"Initial PostgreSQL regression run exposed four legacy test helpers spreading the expanded response DTO into legacy input. Helpers now explicitly project definition input; parser null-marker rejection remains intact. Full suite rerun passed.",
"Initial browser helper selected the first select after the new mode select was added; it now selects the labelled Legacy strategy. Exact version loading is awaited before assertions.",
"Repeated serial Chromium launch/close cycles lost the control pipe, including during existing native smoke and ordinary catalog validation. Isolated workflows passed; diagnostic logs support likely runtime pipe lifecycle interference, not proven native-worker causation. The suite now owns one Chromium process and each fixture closes its own fresh context before its server/queue/database cleanup. The final complete suite passes with no retries or swallowed disconnects; production worker code is unchanged.",
"Native worker/browser and disposable database checks needed sandbox escalation. Development services were untouched. Worktrees and logs retained.",
"Strict checks cover new/modern tests; pre-existing broad legacy-harness strict errors from prior waves were not suppressed or expanded into this task.",
"Exact disposable fixture containers stopped after verification. No profiling, performance benchmarks, new-wave commit, push, PR or trading/default activation."
],
"stopped_fixture_ids": [
"25dcbeefeecdf21189f42b6d2694acf51f84878e3c4bedcb21494f2bf4c5fcee",
"ea7d33b519a35b14ca493e460734a70d98937507a29406765edff53688f12b9a"
],
"next": "After acceptance/commit, R05: integrate verified retained executable identity, frozen provenance and existing canonical reports with the durable runner. Begin with a trusted-built-in single-asset slice, without claiming all R05 complete or enabling candidates/multi-asset default. R03 is independently ready. Performance remains deferred."
}
}

View file

@ -62,7 +62,7 @@ Keep migrations additive and previous results readable. Do not add a switch that
## Web/API contract and user states
- API: R01 catalog/version endpoints plus version ID in saved backtest template/request snapshot.
- API: R01 catalog/version endpoints plus exact version ID and normalized parameters in saved backtest templates. R05 owns versioned run admission and immutable request snapshots; R02 creates no catalog run/outbox.
- Backend/data dependencies: R01 schema; current engine capability metadata. Unsupported version/runtime combinations fail before submit.
- Loading/error/empty behavior: Skeleton list/detail; no-strategies create CTA; schema error next to parameter; retry fetch; unsaved edit warning.
- User-facing completion is demonstrated by the acceptance criteria and interaction tests above; a backend-only implementation is insufficient where a UI is in scope.
@ -70,3 +70,24 @@ Keep migrations additive and previous results readable. Do not add a switch that
## Handoff
Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done.
## Wave22 execution contract
R10 committed `8cca0ee`; owner authorized R02. Reuse existing catalog APIs, React routes and backtest templates. Publish author code through existing repository/artifact APIs; no browser IDE or new compilation/runtime service. Read-only artifact comparison shows retained bundled JavaScript, schema and identities, not reconstructed original TypeScript.
Migration18 adds `strategy_version_id` (restrictive FK) and separate scalar `strategy_parameters`. The saved template uses `strategy: 'catalog'`; the version never becomes a legacy alias. Creation requires explicit `autoStart:false`. Save validates retained checksums, exact version parameters, data/execution settings and selected-dataset compatibility. Preserve omitted selection on partial updates; an explicit new version requires explicit parameters. Both legacy/catalog mode conversions are rejected; create another template instead. New selections reject archived families under their row lock; existing references remain readable and editable unless the template itself is archived.
V2 submission rejects before run/outbox insertion; V1 rejects catalog input before saving. Direct repository marker checks and the existing SQL run-admission trigger close alternate paths. Legacy receipt replay remains first. Keep the pure legacy parser's pre-strip rejection intact, including null version fields. Map trusted legacy DTOs explicitly instead of weakening that guard.
All versions remain non-runnable, including approved built-ins. The UI supports exact version selection, schema fields, server validation and saved setups with fresh submission disabled. Existing supported legacy strategies remain a separate qualified workflow. No inferred version/deployment histories from names; show absent integration honestly. Schema forms preserve optional omissions, false, zero, typed enums and decimal strings. Retained bundle text is never executed. Metadata/clone drafts preserve input and use explicit discard warnings; clone retries retain their original key/body.
## Validated handoff — 2026-10-23
Implemented the pinned Wave22 contract in 39 source/shared-contract/migration/test files. Catalog family metadata, immutable version selection, clone retries, exact schema validation, escaped bundle comparison and existing save/reopen/settings flows are integrated. API, repository and SQL gates keep all catalog versions non-runnable; legacy receipt ordering and supported legacy runs remain unchanged. Migration 18 retains version/parameters without creating catalog runs or request snapshots.
Review fixes include explicit empty-string versus omitted parameters, normalized value display, frozen clone source identity during navigation, catalog settings omitting legacy pacing, and authoritative archive/restore resets that invalidate stale parameter validation. Browser coverage proves exact saved values, immutable selection after new publication, clone lineage, safe bundle display, and zero runs/outbox. Each browser fixture has its own context/server/schema/queue within one suite-owned Chromium process after repeated driver teardown exposed pipe loss under Bun 1.2.17; no retry hides failures.
Validation: full repository checks passed (541 integration, 150 Rust, 93 tooling, 43 utility, 44 calculation plus build/types/contracts/lint/secrets); full PostgreSQL/Redis 137 tests/1052 assertions; all 8 browser workflows/117 assertions; strict new/modern test types and scoped lint/format/diff checks. Source hashes, commands, logs, independent review and stopped fixture IDs are in `manifest.json` → `twenty_second_wave_validation`. Release addon matches the prior wave; Rust financial source is unchanged.
Read-only source is retained bundled JavaScript, not original TypeScript. Code publication stays in repository/offline tooling or existing artifact APIs; no embedded editor/upload UI. Version-linked backtest/deployment histories remain unavailable. Unsaved warnings cover local discard actions/document unload, not a new global routing framework. Clone retry identity lasts within the mounted detail view. Current legacy economics remain explicitly qualified. R05 owns verified retained-artifact execution and full provenance; A02 gates candidates, and the multi-asset default policy remains unresolved. No R02 commit/push/PR, default cutover, trading activation or performance work.

View file

@ -8,7 +8,7 @@ Scheduling source of truth: [manifest entry R05](../manifest.json). No task is a
- **WEB-04 — Verified:** Existing results snapshot configuration and datasets but do not capture an immutable strategy artifact/engine build/model/seed bundle. Legacy projection can fall back to mutable definition fields. [libs/core/types/src/backtest-run.ts:4](../../../../libs/core/types/src/backtest-run.ts#L4); [apps/stock/web-api/src/services/backtest-result.ts:107](../../../../apps/stock/web-api/src/services/backtest-result.ts#L107).
- **KEEP-02 — Verified:** Preserve frozen/hash-verified historical snapshots and fenced durable runner attempts; extend them instead of creating a second job engine. [apps/stock/orchestrator/src/data/historical-dataset.ts:98](../../../../apps/stock/orchestrator/src/data/historical-dataset.ts#L98); [apps/stock/orchestrator/src/backtest/BacktestRunner.ts:190](../../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L190).
- **FIN-05 — Verified:** Rust and TypeScript separately implement fill/accounting behavior; the exposed native TypeScript callback method explicitly rejects callbacks. [apps/stock/engine/src/api/backtest.rs:63](../../../../apps/stock/engine/src/api/backtest.rs#L63); [apps/stock/orchestrator/src/execution/SimulationExecution.ts:114](../../../../apps/stock/orchestrator/src/execution/SimulationExecution.ts#L114).
- **FIN-05 — Updated after S01/S02/F08:** Canonical TypeScript decisions on Rust sessions and canonical reports already exist. The durable runner still calls the legacy `runBacktest` path; the canonical worker constructs the current built-in implementation by identity. R05 must connect retained executable identity and canonical results to durable admission, not introduce another strategy engine. [native-worker.ts:26](../../../../apps/stock/orchestrator/src/backtest/native-worker.ts#L26), [strategy-runtime.ts:224](../../../../apps/stock/orchestrator/src/backtest/strategy-runtime.ts#L224), [canonical-result.ts:37](../../../../apps/stock/orchestrator/src/backtest/canonical-result.ts#L37), [BacktestRunner.ts:191](../../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L191).
## Intended behavior and implementation scope
@ -16,6 +16,8 @@ Freeze strategy/model artifact IDs, parameters, seed, code/lockfile/build hashes
Consume F08's additive canonical analytics/report contract here. Version the persisted/public projection so canonical fractions, genuine zero exposure and null reasons bypass legacy percentage conversion/placeholder suppression. Preserve owner books and distinguish fills from round trips. Additional position valuations needed by the UI must come from Rust or be explicitly unavailable; do not invent marks, average-price basis or unrealized P&L in TypeScript merely to satisfy the old DTO. Keep historical readers unchanged and prove reopen/render compatibility during this cutover.
R02 now saves catalog versions and validated parameters with execution blocked at API, repository and SQL boundaries. Replace those gates only for verified supported execution. Before parallel implementation, pin the executable artifact/build binding: a retained bundle hash must never certify execution of a different current `createBuiltinStrategy` implementation. Verify the exact executable identity before the first decision; mismatches fail closed without a legacy-name fallback. Start with a trusted built-in single-asset vertical slice, retaining candidate isolation and multi-asset policy gates. That milestone alone does not complete all R05 requirements or authorize default activation.
Measurable benefit: Creates reproducible, project-gated runs usable by humans and AI.
## Exclusions
@ -43,12 +45,14 @@ Parallel eligibility: only with disjoint actual files and reserved write locks;
- Changing template, strategy source or provider history after dataset freezing cannot alter an admitted run. A source query alone is not labelled a frozen dataset.
- No strategy decision executes before artifact verification and atomic dataset binding; failed preparation remains diagnosed and retry-safe.
- A retained-version/current-build mismatch rejects before execution; successful provenance identifies the executable that actually ran. Changing the current built-in implementation cannot silently change a retained version's behavior.
- New results declare financialEngine=rust and strategyExecution separately; correctness-gate evidence requires approved engine/data gates, not a UI flag.
- Before making canonical multi-asset research the default, obtain explicit owner disposition of sequential equal-time mark risk: either accept the disclosed versioned approximation or approve a coordinated atomic-mark policy/implementation with independent fixtures. F04/F05 currently evaluate each ordered mark; F06 demonstrates offsetting simultaneous moves can latch intermediate loss/drawdown halts. A passing deterministic replay suite alone does not resolve this material modeling issue. Single-asset component work and additive native integration need not wait for this decision.
## Mandatory tests
- mutate_template_after_submit, freeze_before_first_decision, frozen_seed_replay, provider_change_after_dataset_bind.
- retained_artifact_executable_binding, current_builtin_mismatch_rejected_before_decision, catalog_version_never_falls_back_to_legacy_name.
- Full durable runner restart/lease/cancel suite and result contract compatibility.
- Canonical reporting fractions/zero/null reasons, owner attribution and fill-versus-round-trip semantics survive persistence/reopen/UI rendering; existing legacy rows retain their prior interpretation.
- Multi-asset default activation rejects while the mark-policy disposition is absent; accepted policy/version/limitations are frozen in provenance, with offsetting-mark regression evidence.