refactor: share research domain and simplify application workflows

This commit is contained in:
Boki 2026-10-26 15:29:43 -04:00
parent 805a9f8fd4
commit 8c39ccf7ea
58 changed files with 3805 additions and 3081 deletions

View file

@ -1,6 +1,6 @@
# Cleanup and maintainability plan
Baseline: `fbf2eb9e`, inspected October 26, 2026. This extends the existing development backlog. The original 45 scheduled tasks remain complete; these 13 cleanup stories are new work. The owner subsequently authorized implementation and validated commits; progress and checks are recorded in [cleanup-execution.md](cleanup-execution.md). No additional agents have been launched.
Baseline: `fbf2eb9e`, inspected October 26, 2026. This extends the existing development backlog. The original 45 scheduled tasks remain complete; these 13 cleanup stories are new work. The owner subsequently authorized implementation and validated commits; progress and checks are recorded in [cleanup-execution.md](cleanup-execution.md). All 13 stories are implemented and validated. They remain in `review` until an independent reviewer signs off; no additional agents have been launched.
[manifest.json](backlog/manifest.json) remains the scheduling source of truth. It records task states, prerequisites, priorities and write locks. This page explains the execution contract and recommended order; it is not a second status tracker. Current evidence is appended to [findings.md](backlog/findings.md#cleanup-audit-2026-10-26).

View file

@ -1,10 +1,10 @@
# Revised development roadmap
## Current planning — October 26, 2026
## Cleanup implementation — October 26, 2026
The [cleanup plan](CLEANUP.md) adds 13 scoped stories under E10, grounded in the current code audit. The original completion record below remains historical evidence. Current task IDs, states, dependencies and locks are in the [manifest](backlog/manifest.json); the six conditional tasks remain deferred.
**Planning only:** implementation has not been requested. Current `execution_authorized` is false; old continuation instructions do not authorize these new stories. First independent assignments: **CL01 (DI tests), CL03 (startup rollback), CL04 (developer commands)**. Then complete configuration normalization and the shared research/domain boundary before their dependent cleanup.
The owner authorized implementation and validated commits after planning. All 13 cleanup stories are implemented and validated, pending independent review; [execution evidence](cleanup-execution.md) records exact checks and limitations. The historical first wave was CL01/CL03/CL04, followed by configuration, shared research code, backend and frontend cleanup.
**The original 45/45 scheduled tasks are complete.** The canonical Rust engine, TypeScript research/workbench, bounded worker pool, isolated candidates, AI evidence workflow and human-reviewed paper promotion are validated. Implementation commits: `bbf0dd4`, `26b9726`, `25b5cbf` (R07 measurement `ab08db8`). Six conditional tasks remain deferred; four merged IDs remain redirects. This is scheduled-backlog completion, not live-trading activation.

View file

@ -2,13 +2,13 @@
**The original 45/45 scheduled tasks are complete.** The canonical Rust engine, TypeScript research/workbench, bounded worker pool, isolated candidates, AI evidence workflow and human-reviewed paper promotion are validated. Implementation commits: `bbf0dd4`, `26b9726`, `25b5cbf` (R07 measurement `ab08db8`). Six conditional tasks remain deferred; four merged IDs remain redirects. This is scheduled-backlog completion, not live-trading activation.
**New work:** [13 cleanup stories](../CLEANUP.md) were proposed on October 26, 2026. The owner subsequently authorized implementation and commits; see [execution evidence](../cleanup-execution.md). The first independent group is CL01, CL03 and CL04.
**New work:** [13 cleanup stories](../CLEANUP.md) were proposed on October 26, 2026. The owner subsequently authorized implementation and commits; see [execution evidence](../cleanup-execution.md). All 13 are implemented and validated; independent review is the remaining completion gate.
## One source of truth
[manifest.json](manifest.json) owns scheduling metadata: status, priorities, dependencies, ADR approvals, assignments and write locks. Task Markdown owns implementation scope/evidence/acceptance. This index and the [graph](dependencies.mmd) are derived views. Only the planning/integration owner updates scheduling state.
**Current total: 45 completed original tasks + 13 proposed cleanup tasks + 6 deferred + 4 merged IDs = 68 retained IDs.** The original backlog accounted for 55 IDs. F09/P07 added projection/profiling work; the owner deferred P08's TypeScript optimization. Merged records preserve traceability; never execute them separately. Deferred work requires its stated trigger and explicit activation.
**Current total: 45 completed original tasks + 13 implemented cleanup tasks pending independent review + 6 deferred + 4 merged IDs = 68 retained IDs.** The original backlog accounted for 55 IDs. F09/P07 added projection/profiling work; the owner deferred P08's TypeScript optimization. Merged records preserve traceability; never execute them separately. Deferred work requires its stated trigger and explicit activation.
States: ready, claimed, in_progress, review, done, blocked, deferred, merged. “Ready” means no code/ADR prerequisite, not execution authority. Implementation dependencies require accepted integration. `release_gates` govern enabling an end-to-end feature, not component coding or integration; conditional gates apply only to the named capability. F05 may integrate before F06, but its replay behavior is not released until F06 proves it.
@ -118,23 +118,23 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
### E10 — Cleanup and maintainability foundations
Scope and first execution wave: [CLEANUP.md](../CLEANUP.md). Ready is code readiness only; all new implementation is planning-only until requested.
Scope and first execution wave: [CLEANUP.md](../CLEANUP.md). The owner has authorized implementation and commits. Current completion evidence is in [cleanup-execution.md](../cleanup-execution.md); the manifest owns task state.
| Task | Priority / status | Implementation prerequisites | Release gate | Specialist / size |
| --- | --- | --- | --- | --- |
| [CL01 Replace permissive DI configuration tests with production-path assertions](tasks/CL01.md) | P1 / ready | None | — | TypeScript infrastructure testing / M |
| [CL02 Normalize database configuration once and enforce consistent service switches](tasks/CL02.md) | P1 / blocked | CL01 | — | TypeScript configuration and database adapters / M |
| [CL03 Roll back failed shared-service startup and clear initialization timers](tasks/CL03.md) | P1 / ready | None | — | TypeScript resource lifecycle and concurrency / M |
| [CL04 Provide one consistent research startup path and repair stale commands](tasks/CL04.md) | P1 / ready | None | — | Bun/Turbo developer tooling / S |
| [CL05 Extract shared dataset and reporting logic behind a research library boundary](tasks/CL05.md) | P2 / ready | D01, F08, R05 | — | TypeScript domain boundaries and package migration / M |
| [CL06 Use shared dataset response schemas and eligibility checks in the workbench](tasks/CL06.md) | P2 / blocked | CL05 | — | Shared contracts and frontend validation / M |
| [CL07 Share JSON transport handling across experiment and validation clients](tasks/CL07.md) | P2 / ready | None | — | Frontend HTTP contracts and retry semantics / M |
| [CL08 Split backtest template, run and reproduction responsibilities behind the existing service](tasks/CL08.md) | P2 / blocked | CL05 | — | TypeScript application services and PostgreSQL transactions / M |
| [CL09 Separate strategy metadata, version inspection and publication UI](tasks/CL09.md) | P2 / ready | None | — | React strategy workflows / M |
| [CL10 Separate experiment modes and make draft/submission state explicit](tasks/CL10.md) | P2 / ready | None | — | React experiment workflow state / M |
| [CL11 Separate backtest template loading, run monitoring and submission state](tasks/CL11.md) | P2 / ready | None | — | React asynchronous state and durable-run UX / M |
| [CL12 Simplify retired execution seams while preserving historical reads](tasks/CL12.md) | P2 / blocked | CL08 | — | Compatibility cleanup and execution boundaries / M |
| [CL13 Hide placeholder navigation while preserving useful product routes](tasks/CL13.md) | P2 / ready | None | — | React navigation and product clarity / S |
| [CL01 Replace permissive DI configuration tests with production-path assertions](tasks/CL01.md) | P1 / review | None | — | TypeScript infrastructure testing / M |
| [CL02 Normalize database configuration once and enforce consistent service switches](tasks/CL02.md) | P1 / review | CL01 | — | TypeScript configuration and database adapters / M |
| [CL03 Roll back failed shared-service startup and clear initialization timers](tasks/CL03.md) | P1 / review | None | — | TypeScript resource lifecycle and concurrency / M |
| [CL04 Provide one consistent research startup path and repair stale commands](tasks/CL04.md) | P1 / review | None | — | Bun/Turbo developer tooling / S |
| [CL05 Extract shared dataset and reporting logic behind a research library boundary](tasks/CL05.md) | P2 / review | D01, F08, R05 | — | TypeScript domain boundaries and package migration / M |
| [CL06 Use shared dataset response schemas and eligibility checks in the workbench](tasks/CL06.md) | P2 / review | CL05 | — | Shared contracts and frontend validation / M |
| [CL07 Share JSON transport handling across experiment and validation clients](tasks/CL07.md) | P2 / review | None | — | Frontend HTTP contracts and retry semantics / M |
| [CL08 Split backtest template, run and reproduction responsibilities behind the existing service](tasks/CL08.md) | P2 / review | CL05 | — | TypeScript application services and PostgreSQL transactions / M |
| [CL09 Separate strategy metadata, version inspection and publication UI](tasks/CL09.md) | P2 / review | None | — | React strategy workflows / M |
| [CL10 Separate experiment modes and make draft/submission state explicit](tasks/CL10.md) | P2 / review | None | — | React experiment workflow state / M |
| [CL11 Separate backtest template loading, run monitoring and submission state](tasks/CL11.md) | P2 / review | None | — | React asynchronous state and durable-run UX / M |
| [CL12 Simplify retired execution seams while preserving historical reads](tasks/CL12.md) | P2 / review | CL08 | — | Compatibility cleanup and execution boundaries / M |
| [CL13 Hide placeholder navigation while preserving useful product routes](tasks/CL13.md) | P2 / review | None | — | React navigation and product clarity / S |
## Scheduling checks

View file

@ -2,7 +2,7 @@
"schema_version": 1,
"plan_revision": "2026-10-26.79",
"repository_base": "b7aeca4",
"plan_status": "cleanup_backlog_in_progress",
"plan_status": "cleanup_implemented_pending_review",
"execution_authorized": true,
"execution_scope": {
"authorized_by": "Owner: commit and continue with the rest of the tasks till 100%",
@ -2086,7 +2086,7 @@
"epic": "E10",
"priority": "P1",
"severity": "High",
"status": "done",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL01.md",
@ -2105,9 +2105,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "validated",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Focused implementation and integration checks recorded in cleanup-execution.md; no separate reviewer agent was launched.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"libs/core/di/test/container-builder.test.ts",
"libs/core/di/test/di.test.ts"
@ -2120,7 +2120,7 @@
"epic": "E10",
"priority": "P1",
"severity": "High",
"status": "done",
"status": "review",
"dependencies": [
"CL01"
],
@ -2143,9 +2143,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "validated",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Focused implementation and integration checks recorded in cleanup-execution.md; no separate reviewer agent was launched.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"libs/core/config/src/schemas/database.schema.ts",
"libs/core/config/src/schemas/unified-app.schema.ts",
@ -2165,7 +2165,7 @@
"epic": "E10",
"priority": "P1",
"severity": "High",
"status": "done",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL03.md",
@ -2185,9 +2185,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "validated",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Focused implementation and integration checks recorded in cleanup-execution.md; no separate reviewer agent was launched.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"libs/core/di/src/utils/lifecycle.ts",
"libs/core/di/src/container/builder.ts",
@ -2202,7 +2202,7 @@
"epic": "E10",
"priority": "P1",
"severity": "Medium",
"status": "done",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL04.md",
@ -2223,9 +2223,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "validated",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Focused implementation and integration checks recorded in cleanup-execution.md; no separate reviewer agent was launched.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"package.json",
"scripts/docker.sh",
@ -2242,7 +2242,7 @@
"epic": "E10",
"priority": "P2",
"severity": "High",
"status": "ready",
"status": "review",
"dependencies": [
"D01",
"F08",
@ -2271,9 +2271,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/orchestrator/src/data/historical-dataset-v2.ts",
"apps/stock/orchestrator/src/backtest/canonical-result.ts",
@ -2289,7 +2289,8 @@
"libs/research/src/dataset-contracts.ts",
"libs/research/src/datasets.ts",
"libs/research/src/results.ts"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL06",
@ -2297,7 +2298,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "blocked",
"status": "review",
"dependencies": [
"CL05"
],
@ -2317,11 +2318,11 @@
"branch": null,
"pull_request": null,
"completed_commit": null,
"blocker": "Waiting for implementation prerequisites: CL05.",
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts",
"apps/stock/web-api/src/services/canonical-research.service.ts",
@ -2329,7 +2330,8 @@
"libs/research/src/dataset-contracts.ts",
"test/integration/dataset-source-preparation-ui.test.tsx",
"test/integration/canonical-workbench.test.tsx"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL07",
@ -2337,7 +2339,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "ready",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL07.md",
@ -2356,9 +2358,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-app/src/lib/api.ts",
"apps/stock/web-app/src/features/experiments/services/experimentApi.ts",
@ -2366,7 +2368,8 @@
"apps/stock/web-app/src/features/experiments/services/walkForwardApi.ts",
"apps/stock/web-app/src/lib/requestJson.ts",
"test/integration/research-http-transport.test.ts"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL08",
@ -2374,7 +2377,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "blocked",
"status": "review",
"dependencies": [
"CL05"
],
@ -2397,11 +2400,11 @@
"branch": null,
"pull_request": null,
"completed_commit": null,
"blocker": "Waiting for implementation prerequisites: CL05.",
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-api/src/services/backtest-v2.service.ts",
"apps/stock/web-api/src/services/run-reproduction.ts",
@ -2411,7 +2414,8 @@
"apps/stock/web-api/src/services/backtests/runs.ts",
"apps/stock/web-api/src/services/backtests/reproduction.ts",
"apps/stock/web-api/src/services/backtests/results.ts"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL09",
@ -2419,7 +2423,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "ready",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL09.md",
@ -2438,9 +2442,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-app/src/features/strategies/StrategyDetailPage.tsx",
"apps/stock/web-app/src/features/strategies/components/",
@ -2448,7 +2452,8 @@
"test/integration/strategy-workbench.test.tsx",
"apps/stock/web-app/src/features/strategies/components/StrategyVersionPanel.tsx",
"apps/stock/web-app/src/features/strategies/hooks/useStrategyClone.ts"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL10",
@ -2456,7 +2461,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "ready",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL10.md",
@ -2475,9 +2480,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-app/src/features/experiments/components/ExperimentEditor.tsx",
"apps/stock/web-app/src/features/experiments/components/ChronologicalValidationPreflight.tsx",
@ -2485,7 +2490,8 @@
"test/integration/experiments-ui.test.tsx",
"apps/stock/web-app/src/features/experiments/hooks/useExperimentSubmission.ts",
"apps/stock/web-app/src/features/experiments/components/ExperimentDraftForm.tsx"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL11",
@ -2493,7 +2499,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "ready",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL11.md",
@ -2512,9 +2518,9 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-app/src/features/backtest/hooks/useBacktestV2.ts",
"apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx",
@ -2522,7 +2528,8 @@
"test/integration/canonical-workbench.test.tsx",
"apps/stock/web-app/src/features/backtest/hooks/useRunMonitoring.ts",
"apps/stock/web-app/src/features/backtest/hooks/useRunSubmission.ts"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL12",
@ -2530,7 +2537,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Medium",
"status": "blocked",
"status": "review",
"dependencies": [
"CL08"
],
@ -2552,11 +2559,11 @@
"branch": null,
"pull_request": null,
"completed_commit": null,
"blocker": "Waiting for implementation prerequisites: CL08.",
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-api/src/services/backtest-v2.service.ts",
"apps/stock/web-api/src/services/backtest-result.ts",
@ -2564,7 +2571,8 @@
"apps/stock/orchestrator/src/backtest/execution-engine.ts",
"apps/stock/orchestrator/src/api/rest/backtest.ts",
"scripts/test/architecture.test.ts"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
},
{
"id": "CL13",
@ -2572,7 +2580,7 @@
"epic": "E10",
"priority": "P2",
"severity": "Low",
"status": "ready",
"status": "review",
"dependencies": [],
"decision_dependencies": [],
"task_file": "backlog/tasks/CL13.md",
@ -2591,16 +2599,17 @@
"completed_commit": null,
"blocker": null,
"release_gates": [],
"integration_state": "planned",
"integration_state": "validated_pending_independent_review",
"integration_base": "fbf2eb9e",
"review_notes": "Planning-only cleanup story requested 2026-10-26. Current implementation authorization is false. No implementation, tests or completion are claimed by this entry.",
"review_notes": "Implementation and relevant checks are complete. Separate self-review performed; independent reviewer sign-off remains pending. No reviewer agent was launched.",
"concrete_write_scope": [
"apps/stock/web-app/src/lib/constants.ts",
"apps/stock/web-app/src/app/App.tsx",
"apps/stock/web-app/README.md",
"docs/guide/README.md",
"test/integration/navigation.test.tsx"
]
],
"completion_evidence": "docs/development/cleanup-execution.md"
}
],
"review_note": "Independent skeptical revision: four superseded tasks retain stable IDs; deferred work is not a dependency of scheduled tasks. Release gates are distinct from implementation prerequisites.",

View file

@ -31,3 +31,77 @@ intentionally owns DB1 and its service/global namespace; core `db`/`keyPrefix` d
that isolation policy. Core `ttl`, retry hints and QuestDB buffer/flush metadata are not
claims that the shared DI client supports writer/cache tuning; those adapter APIs remain
unchanged. Financial inputs, hashes and accounting were not modified.
## CL05–CL13 — Shared domain and application cleanup
- CL05 adds one `@stock-bot/research` workspace with browser-safe contracts, server
normalization/hashing and statistical reports. Orchestrator paths re-export the one
implementation. Legacy V1 adaptation stays application-owned and calls an explicit
parent-hash factory; existing pure stock-config contracts are reused.
- CL06 reuses shared manifest structures and structural eligibility policy in API/browser
admission. Preparation-specific parent-hash/null and response refinements remain explicit;
server content validation and client expected-identity checks remain separate.
- CL07 shares cookie JSON transport for experiment, chronological and walk-forward clients.
Domain parsing, uncertain acceptance, receipt identities and endpoint errors remain local.
No automatic retry or research-token/browser credential mixing is introduced.
- CL08 retains BacktestServiceV2 as a compatible facade over template, run/control,
reproduction and result operations. Row mapping and contracts are shared locally. SQL
transactions retain their original ordering and pass the same connection into result reads.
- CL09 separates metadata presentation, version/artifact comparison and clone-receipt state
from the strategy route. Publication continues using the existing CandidatePublication.
- CL10 separates saved-template loading and the preview/submission coordinator. One phase
replaces coupled ordinary-submission flags; the immediate submission lock/ref and exact
frozen receipt remain necessary across ordinary/chronological/walk-forward modes.
- CL11 separates run selection/polling/results/cancellation and submission receipt lifetime
from editable-template state. The useBacktestV2 public return contract is preserved.
- CL12 removes the impossible legacy snapshot fallback after canonical admission. Current
run writes use the admitted canonical request/hash. Legacy template adapters, saved result
readers, historical provenance parsing, retired REST/runner rejection and native exports
remain. No algorithms, calculation library or retained executable artifacts were deleted.
- CL13 hides only the three verified placeholder menu items; their URLs show explicit
availability messages and links to existing backtest/experiment analytics. AuthGate and
all working route identities remain unchanged.
Review focused on receipt lifetime and navigation races, original request/result identity,
transaction ordering, single-connection reads, hash/property-order preservation, client
bundle boundaries, and avoiding additional framework layers. The public facade re-exports
its original contracts; internal helper/container types are not new public API.
Intermediate verification:
- Workspace build — 28/28 tasks pass.
- Domain/native/UI group — 174 pass; one initial architecture allowlist failed on the
newly shared **pure** report subpath. Added the narrow allowlist plus tests verifying the
new package has no application/service imports and browser contracts bundle successfully.
- Strategy/publication/experiment/transport group — 218 pass / 931 assertions.
- Run-control/workbench/reproduction UI group — 83 pass / 472 assertions.
- Backend/reproduction/result/navigation group — 28 pass / 184 assertions.
- First full check found the missing-config disabled MongoDB URI regression; corrected
the schema-valid default instead of weakening validation. Store/offline/paper-composition
focused group then passed 22 tests / 129 assertions.
- Final `CARGO_BUILD_JOBS=2 bun run check` — pass: 132 tooling, 43 utility, 44 calculation,
1,221 integration tests (14 explicitly skipped), 150 Rust tests (4 ignored), plus build,
type/contract checks, secret audit and lint. Conditional OS-isolation tests remain skipped
under their existing explicit runtime gate; this cleanup does not certify live trading.
- DI builder/general/lifecycle focused group — 32 pass; root integration separately covers
startup rollback and store configuration.
The first disposable PostgreSQL suite ran concurrently with the first repository check,
encountered the same pre-fix disabled-Mongo default, then Bun 1.2.17 segfaulted. That attempt
is not a pass. A fresh full suite runs after the successful repository check on the corrected
build; final PostgreSQL/browser outcomes are recorded below. Sandbox-restricted native
worker spawning also failed initially; its rerun outside the sandbox used the assigned
checkout and correctly built addon rather than weakening worker checks.
Final integration evidence:
- `PIPELINE_TEST_DATABASE_URL=<disposable PostgreSQL>/stock_bot_safety BACKTEST_TEST_REDIS_URL=<disposable Redis>/15 bun run test:postgres` — **273 pass, 0 fail, 2,617 assertions, 34 files**. Fresh run completed after the runtime crash noted above; it includes single-connection reproduction, concurrent receipts/outbox transactions, recovery, ownership and unchanged native economics.
- The same fixture URLs with `bun run test:e2e` — **18 pass, 0 fail, 655 assertions** using installed Chromium and a freshly built frontend. Includes native smoke, version clone, archived history, experiments/validation and research evidence workflows.
- Final review added an explicit unknown-VWAP guard to `createDatasetV2FromLegacy`: the former private application adapter guaranteed this invariant before normalization. Its shared entrypoint now rejects contradictory provenance before returning a prepared dataset. Dataset/report focused suites passed **25 tests / 515 assertions**, including detached validation, golden hashes and malformed parent hashes. Typecheck/lint passed again.
- Temporary PostgreSQL and Redis fixture containers were removed after both suites. Existing development stores and environment files were preserved.
- After the final boundary guard, `CARGO_BUILD_JOBS=2 bun run check` passed again on the final application tree: **1,222 integration tests** (14 existing skips), **150 Rust tests** (4 ignored), plus all build/type/contract/tooling/utility/calculation/secret/lint gates. No application edits followed that pass.
All 13 implementations are validated. Their manifest status is `review`, because these
stories define independent review as part of done and this execution used one agent.
The earlier first-four `done` entries were corrected to `review` for consistency; this is
an outstanding reviewer sign-off, not unfinished implementation or a failing test gate.

View file

@ -81,3 +81,7 @@ This fixture does not need a provider connection or running databases. For initi
- [Backlog](../development/backlog/README.md) and [roadmap](../development/ROADMAP.md): work history, completion evidence and conditional future tasks.
When documentation and an implementation disagree, follow the current entrypoint, contract and focused regression test. Historical plans explain the direction; these guides explain how the current pieces fit together.
Primary navigation lists implemented workflows. Standalone Portfolio, Analytics and Settings
remain unavailable at their existing URLs and are hidden from the menu. Saved backtest and
experiment pages continue to provide performance, trade and risk analysis.

View file

@ -1,5 +1,14 @@
# Reading the implementation
The cleanup keeps old dataset/report paths as compatibility entrypoints. Read
`libs/research/src/datasets.ts` for V2 normalization and hashes, and
`libs/research/src/results.ts` for statistical reporting. The backtest API facade now delegates
to `apps/stock/web-api/src/services/backtests/{templates,runs,reproduction,results}.ts`.
Frontend run observation/submission, strategy cloning/version inspection and experiment
submission each have focused hooks/components beside their existing pages. These moves
preserve the Rust financial engine and saved-run contracts described below.
[Guide home](README.md) · [System map](system-map.md) · [Backtest walkthrough](backtest-walkthrough.md) · [Strategy authoring](strategy-development.md)
This guide follows **functions and state**, rather than application boxes. The linked TypeScript files now have explanatory TSDoc comments, and the Rust financial modules have module and method documentation. Read these beside the implementation; you can hover documented symbols in your editor.