3.4 KiB
CL18 — Share strict native parsing and financial view projection
Parent epic: E11. Priority/severity: P2 / Medium. Complexity: M. Specialist: Rust canonical transport contracts.
Scheduling and commit evidence: manifest. Scope baseline: 700ee09c. Owner authorized planning, implementation and one commit per completed task on 2026-10-26; CL21 remains conditional. Follow quality gates and agent instructions.
Outcome and evidence
api/replay.rs:78 and api/paper.rs:53 duplicate keys_match; replay.rs:297 and paper.rs:66 duplicate the canonical financial view.
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
- Extract small pure helpers shared by native replay and paper adapters; keep host identities/envelopes separate.
- Preserve strict recursive unknown/missing field checks including explicit required null fields.
- Preserve paper intermediate journal pre-transaction admissionRevision and final post-transaction revision.
- Retain one financial kernel; no new serializer framework or TS arithmetic.
Likely files/modules:
apps/stock/engine/src/api/replay.rsapps/stock/engine/src/api/paper.rsapps/stock/engine/src/api/mod.rsapps/stock/engine/src/financial/mod.rsscripts/test/native-bindings.test.ts
Exclusions
No wire shape/version/checkpoint changes, event order changes, economic policy or generic API framework. 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: CL15
Write locks: native-canonical-api.
Parallelism: After CL15; no simultaneous native build or canonical Rust contract owner.
Acceptance criteria
- Equivalent canonical states expose identical financial-view fields through both hosts.
- Nested unknown/missing/null contract negatives remain rejected identically.
- Paper retry journals and every intermediate/final revision are unchanged; existing exact replay/checkpoint fixtures pass.
Mandatory verification
- cargo test -p engine --lib --offline
- Build native addon; bun test scripts/test/native-bindings.test.ts test/integration/native-replay.test.ts test/integration/native-replay-report.test.ts
- Add focused view parity and strict nested/null fixtures where existing tests do not establish parity
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
Weakening required nullable fields or changing journal projection revision/order.
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.