427 lines
71 KiB
Markdown
427 lines
71 KiB
Markdown
# Revised development roadmap
|
||
|
||
Baseline `b7aeca4` · execution 2026-10-23 · **F08 committed; S01 validated, uncommitted**
|
||
|
||
Authorization update: the owner accepted F08 and requested “commit all of it and continue” after the handoff named S01 and linked ADR-005. F08 is committed as `3838295`; S01 is authorized under ADR-004/005. Other pending ADRs and the multi-asset mark policy are unchanged. New S01 implementation commits, pushes, PRs and trading/default-engine operations remain outside this continuation's scope.
|
||
|
||
## Strategy and review outcome
|
||
|
||
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. F09/P07/P08 added three IDs; the owner subsequently deferred P08. The current plan has **45 scheduled + 6 deferred/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.
|
||
|
||
## Decisions to approve
|
||
|
||
| Decision | Direction | Approval |
|
||
| --- | --- | --- |
|
||
| [ADR-001](architecture/decisions/001-ownership.md) | TS product/strategy code; Rust financial authority; retain monolith and workers | User-mandated |
|
||
| [ADR-002](architecture/decisions/002-financial-policy.md) | Maintained checked decimal; 8-place half-up postings; authoritative remaining cost; owner books from day one; initial cash-funded long-only account | Approved by owner, 2026-10-22 |
|
||
| [ADR-003](architecture/decisions/003-time-and-datasets.md) | Availability/event phases; open-only next-interval matching; explicit zero-latency convention; mark-open terminal policy; account risk-session clock | Approved by owner, 2026-10-22 |
|
||
| [ADR-004](architecture/decisions/004-strategy-boundary.md) | NAPI pull sessions in existing workers; tagged decision barriers; IPC for untrusted code; no embedded JS | Approved by owner, 2026-10-22 |
|
||
| [ADR-005](architecture/decisions/005-durable-cutover.md) | One Rust transition kernel; resident research state; private staged paper state under existing SQL transactions | Approved by owner continuation, 2026-10-23; paper activation separately gated |
|
||
| [ADR-006](architecture/decisions/006-research-product.md) | Existing API/queue/database; immutable versions, provenance and evidence retention; no laboratory framework | Plan approval |
|
||
| [ADR-007](architecture/decisions/007-ai-boundary.md) | Isolated untrusted code, research-only permissions/budgets; human-only paper promotion; live disabled | Explicit trust-model approval |
|
||
| [ADR-008](architecture/decisions/008-performance.md) | Measure actual paths; cursor replay and bounded trials; caching/DSL only when measured | Plan approval; later optimization go/no-go |
|
||
|
||
Long-only is the approved first canonical model, not deletion of short history or a silent change to current paper accounts. Short/margin support still needs a separate approved borrowing policy and fixtures. C01/C03/C04/W01 preserve the legacy behavior described in their task scopes.
|
||
|
||
**Pre-default multi-asset risk decision:** F06 review confirms existing ordered mark transitions can latch an intermediate portfolio loss/drawdown halt even when simultaneous offsetting moves leave final equity unchanged. Additive F06/F07 work can proceed under the current deterministic policy, but R05 must not enable canonical multi-asset default research until the owner explicitly accepts the disclosed versioned approximation or approves a coordinated atomic-mark correction with fixtures. Determinism alone does not resolve this modeling issue.
|
||
|
||
## Milestones
|
||
|
||
| Milestone | Tasks | Exit criterion |
|
||
| --- | --- | --- |
|
||
| M0: safe interim behavior | C01/C02/C03/C04/C06; O01; P01 | Scoped terminal/funding/input fixes; failed init cleans up; shared-runtime research rejected; migration lock and honest baseline measurements |
|
||
| M1: usable current workbench | W01–W04 | Save, submit, cancel, inspect and reopen tested in browser; unsupported controls hidden; legacy economic limitations visible |
|
||
| M2: canonical Rust/TS research | F01/F02/F04–F09, D01, S01/S02; R01/R10/W03/C06 then R05; P07 measurements | Owner-aware finance, deterministic replay, compact results, one TS strategy and retained input provenance work through durable runs |
|
||
| M3: useful research product | R02/R03/R04/R11/R12 | Catalog/workspace/dataset selection and original reproduction; metadata/UI proceed alongside engine work |
|
||
| M4: batch research and validation | R06–R09, P04; S05 when ready | Bounded sweeps, summary comparisons, OOS/reset-segment walk-forward and measured worker scaling; regime panels only with S05 |
|
||
| M5: paper parity and AI research | S03/S04, A01–A04 | Recovery parity, operator readiness, isolated bounded AI experiments and evidence-linked human paper promotion |
|
||
| M6: remove duplicates / optional speed | S06; conditional D04/P03/P05/P06/O02 | Retire duplicate economics only after cutover proof; optional work requires demonstrated need |
|
||
|
||
Rows are outcomes, not a sequential waterfall. S03 does not wait for research UI or statistical reporting; basic experiments do not wait for regime models or feature caches.
|
||
|
||
## Critical path and parallel lanes
|
||
|
||
```mermaid
|
||
flowchart LR
|
||
F01[Contract + economic fixtures] --> F02[Owned ledger] --> F04[Risk + reservations] --> F05[Matcher]
|
||
F05 --> F06[Deterministic cursor replay]
|
||
D01[Availability-aware eligible datasets] --> F06
|
||
P01[Existing-path measurements] --> F06
|
||
F06 --> F07[Bounded NAPI sessions] --> S01[TS decisions] --> S02[One SMA]
|
||
F07 --> F09[Compact financial projections] --> F08
|
||
F07 --> P07[Representative replay profiling]
|
||
C02[Boundary integrity] --> F07
|
||
F06 --> F08[Canonical projections + reviewed TS statistics]
|
||
S02 --> R05[Durable canonical runs]
|
||
F08 --> R05
|
||
PRODUCT[Versions / retained artifacts / safe submission] --> R05
|
||
C06[Runtime containment] --> R05
|
||
R05 --> R06[Bounded experiments] --> P04[Measured parallel trials]
|
||
R06 --> R08[Chronological validation]
|
||
R06 --> A01[Research authorization] --> A02[Untrusted code isolation]
|
||
R08 --> A03[AI evidence loop]
|
||
A02 --> A03
|
||
S01 --> S03[Durable Rust paper adapter]
|
||
```
|
||
|
||
The full [dependency graph](backlog/dependencies.mmd) includes all code and decision gates. Solid task edges are implementation prerequisites. Dotted task edges are release/conditional gates, not blockers to integrating component work.
|
||
|
||
After approval, run one financial-core owner alongside one web/product owner and one data/benchmark/metadata owner. Serialize shared DTOs, migration registry, worker protocol and actual overlapping files. Core tasks F01/F02/F04/F05 must not be split among agents simultaneously.
|
||
|
||
## First wave: four independent assignments
|
||
|
||
Completed wave; the table records its original rationale. Exact prompts, paths, commands, commit references and verification results: [FIRST-WAVE.md](FIRST-WAVE.md).
|
||
|
||
| Task | Why now | Ownership / unlock |
|
||
| --- | --- | --- |
|
||
| [C01](backlog/tasks/C01.md) | Final native equity currently omits liquidation costs | Legacy Rust engine/results only; preserves a known arithmetic fixture for migration |
|
||
| [C03](backlog/tasks/C03.md) | Existing gross-capital guard ignores fee liability | TS execution model only; safer interim paper behavior without a new financing model |
|
||
| [C04](backlog/tasks/C04.md) | Partially initialized runtime can retain resources | ModeManager lifecycle only; unlocks C06 containment |
|
||
| [W01](backlog/tasks/W01.md) | Current user-facing cancellation/status can mislead | Frontend controls/hooks only; unlocks W02 and the tested workbench |
|
||
|
||
Recommend **3 simultaneous implementers**, reserving one slot for coordination/independent review. Start C01 + C03 + W01; rotate C04 into the first freed slot, or start C04 first if runtime containment is the immediate operational need. These four have no mutual code dependencies and disjoint writable files. Four concurrent implementers are technically possible but not recommended without separate review capacity.
|
||
|
||
O01/P01, W03 and W04 are committed. W04 adds validated real-browser end-to-end verification of the existing workbench. F01/D01 passed integrated validation and are committed; F02/D02 passed integrated validation and await acceptance/commit, while subsequent tasks remain prerequisite-gated.
|
||
|
||
## Second-wave handoff — 2026-10-22
|
||
|
||
All three tasks are `done` / `validated_committed` following owner approval: C02 `ee670a3`, C06 `43ffb54`, W02 `fe00ecd`. Worktrees are retained under `/tmp/stock-bot-wave2.M9vHDK/`.
|
||
|
||
| Task | Implemented and verified |
|
||
| --- | --- |
|
||
| C02 | Whole-load native validation preserves previously admitted data on any invalid row. Indexed errors cover malformed rows, OHLCV/VWAP, timestamps and unsupported types. 1001ms/1999ms remain distinct. Identical/conflicting duplicates and decreasing timestamps now reject explicitly; optional VWAP and zero volume remain accepted. |
|
||
| C06 | Default paper composition uses native research. Legacy TS requires explicit `role: 'research-only'`; startup and both exposed mode initializers reject cross-role activation before effects. Real paper account/ledger/checkpoint hashes and lifecycle stay unchanged through native success/cancel/failure jobs, and the paper feed continues afterward. No second execution framework was added. |
|
||
| W02 | Saved configuration and dataset evidence are distinguished from mutable legacy display fallbacks. Missing artifact/build versions stay unknown; known metric placeholders are unavailable while measured TS zeros remain visible. Limitations appear beside performance, and mutable legacy capital cannot fabricate cash profit. No stored results or financial calculations were rewritten. |
|
||
|
||
Combined integration gates:
|
||
|
||
- `CARGO_BUILD_JOBS=2 bun run check`: passed all gates; 54 tooling, 43 utility, 35 calculation, 293 integration and 37 Rust tests, with no failures. Build, typecheck, contracts, lint and secret audit passed. The 47 native bridge cases are included in integration, not an additional count.
|
||
- `bun run test:postgres` against disposable `stock_bot_safety` PostgreSQL and Redis DB15: 47 passed, 267 assertions. Includes two real-ledger research-isolation regressions. Temporary fixture containers were removed after validation; development databases/services were untouched.
|
||
- `git diff --check`: passed. All 21 authored implementation/test files match reviewed worktrees; the rebuilt integration addon hash is in the manifest.
|
||
|
||
Native subprocess builds/IPC and fixture networking required sandbox escalation. Existing Rust/frontend build warnings remain. Explicit linting of the old W01 test harness still reports its unchanged test-only curly findings; the repository lint gate and new scoped code checks pass. No real-browser E2E coverage is claimed here.
|
||
|
||
Limits: composition guards are not an untrusted-code sandbox; same-bar execution, canonical Rust accounting and owner-aware funding remain future tasks. ADR-002/003/004 still gate F01, and ADR-007 gates AI isolation. No push, PR or trading operation occurred. Subsequent O01/P01 work is tracked separately in the manifest.
|
||
|
||
## Third-wave handoff — 2026-10-22
|
||
|
||
O01 and P01 are independently reviewed and `validated_committed`: O01 `bba5aa1`, P01 `2e851ec`. Four implementation/test files were integrated from isolated worktrees under `/tmp/stock-bot-wave3.VjJvWX/`. The owner subsequently authorized W03 continuation.
|
||
|
||
- **O01:** Startup migrations acquire one transaction-scoped advisory lock on the same client before table initialization, discovery, checks, application and recording. The additive allowlist and SQL scripts are unchanged. Real PostgreSQL tests prove competing-client blocking, SQL/record failure rollback and retry, destructive-script exclusion, and preservation of saved runs, datasets, ledger and checkpoints.
|
||
- **P01:** `bun run scripts/benchmark-research.ts` runs a tiny deterministic self-test; `--measure` runs 1k/10k total-bar workloads over 1/10 assets. Three SMA configurations repeat twice per fresh process, with two processes per workload. Source/artifact/runtime/host/seed identities, raw phases, result bytes, RSS and economic hashes are retained. Existing dataset benchmarking is unchanged; no engine or financial behavior changed.
|
||
|
||
Combined gates passed: `CARGO_BUILD_JOBS=2 bun run check` (58 tooling, 43 utility, 35 calculation, 293 integration and 37 Rust tests; zero failures), plus `bun run test:postgres` (51 tests, 301 assertions). The four new migration cases and four benchmark cases are included in those totals. Explicit ESLint on all four files, standalone strict benchmark TypeScript checking and `git diff --check` also passed. Temporary PostgreSQL/Redis containers and their disposable data were removed afterward; development services were untouched. Worktrees and local measurement artifacts are retained.
|
||
|
||
Release measurements on Linux/x64, Ryzen 9 9950X3D, Bun 1.2.17 / rustc 1.88.0:
|
||
|
||
| Total bars / assets | Median whole-trial ms | Median bars/s |
|
||
| --- | --- | --- |
|
||
| 1,000 / 1 | 20.4 | 48,962 |
|
||
| 1,000 / 10 | 17.4 | 57,419 |
|
||
| 10,000 / 1 | 193.7 | 51,631 |
|
||
| 10,000 / 10 | 167.3 | 59,769 |
|
||
|
||
Whole-trial timing includes native construction/load/run, JS parsing, validation and hashing, but excludes fresh-process startup and initial dataset preparation (reported separately). All 48 trials reproduced economic hashes. Release addon SHA-256: `324f1e18de495791e9e53c4e36be39d0b165a11e13e9bcd82f5ca2b22d014674`. Raw timings and metadata: `/tmp/stock-bot-wave3.VjJvWX/research-release.json`; durable summary and hashes are in the manifest. The subsequent full check rebuilt the debug addon; its separate identity is also recorded.
|
||
|
||
These are single-host synthetic baseline measurements, not a speedup claim or financial certification. Reused JS inputs still reload the one-shot native engine each trial; native run includes serialization and logging. Native execution dominates the measured phases, but no internal bottleneck attribution is claimed. Callbacks, shared caches, queue/storage latency, allocation counts and parallel simulation remain explicitly unmeasured. 100k is opt-in and was not run. Linux peak RSS uses `/proc/self/status` VmHWM after Bun's `maxRSS` counter proved unreliable; unsupported platforms report unavailable.
|
||
|
||
No DSL, cache, scheduler or new service is justified by this wave. Same-bar execution and canonical ownership/funding remain gated future work. O01/P01 were committed with owner approval; no pushes, PRs or trading operations occurred.
|
||
|
||
## Fourth-wave handoff — 2026-10-22
|
||
|
||
W03 is independently reviewed and `validated_committed` as `9b9403e` following owner approval. Backend and frontend contributors used separate worktrees under `/tmp/stock-bot-wave4.iEBUTZ/` with a pinned API contract. All 18 implementation/test files match their reviewed versions.
|
||
|
||
- **Save / Save and run:** Web saves explicitly send `autoStart:false`. Save and run keeps the saved definition and original submission body/key through rejection or a lost response; retry does not save another definition. Immediate ref guards prevent duplicate clicks. Close waits for an unresolved definition write; closing after saving refreshes the list. Detail submissions have separate errors, explicit retry controls and late-navigation guards.
|
||
- **Durable admission:** `Idempotency-Key` is scoped to the existing verified operator or service principal, not a caller-supplied identity or browser-session nonce. A normalized intent fingerprint distinguishes retries from conflicts. Parent-row locking, immutable request snapshots and dispatch insertion remain in one transaction; the unique principal/key constraint also covers concurrent submissions across different definitions. Matching retries return the original run; changed intent returns 409 with existing 202/Location success behavior.
|
||
- **Migration / compatibility:** New additive `14-backtest-submission.sql` is admitted by O01's serialized startup runner. Legacy NULL-key rows remain readable. Omitted `autoStart` retains legacy auto-start, and keyless clients retain non-idempotent behavior. New web paths opt into explicit save and keyed submission. No financial simulation or paper-state behavior changed.
|
||
|
||
Combined validation:
|
||
|
||
- `CARGO_BUILD_JOBS=2 bun run check`: all gates passed; 60 tooling, 43 utility, 35 calculation, 310 integration and 37 Rust tests; zero failures. The 36 DOM interaction cases and 12 security cases are included in these totals, not additional suites.
|
||
- `bun run test:postgres`: 58 tests, 345 assertions, zero failures against disposable PostgreSQL/Redis, including a final rerun after the combined build. A database barrier proves both cross-definition contenders reach INSERT before release; tests verify one run/outbox, rollback/retry, numbering, principal separation, cookie renewal, frozen snapshots and preserved legacy rows.
|
||
- Explicit frontend typecheck, application-source lint, production build and `git diff --check` passed. Existing Rust/frontend warnings and the unchanged 12 curly findings in the old DOM test harness remain; the repository lint gate passes.
|
||
|
||
Independent review caught and corrected premature list refresh while saving and a submission error hidden after changing selected runs; dedicated real-component/route regressions cover both. Local logs and hashes are recorded in the manifest. Disposable test containers and their recreatable fixture data were removed; development services were untouched. Worktrees are retained.
|
||
|
||
Limits: UI retry identities are component-lifetime state, not recovery across reload/navigation. Definition POST response loss is not covered by run-submission idempotency. Operator/service scopes are the existing single-operator security model, not new user accounts or AI authorization. DOM tests do not prove browser layout, virtualized rows or full browser/API execution; that is W04. Existing native economic limitations remain visible and unchanged.
|
||
|
||
W03 was committed with owner approval; no push, PR or trading operation occurred. W04's subsequent execution is recorded below; canonical Rust finance still requires ADR-002/003/004 approval.
|
||
|
||
## Fifth-wave handoff — 2026-10-22
|
||
|
||
W04 is independently reviewed and `validated_committed` as `550d8b7` on base `95842c3`, following owner approval. The sole implementation owner used `/tmp/stock-bot-wave5.t2GVG7/w04`; the independent reviewer accepted the frozen five-file implementation and reran all browser cases. Integration and pre-commit verification preserved all five hashes. No production application source, financial behavior or business API changed.
|
||
|
||
- **Real product path:** Chromium uses the built frontend, authenticated existing routes/websocket projection, SQL repository, durable dispatcher and worker against isolated fixtures. Save-only creates no run/outbox; explicit submission, persisted progress, unsupported-control absence, completion, trades, limitations, frozen inputs and reopening survive navigation/reload.
|
||
- **Failure and race evidence:** Separate cases cover cancellation acknowledgement versus worker settlement, failed and zero-trade results, missing results/run, network failure/retry, actual client websocket disconnect/reconnect, and a delayed real API response after switching selected runs. The stale-response assertion waits for the exact old request to finish or fail before inspecting the selected run.
|
||
- **Native smoke:** The existing Rust adapter/subprocess executes 70 synthetic bars, persists native results and dataset provenance, and renders trades/reopened results. Fixed lifecycle fixture outputs are UI test data, not an alternate financial simulator or correctness oracle.
|
||
- **Harness:** `bun run test:e2e` requires explicit disposable `stock_bot_safety*` PostgreSQL, Redis DB15, a local build/addon and explicitly installed Chromium. It rebuilds the UI in production mode with same-origin API routing. It blocks external browser requests and unrelated fixture API routes, isolates schemas/queues/listeners, and reports prerequisite/readiness/cleanup failures instead of skipping tests. Playwright 1.53.2 is now an explicit dependency; no additional runner framework was introduced.
|
||
|
||
Combined validation:
|
||
|
||
- `CARGO_BUILD_JOBS=2 bun run check`: all gates passed; 60 tooling, 43 utility, 35 calculation, 310 integration and 37 Rust tests, zero failures. Build, typecheck, contracts, lint and secret audit passed.
|
||
- `bun run test:postgres`: 58 tests, 345 assertions, zero failures against disposable PostgreSQL/Redis after integration.
|
||
- `bun run test:e2e`: 4 tests, 42 assertions, zero failures on the final main-workspace build (18.99s). Author and independent reviewer also passed all four cases on the frozen implementation. These are additional gates, not included in the repository-check totals.
|
||
- Standalone strict TypeScript and explicit ESLint passed for all three new harness files. Frozen offline dependency installation passed. Missing fixture settings, unsafe PostgreSQL/Redis databases and a missing browser installation each failed explicitly before execution.
|
||
|
||
Logs, five reviewed file hashes and native artifact identities are recorded in the manifest. Exact disposable PostgreSQL/Redis containers and their recreatable fixture data, including leftovers from aborted diagnostic attempts, were removed after validation. Development services were untouched; worktree and local logs are retained. W04 was committed with owner approval; no push, PR or trading operation occurred.
|
||
|
||
Limits: Chromium only (138.0.7204.23). A standalone probe reproduced a Bun 1.2.17 server-initiated websocket close/reconnect shutdown hang; final coverage uses an actual client-initiated disconnect and does not suppress server cleanup failures or claim server-initiated shutdown coverage. An author-reported first clean-worktree build had a browser/logger type-resolution ordering failure; a retry and the combined check passed, but no fix or reproducible diagnosis is claimed. Existing build warnings remain. UI fixtures and native smoke do not certify same-bar execution, canonical accounting, ownership or funding semantics.
|
||
|
||
At the fifth-wave closeout, the readiness review found 32 remaining scheduled tasks and no ungated candidate. The owner subsequently explicitly approved ADR-002/003/004, unblocking F01/D01; that approval is separate from test completion or the earlier generic continuation request. R01 still requires ADR-006. Optimization/deferred work is not a substitute for prerequisite completion.
|
||
|
||
## Sixth-wave handoff — 2026-10-22
|
||
|
||
F01 and D01 are independently accepted and `done` / `validated_committed` in `b4af840`. Base `243e9ab`; isolated worktrees under `/tmp/stock-bot-wave6.uIuYHz/`. Financial and dataset owners implemented in parallel, with an independent read-only reviewer; the integrator merged their common types exports.
|
||
|
||
- **F01:** Pinned maintained decimal dependency; checked exact decimal ingress, fixed-8 half-away posting, bounded arithmetic, versioned Rust/TypeScript contracts, owner/decision identities and hand-derived economic fixtures. Strategy intents cannot parse as internal financial mutations. Safe integer, Unicode, strict decimal, overflow and wire-roundtrip regressions pass. The snapshot is only an economic projection. F02 still owns actual ledger/dedup transitions and operation-specific proportional basis arithmetic; generic multiply/divide was deliberately not introduced.
|
||
- **D01:** Additive v2 normalizer retains interval/event/availability time, source sequence, explicit versioned calendars, execution-series selection, universe/action coverage and limitations. Hash-verified v1 conversion retains its parent hash and makes unverifiable legacy VWAP unknown. DST/half-days, delayed availability, conflicts, overlapping intervals, parent-hash syntax and prefix stability are tested. Unsupported action/adjusted execution data rejects; unknown coverage remains exploratory. Initial intraday support requires full-duration session-contained bars.
|
||
|
||
Combined validation passed:
|
||
|
||
- `CARGO_BUILD_JOBS=2 bun run check`: 60 tooling, 43 utility, 35 calculation, 334 integration and 44 Rust tests, zero failures. Build, typecheck, contracts, lint and secret audit passed. The initial sandbox attempt failed native spawning/worker checks; the escalated full rerun passed.
|
||
- Final focused rerun after formatting two JSON fixtures: 35 TypeScript tests / 601 assertions and 44 Rust tests, zero failures. Parsed fixture values match the independently reviewed source exactly.
|
||
- Standalone strict TypeScript, explicit scoped ESLint, scoped Prettier and `git diff --check` passed. Reviewed hashes match except the deliberate shared-export merge and documented formatting-only differences. Full hashes, logs and independently rebuilt addon identities are in the manifest.
|
||
|
||
No PostgreSQL/Redis or Chromium rerun was needed for these additive, unused contracts: SQL, APIs, UI and current execution paths did not change. No throughput certification is claimed. Existing build warnings remain; isolated clean builds needed existing dependency builds/retries, without a build-system fix.
|
||
|
||
Only the verified stalled sandbox test processes were stopped after the successful rerun. No user services or data were removed; worktrees and logs remain available.
|
||
|
||
Existing v1 snapshots and financial runtimes remain unchanged. F01 is not a working canonical ledger; D01 prefix tests are not F06 replay enforcement. The subsequent owner request authorized the F01/D01 commit and F02/D02 continuation, not a push, PR or trading operation.
|
||
|
||
## Seventh-wave handoff — 2026-10-22
|
||
|
||
F02/D02 were independently accepted and subsequently committed as `b65accc` at owner request. Base `b4af840`; isolated worktrees under `/tmp/stock-bot-wave7.UIkAQD/`. Financial and data owners implemented in parallel; an independent reviewer checked both; root integrated all ten reviewed files with matching hashes.
|
||
|
||
- **F02:** Owner-keyed quantity, remaining basis, realized P&L and fees; exact rational intermediates rounded once into the maintained decimal posting type. Fee-inclusive funding, wrong-owner disposal, overflow and identity conflicts reject atomically. Command/fill aliases return original replay-labelled receipts, including after intervening operations. Explicit market marks remain separate from fill prices; owner-level marked postings reconcile to account equity. Same-session boundary repetition is an accepted no-op, not a false session-change effect. Ledger-only checkpoints retain and validate ordered receipts by replay; ordinary transitions touch only affected state.
|
||
- **D02:** Existing EOD `1m`/`5m`/`1h` Mongo collections now feed the common research storage admission path. Unix-second timestamps/listing identities validate; supported-provider capability reports distinguish configuration/connectivity from coverage. Default QuestDB priority remains, explicit provider selection is available at the storage API, and missing/error ranges never switch to daily/synthetic data. Real writer/read/normalizer composition and repeated legacy native runs are tested on synthetic provider records; HTTP/Mongo transport alone is replaced.
|
||
|
||
Combined validation:
|
||
|
||
- `CARGO_BUILD_JOBS=2 bun run check`: 60 tooling, 43 utility, 35 calculation, 342 integration and 59 Rust tests passed, zero failures. Build, typecheck, contracts, lint and secret audit passed. One Rust test is intentionally ignored by the ordinary suite because it is a manually invoked release measurement.
|
||
- Independent review: 22 financial Rust tests passed; 36 intraday/ingestion/dataset tests with 264 assertions passed. These overlap the combined totals, not additional independent cases.
|
||
- Standalone strict TypeScript including the real ingestion import graph, explicit scoped ESLint, Prettier, scoped rustfmt and `git diff --check` passed. Cargo.toml line endings were normalized alongside its pinned dependency additions; no dependency upgrades occurred. Only num-bigint was newly added to the lockfile.
|
||
- A repeatable release ledger workload runs 1k/10k prebuilt commands over one owner/asset or three owners/four assets, with three repeats and full state/effect byte equality. Transition, checkpoint-copy and restore times are recorded separately. Detailed raw measurements/build identities are in the manifest; these are not end-to-end backtest throughput or a speedup claim. Receipt memory and restore work grow with history; compaction is not implemented.
|
||
|
||
The manual release measurement also passed on the final integrated checkout (1 test, zero failures), with identical repeatability checksums to the author build. It is additional validation, not a skipped correctness test.
|
||
|
||
Limits: no F04 reservation/portfolio-risk policy, matcher, F06 replay, native session API, SQL/paper cutover, order/strategy/RNG session restoration or canonical-engine release. D02's provider selector is not a web/run-configuration control; no Mongo server-conformance, range-completeness or live-availability claim. Provider delayed-finalization caveats and the explicit bar-close simulation assumption are retained in the task evidence. PostgreSQL/Redis and Chromium suites were not rerun because their persistence/API/UI boundaries did not change. Existing build warnings remain.
|
||
|
||
Only exact identified stalled D02 sandbox test/worker processes were terminated after the successful escalated rerun; no development services/data were changed. Worktrees and logs remain available. The subsequent owner request authorized the seventh-wave commit and **F04 central cash reservations and portfolio risk enforcement**. No push, PR or trading operation occurred. Product/AI work remains subject to its unapproved ADRs.
|
||
|
||
## Eighth-wave handoff — 2026-10-22
|
||
|
||
F04 is independently accepted and `review` / `validated_uncommitted`. Base `b65accc`; isolated worktree `/tmp/stock-bot-wave8.pKzr7p/f04`. One owner implemented five financial files, two read-only reviewers accepted them, and root integrated exactly matching hashes. See [execution policy clarifications](backlog/tasks/F04.md#execution-policy-clarifications).
|
||
|
||
- **RiskAccount** privately owns the existing Ledger. Explicit and target-derived normalized orders share funded admission; strategy-owned sells cannot borrow inventory or credit anticipated proceeds. Fill-time checks account for other reservations, adverse gaps and split-fill rounding; rejection releases the remainder without changing prior fills. Commission is computed from exact quantity × price × rate, rounded once.
|
||
- Portfolio quantity/exposure uses owner-book rounding, including pending buys. Increasing risk requires fresh marks across held/pending assets. Reductions remain possible during stale data and marked-loss halts. Explicit account boundaries reset daily state only; drawdown peak/halt persists through rollover and restore. Instance-bound operator reset records its baseline, separate from strategy input.
|
||
- Recorded accepted/rejected outcomes and fill aliases replay without reapplying effects or moving the clock. Checkpoints reconstruct and verify risk/ledger state, reservations and receipts. Overflow/malformed internal commands remain atomic errors, not ordinary risk rejections. Future adapters must honor the outer replay flag before publishing nested financial effects.
|
||
|
||
Validation: `CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/lint/audit plus 60 tooling, 43 utility, 35 calculation, 342 integration and 77 Rust tests. Independent risk suites passed 18 cases; the broader financial suite passed 40 (overlapping totals). Two manual benchmarks are excluded from ordinary Rust runs; the new risk release benchmark was separately executed successfully in both author and integrated checkouts. Scoped rustfmt, diff checks and manifest DAG/readiness validation passed. Existing repository-wide rustfmt and planning-manifest Prettier style deviations were confirmed outside this change's formatting scope; no unrelated formatting rewrite.
|
||
|
||
The narrow release workload uses 1k/10k prebuilt mark/admit/partial-fill/release commands, three repeats, one active owner/asset or two active owners/four assets. Full checkpoint/outcome bytes and restored checkpoints match. Integrated 10k transition time was approximately 42–45ms single and 55–56ms multi, excluding build/loading/serialization; checkpoint and restore are measured separately. Only zero/one live reservation is exercised. This is not full backtest throughput or a scaling guarantee: normal risk checks scan retained book keys and live commitments with ordered-map costs; retained journal memory/restore work grows with history. Raw commands, logs, artifact/source hashes and measurements are in the manifest.
|
||
|
||
Limits: active legacy engines unchanged; no F05 matcher, target expansion/mode coordination, limit/TIF/capacity eligibility, F06 calendar/replay, F07 native sessions, paper/SQL cutover or full strategy/replay/RNG recovery. Operator capability is API separation, not untrusted-code security. PostgreSQL/Redis, browser and Python suites were not rerun because those boundaries did not change. No services/data were removed. No new-wave commit, push, PR or trading operation. Next after acceptance/commit: **F05 matching and order lifecycle on the canonical ledger/risk facade**; replay release remains gated by F06.
|
||
|
||
## Ninth-wave handoff — 2026-10-22
|
||
|
||
F05 is independently reviewed and `review` / `validated_uncommitted`. Its isolated worktree `/tmp/stock-bot-wave9.P8EKsc/f05` uses base `b65accc` plus the five exact F04 prerequisite files. The owner accepted continuation without requesting a prerequisite commit. One financial owner implemented; execution and quant reviewers accepted the final source; root integrated exactly matching hashes. See [F05 execution policies](backlog/tasks/F05.md#execution-policy-clarifications).
|
||
|
||
- **MatchingAccount** privately owns RiskAccount, with no competing ledger, fee or funding logic. Open-only and quote execution have explicit spread/slippage rounding, limit crossing, latency, session eligibility and shared liquidity. IOC/FOK/DAY/GTC transitions, partial fills, cancellation, rejection and terminal cancellation are deterministic. No synthetic end-of-run liquidation is introduced.
|
||
- Owner-scoped absolute targets account for holdings and live commitments. Omitted assets remain unchanged; repeated targets preserve partial orders. Changed targets cancel only the owner's relevant commitments before risk-checked replacement. Declared target-array order is priority, not an atomic portfolio rebalance. Target and explicit-order modes cannot be mixed for an owner.
|
||
- Structural batch validation precedes mutation. Physical execution identity prevents capacity reuse under changed delivery keys; delayed quotes retain their physical time and cannot fill orders that were not yet eligible. Exact retries replay original receipts without republishing nested effects. Checkpoints reconstruct matching, risk and ledger state. Unexpected numerical failure records the committed prefix and makes the attempt terminal; adapters must fail the run, never publish successful metrics from that prefix.
|
||
- Admission uses a coordinator revision, distinct from the nested ledger snapshot revision. F06 must honor that token, physical event timing and failure contract; it must not restamp missed opens. Full replay/strategy/RNG session restoration remains later work.
|
||
|
||
Combined validation: `CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/lint/audit plus 60 tooling, 43 utility, 35 calculation, 342 integration and **106 Rust tests**, zero failures. The 29 matching regressions also passed independently in both reviews (overlapping totals). Three manual benchmarks are ignored by the ordinary Rust suite; the new matching release measurement passed separately in both author and integrated builds. Scoped rustfmt, diff checks and final manifest/source verification passed.
|
||
|
||
The narrow release workload uses 1k/10k execution events and fills, each preceded by a submit (2k/20k coordinator commands plus setup), over one owner/asset or two owners/two assets, with three repeats. Integrated 10k apply time was 214–235ms single and 234–238ms multi. Apply includes fixture construction/assertions/outcome collection; checkpoint copying is separate, and restore includes cloning its checkpoint input. Serialization is outside these timers. Exact economics, checkpoint/outcome repeatability and restored checkpoint equality are asserted. Serialized checkpoint plus returned outcomes are approximately 12.6MB/128MB at 1k/10k; this is not RSS. Retained journals grow with history. These are component measurements, not end-to-end backtest throughput, a speedup claim or a reason to introduce caching/compaction prematurely. Full raw rows and artifact/source identities are in the manifest.
|
||
|
||
Limits: active legacy simulator and NAPI unchanged; no replay scheduler, paper/SQL cutover or full session restore. Checkpoints validate consistency, not authenticity or arbitrary-code security. PostgreSQL/Redis, browser and Python suites were not rerun because their boundaries did not change. Existing build warnings remain. No services/data removed; worktree/logs retained. **F04/F05 remain uncommitted. Next after acceptance: F06 deterministic availability-aware replay**, still the release gate for this matcher. No commit, push, PR or trading operation occurred.
|
||
|
||
## Tenth-wave handoff — 2026-10-22
|
||
|
||
F04/F05 were accepted and committed as `ccf333c` at owner request, superseding their uncommitted handoff status above. F06 is independently reviewed and `review` / `validated_uncommitted`. Isolated worktree `/tmp/stock-bot-wave10.8uCLfa/f06` starts at that commit. One implementation owner wrote three replay files; independent timing/execution and quant/performance reviewers accepted the frozen source; root integrated exactly matching hashes. See [F06 execution clarifications](backlog/tasks/F06.md#execution-handoff-clarifications).
|
||
|
||
- **Replay** owns MatchingAccount and one sorted immutable event vector. Available observations use an index prefix rather than repeated history copies. Declared cadence produces one synchronized barrier per timestamp; exact due owners submit against the matching admission revision. Missing/stale feature inputs remain explicit. Prepared input/config ordering is canonicalized; file permutations preserve trace/checkpoint bytes.
|
||
- Only the pinned execution series provides open opportunities, marks and liquidity derived from the physically latest completed available volume. Warmup cannot trade; terminal observations mark only. Late prior closes cannot overwrite a physically newer open even when their timestamps tie. True retained session opens are never restamped for mid-session starts. Risk-session boundaries are a separate explicit clock.
|
||
- Exact canonical input/config content, not an unverified label, binds checkpoints. Restore reconstructs event prefixes and fixed decision submissions, then verifies the full state. Both submission-time and automatic-event financial failures preserve terminal diagnostic prefixes without producing a successful run. Strategy-state/RNG recomputation remains F07/S01.
|
||
|
||
Combined validation: `CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/lint/audit plus 60 tooling, 43 utility, 35 calculation, 342 integration and **131 Rust tests**, zero failures. The **25 replay regressions** passed independently; the timing reviewer also ran the full frozen test binary. Four manual benchmarks are ignored by ordinary Rust runs; the new release replay measurement passed in both author and integrated checkouts. Scoped rustfmt, diff, task DAG/readiness and final source/artifact checks passed.
|
||
|
||
Release measurement: one/two assets, 1k/10k/100k execution bars plus one cadence-only row, three repeats each, one buy/fill per run. Full checkpoint bytes repeat exactly; independent expected cash/equity and restored checkpoints match. Integrated 100k load was 76–85ms and traversal 0.91–1.11s. Load includes canonicalization, validation, sorting and exact binding serialization; traversal includes financial marks/journals and the fixture decision. Input generation/cloning and output serialization are excluded. Checkpoint copying and full restore are timed separately. At 100k the serialized checkpoint is approximately 429MB, not RSS. Receipt history is retained; no compaction or cross-trial cache was introduced. This is not order-heavy, TS/NAPI, batch or storage throughput, nor a baseline speedup claim. Raw rows and hashes are in the manifest.
|
||
|
||
**Material model restriction:** existing sequential equal-time marks can latch intermediate portfolio loss/drawdown despite unchanged final synchronized equity. The implementation exposes this limitation and pins a permutation regression. R05's multi-asset default activation requires explicit owner acceptance or an approved coordinated atomic-mark correction. F06 acceptance does not waive that gate.
|
||
|
||
Other limits: trusted internal prepared bars only; F07 must verify/adapt frozen D01 inputs and preserve provenance/model limitations. Quote replay and abutting sessions explicitly reject. Event budget bounds count, not wall time. Active legacy simulator, native API, SQL/paper and web paths are unchanged; no PostgreSQL/Redis, browser or Python rerun was needed. Existing build warnings remain. No services/data removed; worktree/logs retained. **F06 remains uncommitted. Next after acceptance: F07 native pull-session/dataset adapter**; F08 result projection may follow with coordinated contract ownership. No push, PR, trading operation or further task implementation occurred.
|
||
|
||
## Eleventh-wave handoff — 2026-10-23
|
||
|
||
F06 was accepted and committed as `417a7bd` at owner request, superseding its uncommitted handoff status above. F07 was independently reviewed, validated and subsequently committed as `e3635f2` at owner request. Isolated worktree `/tmp/stock-bot-wave11.l8cJnN/f07` starts at the F06 commit. One native/worker owner implemented; a second owner supplied three disjoint benchmark files reviewed by root. Independent boundary/lifecycle and data/quant reviews accepted the boundary. Root integrated 22 matching source/test files. See [F07 clarifications](backlog/tasks/F07.md#execution-handoff-clarifications).
|
||
|
||
- **FinancialReplaySession:** thin NAPI export over one ReplayHost/F06 core; strict identity/version envelopes, event-count-bounded progress/decision/complete/failed steps, synchronized admission revisions, complete-batch submission, terminal success gate and disposal. One read-only observation-range accessor avoids checkpoint copies. The exact host is tested against direct Rust Replay with identical barriers, outcomes and receipts; TS uses the same frozen fixture and independent arithmetic.
|
||
- **TypeScript/worker:** existing D01 validator verifies actual data and derived eligibility/limitations. Numeric ingress expands scientific notation and rejects unsupported precision without rounding. Calendars, execution feed and availability are retained. Callbacks receive only shared immutable published deltas and financial views. Exceptions submit no partial batch; worker results must match captured identity/policy. Existing process cancellation, crash, wait-for-close and lease protections remain.
|
||
- **Scope:** fixed trace and fixture callbacks only, not S01 production strategy state/RNG or a DSL. The legacy request, durable runner default and paper/live behavior are unchanged. Exact architecture tests permit only the worker and its helper to reach native replay; shared schemas still cannot import native/data/services.
|
||
|
||
Final validation: `CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/lint/audit plus **63 tooling, 43 utility, 35 calculation, 353 integration and 133 Rust tests**, zero failures. Four earlier manual Rust measurements remain intentionally ignored by the ordinary suite. Independent frozen-artifact review ran 69 focused TS tests and 29 replay-related Rust cases (overlapping totals). Disposable PostgreSQL/Redis suites passed **58 tests / 345 assertions** before and after integration. Release-addon replay/binding tests passed **17 tests / 120 assertions**. Extra strict TypeScript for affected scripts/tests, scoped ESLint, rustfmt and diff checks passed. Explicit lint of the normally ignored architecture test confirms the same 13 pre-existing curly-style errors at HEAD and in the worktree; no new ones. The clean isolated build initially needed the existing logger prerequisite built manually; no build-system rewrite.
|
||
|
||
Release measurement: 1k/10k total bars, one asset/owner or ten assets/two owners, two fresh processes with two fresh native sessions each; alternate one-unit buy/sell targets. Full normalized results match across repeats, reverse callback order and debug/release profiles. Independent integer-cent cash/equity/basis/fee/fill checks pass. At 10k, release whole-trial times were **2.65–2.93s single / 3.51–3.61s multi**; finalization alone was **0.89–1.03s / 1.34–1.40s**. Final receipt payloads were approximately **66.7MB / 103.6MB**, not RSS. Cold imports and detached dataset verification, mapping, session load, real advance/submit/decision timings, bytes and process RSS are recorded separately in the manifest/logs. This is order-heavy component conformance throughput, not empty-crossing overhead, a production research benchmark, an isolated-host SLA or a legacy-engine speedup. No cache, batch pool, compaction or DSL was introduced.
|
||
|
||
Limits remain explicit: trusted host interface, not an untrusted-code sandbox; native prepared input does not independently authenticate D01. Quote/abutting-session replay remains unsupported; event count is not a wall-time guarantee. Sequential equal-time marks can still latch intermediate risk halts; R05's owner policy gate remains unresolved. Full receipts are retained and serialized; F08 can use these measurements when designing canonical results without prematurely adding a general storage framework.
|
||
|
||
Only the two named disposable fixture containers and their recreatable synthetic data were removed; development services were untouched. Worktree/logs retained. Browser/Python suites were not rerun because those boundaries did not change. **F07 is committed. Next recommended: F08 canonical metrics/result projections**, now code/ADR-ready but not yet authorized. S01 requires ADR-005 approval. No push, PR, default cutover or trading operation occurred.
|
||
|
||
## Twelfth-wave handoff — 2026-10-23
|
||
|
||
Two focused performance stories replace a broad optimization request: [F09](backlog/tasks/F09.md) emits compact authoritative terminal values/owned fills with optional complete diagnostics; [P07](backlog/tasks/P07.md) profiles no-trade, sparse and high-turnover workloads using the existing harness. F08 consumes F09 and later adds explicit session sampling/exposure/statistical policies. No session-close values are inferred from risk baselines, and fills are not relabelled completed trades.
|
||
|
||
Base `19e9dad`; isolated worktrees under `/tmp/stock-bot-wave12.F9Rlh4/`. One native/result contract owner, one disjoint benchmark owner, root planning/integration and independent review. Baseline profiling was measured on F07; compact comparisons used the accepted F09 contract. Internal journals/recovery, legacy/default paths and all mark-policy release gates remain. No framework, DSL, cache, worker-pool or web-pagination expansion.
|
||
|
||
Both stories are independently reviewed and `review` / `validated_uncommitted`. Root integrated 14 source/test files with exact reviewed hashes. F09's accepted contract was overlaid into P07's isolated worktree before compact comparison work; neither owner independently changed the other's contract.
|
||
|
||
- **F09:** native `project()` returns the existing authoritative ledger valuation and actual owned fills copied from committed commands/effects. It skips replay aliases and retains separate gross cash movement and fee postings, signed owner contributions and residual cost basis. Typed serialization borrows journal facts; no checkpoint copying, financial replay or TypeScript accounting is introduced. Complete-state/identity/format/cancellation guards cover the compact path. Full `finalize()` output, defaults, internal journals and recovery are preserved.
|
||
- **P07:** the existing harness now selects no-trade, sparse and turnover profiles with identical callback cadence, plus trace/projection/both output. It records native-finalization, decoding, validation and disposal separately. Comparisons require the same dataset, policy, strategy, artifact, terminal view and actual fill facts. Full per-format hashes remain independent; no TypeScript valuation is fabricated to compare formats. A 200,000-fill regression prevents a benchmark-only JavaScript argument-limit failure.
|
||
|
||
Validation: full `CARGO_BUILD_JOBS=2 bun run check` passed build/types/contracts/lint/audit, 63 tooling, 43 utility, 35 calculation, 359 integration and **136 Rust tests**, zero failures; four existing manual benchmarks remain intentionally ignored. After the final benchmark files were integrated, all **72 tooling tests / 10,184 assertions** passed. Extra strict test/script TypeScript, scoped ESLint, rustfmt and diff checks passed. Disposable PostgreSQL/Redis suites passed **58 tests / 345 assertions** before and after integration. Independent debug and integrated release native/worker checks each passed **23 tests / 198 assertions**. These focused tests overlap larger suites. No browser/Python rerun was needed for unchanged boundaries.
|
||
|
||
Paired release results below use identical frozen source and addon `d98308d0…`, two fresh processes with two fresh native sessions each, including reversed callback order. Numbers are median **replay/decision/finalization/disposal time**, excluding native construction and benchmark-only oracle/hash work. Bars are total across assets. Preparation/imports, whole-trial time, all phase timings, RSS, hashes and raw report paths are recorded in the manifest. This is synthetic component conformance throughput on a shared host, not durable-job latency or an isolated-host SLA.
|
||
|
||
| Total bars | Profile | Assets / owners | Full trace | Compact | Reduction |
|
||
| --- | --- | --- | ---: | ---: | ---: |
|
||
| 10,000 | No trade | 1 / 1 | 1.142s | 0.744s | 34.9% |
|
||
| 10,000 | No trade | 10 / 2 | 0.599s | 0.296s | 50.7% |
|
||
| 10,000 | Sparse | 1 / 1 | 1.184s | 0.835s | 29.5% |
|
||
| 10,000 | Sparse | 10 / 2 | 0.720s | 0.419s | 41.8% |
|
||
| 10,000 | Turnover | 1 / 1 | 2.105s | 1.467s | 30.3% |
|
||
| 10,000 | Turnover | 10 / 2 | 2.598s | 1.804s | 30.6% |
|
||
| 100,000 | Sparse | 1 / 1 | 11.918s | 8.097s | 32.1% |
|
||
| 100,000 | Sparse | 10 / 2 | 7.312s | 4.245s | 41.9% |
|
||
| 100,000 | Turnover | 1 / 1 | 21.027s | 14.821s | 29.5% |
|
||
| 100,000 | Turnover | 10 / 2 | 26.501s | 18.743s | 29.3% |
|
||
|
||
Every selected comparison passed independent economic oracles, complete result repeatability and common financial equality. All six 10k diagnostic hashes also match the historical F07 baseline. That intermediate extended harness's source bodies were not retained, only their hashes, so historical timings are contextual; speedup claims use the final paired source, which is archived with all 21 changed files as measured. Final planning edits follow the measurements; application source remains identical. No 100k no-trade run is claimed.
|
||
|
||
At 10k turnover, output falls from **66.7MB to 9.8MB** single and **103.6MB to 19.4MB** multi. At 100k turnover it falls from 672MB/1.044GB to 98.6MB/195.8MB. Full diagnostics remain available; this is an export reduction, not deletion of retained history. Compact 10k advance/submit accounts for 70–88% of run time. Those mixed timers should be profiled before selecting another optimization. Fixture TS decisions take only 0.9–3.5%; these results do not justify a DSL. Compact schema validation and disposal remain measured costs; removing checks or recovery history is not the next step.
|
||
|
||
Only the two exact disposable fixture containers and their synthetic data were removed; development services were untouched. Worktrees, logs and measured-source archive remain available. No commits, pushes, PRs, default cutover or trading operation occurred. **Next after acceptance: F08 historical equity/session/exposure and versioned statistics**, with explicit sampling conventions. S01 and product/AI work retain their pending ADR gates; the equal-time multi-asset risk-mark restriction remains unresolved.
|
||
|
||
## Thirteenth-wave execution — 2026-10-23
|
||
|
||
F09/P07 were accepted and committed as `e3bd722`, superseding their uncommitted handoff above. [F08](backlog/tasks/F08.md#execution-contract--2026-10-23) is the next code/ADR-ready story. Isolated worktrees start at that commit under `/tmp/stock-bot-wave13.KfvceG/`.
|
||
|
||
Root pinned the reporting contract after Rust and quantitative review. One owner implements the native reporting accumulator/wire; a disjoint owner implements reviewed statistics and the additive analytics adapter. The accepted native schema is passed to the consumer before integration. An independent reviewer checks sampling, financial invariants and undefined-statistic handling.
|
||
|
||
Account-session samples follow all equal-time observations without changing the earlier risk reset or financial event indexes. Partial session returns remain visible but are excluded from full-period annualized ratios. Exposure counts the union of actual occupied intervals over elapsed calendar time, including open positions through termination. Statistical policy explicitly records annualization/risk-free conventions and unavailable benchmark/round-trip metrics; no hidden 2%/252 defaults are introduced for canonical reports.
|
||
|
||
F08 adds a canonical analytics DTO beside the existing result contract. It does not fabricate the legacy DTO's per-position mark/average/P&L fields or infer round trips from fills. R05 retains persisted/public-result migration and default cutover. Existing readers/UI remain compatibility gates. No new financial policy, cache/DSL, journal deletion or unrelated per-step performance change is included.
|
||
|
||
**Validated handoff:** F08 is `review` / `validated_uncommitted`. Root integrated all 22 owner files with exact independently reviewed hashes and added a real native → worker → analytics composition test. The planning commit is `1e16445`; no F08 implementation commit has been made.
|
||
|
||
- Rust records account-session equity after equal-time observations and unions actual occupied intervals, including open positions at termination. Restore reconstructs the same facts without changing financial event IDs, checkpoints or existing trace/projection output.
|
||
- Native `report()` and the existing worker transport expose the versioned facts. The additive TypeScript adapter reuses reviewed calculations with explicit annualization/risk-free policy, partial-period exclusion and nullable unsupported metrics. Shared calculations retain old defaults for old callers; exactly constant returns and zero terminal-equity CAGR now have pinned edge-case tests.
|
||
- Repository build, typecheck, contract, audit and lint gates passed, with 72 tooling, 43 utility, 44 calculation and 144 Rust tests. Four existing manual Rust benchmarks remain ignored. The initial integration run exposed missing explicit hold decisions in the new composition fixture; after that test-only correction, **375 integration tests / 3,345 assertions passed**. Strict test TypeScript, scoped ESLint/Prettier/rustfmt and diff checks passed. Disposable PostgreSQL/Redis recovery suites passed **58 tests / 345 assertions** before and after integration. The release addon passed **39 focused native/worker/analytics tests / 703 assertions**. Counts overlap; browser/Python boundaries did not change and those suites were not rerun.
|
||
|
||
Release measurements used six synthetic workloads with **10,000 total bars**, one asset/owner or ten assets/two owners, and no-trade/sparse/turnover strategies. The first candidate appeared 33–44% slower than the early baseline, including unchanged TypeScript callback/JSON phases. Shared host load varied materially. A contemporaneous rerun of the exact unchanged F09 release reproduced that slowdown; 128 relevant control source files match `e3bd722`. All complete result and financial hashes agree. Retain both sets of evidence; this is not a speedup claim.
|
||
|
||
| Workload | Early F09 median | Contemporaneous F09 control | F08 median | F08 vs control |
|
||
| --- | ---: | ---: | ---: | ---: |
|
||
| No trade, 1 asset / 1 owner | 722 ms | 1,050 ms | 1,037 ms | −1.2% |
|
||
| No trade, 10 assets / 2 owners | 301 ms | 422 ms | 413 ms | −2.2% |
|
||
| Sparse, 1 asset / 1 owner | 788 ms | 1,137 ms | 1,125 ms | −1.0% |
|
||
| Sparse, 10 assets / 2 owners | 425 ms | 589 ms | 582 ms | −1.3% |
|
||
| Turnover, 1 asset / 1 owner | 1,425 ms | 1,994 ms | 2,009 ms | +0.7% |
|
||
| Turnover, 10 assets / 2 owners | 1,820 ms | 2,432 ms | 2,426 ms | −0.3% |
|
||
|
||
Each median has four fresh-session samples across two processes. A separate counterbalanced comparison of projection/report output passed all **48 sessions**, exact repeated report/analytics hashes and an independent integer-cent oracle. Removing reporting fields and normalizing the format discriminator to `projection` yields the identical complete projection. Report finalization medians were 0.24–6.77 ms higher; analytics took 0.50–1.28 ms. These fixtures have only one partial account period: they measure export/occupancy and minimal analytics, not long histories of session statistics, durable research throughput or empty NAPI cost. There is no demonstrated material replay regression on these workloads, and no stable-host SLA is claimed.
|
||
|
||
Raw samples, source/artifact hashes, commands and review evidence are in `manifest.json` → `thirteenth_wave_validation`, with retained files under `/tmp/stock-bot-wave13.KfvceG/`. Only the two exact disposable test containers were stopped; development services were untouched. Source worktrees and logs remain.
|
||
|
||
Limits: sampled drawdown is not intraday maximum; marks are last available without per-session freshness certification; benchmark-dependent and round-trip statistics remain null with reasons. Sequential equal-time marks can still latch intermediate risk halts. R05 retains its owner policy gate and public/persisted result cutover. **Next after acceptance: S01 stateful TypeScript strategy decisions**, requiring ADR-005 approval; R01/R11 require ADR-006. No pending decision, default cutover, push, PR or trading operation was implicitly approved.
|
||
|
||
## Fourteenth-wave execution — 2026-10-23
|
||
|
||
F08 was accepted and committed as `3838295`, superseding its uncommitted handoff above. S01 is the next satisfied task under ADR-004/005. Isolated runtime and verification worktrees start at that commit under `/tmp/stock-bot-wave14.JYfazy/`; root owns planning/integration and a separate reviewer checks the result.
|
||
|
||
[S01's execution contract](backlog/tasks/S01.md#execution-contract--2026-10-23) pins one shared pull loop, typed synchronous state-in/state-out strategy programs, per-owner observation/decision/RNG cursors, atomic staging around native submission and truthful admission feedback. Different strategy cadences must not lose another owner's observations. Rust remains the only financial authority.
|
||
|
||
Recovery deliberately follows the current research job boundary: restart the whole attempt from frozen inputs and original initial states/seeds. TS snapshots are diagnostic; no incomplete mid-run resume or new native checkpoint transport. S02 owns the first real strategy and trusted worker composition; S03 preserves durable paper integration, R05 the default/public-result cutover. The active legacy registry, SQL/paper state and web runner remain unchanged.
|
||
|
||
**Validated handoff:** S01 is `review` / `validated_uncommitted`. Eight author/verification files were integrated with exact independently reviewed hashes. Root added the permanent author type-test gate. The source bundle and raw logs remain under `/tmp/stock-bot-wave14.JYfazy/`; the manifest owns the precise validation record.
|
||
|
||
Callbacks now receive frozen prefix observations, isolated typed state/positions and scoped per-owner randomness. Every due callback uses the same native portfolio view; all next states/intents are staged before admission and all feedback is validated before one committed-state swap. Rejections advance state and carry actual Rust order status. Late callback failures, ambiguous native submissions and malformed feedback dispose the attempt and retain the last confirmed diagnostic state. The original conformance driver uses the same extracted pull loop with unchanged IDs and financial hashes.
|
||
|
||
Review caught two boundary defects before integration: unhandled Promise rejections from invalid async callbacks, and empty feedback envelopes accepted by `z.unknown()` fields. Narrow fixes observe actual Promise rejection without awaiting/invoking arbitrary thenables and require present object-valued feedback tags. Regression tests cover both, including foreign-realm Promises and failure after real native admission. No Rust semantics, worker protocol, SQL or legacy registry implementation changed.
|
||
|
||
Full `CARGO_BUILD_JOBS=2 bun run check` passed build/typecheck/contracts/audit/lint plus **78 tooling, 43 utility, 44 calculation, 390 integration and 144 Rust tests**, with four existing manual Rust measurements ignored. Extra strict test TypeScript, scoped ESLint/Prettier and diff checks passed. The initial temporary strict config lacked its root-relative Bun type lookup; fixing that external config resolved it without source changes. Disposable PostgreSQL/Redis suites passed **58 tests / 345 assertions**; final release tests passed **43 tests / 568 assertions**. Independent native verification contributed 15 scenarios / 249 assertions, overlapping the integrated totals. Browser and Python boundaries did not change and those suites were not rerun.
|
||
|
||
The unchanged conformance CLI passed all six 10k workloads with identical complete result/economic hashes and the same release native artifact as F08. Historical wall-time changes track shared-host load; they are not an extraction speedup claim. A separate counterbalanced benchmark compared stateful programs with **replay of their exact captured decisions**, including IDs. This avoids treating different identity/payload sizes as callback cost.
|
||
|
||
| 10,000 total bars | Recorded decisions | Stateful programs | Added wall time |
|
||
| --- | ---: | ---: | ---: |
|
||
| No trade, 1 asset / 1 owner | 861 ms | 949 ms | 88 ms / 10.3% |
|
||
| No trade, 10 assets / 2 owners | 357 ms | 372 ms | 14 ms / 4.0% |
|
||
| Sparse, 1 asset / 1 owner | 908 ms | 1,050 ms | 143 ms / 15.7% |
|
||
| Sparse, 10 assets / 2 owners | 511 ms | 527 ms | 16 ms / 3.1% |
|
||
| Turnover, 1 asset / 1 owner | 1,569 ms | 1,881 ms | 313 ms / 19.9% |
|
||
| Turnover, 10 assets / 2 owners | 1,925 ms | 2,212 ms | 287 ms / 14.9% |
|
||
|
||
All **48 timed sessions** match complete financial hashes; repeated/reversed program order preserves diagnostic state/RNG hashes. Each fresh child first captures a reference trace, so timed sessions are in a warmed process. Medians have four samples per mode. Wall time includes construction, state validation/staging, callbacks, admission feedback, finalization and disposal; post-run oracle/hash work is separate. Each callback updates four scalar fields and draws once. This is neither pure callback overhead nor complex-strategy, database/queue or cold-start throughput. The measured 3.1–19.9% overhead is retained as a profiling baseline, without removing correctness checks or introducing a DSL/cache.
|
||
|
||
Only the two exact disposable fixture containers were stopped; development services were untouched. Worktrees, archives and measurements remain. **Next after acceptance: S02**, port one SMA strategy and wire its explicit trusted version into the existing worker. Its handoff distinguishes indicator state reconstruction from unsupported native mid-run resume. R05 still owns durable/public-result activation; paper migration and other pending decisions remain separately gated. No S01 commit, push, PR or trading operation occurred.
|
||
|
||
## Fifteenth-wave execution — 2026-10-23
|
||
|
||
S01 is accepted and committed as `2bcadbd`, superseding its uncommitted handoff above. S02 now has satisfied prerequisites. Isolated strategy and worker worktrees start at that commit under `/tmp/stock-bot-wave15.zi3GmP/`; root owns integration and a separate reviewer checks both changes.
|
||
|
||
[S02's pinned contract](backlog/tasks/S02.md#execution-contract--2026-10-23) defines an explicit long-only SMA version with reviewed crossover arithmetic, owner-budget whole-share sizing, prefix-safe history and native freshness checks. The existing worker accepts only reviewed built-in selections and binds returned strategy provenance to the captured request. Legacy readers/factories, financial Rust semantics and active web/paper paths stay intact. No generic registry, source-code transport, feature framework or incomplete checkpoint resume is introduced.
|
||
|
||
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.
|
||
|
||
## Sixteenth-wave execution — 2026-10-23
|
||
|
||
S02 was accepted and committed as `ca5abdd`. The owner then explicitly stopped performance work and requested the remaining backlog. P08 is deferred; its initial inspection made no application changes and ran no profiling or benchmarks.
|
||
|
||
S03 is the next highest-priority code/ADR-ready task. [Its pinned execution contract](backlog/tasks/S03.md#execution-contract--2026-10-23) covers a stateless native transaction adapter, versioned SQL custody and actual strategy-state/RNG/batch-intent recovery. Native and durable owners use separate worktrees based on `ca5abdd` under `/tmp/stock-bot-wave16.kgaZm4/`; independent review checks the contract before integration.
|
||
|
||
Preserve existing row locks, journal context, idempotency and rollback behavior. Canonical next-event timing and immutable policy differ explicitly from legacy execution; refuse implicit account conversion. Retain failed native prefixes atomically as terminal, and keep notification delivery separate from financial commit. No performance work, default switch, paper feed activation or other pending ADR approval is included. S04 owns feed readiness; R01/R11 still require ADR-006.
|
||
|
||
## 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.
|
||
|
||
Deferred economics: short/margin/borrow, multicurrency, full corporate actions, intrabar stops/OCO, detailed market impact and live brokers. Reject unsupported datasets/orders explicitly. The model is not generalized by pretending unsupported behavior exists.
|
||
|
||
Later product/research: embedded IDE, advanced optimizers, generalized ML training, Monte Carlo significance tooling. Basic immutable versions, chronological validation and evidence links are not deferred.
|
||
|
||
Rejected: competing TS/web simulators, wholesale Rust rewrite, hand-written decimal engine, new service/message bus/workflow framework, generic signal DSL, compatibility switches that re-enable defects, deleting reviewed calculations because they are currently unused. Keep existing local environment-file policy; no WCAG or cosmetic-dashboard scope here.
|
||
|
||
## Execution governance
|
||
|
||
Only [manifest.json](backlog/manifest.json) owns status/assignment/dependencies. [Task files](backlog/README.md) own scope/acceptance. Read the reusable [implementation](agents/implementation.md), [review](agents/review.md), [integration](agents/integration.md), [planning](agents/planning.md) briefs and [quality gates](QUALITY-GATES.md).
|
||
|
||
Approval of planning artifacts is not permission to commit, push or create PRs. Historical planning-only statements refer to the original audit; later execution records and the canonical manifest identify actual implementation, authorization and validation evidence.
|