docs: plan cleanup and maintainability backlog
This commit is contained in:
parent
fbf2eb9e0c
commit
4ddffa6b67
19 changed files with 1743 additions and 7 deletions
64
docs/development/backlog/tasks/CL01.md
Normal file
64
docs/development/backlog/tasks/CL01.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# CL01 — Replace permissive DI configuration tests with production-path assertions
|
||||
|
||||
Parent epic: E10. Priority/severity: P1 / High. Complexity: M. Specialization: TypeScript infrastructure testing.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a maintainer, I want configuration tests to fail when a valid configuration stops working, so subsequent cleanup has a trustworthy safety net.
|
||||
|
||||
Expected benefit: Removes false passing coverage before changes to configuration and startup.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F03:** Several success tests also pass when any exception is thrown; the test file supplies its own toUnifiedConfig implementation through a module mock. [libs/core/di/test/container-builder.test.ts:114](../../../../libs/core/di/test/container-builder.test.ts#L114).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Replace the locally reimplemented config normalizer with the real configuration path for builder tests. Use complete, valid fixtures and skip external initialization.
|
||||
- Make successful construction assert actual registered configuration/services. Make invalid input assert the specific expected rejection.
|
||||
- Remove success-or-error catch blocks and prevent module mocks from contaminating other suites. Keep tests for current supported behavior; CL02 owns regressions for currently broken options/settings.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `libs/core/di/test/container-builder.test.ts`
|
||||
- `libs/core/di/test/di.test.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No production configuration behavior changes.
|
||||
- No blanket replacement of every infrastructure test or rewrite of the test runner.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `di-builder-tests`.
|
||||
|
||||
Parallel execution: Ready independently. Can run with CL03 and CL04 in isolated worktrees; do not share test-process module mocks. CL02 waits for this test baseline.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. Every success case fails if its production builder call throws; no assertion treats an arbitrary error as success.
|
||||
2. Tests use the actual toUnifiedConfig and DI schemas and check resulting values, not only container existence.
|
||||
3. Invalid fixtures have explicit rejection assertions; valid fixtures do not depend on network access, local credentials, or running stores.
|
||||
4. Tests pass individually and alongside the existing real-path QuestDB configuration regression without leaking mocks.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test libs/core/di/test/container-builder.test.ts
|
||||
bun test test/integration/questdb-configuration.test.ts
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: valid full config, invalid required fields, nested/flat normalization, QuestDB credential propagation, and module-mock isolation.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Removing permissive assertions may expose old invalid fixtures. Repair fixtures against the supported schema; do not weaken validation or rewrite expectations to conceal production defects.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
79
docs/development/backlog/tasks/CL02.md
Normal file
79
docs/development/backlog/tasks/CL02.md
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# CL02 — Normalize database configuration once and enforce consistent service switches
|
||||
|
||||
Parent epic: E10. Priority/severity: P1 / High. Complexity: M. Specialization: TypeScript configuration and database adapters.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a developer, I want my connection settings and explicit service-disable choices to reach the intended clients unchanged, so configuration cannot silently enable services or discard settings.
|
||||
|
||||
Expected benefit: Addresses a reproduced enable/disable defect and the same multi-stage mapping pattern that caused the QuestDB credential failure.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F01:** An isolated probe with supplied enabled configurations and all three enable options false still resolves enabled PostgreSQL, MongoDB and cache configurations. [libs/core/di/src/container/builder.ts:88](../../../../libs/core/di/src/container/builder.ts#L88).
|
||||
- **Verified — CL-F01:** The canonical PostgreSQL schema accepts SSL, pool size and timeouts, while the DI schema and registration omit them. [libs/core/config/src/schemas/database.schema.ts:4](../../../../libs/core/config/src/schemas/database.schema.ts#L4).
|
||||
- **Verified — CL-F01:** Client registration reconstructs only part of the accepted PostgreSQL configuration. [libs/core/di/src/registrations/database.registration.ts:43](../../../../libs/core/di/src/registrations/database.registration.ts#L43).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Use the existing core configuration schemas as the canonical database representation; keep compatibility aliases in a single boundary adapter rather than multiple reconstruction passes.
|
||||
- Define consistent precedence: an explicit service option false disables that service; true permits but does not override an explicitly disabled configured service. Preserve documented defaults when neither is specified.
|
||||
- Carry supported credentials, SSL, pool and timeout settings into client-specific configuration, including explicit ilpPort/influxPort translation. Audit accepted fields for silent loss and document supported mappings.
|
||||
- Add real-path tests with distinctive nondefault values for each store. Update configuration types and DI registration together.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `libs/core/config/src/schemas/database.schema.ts`
|
||||
- `libs/core/config/src/schemas/unified-app.schema.ts`
|
||||
- `libs/core/di/src/config/schemas/`
|
||||
- `libs/core/di/src/container/builder.ts`
|
||||
- `libs/core/di/src/registrations/database.registration.ts`
|
||||
- `libs/core/di/src/registrations/cache.registration.ts`
|
||||
- `test/integration/questdb-configuration.test.ts`
|
||||
- `libs/core/di/test/container-builder.test.ts`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `test/integration/store-configuration.test.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No credential rotation, environment-file deletion, new configuration framework or database replacement.
|
||||
- No connection to development trading state in automated tests; no financial-policy changes.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: [CL01](CL01.md).
|
||||
|
||||
Write locks: `di-configuration`, `di-container`, `di-builder-tests`.
|
||||
|
||||
Parallel execution: After CL01. Must be serialized with CL03 because both can edit container/builder.ts; this is an actual-file lock, not an additional code dependency.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. The audit probe with configured stores enabled and explicit options false resolves disabled/null PostgreSQL, MongoDB and cache services without opening sockets.
|
||||
2. Configured enabled=false remains disabled when the corresponding service option is true.
|
||||
3. Nondefault PostgreSQL SSL, pool size and connection/idle timeouts reach final wire settings; QuestDB credentials and ports retain their existing regression guarantees.
|
||||
4. Each supported database field has one explicit translation to the client representation; no accepted setting silently disappears during schema conversion.
|
||||
5. Existing nested and flat configuration callers remain compatible, including intentional precedence when both appear.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
store-configuration.test.ts is a proposed new test file. Capture real client/wire configuration without connecting to stores; substitute external transports only where necessary.
|
||||
|
||||
```sh
|
||||
bun run --cwd libs/core/di build
|
||||
bun test libs/core/di/test/container-builder.test.ts
|
||||
bun test test/integration/store-configuration.test.ts test/integration/questdb-configuration.test.ts
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: all explicit disable switches, configured disable with option true, absent defaults, nested/flat precedence, optional credentials, SSL and nondefault pool/timeouts.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Configuration precedence and client SSL representations differ today. Preserve existing defaults, reject unsupported combinations explicitly, and do not make a broad strict-schema change that rejects unrelated process environment variables.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
73
docs/development/backlog/tasks/CL03.md
Normal file
73
docs/development/backlog/tasks/CL03.md
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# CL03 — Roll back failed shared-service startup and clear initialization timers
|
||||
|
||||
Parent epic: E10. Priority/severity: P1 / High. Complexity: M. Specialization: TypeScript resource lifecycle and concurrency.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a developer restarting services, I want a failed or timed-out initialization to release resources it acquired, so a retry starts from a clean state.
|
||||
|
||||
Expected benefit: Fixes a reproduced resource-ownership gap in shared DI startup without changing trading recovery.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F02:** Initialization awaits Promise.all without rolling back earlier successful connections; an isolated cache-success/mongo-failure probe records no cache disconnect. [libs/core/di/src/utils/lifecycle.ts:24](../../../../libs/core/di/src/utils/lifecycle.ts#L24).
|
||||
- **Verified — CL-F02:** Timeout promises retain timers after successful initialization. [libs/core/di/src/utils/lifecycle.ts:97](../../../../libs/core/di/src/utils/lifecycle.ts#L97).
|
||||
- **Verified — CL-F02:** A failed lifecycle call rejects build before the caller receives a container to clean up. [libs/core/di/src/container/builder.ts:74](../../../../libs/core/di/src/container/builder.ts#L74).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Track the resources and initialization work owned by a build attempt. Clean up acquired resources when initialization or service resolution fails.
|
||||
- Clear initialization timeout handles when work settles. Keep startup failure bounded and retain cleanup ownership of any late-settling initializer.
|
||||
- Reuse the existing lifecycle manager and client cleanup methods. Ensure cleanup errors do not hide the original startup failure and repeated cleanup is safe.
|
||||
- Add failure-oriented tests with controlled deferred promises and fake/controlled timers; do not depend on live stores.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `libs/core/di/src/utils/lifecycle.ts`
|
||||
- `libs/core/di/src/container/builder.ts`
|
||||
- `libs/core/di/test/lifecycle.test.ts`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `test/integration/service-startup-rollback.test.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No changes to ModeManager, strategy checkpoints, paper recovery, research leases or financial execution.
|
||||
- No new lifecycle framework or blanket migration of all application shutdown handlers.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `di-container`, `di-service-lifecycle`.
|
||||
|
||||
Parallel execution: Ready independently and disjoint from CL01/CL04. Serialize with CL02 on di-container; use separate test files from CL01.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. When one service connects and another initialization fails, the connected service is cleaned up and build rejects with the original failure.
|
||||
2. Resolution failures and timeouts also release resources acquired by that attempt; late successful initialization cannot leave an orphaned connection after failure.
|
||||
3. Successful initialization leaves no pending startup timeout handles; failure paths clear settled-work timers.
|
||||
4. Cleanup failure does not prevent remaining cleanup or conceal the initiating failure. Repeated shutdown is safe.
|
||||
5. Existing successful startup and shutdown contracts remain covered; no tests require waiting for the production 30-second timeout.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
service-startup-rollback.test.ts is a proposed new test file. Use simulated services and controlled clocks; no databases or native builds are needed.
|
||||
|
||||
```sh
|
||||
bun test libs/core/di/test/lifecycle.test.ts
|
||||
bun test test/integration/service-startup-rollback.test.ts
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: partial success followed by failure, dependency-resolution exception, timeout, late completion, cleanup exception, repeated cleanup and successful timer disposal.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
A timeout does not cancel an arbitrary promise. The implementation must retain responsibility for pending work and clean up late resources, rather than assuming Promise.race cancelled initialization.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
71
docs/development/backlog/tasks/CL04.md
Normal file
71
docs/development/backlog/tasks/CL04.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# CL04 — Provide one consistent research startup path and repair stale commands
|
||||
|
||||
Parent epic: E10. Priority/severity: P1 / Medium. Complexity: S. Specialization: Bun/Turbo developer tooling.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a developer, I want documented startup commands to launch the required research services on predictable ports, so getting the workbench running does not require debugging obsolete scripts.
|
||||
|
||||
Expected benefit: Removes three broken command targets and inconsistent infrastructure startup.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F08:** db:setup-ib, db:init and proxy reference files absent at the audit baseline; docker:start and infra:up use different paths. [package.json:55](../../../../package.json#L55).
|
||||
- **Verified — CL-F08:** docker:start starts Dragonfly, PostgreSQL and QuestDB but omits MongoDB, unlike infra:up. [scripts/docker.sh:93](../../../../scripts/docker.sh#L93).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Offer one clearly named research development command selecting web-api, orchestrator and web-app through existing tooling; reuse the current build dependencies.
|
||||
- Make the documented infrastructure-start aliases agree on required stores and the supported Docker Compose invocation.
|
||||
- Remove obsolete missing-file aliases or redirect them only to existing, reviewed equivalents. Preserve migration safeguards; ordinary startup must never execute destructive init/reset scripts.
|
||||
- Document ports 2003/2004/5173 and required authentication configuration without printing or generating new secrets. Add dry-run/command-target checks to existing tooling tests.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `package.json`
|
||||
- `scripts/docker.sh`
|
||||
- `scripts/test/workspace.test.ts`
|
||||
- `README.md`
|
||||
- `apps/stock/README.md`
|
||||
- `apps/stock/web-app/README.md`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No new process supervisor, deployment stack or package manager.
|
||||
- No automatic reset, credential changes, provider ingestion, paper/live activation or startup of optional monitoring/admin services.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `root-scripts`, `docker-startup`, `startup-documentation`.
|
||||
|
||||
Parallel execution: Ready independently. Can run with CL01/CL03. CL05 uses the existing libs/* workspace glob and must not edit root scripts concurrently.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. Every retained script alias resolves to an existing executable target or documented installed tool; the three identified missing-file commands are repaired or removed.
|
||||
2. The research dev task plan contains exactly the three intended application dev roles plus required build tasks; it does not start ingestion or activate paper/live accounts.
|
||||
3. Infrastructure aliases agree on their store set and propagate failures instead of printing success after a failed Compose command.
|
||||
4. Documentation matches actual commands and fixed ports. Existing .env files and contents remain intact.
|
||||
5. Tests can verify task selection and command targets without starting services or provisioning containers.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test scripts/test/workspace.test.ts
|
||||
bun run build --dry=json
|
||||
git diff --check
|
||||
```
|
||||
|
||||
Required regression cases: missing command targets, exact dev task selection, startup failure exit propagation, and exclusion of reset/init/activation commands.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Changing convenience aliases can break local habits. Keep safe compatibility aliases where useful and make intentionally removed aliases explicit in documentation.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
84
docs/development/backlog/tasks/CL05.md
Normal file
84
docs/development/backlog/tasks/CL05.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# CL05 — Extract shared dataset and reporting logic behind a research library boundary
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / High. Complexity: M. Specialization: TypeScript domain boundaries and package migration.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a backend or research-tool developer, I want reusable dataset and reporting logic to have a stable package interface, so clients do not import another application implementation directory.
|
||||
|
||||
Expected benefit: Creates a small shared boundary for the API, workers and future research clients while preserving existing behavior.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F04:** Web admission imports worker-application implementation modules directly. [apps/stock/web-api/src/services/canonical-research.service.ts:31](../../../../apps/stock/web-api/src/services/canonical-research.service.ts#L31).
|
||||
- **Verified — CL-F04:** Result reading imports the orchestrator reporting implementation. [apps/stock/web-api/src/services/backtest-v2.service.ts:37](../../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L37).
|
||||
- **Verified — CL-F04:** V2 validation mixes reusable normalization/hashing with a legacy conversion dependency. [apps/stock/orchestrator/src/data/historical-dataset-v2.ts:1](../../../../apps/stock/orchestrator/src/data/historical-dataset-v2.ts#L1).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Introduce one focused libs/research workspace, @stock-bot/research, using the existing libs/* workspace pattern. Publish explicit browser-safe dataset-contract, server dataset-validation and pure result-analysis subpaths.
|
||||
- Move only reusable V2 normalization/validation/hash and canonical statistical-report code. Keep provider IO, legacy source adaptation, worker supervision, build-file inspection and sandbox execution in application adapters.
|
||||
- Keep thin compatibility re-exports at existing imports during migration; establish one implementation, not duplicate helpers. Do not relocate every historical contract or create a package per concept.
|
||||
- Replace the API imports of these moved pure helpers and add import/bundle boundaries. Existing stock-config contract subpaths may remain dependencies when they load no configuration manager or application runtime.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/orchestrator/src/data/historical-dataset-v2.ts`
|
||||
- `apps/stock/orchestrator/src/backtest/canonical-result.ts`
|
||||
- `apps/stock/web-api/src/services/canonical-research.service.ts`
|
||||
- `apps/stock/web-api/src/services/backtest-v2.service.ts`
|
||||
- `apps/stock/web-api/src/services/dataset-preparation.service.ts`
|
||||
- `apps/stock/web-api/src/services/validation-preview.ts`
|
||||
- `apps/stock/web-api/src/services/chronological-validation.service.ts`
|
||||
- `scripts/test/architecture.test.ts`
|
||||
- `tsconfig.check.json`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `libs/research/package.json`
|
||||
- `libs/research/tsconfig.json`
|
||||
- `libs/research/src/dataset-contracts.ts`
|
||||
- `libs/research/src/datasets.ts`
|
||||
- `libs/research/src/results.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No NAPI/Rust financial changes, new API routes, generic plugin/DI framework or relocation of provider adapters.
|
||||
- No persisted schema/hash changes, edited historical artifact bytes, new feature caching, DSL or performance work.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: [D01](D01.md), [F08](F08.md), [R05](R05.md).
|
||||
|
||||
Write locks: `research-domain-package`, `dataset-domain`, `research-architecture-tests`.
|
||||
|
||||
Parallel execution: Code-ready against completed D01/F08/R05. Independent of the DI stories. Serialize exact API file edits with CL08 and dataset-client edits with CL06; CL06/CL08 depend on this boundary.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. There is one implementation of moved V2 and report behavior; the old entrypoints are compatibility facades rather than copies.
|
||||
2. The new library has no imports of apps/*/src implementation paths, service containers, databases, native bindings or application entrypoints.
|
||||
3. The dataset-contract subpath bundles for the browser without node:crypto, filesystem access or native code; server hashing stays outside that entrypoint.
|
||||
4. Existing dataset hash fixtures, acceptance/rejection cases and canonical analytics outputs remain identical.
|
||||
5. The web API uses the shared package for moved helpers. Native-worker bundling and original-result reading still pass; old retained artifacts are preserved.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Build the changed package and worker artifacts in the assigned checkout before integration tests. Preserve existing retained artifact fixtures rather than rebaselining economic output.
|
||||
|
||||
```sh
|
||||
bun run build
|
||||
bun test scripts/test/architecture.test.ts test/integration/historical-dataset-v2.test.ts test/integration/canonical-result.test.ts
|
||||
bun test test/integration/canonical-sma.test.ts test/integration/retained-strategy-worker.test.ts
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: browser-safe imports, one validation implementation, golden dataset hashes, metadata round trips, canonical analytics equivalence and retained-worker execution.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Hash property order, module-local prepared-object caches and worker build identities can change accidentally during moves. Preserve semantic outputs and retained executable bytes; new current builds must not overwrite original reproduction artifacts.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
74
docs/development/backlog/tasks/CL06.md
Normal file
74
docs/development/backlog/tasks/CL06.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# CL06 — Use shared dataset response schemas and eligibility checks in the workbench
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: Shared contracts and frontend validation.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a researcher, I want the browser and API to interpret dataset responses consistently, so valid datasets do not fail because independent schema copies drift.
|
||||
|
||||
Expected benefit: Removes a large inline manifest schema and repeated eligibility rules from the backtest client.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F05:** The client defines a second substantial dataset manifest schema and preparation-response validation. [apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts:113](../../../../apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts#L113).
|
||||
- **Verified — CL-F05:** The server defines overlapping calendar, series, bounds and corporate-action structures. [apps/stock/orchestrator/src/data/historical-dataset-v2.ts:34](../../../../apps/stock/orchestrator/src/data/historical-dataset-v2.ts#L34).
|
||||
- **Verified — CL-F05:** Workbench dataset eligibility is enforced separately at admission. [apps/stock/web-api/src/services/canonical-research.service.ts:51](../../../../apps/stock/web-api/src/services/canonical-research.service.ts#L51).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Reuse the CL05 browser-safe structural schemas in dataset catalog/preparation response parsing.
|
||||
- Centralize workbench-specific structural eligibility checks used by response consistency checks and admission, without broadening the single-asset/single-series policy.
|
||||
- Keep expected-request/hash identity checks at the client boundary and full dataset-byte/hash validation at execution. Shared shape validation must not pretend to authenticate dataset content.
|
||||
- Preserve existing prepared/stored-source response contracts, explicit unavailable reasons and immutable retained inputs.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-app/src/features/backtest/services/backtestApiV2.ts`
|
||||
- `apps/stock/web-api/src/services/canonical-research.service.ts`
|
||||
- `apps/stock/config/src/contracts/canonical-research.ts`
|
||||
- `test/integration/dataset-source-preparation-ui.test.tsx`
|
||||
- `test/integration/canonical-workbench.test.tsx`
|
||||
|
||||
Prerequisite output: `libs/research/src/dataset-contracts.ts` is proposed by CL05 and must exist before this story begins; it is not present at this audit baseline.
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No new datasets UI, automatic calendar assumptions, changed content hashes or wider execution eligibility.
|
||||
- No browser hashing of full datasets, client-authoritative eligibility or weakened worker checks.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: [CL05](CL05.md).
|
||||
|
||||
Write locks: `dataset-response-contracts`, `web-backtest-api`.
|
||||
|
||||
Parallel execution: After CL05. Disjoint from CL07, which initially excludes backtestApiV2.ts; reserve this client file explicitly.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. Calendar/series/bounds/action response structures have one shared schema definition used by the server and browser.
|
||||
2. Valid server preparation and catalog fixtures are accepted by the browser; malformed or mismatched identities still fail.
|
||||
3. Eligibility and unavailable-reason consistency match between UI response parsing and server admission for supported and unsupported fixtures.
|
||||
4. A browser build of this client contains no native/file/database or Node hashing dependencies.
|
||||
5. Stored snapshots, normalized bars, v1/v2 hash fixtures and exact run provenance remain unchanged.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test test/integration/dataset-source-preparation-ui.test.tsx test/integration/canonical-workbench.test.tsx
|
||||
bun test test/integration/dataset-source-preparation.test.ts test/integration/historical-dataset-v2.test.ts
|
||||
bun test scripts/test/architecture.test.ts
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: eligible/unsupported series, missing calendars/actions, malformed fields, corrupt response hashes, expected-request mismatch and browser dependency boundaries.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Manifest validation and full content integrity are different boundaries. Consolidate shared structures without dropping contextual checks or treating a catalog entry as proof that retained bars are valid.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
75
docs/development/backlog/tasks/CL07.md
Normal file
75
docs/development/backlog/tasks/CL07.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# CL07 — Share JSON transport handling across experiment and validation clients
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: Frontend HTTP contracts and retry semantics.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a frontend maintainer, I want one small transport helper for repeated experiment request handling, so error and cancellation behavior stays consistent.
|
||||
|
||||
Expected benefit: Removes duplicated request/JSON/status handling without combining independent domain workflows.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F06:** Experiment requests implement fetch, abort handling, JSON decoding, expected-status checks and uncertainty classification. [apps/stock/web-app/src/features/experiments/services/experimentApi.ts:44](../../../../apps/stock/web-app/src/features/experiments/services/experimentApi.ts#L44).
|
||||
- **Verified — CL-F06:** Chronological validation repeats the same transport sequence with a different domain parser/error type. [apps/stock/web-app/src/features/experiments/services/chronologicalValidationDurableApi.ts:29](../../../../apps/stock/web-app/src/features/experiments/services/chronologicalValidationDurableApi.ts#L29).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Extract a small browser JSON request helper and apply it first to ordinary/cost experiment, durable chronological-validation and walk-forward clients.
|
||||
- Keep endpoint schemas, request identity comparisons and operation-specific error messages beside each domain client. Preserve cancellation as cancellation and existing ambiguous-acceptance classifications.
|
||||
- Keep browser cookie transport separate from ResearchClient bearer credentials; reuse shared response parsers already present.
|
||||
- Avoid hidden retries, generalized request managers, new state libraries or a policy-heavy client framework.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-app/src/lib/api.ts`
|
||||
- `apps/stock/web-app/src/features/experiments/services/experimentApi.ts`
|
||||
- `apps/stock/web-app/src/features/experiments/services/chronologicalValidationDurableApi.ts`
|
||||
- `apps/stock/web-app/src/features/experiments/services/walkForwardApi.ts`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `apps/stock/web-app/src/lib/requestJson.ts`
|
||||
- `test/integration/research-http-transport.test.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No backtestApiV2.ts migration in this story; CL06 owns its dataset parser cleanup.
|
||||
- No auth weakening, new automatic retries, endpoint/receipt changes, or mandatory conversion of every HTTP client.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `web-experiment-transport`.
|
||||
|
||||
Parallel execution: Ready independently. It can run with CL05/CL06 and frontend component stories only when actual client/test files are disjoint.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. The selected clients share fetch/JSON/status plumbing while retaining their public method and error contracts.
|
||||
2. Aborted reads remain distinguishable from failed writes; no retry occurs unless explicitly requested by the caller.
|
||||
3. Lost responses, malformed accepted responses and server failures preserve the current uncertain-submission behavior and receipt inputs.
|
||||
4. Unexpected success statuses, invalid envelopes and wrong response identities still reject.
|
||||
5. Browser requests include cookies; research-agent tokens are neither introduced into the browser nor routed through this helper.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
research-http-transport.test.ts is a proposed new test file. Substitute only HTTP responses; exercise the production helper and existing domain clients.
|
||||
|
||||
```sh
|
||||
bun test test/integration/research-http-transport.test.ts
|
||||
bun test test/integration/experiments-ui.test.tsx test/integration/chronological-validation-durable-ui.test.tsx test/integration/walk-forward-ui.test.tsx
|
||||
bun test test/integration/experiment-retries-ui.test.tsx test/integration/cost-sensitivity-ui.test.tsx
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: abort, network loss, invalid JSON, wrong 2xx status, 4xx/5xx domain errors, identity mismatch, cookie forwarding and absence of implicit POST retries.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
A generic helper can erase distinctions between uncertain acceptance and definitive rejection. Keep those policies explicit in the domain client and preserve existing race/retry tests.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
76
docs/development/backlog/tasks/CL08.md
Normal file
76
docs/development/backlog/tasks/CL08.md
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
# CL08 — Split backtest template, run and reproduction responsibilities behind the existing service
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: TypeScript application services and PostgreSQL transactions.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a backend developer, I want coherent backtest application modules, so changing reproduction or run admission does not require navigating a thousand-line service.
|
||||
|
||||
Expected benefit: Reduces the number of unrelated behaviors sharing one class while preserving existing API and transaction contracts.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F07:** BacktestServiceV2 combines template CRUD, run admission, controls, results, reproduction and row mapping in 1,071 lines at the audit baseline. [apps/stock/web-api/src/services/backtest-v2.service.ts:167](../../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L167).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Keep BacktestServiceV2 as a compatible facade while extracting focused template operations, run submission/control operations and reproduction/result readers within the same application.
|
||||
- Move logic with its existing transaction boundaries, identity checks and error types. Pass the existing query/transaction client through helpers; do not open nested pool transactions.
|
||||
- Use the shared CL05 report/domain helpers. Keep schema mappings explicit and avoid a new generic repository/service layer for each table.
|
||||
- Preserve idempotent receipt lookup before current eligibility checks and keep run/outbox insertion atomic.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-api/src/services/backtest-v2.service.ts`
|
||||
- `apps/stock/web-api/src/services/run-reproduction.ts`
|
||||
- `apps/stock/web-api/src/services/reproduction-comparison.ts`
|
||||
- `apps/stock/web-api/src/routes/backtests-v2.routes.ts`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `apps/stock/web-api/src/services/backtests/templates.ts`
|
||||
- `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`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No schema migration, endpoint redesign, new simulator, financial calculations or receipt-key changes.
|
||||
- No cleanup of legacy execution branches in this extraction; CL12 follows it.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: [CL05](CL05.md).
|
||||
|
||||
Write locks: `web-backtest-service`, `web-run-reproduction`.
|
||||
|
||||
Parallel execution: After CL05. Must not overlap CL12 or another backtest service owner. Can run with disjoint frontend work.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. Existing service callers and routes retain method signatures, HTTP behavior and persisted result shapes.
|
||||
2. Templates, admission/controls and reproduction/results have focused implementation modules; the facade does not duplicate extracted logic.
|
||||
3. Same-key retries after edits/archive or eligibility changes recover the original admitted request; conflicting key reuse still fails.
|
||||
4. Run and dispatch writes remain atomic; single-connection transactions do not acquire another pool client.
|
||||
5. Reproduction pins retained original inputs/builds, and result reading still verifies provenance and reports missing canonical data explicitly.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
PostgreSQL tests require disposable stock_bot_safety* and Redis DB15 fixtures under the existing harness; never run them on development research or paper state. Extend existing admission/reproduction transaction tests.
|
||||
|
||||
```sh
|
||||
bun test test/integration/run-reproduction-api.test.ts test/integration/reproduction-comparison.test.ts test/integration/canonical-durable-runner.test.ts
|
||||
bun test test/integration/canonical-workbench.test.tsx test/integration/backtest-run-controls.test.tsx
|
||||
bun run test:postgres
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: receipt replay/conflicts, concurrent submission, archive races, cancellation, one-connection transaction behavior, result corruption and unavailable original builds.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Splitting code can accidentally move a check outside a lock or create nested transactions. Review operation order and test actual concurrent SQL behavior, not just mocked method calls.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
73
docs/development/backlog/tasks/CL09.md
Normal file
73
docs/development/backlog/tasks/CL09.md
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# CL09 — Separate strategy metadata, version inspection and publication UI
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: React strategy workflows.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a strategy developer, I want version inspection, parameter editing and publication to be understandable independent workflows, so changes to one do not disturb the others.
|
||||
|
||||
Expected benefit: Reduces the responsibilities and coupled state in StrategyDetailPage without changing strategy authoring semantics.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F07:** One 796-line file contains metadata editing, version selection, parameters, publication, cloning, history and comparison. [apps/stock/web-app/src/features/strategies/StrategyDetailPage.tsx:20](../../../../apps/stock/web-app/src/features/strategies/StrategyDetailPage.tsx#L20).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Extract focused version inspection/comparison, metadata, and publication/clone panels or hooks as justified by their state ownership.
|
||||
- Keep the route component responsible for selected strategy/version identity and composing panels. Reuse existing CandidatePublication, BuiltinReview and parameter components.
|
||||
- Preserve exact clone/publication receipts, dirty-draft protection, parent/version identity checks and stale-response rejection.
|
||||
- Use explicit local action states where they replace coupled Boolean flags; do not add a global state framework.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-app/src/features/strategies/StrategyDetailPage.tsx`
|
||||
- `apps/stock/web-app/src/features/strategies/components/`
|
||||
- `apps/stock/web-app/src/features/strategies/services/candidatePublication.ts`
|
||||
- `test/integration/strategy-workbench.test.tsx`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `apps/stock/web-app/src/features/strategies/components/StrategyVersionPanel.tsx`
|
||||
- `apps/stock/web-app/src/features/strategies/hooks/useStrategyClone.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No browser IDE, new strategy/package format, review-policy changes or activation controls.
|
||||
- No redesign of the future AI research workspace or removal of version/evidence history.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `web-strategy-detail`.
|
||||
|
||||
Parallel execution: Ready independently; disjoint from DI, CL06 and CL07. Reserve strategy detail/panel/test files against any other frontend owner.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. The route composes focused components instead of defining the complete version comparison/publication workflow inline.
|
||||
2. Changing routes/versions cannot apply an old response to a new selection or lose an unacknowledged receipt silently.
|
||||
3. Metadata, parameter, clone and candidate drafts preserve their current unsaved-change and retry behavior.
|
||||
4. Archived/read-only/missing-version states, clone recovery and immutable version links remain functional.
|
||||
5. Existing catalog review and candidate-isolation distinctions remain visible and unchanged.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test test/integration/strategy-workbench.test.tsx test/integration/candidate-publication-ui.test.tsx
|
||||
bun test test/integration/canonical-workbench.test.tsx
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: version navigation races, dirty draft confirmation, ambiguous clone/publication response, archived family, review failure and immutable version reopen.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Extracted panels can reset state by remounting or keep state under the wrong version. Preserve the deliberate keyed identity boundaries and ownership checks.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
75
docs/development/backlog/tasks/CL10.md
Normal file
75
docs/development/backlog/tasks/CL10.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# CL10 — Separate experiment modes and make draft/submission state explicit
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: React experiment workflow state.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a researcher configuring experiments, I want parameter sweeps, cost studies and validation recipes to have clear action ownership, so switching modes cannot lose or duplicate work.
|
||||
|
||||
Expected benefit: Makes the 623-line ExperimentEditor easier to maintain while retaining its important receipt and race protections.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F07:** The editor combines multiple experiment kinds, template loading, candidate state, preview revisions and mutually exclusive submission owners. [apps/stock/web-app/src/features/experiments/components/ExperimentEditor.tsx:49](../../../../apps/stock/web-app/src/features/experiments/components/ExperimentEditor.tsx#L49).
|
||||
- **Verified — CL-F07:** Chronological and walk-forward preflight components share draft fields and submission ownership through the same parent. [apps/stock/web-app/src/features/experiments/components/ExperimentEditor.tsx:589](../../../../apps/stock/web-app/src/features/experiments/components/ExperimentEditor.tsx#L589).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Extract focused template/candidate selection, ordinary/cost preview-submission, and validation recipe composition at coherent state boundaries.
|
||||
- Represent each action as an explicit draft/preview/submitting/uncertain/accepted state where that replaces coupled refs and Booleans. Keep concurrency coordination local to this workspace.
|
||||
- Retain a single coordinator for mutually exclusive submissions and exact frozen key/body custody after an ambiguous response.
|
||||
- Keep current response parsers, reset-segment validation semantics, invalidation rules and unsaved-change behavior.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-app/src/features/experiments/components/ExperimentEditor.tsx`
|
||||
- `apps/stock/web-app/src/features/experiments/components/ChronologicalValidationPreflight.tsx`
|
||||
- `apps/stock/web-app/src/features/experiments/components/WalkForwardPreflight.tsx`
|
||||
- `test/integration/experiments-ui.test.tsx`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `apps/stock/web-app/src/features/experiments/hooks/useExperimentSubmission.ts`
|
||||
- `apps/stock/web-app/src/features/experiments/components/ExperimentDraftForm.tsx`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No new optimizer, validation policy, data model or financial behavior.
|
||||
- No HTTP client/transport edits owned by CL07 and no global workflow/state-machine framework.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `web-experiment-editor`.
|
||||
|
||||
Parallel execution: Ready independently. Can run alongside CL07 only with disjoint authored client/test files and preserved public client contracts. Integration checks must cover their combination.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. The parent composes coherent workflows and owns one explicit submission coordinator; it no longer manages all request and form transitions inline.
|
||||
2. Changing template, candidate, grid or mode invalidates only the matching preview and cannot submit stale data.
|
||||
3. An uncertain accepted request keeps its exact body/key and blocks conflicting ordinary/chronological/walk-forward submission until resolved or explicitly abandoned.
|
||||
4. Late responses after navigation or newer edits cannot overwrite current preview, errors or receipts.
|
||||
5. Saved experiment IDs, validation reports, failed-trial visibility and current comparison links remain unchanged.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test test/integration/experiments-ui.test.tsx test/integration/cost-sensitivity-ui.test.tsx
|
||||
bun test test/integration/chronological-validation-durable-ui.test.tsx test/integration/walk-forward-ui.test.tsx
|
||||
bun test test/integration/experiment-retries-ui.test.tsx
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: mode switching, edited-after-preview, candidate parameter changes, concurrent clicks, ambiguous response, exact receipt retry, navigation races and explicit discard.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
A visually cleaner form can accidentally weaken mutual exclusion or regenerate a receipt. Preserve the current race tests and test transitions rather than only rendered snapshots.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
74
docs/development/backlog/tasks/CL11.md
Normal file
74
docs/development/backlog/tasks/CL11.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# CL11 — Separate backtest template loading, run monitoring and submission state
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: React asynchronous state and durable-run UX.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a researcher, I want saved-template editing, run selection and job submission to remain independent, so navigation and retries behave predictably.
|
||||
|
||||
Expected benefit: Reduces the responsibilities of the 571-line backtest hook without discarding its existing correctness protections.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F07:** The hook owns template CRUD, eligibility, selected-run request chains, polling, submission receipts and cancellation. [apps/stock/web-app/src/features/backtest/hooks/useBacktestV2.ts:34](../../../../apps/stock/web-app/src/features/backtest/hooks/useBacktestV2.ts#L34).
|
||||
- **Verified — CL-F07:** A 645-line page composes template configuration, controls, run history and result presentation. [apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx:1](../../../../apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx#L1).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Extract focused template state, selected-run monitoring and submission/cancellation helpers behind the current useBacktestV2 facade.
|
||||
- Keep one owner for the selected status-then-results request chain. Generation checks and AbortControllers must still reject stale responses.
|
||||
- Keep template archival, browser monitoring stop and server job cancellation distinct. Preserve exact in-memory receipt custody through ambiguous submissions.
|
||||
- Reduce page wiring only where this extraction makes it redundant; reuse current result/configuration components.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-app/src/features/backtest/hooks/useBacktestV2.ts`
|
||||
- `apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx`
|
||||
- `test/integration/backtest-run-controls.test.tsx`
|
||||
- `test/integration/canonical-workbench.test.tsx`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `apps/stock/web-app/src/features/backtest/hooks/useRunMonitoring.ts`
|
||||
- `apps/stock/web-app/src/features/backtest/hooks/useRunSubmission.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No browser-persistent receipt journal, new backend controls, pause/resume support or financial result reconstruction.
|
||||
- No dataset/HTTP parser edits owned by CL06 and no general hook framework.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `web-backtest-monitor`.
|
||||
|
||||
Parallel execution: Ready independently. Can run with CL08 because UI/client contracts remain stable. Serialize with other backtest page/hook owners; keep CL06 API-client edits separate.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. useBacktestV2 retains its public return contract while delegating distinct lifetimes to focused helpers.
|
||||
2. Only the selected run/backtest identity can update status, errors or results; changing the parent route fences earlier requests.
|
||||
3. Polling, WebSocket refresh and cancellation acknowledgement share one serialized refresh chain without overlapping result requests.
|
||||
4. Uncertain submissions reuse the original key/body even after template edits or archival; creating a new logical request remains explicit.
|
||||
5. Leaving a page stops browser observation without cancelling server work. Completed/cancelled/failed/missing results stay distinct and reopen correctly.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test test/integration/backtest-run-controls.test.tsx test/integration/canonical-workbench.test.tsx
|
||||
bun test test/integration/run-reproduction-ui.test.tsx
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: selected-run and parent navigation races, reload, late status/results, WebSocket invalidation during a poll, cancellation failure, archive while pending and exact receipt retry.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Moving refs between hooks can change their lifetime or create stale closures. Preserve identity ownership and existing interaction tests; do not replace this with several independent polling effects.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
73
docs/development/backlog/tasks/CL12.md
Normal file
73
docs/development/backlog/tasks/CL12.md
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# CL12 — Simplify retired execution seams while preserving historical reads
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Medium. Complexity: M. Specialization: Compatibility cleanup and execution boundaries.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a strategy developer, I want the supported execution path to be obvious, so obsolete APIs and impossible fallback branches do not look like alternative financial authorities.
|
||||
|
||||
Expected benefit: Removes confirmed-unreachable new-run code and sharpens supported-versus-compatibility boundaries without deleting useful history.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F09:** New run admission rejects non-catalog requests before retaining legacy snapshot fallback branches later in the same method. [apps/stock/web-api/src/services/backtest-v2.service.ts:461](../../../../apps/stock/web-api/src/services/backtest-v2.service.ts#L461).
|
||||
- **Verified — CL-F09:** The legacy runBacktest entry exists only to reject execution. [apps/stock/orchestrator/src/backtest/BacktestRunner.ts:70](../../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L70).
|
||||
- **Verified — CL-F09:** Legacy and canonical native exports remain adjacent; this alone does not prove legacy exports are unused. [apps/stock/engine/index.mjs:28](../../../../apps/stock/engine/index.mjs#L28).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Inventory the callers of touched legacy seams and classify each as supported execution, historical result compatibility, preserved research, or explicit retired-API rejection in the story handoff.
|
||||
- Remove branches proved unreachable after canonical admission and stop carrying their legacy input requirements through current run helpers.
|
||||
- Keep explicit retired-API responses small and truthful. Preserve their current HTTP/status behavior unless a separately approved API change is required.
|
||||
- Extend existing architecture checks so canonical entrypoints cannot regain legacy accounting/fill fallback dependencies. Preserve compatibility result readers and retained artifacts.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `apps/stock/web-api/src/services/backtest-v2.service.ts`
|
||||
- `apps/stock/web-api/src/services/backtest-result.ts`
|
||||
- `apps/stock/orchestrator/src/backtest/BacktestRunner.ts`
|
||||
- `apps/stock/orchestrator/src/backtest/execution-engine.ts`
|
||||
- `apps/stock/orchestrator/src/api/rest/backtest.ts`
|
||||
- `scripts/test/architecture.test.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No mass deletion or rewrite of old strategies, calculation APIs, legacy Rust exports, short-trade examples, financial fixtures or stored results.
|
||||
- No changes to historical request/result formats, economic policies, original reproduction artifacts or supported risk controls.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: [CL08](CL08.md).
|
||||
|
||||
Write locks: `web-backtest-service`, `legacy-execution-boundaries`.
|
||||
|
||||
Parallel execution: After CL08. One owner for the affected execution/API seams. This is not authority to remove unrelated code merely because static imports look absent.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. Current run submission contains no fallback branch that its admission guard makes impossible.
|
||||
2. Canonical entrypoint dependency checks forbid legacy financial execution; retired APIs still return their documented rejection rather than starting work.
|
||||
3. Existing legacy result mapping and historical reads pass unchanged; callers of every removed branch are documented and verified.
|
||||
4. Native financial output, strategy decisions, fees and equity remain identical on existing deterministic fixtures.
|
||||
5. No preserved calculation capability, retained artifact or compatibility reader is removed without separate evidence and scope approval.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
||||
|
||||
```sh
|
||||
bun test scripts/test/architecture.test.ts
|
||||
bun test test/integration/canonical-durable-runner.test.ts test/integration/backtest-result-mapping.test.ts
|
||||
bun test test/integration/canonical-sma.test.ts test/integration/strategy-runtime.test.ts
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: retired entry rejection, canonical-only admission, historical result reads, no legacy fallback and unchanged economic fixtures.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Runtime exports and retained artifacts have consumers beyond simple source imports. Keep native exports and preserved algorithms out of this story; distinguish unreachable control flow from merely old code.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
72
docs/development/backlog/tasks/CL13.md
Normal file
72
docs/development/backlog/tasks/CL13.md
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# CL13 — Hide placeholder navigation while preserving useful product routes
|
||||
|
||||
Parent epic: E10. Priority/severity: P2 / Low. Complexity: S. Specialization: React navigation and product clarity.
|
||||
|
||||
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
||||
|
||||
## User story and outcome
|
||||
|
||||
As a user, I want navigation to lead to functioning workflows, so unfinished pages do not imply capabilities the product does not have.
|
||||
|
||||
Expected benefit: Immediately reduces misleading navigation without committing to a new AI research interface.
|
||||
|
||||
## Verified evidence
|
||||
|
||||
- **Verified — CL-F10:** Portfolio, Analytics and Settings are top-level navigation items. [apps/stock/web-app/src/lib/constants.ts:32](../../../../apps/stock/web-app/src/lib/constants.ts#L32).
|
||||
- **Verified — CL-F10:** Those destinations currently render Coming Soon placeholders. [apps/stock/web-app/src/app/App.tsx:34](../../../../apps/stock/web-app/src/app/App.tsx#L34).
|
||||
|
||||
## Implementation scope
|
||||
|
||||
- Remove placeholder destinations from primary navigation while keeping existing direct URLs readable with a clear unavailable message.
|
||||
- Keep working strategy, backtest, experiment, research, market-data, system and paper-review navigation intact.
|
||||
- Update current product documentation to match the visible menu and add focused route/navigation coverage.
|
||||
- Do not relabel completed backtest analytics as a new standalone Analytics capability.
|
||||
|
||||
Likely existing files/modules:
|
||||
|
||||
- `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`
|
||||
|
||||
Proposed new files/modules (names may be adjusted within this scope):
|
||||
|
||||
- `test/integration/navigation.test.tsx`
|
||||
|
||||
## Exclusions
|
||||
|
||||
- No deletion of portfolio/analytics domain code or existing run/experiment analytics.
|
||||
- No redesign of Research around chat, MCP, notebooks or an unapproved product workflow; no deployment activation changes.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Implementation prerequisites: None.
|
||||
|
||||
Write locks: `web-navigation`.
|
||||
|
||||
Parallel execution: Ready independently but lower priority than the first cleanup wave. Reserve route/navigation files against any concurrent product work.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. The primary menu contains no links to pages that only say Coming Soon.
|
||||
2. Existing placeholder URLs remain explicit and safe to open; working deep links and authentication boundaries remain unchanged.
|
||||
3. Implemented run/experiment analytics, research-agent access and paper-review pages remain discoverable.
|
||||
4. Navigation tests cover desktop/mobile data sources or their shared navigation model and direct-route behavior.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
navigation.test.tsx is a proposed new test file. Test the shared navigation model and route output without provisioning application infrastructure.
|
||||
|
||||
```sh
|
||||
bun test test/integration/navigation.test.tsx
|
||||
bun test test/integration/canonical-workbench.test.tsx
|
||||
bun run typecheck
|
||||
```
|
||||
|
||||
Required regression cases: placeholder visibility, working link targets, retained deep links, authenticated routing and existing analytics access.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
A menu cleanup can accidentally make a working capability inaccessible. Hide only verified placeholders and preserve existing route identities.
|
||||
|
||||
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|
||||
Loading…
Add table
Add a link
Reference in a new issue