# CL19 — Share pure strategy bookkeeping and event ordering Parent epic: E11. Priority/severity: P2 / Medium. Complexity: M. Specialist: TypeScript strategy and durable paper parity. 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 strategy-controller.ts:60/:186 and CanonicalPaperExecution.ts:74/:330 duplicate diagnostics/feedback. feed.ts:48 and canonical-paper.ts:199 duplicate event comparator. Canonical paper imports canonicalJson from legacy strategy-recovery.ts:6. 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 - Share pure initial-diagnostic and owner-scoped admission-feedback helpers without combining controllers. - Use one event-key comparator with existing timestamp/phase/UTF-8/source ordering. - Move canonicalJson unchanged to a neutral local module with compatibility re-export; preserve exact historical bytes. - Keep research state confirmation and paper SQL transaction/recovery rules separate. Likely files/modules: - `apps/stock/orchestrator/src/strategies/strategy-controller.ts` - `apps/stock/orchestrator/src/strategies/strategy-decision.ts` - `apps/stock/orchestrator/src/execution/CanonicalPaperExecution.ts` - `apps/stock/orchestrator/src/execution/canonical-paper.ts` - `apps/stock/orchestrator/src/execution/strategy-recovery.ts` - `apps/stock/orchestrator/src/paper/feed.ts` ## Exclusions No generic state-machine framework, state serialization policy changes, checkpoint/schema version changes or replacement of canonicalJson with stricter stateCopy. 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: None; inspect existing integrated baseline rather than reopening earlier cleanup tasks. Write locks: `strategy-decision-helpers`, `canonical-paper-contract`. Parallelism: Independent of CL14/CL15/CL16; reserve paper and strategy helper files. ## Acceptance criteria 1. Equivalent research/paper inputs retain identical state/RNG/owner feedback; malformed ownership fails before state commit. 2. Unicode and phase ties keep Rust-compatible ordering. 3. Historical canonicalJson fixtures remain byte identical; crash/retry/partial failures retain committed state. ## Mandatory verification - bun test test/integration/strategy-runtime.test.ts test/integration/paper-feed.test.ts scripts/test/architecture.test.ts - bun run typecheck - Disposable PostgreSQL: test/postgres/canonical-paper.test.ts test/postgres/canonical-paper-crash.test.ts test/postgres/strategy-recovery.test.ts - Add parity/order/serialization fixtures that exercise public behavior 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 Moving commit boundaries, changing ordering or fingerprint serialization, sharing mutable diagnostic objects. 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.