docs: plan cleanup and maintainability backlog
This commit is contained in:
parent
fbf2eb9e0c
commit
4ddffa6b67
19 changed files with 1743 additions and 7 deletions
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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue