58 lines
3.8 KiB
Markdown
58 lines
3.8 KiB
Markdown
# CL17 — Separate historical reads from unused storage writes
|
||
|
||
Parent epic: E11. Priority/severity: P2 / Medium. Complexity: M. Specialist: TypeScript market data and provider normalization.
|
||
|
||
Scheduling and commit evidence: [manifest](../manifest.json). Scope baseline: `700ee09c`. Owner authorized planning, implementation and one commit per completed task on 2026-10-26; CL21 remains conditional. Follow [quality gates](../../QUALITY-GATES.md) and [agent instructions](../../agents/implementation.md).
|
||
|
||
## Outcome and evidence
|
||
|
||
StorageService.ts:71-193 combines mode initialization, DDL and two writers with no repository callers; historical capabilities/read/normalization start at :196/:250/:373. Current web dataset preparation uses only historical read capability.
|
||
|
||
The concrete benefit is a smaller supported execution surface with unchanged financial behavior. Findings are verified at the baseline; recheck caller/module evidence before edits. This does not imply active financial corruption.
|
||
|
||
## Scope
|
||
|
||
- Recheck callers; remove unused writers or explicitly isolate required compatibility behavior.
|
||
- Keep the existing historical facade and move concrete provider decoding/common validation into small cohesive functions only where it improves the data flow.
|
||
- Remove unnecessary PostgreSQL/mode ownership from the current historical reader; adapt retained examples only as necessary.
|
||
- Preserve provider selection, no fallback on missing/error, explicit synthetic opt-in, date semantics and all data-quality gates.
|
||
|
||
Likely files/modules:
|
||
|
||
- `apps/stock/orchestrator/src/services/StorageService.ts`
|
||
- `apps/stock/orchestrator/src/data/`
|
||
- `apps/stock/web-api/src/services/stored-dataset-preparation.ts`
|
||
- `test/integration/intraday-storage.test.ts`
|
||
|
||
## Exclusions
|
||
|
||
No new provider framework, source cleansing, null-volume coercion, cache, throughput optimization, DB migration or changes to adjustment/calendar policy. Preserve retained strategy packages/datasets/results, useful algorithms, reviewed calculations, durable recovery and the existing .env files. No pushes, PRs or paper/live activation.
|
||
|
||
## Dependencies and ownership
|
||
|
||
Prerequisites: [CL14](CL14.md)
|
||
|
||
Write locks: `historical-storage`.
|
||
|
||
Parallelism: After CL14; independent of native boundary and strategy diagnostic cleanup.
|
||
|
||
## Acceptance criteria
|
||
|
||
1. Current historical reader has no unused market/performance writes or ad hoc DDL responsibilities.
|
||
2. Existing provider routing, cancellation, malformed-row rejection and duplicate/timestamp/identity handling remain unchanged.
|
||
3. Frozen V1/V2 fixtures retain exact hashes and result eligibility; useful synthetic/legacy examples still work.
|
||
|
||
## Mandatory verification
|
||
|
||
- bun test test/integration/intraday-storage.test.ts test/integration/historical-dataset-v2.test.ts test/integration/ingestion-backtest.test.ts test/integration/stored-dataset-preparation.test.ts
|
||
- bun run typecheck
|
||
- Disposable PostgreSQL: test/postgres/stored-dataset-preparation.test.ts if persistence-facing behavior/imports change
|
||
|
||
Use isolated worktrees/build outputs and disposable safety databases/Redis only. Never rebaseline financial fixtures to hide changed behavior. Integrator runs repository checks on the combined source. Performance work remains deferred; no speed claims are part of acceptance.
|
||
|
||
## Risks and definition of done
|
||
|
||
Accidentally changing normalization, hash inputs, explicit provider precedence or legacy initialization.
|
||
|
||
Done requires scoped tests, independent reviewer acceptance, integration verification, and a focused commit. The manifest owns status and evidence; implementers do not edit it. Root records each completed commit in the next bookkeeping update; the task completion commit includes its tests/reviewer evidence, avoiding self-referential hashes. Unrelated prior CL01–CL13 review status remains unchanged.
|
||
|