# Revised development roadmap Baseline `b7aeca4` · reviewed 2026-10-22 · **Third wave committed; W03 continuation authorized; see manifest execution_scope** Authorization update: the first three waves are independently reviewed, validated and committed. The owner's “commit and start the next wave” authorizes the O01/P01 closeout and continuation with next-ready W03. Other tasks and economic/timing/trust-model decisions remain gated. Fourth-wave implementation commits, pushes, PRs and trading operations are not authorized. ## 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 consolidates **52 separate task definitions into 43 scheduled tasks plus 5 conditional tasks**. Four old IDs remain merged redirects, not extra work. This is a smaller delivery plan, not a smaller correctness standard. 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 | Explicit economic approval | | [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 | Explicit execution/data approval | | [ADR-004](architecture/decisions/004-strategy-boundary.md) | NAPI pull sessions in existing workers; tagged decision barriers; IPC for untrusted code; no embedded JS | Plan approval | | [ADR-005](architecture/decisions/005-durable-cutover.md) | One Rust transition kernel; resident research state; private staged paper state under existing SQL transactions | Plan approval | | [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 a proposed first canonical model, not deletion of short history or a silent change to current paper accounts. If first-release shorts are required, approve borrowing/margin policy and fixtures before F01. C01/C03/C04/W01 do not depend on those unresolved economic choices. ## 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–F08, D01, S01/S02; R01/R10/W03/C06 then R05 | Owner-aware finance, deterministic replay, 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] 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 are committed. W03 is the authorized next workbench task; it separates saving definitions from repeat-safe run submission. F01/D01 still require their ADR approvals. W04 remains blocked on W03; subsequent work is not included in this execution scope. ## 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. ## 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.