feat(research): run trusted SMA strategies through native workers
This commit is contained in:
parent
4f6e44a853
commit
ca5abdde0e
16 changed files with 1682 additions and 28 deletions
|
|
@ -8,7 +8,7 @@ Authorization update: the owner accepted F08 and requested “commit all of it a
|
|||
|
||||
Use TypeScript for strategies, research and the web product; one Rust kernel owns money, risk, matching and replay. Preserve durable decisions/checkpoints, transactional execution, frozen datasets, reviewed calculations and failure-oriented tests.
|
||||
|
||||
The skeptical review established 43 scheduled tasks, 5 conditional tasks and 4 merged redirects. The measured F09/P07 additions bring the current plan to **45 scheduled + 5 conditional + 4 merged = 54 retained IDs**. See [review findings and dispositions](REVIEW.md), [complete index](backlog/README.md) and [canonical manifest](backlog/manifest.json).
|
||||
The skeptical review established 43 scheduled tasks, 5 conditional tasks and 4 merged redirects. The measured F09/P07/P08 additions bring the current plan to **46 scheduled + 5 conditional + 4 merged = 55 retained IDs**. See [review findings and dispositions](REVIEW.md), [complete index](backlog/README.md) and [canonical manifest](backlog/manifest.json).
|
||||
|
||||
The existing web workbench improves during engine migration. Legacy results remain labelled; fixing controls or terminal valuation does not make same-bar economics trustworthy. C06 blocks shared-runtime legacy research rather than building another soon-to-be-retired simulator runtime.
|
||||
|
||||
|
|
@ -379,6 +379,29 @@ S01 is accepted and committed as `2bcadbd`, superseding its uncommitted handoff
|
|||
|
||||
S03 is code/ADR-ready but outside this wave. R05 retains durable canonical/default activation and its multi-asset policy gate; R01/R11 require ADR-006. No pending policy was implicitly approved.
|
||||
|
||||
**Validated handoff:** S02 is `review` / `validated_uncommitted`. Ten integrated source/test files match the independently reviewed hashes. `sma-crossover-long-only/v1` uses the existing aliases and reviewed crossover helper, exact whole-share budget sizing, bounded JSON state and explicit availability/freshness rules. The legacy long/short strategy stays intact. The existing child worker locally runs trusted programs over the canonical Rust session; the parent detaches input and checks exact effective selections plus native identity/policy/format. No callback source, module path, TS financial engine or default/paper activation was added.
|
||||
|
||||
The independent next-open fixture buys ten shares at5 and sells at2, with0.7 total fees and9969.3 terminal equity from10000. Further tests cover warmup entry sizing, delayed older bars, equality, stale inputs, unaffordable fees/gaps, same-order partial fills, owner attribution, JSON reconstruction and full retry. Worker tests reject altered provenance/economics, malformed/duplicate output and crashes, and preserve hard cancellation even after a result arrives before child close.
|
||||
|
||||
`CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/audit/lint plus **78 tooling, 43 utility, 44 calculation, 432 integration and 144 Rust tests**; four existing manual Rust measurements remain ignored. Dedicated test/fixture strict TypeScript and scoped lint/format/diff checks passed. Disposable PostgreSQL/Redis: **58 tests /345 assertions**. Final release tests: **48 /175**. Built `dist/native-worker.js` matches direct execution in trace, projection and report formats. Browser/Python boundaries did not change and were not rerun.
|
||||
|
||||
The worker owner's second elevated test run waited for approval and was aborted; root took over final validation after an explicit handoff. Root's restricted IPC run also stalled and was stopped, then passed unrestricted. Fixture correction uses a mutable detached dataset for the mutation test; schema `.min(1)` retains runtime nonempty validation without requiring a tuple input type. No economic failure was hidden by those environment/type corrections. Only the two exact disposable test containers were stopped.
|
||||
|
||||
The unchanged release addon is `6fe9dae…`. A paired benchmark compares actual SMA programs with replay of their **exact captured decisions**, including IDs. All **48 timed sessions** preserve complete financial hashes; repeated/reversed program order preserves diagnostics.
|
||||
|
||||
| 10,000 total bars | Recorded decisions | SMA callbacks | Added wall time |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| SMA5/15, 1 asset /1 owner | 1,091 ms | 1,467 ms | 376 ms /34.5% |
|
||||
| SMA5/15, 10 assets /2 owners | 410 ms | 478 ms | 69 ms /16.8% |
|
||||
| SMA5/15, 10 assets /10 owners | 624 ms | 916 ms | 292 ms /46.8% |
|
||||
| SMA15/252, 1 asset /1 owner | 1,018 ms | 2,351 ms | 1,333 ms /130.9% |
|
||||
| SMA15/252, 10 assets /2 owners | 409 ms | 636 ms | 227 ms /55.5% |
|
||||
| SMA15/252, 10 assets /10 owners | 594 ms | 1,681 ms | 1,087 ms /183.1% |
|
||||
|
||||
Each median has four samples across two processes, after an untimed reference capture. Imports/preparation are separate. Ten-assets/two-owners trades only two assets; the other eight still replay. Single-asset runs have9999 decisions and10000 advance calls; ten-assets/two-owners has1998 decisions/1000 calls, and ten-owners has9990 decisions/1000 calls. Warmup proportions and fills also differ. Cross-shape ratios do not isolate scaling. This is warmed direct-runtime throughput, not durable jobs, worker IPC, pure callbacks or NAPI cost; no speedup is claimed for S02.
|
||||
|
||||
The long-window decision/state phase accounts for roughly51–62% of wall time in the owner-dense cases, but cloning, freezing, schema validation, trailing calculation and allocation costs are not yet separated. [P08](backlog/tasks/P08.md) is the recommended next task **after S02 acceptance**, to profile and reduce that measured cost while preserving all strict-state and financial invariants. It is planned, not started. Immutable code artifacts remain R01/R05 work; no label-only reproduction guarantee is claimed. All raw evidence, exact commands, source archive and hashes are in `manifest.json` → `fifteenth_wave_validation` and `/tmp/stock-bot-wave15.zi3GmP/`. No new implementation commit, push, PR or trading operation occurred.
|
||||
|
||||
## Deferred and rejected
|
||||
|
||||
Conditional: shared feature cache D04; cross-trial resident datasets P03; large-detail pagination/storage P05; tiny DSL P06; expanded cross-service monitoring O02. Each has a measured/real-need trigger and is not a prerequisite for scheduled work.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue