feat(research): add canonical session reporting and analytics
This commit is contained in:
parent
1e164450c3
commit
3838295eec
28 changed files with 2402 additions and 47 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Canonical development backlog
|
||||
|
||||
**First twelve waves committed; F08 in progress.** F09/P07 were accepted as `e3bd722`. F08 adds account-session equity, occupied-time exposure and explicit statistical policies on the same financial core. Consult manifest execution_scope and [current wave](../ROADMAP.md#thirteenth-wave-execution--2026-10-23). ADR-002/003/004 are approved; other policies/default cutovers remain gated.
|
||||
**First twelve waves committed; F08 validated and awaiting acceptance.** F09/P07 were accepted as `e3bd722`; `1e16445` records their completion and the F08 contract. F08 adds account-session equity, occupied-time exposure and explicit statistical policies on the same financial core. Consult manifest execution_scope and [current wave](../ROADMAP.md#thirteenth-wave-execution--2026-10-23). ADR-002/003/004 are approved; other policies/default cutovers remain gated.
|
||||
|
||||
## One source of truth
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
|
|||
| [F05 Unify matching and order lifecycle on the ledger](tasks/F05.md) | P0 / done | F04, ADR-003 | F06 | Rust execution semantics / L |
|
||||
| [F06 Implement deterministic replay once, with linear historical traversal](tasks/F06.md) | P0 / done | F05, D01, P01, ADR-003 | — | Rust deterministic replay / M |
|
||||
| [F07 Expose bounded Rust step sessions through existing NAPI workers](tasks/F07.md) | P0 / done | F06, C02, ADR-004 | — | Rust/TypeScript integration / M |
|
||||
| [F08 Publish canonical metrics and versioned result projections](tasks/F08.md) | P1 / in_progress | F06, F09, ADR-002, ADR-003 | — | Quant analytics/Rust integration / M |
|
||||
| [F08 Publish canonical metrics and versioned result projections](tasks/F08.md) | P1 / review | F06, F09, ADR-002, ADR-003 | — | Quant analytics/Rust integration / M |
|
||||
| [F09 Return compact canonical replay projections](tasks/F09.md) | P1 / done | F07, ADR-002, ADR-003, ADR-004 | — | Rust/TypeScript financial integration / M |
|
||||
|
||||
### E3 — Point-in-time datasets and features
|
||||
|
|
@ -117,4 +117,4 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr
|
|||
|
||||
Before any wave: unique IDs; existing task/ADR references; acyclic implementation graph; no scheduled task dependent on merged/deferred work; approvals/readiness; actual file locks; isolated native build outputs/workspace dependencies and test databases. Release gates are checked separately at activation.
|
||||
|
||||
The first eleven waves are independently reviewed, validated and committed. Current authorization covers **F09 compact projections and P07 profiling** only. P07 baseline files can progress in parallel; paired projection measurements consume the accepted F09 contract afterward. F08 adds historical sampling/statistics next, without reconstructing accounting in TS. S01 needs ADR-005 and R01 needs ADR-006. The unresolved multi-asset mark-policy gate still blocks default activation. No new commit, push, PR or trading operation is authorized.
|
||||
The first twelve waves are committed. **F08 is independently reviewed and validated, with new implementation changes uncommitted.** Its reporting facts and statistics preserve authoritative Rust financial output; R05 retains persistence and public-result migration. Next, S01 needs ADR-005 approval; R01/R11 need ADR-006. The unresolved multi-asset mark-policy gate still blocks default activation. No further task, new commit, push, PR or trading operation is included in this continuation.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"schema_version": 1,
|
||||
"plan_revision": "2026-10-23.29",
|
||||
"plan_revision": "2026-10-23.30",
|
||||
"repository_base": "b7aeca4",
|
||||
"plan_status": "thirteenth_wave_in_progress",
|
||||
"plan_status": "thirteenth_wave_in_review",
|
||||
"execution_authorized": true,
|
||||
"execution_scope": {
|
||||
"authorized_by": "User: lets commit and continue with the backlog (2026-10-23). Accepted F09/P07 commit and authorizes F08 canonical historical reporting under approved ADR002/003/004; no default cutover or new financial policy.",
|
||||
|
|
@ -650,7 +650,7 @@
|
|||
"epic": "E2",
|
||||
"priority": "P1",
|
||||
"severity": "High",
|
||||
"status": "in_progress",
|
||||
"status": "review",
|
||||
"dependencies": [
|
||||
"F06",
|
||||
"F09"
|
||||
|
|
@ -682,7 +682,7 @@
|
|||
"release_gates": [],
|
||||
"worktree": "/tmp/stock-bot-wave13.KfvceG/f08",
|
||||
"integration_base": "e3bd722e31a4e14519df543d87affd90a8103fa2",
|
||||
"integration_state": "isolated_implementation",
|
||||
"integration_state": "validated_uncommitted",
|
||||
"implementation_slices": [
|
||||
{
|
||||
"owner": "/root/f08_contract_review",
|
||||
|
|
@ -697,7 +697,9 @@
|
|||
"branch": "wave13/f08-analytics"
|
||||
}
|
||||
],
|
||||
"review_notes": "Root pinned reporting conventions in F08 Execution contract. Preserve financial event IDs/checkpoints/trace/projection outputs. Additive canonical analytics contract; incompatible legacy DTO/persistence/public-result migration remains R05. No default cutover."
|
||||
"review_notes": "Independent reviews accepted native/reporting and analytics slices. 22 owner files integrated with exact hashes plus root native/worker/analytics composition tests. Repository gates, disposable recovery and release comparisons pass; shared-host drift checked against unchanged release control. Financial event IDs/checkpoints/trace/projection and legacy paths retained. See thirteenth_wave_validation; R05 owns persisted/public-result cutover.",
|
||||
"reviewed_by": ["/root/wave12_review", "/root"],
|
||||
"verification_reference": "ROADMAP.md#thirteenth-wave-execution--2026-10-23"
|
||||
},
|
||||
{
|
||||
"id": "F09",
|
||||
|
|
@ -4925,5 +4927,280 @@
|
|||
"Reporting conventions pinned in F08 Execution contract after independent Rust/quant design inspection. Separate accumulator; existing financial events/checkpoints/config/outputs retained; account-session reporting and elapsed occupancy are explicit.",
|
||||
"Two isolated source owners: native/reporting wire and disjoint shared analytics/statistics adapter. Exact accepted schema is handed off before consumer integration. Independent reviewer is read-only.",
|
||||
"Legacy positions and round-trip DTOs cannot truthfully represent the new facts without further work. F08 publishes an additive canonical analytics DTO; R05 retains persisted/public-result/default cutover with existing approval gates."
|
||||
]
|
||||
],
|
||||
"thirteenth_wave_validation": {
|
||||
"state": "validated_uncommitted",
|
||||
"work_root": "/tmp/stock-bot-wave13.KfvceG",
|
||||
"committed_before_implementation": [
|
||||
"e3bd722e31a4e14519df543d87affd90a8103fa2",
|
||||
"1e164450c3f7a16c1838b3318842f49a5ff3cf28"
|
||||
],
|
||||
"scope": "F08 only. Additive reporting/analytics; financial events/checkpoints/trace/projection and active legacy/web/paper paths unchanged. R05 owns persisted/public-result cutover.",
|
||||
"source_integration": {
|
||||
"reviewed_owner_files": 22,
|
||||
"all_owner_hashes_match": true,
|
||||
"root_additions": [
|
||||
"test/integration/canonical-native-report.test.ts",
|
||||
"libs/calculations/README.md"
|
||||
],
|
||||
"source_archive": "/tmp/stock-bot-wave13.KfvceG/integrated-source.tar",
|
||||
"source_archive_sha256": "1b72060dd11f4f7577d5078798188b0e024a34c951d316b3a29cfde193eb3a04",
|
||||
"measured_source": {
|
||||
"commit": "1e164450c3f7a16c1838b3318842f49a5ff3cf28",
|
||||
"dirty": true,
|
||||
"contentSha256": "4f60ad86bf2ef9afbc2630563d3ae2c8c5a54e60f4a57c82de798edc1a497a00",
|
||||
"files": 1167
|
||||
},
|
||||
"owner_hashes_file": "/tmp/stock-bot-wave13.KfvceG/f08-sources.sha256 and /tmp/stock-bot-wave13.KfvceG/analytics-final.sha256"
|
||||
},
|
||||
"gates": {
|
||||
"repository": {
|
||||
"command": "CARGO_BUILD_JOBS=2 bun run check",
|
||||
"log": "/tmp/stock-bot-wave13.KfvceG/integration-check.log",
|
||||
"outcome": "Build/typecheck/contracts/audit/lint passed; 72 tooling, 43 utility, 44 calculation and 144 Rust tests passed (4 existing manual benchmarks ignored). Initial integration failed only new composition fixtures missing explicit hold decisions; fixed test only. Required integration rerun below passed; no production changes after passing gates."
|
||||
},
|
||||
"integration": {
|
||||
"command": "bun run test:integration",
|
||||
"log": "/tmp/stock-bot-wave13.KfvceG/integration-tests-final.log",
|
||||
"passed": 375,
|
||||
"assertions": 3345
|
||||
},
|
||||
"strict_test_types": {
|
||||
"command": "bunx tsc --project /tmp/stock-bot-wave13.KfvceG/tsconfig.integration.json --noEmit",
|
||||
"log": "/tmp/stock-bot-wave13.KfvceG/integration-extra-types-final.log",
|
||||
"passed": true
|
||||
},
|
||||
"disposable_recovery": {
|
||||
"command": "PIPELINE_TEST_DATABASE_URL=postgres://fixture:fixture@127.0.0.1:32809/stock_bot_safety BACKTEST_TEST_REDIS_URL=redis://127.0.0.1:32810/15 bun run test:postgres",
|
||||
"baseline_log": "/tmp/stock-bot-wave13.KfvceG/baseline-postgres.log",
|
||||
"integrated_log": "/tmp/stock-bot-wave13.KfvceG/integration-postgres.log",
|
||||
"passed_each": 58,
|
||||
"assertions_each": 345
|
||||
},
|
||||
"release_focused": {
|
||||
"command": "bun test test/integration/native-replay.test.ts test/integration/native-replay-projection.test.ts test/integration/native-replay-report.test.ts test/integration/canonical-result.test.ts test/integration/canonical-native-report.test.ts scripts/test/native-bindings.test.ts",
|
||||
"log": "/tmp/stock-bot-wave13.KfvceG/integration-release-focused.log",
|
||||
"passed": 39,
|
||||
"assertions": 703
|
||||
},
|
||||
"formatting": "Scoped test ESLint with --no-ignore --max-warnings 0; scoped Prettier and Rust rustfmt; git diff --check passed.",
|
||||
"review": "Independent frozen native/wire and analytics review; real native/worker/analytics composition reviewed after corrected exact-trace fixtures. No blockers. Focused counts overlap full suites.",
|
||||
"not_run": "Browser/Python unchanged; no browser or Python rerun. No default cutover, paper account migration or live operation."
|
||||
},
|
||||
"native": {
|
||||
"release_sha256": "6fe9dae546b4fc1d50b064b2ad50b0a3d08a0208ede3c568bf0f95e549c57b9e",
|
||||
"artifact_matches": "apps/stock/engine/dist/engine.node == target/release/libengine.so",
|
||||
"generated_types_sha256": "4ab02314df3b64ae698942d5ba69260430f4488dc8ad64d1ef825d86db71da5d"
|
||||
},
|
||||
"performance": {
|
||||
"methodology": "Release; six workloads of 10000 TOTAL bars, one asset/owner or ten assets/two owners, none/sparse/turnover; two fresh processes x two fresh sessions each. Shared host; no timing assertions.",
|
||||
"projection_command": "bun run scripts/benchmark-research.ts --session --measure --profile=all --format=projection --bars=10000",
|
||||
"raw_files": {
|
||||
"baseline": {
|
||||
"path": "/tmp/stock-bot-wave13.KfvceG/baseline-10k-projection.json",
|
||||
"sha256": "3fd571b271d7ebdacd078315ab8c7102bb4d26edbeb31d9d15ce97e0b1efa6dc"
|
||||
},
|
||||
"candidate": {
|
||||
"path": "/tmp/stock-bot-wave13.KfvceG/candidate-10k-projection.json",
|
||||
"sha256": "e122cdd57d9126eeecf5d85203485dfaded47cbede24a61ce726e0cc8c548b2d"
|
||||
},
|
||||
"control": {
|
||||
"path": "/tmp/stock-bot-wave13.KfvceG/control-10k-projection.json",
|
||||
"sha256": "99940d4dc6debf22e98c1cda45d79f7ae3bfad4890625b22c6f490ad5fd243d4"
|
||||
},
|
||||
"comparison": {
|
||||
"path": "/tmp/stock-bot-wave13.KfvceG/projection-comparison.json",
|
||||
"sha256": "b11ae6348eaf944c7ec0b24abb65d0c931654e572bfa1c831c2fb2414ea3d158"
|
||||
}
|
||||
},
|
||||
"baseline_addon": "d98308d0af80c225f2ee631d5e68065fa762073619a8b5cf6f3681ba0f1d5dd6",
|
||||
"control_source": {
|
||||
"commit": "19e9dad68be9a06d1e9cd86cc27112c5dc8a4aa2",
|
||||
"dirty": true,
|
||||
"contentSha256": "8c181e664dfcd14951da1730918efd7817cc64c24409d12a1dbfbc65a4f3cd68",
|
||||
"files": 1156,
|
||||
"scope": "Tracked and nonignored untracked file paths/content, including dirty changes; generated ignored artifacts excluded."
|
||||
},
|
||||
"projection_rows": [
|
||||
[
|
||||
"none",
|
||||
1,
|
||||
1,
|
||||
722.1379744999999,
|
||||
1036.9407385,
|
||||
1049.7488,
|
||||
-1.2201072770933519,
|
||||
"ba38c860ec1ea215118f3cee4ffbb214d4d22c00e6b5f59fcc041570e6595d39"
|
||||
],
|
||||
[
|
||||
"none",
|
||||
10,
|
||||
2,
|
||||
301.1164395,
|
||||
412.87483849999995,
|
||||
422.0579295,
|
||||
-2.1757892360603215,
|
||||
"c9d2f8c913394fa37b3a4e057567ffa1463413ec5dbcda9c2c26109078b27103"
|
||||
],
|
||||
[
|
||||
"sparse",
|
||||
1,
|
||||
1,
|
||||
788.4738159999999,
|
||||
1125.431942,
|
||||
1136.793305,
|
||||
-0.9994220541261867,
|
||||
"7bba2bd2b3183d3c73d7d0e52e8e9eefd995704d5b3ad3b19d1a0467ff07ac0a"
|
||||
],
|
||||
[
|
||||
"sparse",
|
||||
10,
|
||||
2,
|
||||
425.1541205,
|
||||
581.5226849999999,
|
||||
589.4312225,
|
||||
-1.3417235460410404,
|
||||
"16d8bc7f63fcfbbb17a2ec949959e2976332c90a3b66f88764434bd74a1f870a"
|
||||
],
|
||||
[
|
||||
"turnover",
|
||||
1,
|
||||
1,
|
||||
1425.262843,
|
||||
2008.9278365000002,
|
||||
1994.4425904999998,
|
||||
0.7262804188497007,
|
||||
"84449a90550ae61b1ed7ac038a21420ed0347f7e9130d84fe960ca2d2dc7590c"
|
||||
],
|
||||
[
|
||||
"turnover",
|
||||
10,
|
||||
2,
|
||||
1820.0325200000002,
|
||||
2425.662255,
|
||||
2432.1380289999997,
|
||||
-0.2662584903810772,
|
||||
"aa8405f705705c9153b18b00965ddca11271a3a2e9bf61787985a68cb8df620f"
|
||||
]
|
||||
],
|
||||
"interpretation": "Initial candidate was 33-44% slower than early baseline, including unchanged TS callback/JSON phases. Host load varied 9-26. Contemporaneous unchanged exact F09 addon reproduced slowdown; 128 relevant source/lock files verified equal e3bd722. Candidate/control -2.18% to +0.73%; no material regression demonstrated, no speedup or SLA claim. All complete result/economic hashes identical; retain unfavorable initial samples.",
|
||||
"report_comparison": {
|
||||
"command": "bun run /tmp/stock-bot-wave13.KfvceG/report-benchmark.ts",
|
||||
"harness": {
|
||||
"path": "/tmp/stock-bot-wave13.KfvceG/report-benchmark.ts",
|
||||
"sha256": "d37f63aadd9b1849a57347c27991027e31fd03121edb3c7d6fb40575af2d00a5"
|
||||
},
|
||||
"smoke": "--smoke passed all tiny 8/16-total-bar pairs",
|
||||
"path": "/tmp/stock-bot-wave13.KfvceG/report-comparison.json",
|
||||
"sha256": "3969ca227d46655933395a744bd16a95cf6a90ca28dfe27556c6c2d66169524b",
|
||||
"trials": 48,
|
||||
"rows": [
|
||||
[
|
||||
"none",
|
||||
1,
|
||||
1,
|
||||
1038.244792,
|
||||
1038.0855645000001,
|
||||
0.7150815000001103,
|
||||
0.9550145000000612,
|
||||
0.5035165000000461,
|
||||
5414,
|
||||
5972
|
||||
],
|
||||
[
|
||||
"none",
|
||||
10,
|
||||
2,
|
||||
419.2966825,
|
||||
415.5477985,
|
||||
0.6127834999999777,
|
||||
1.0950445000000286,
|
||||
0.638200500000039,
|
||||
9198,
|
||||
9755
|
||||
],
|
||||
[
|
||||
"sparse",
|
||||
1,
|
||||
1,
|
||||
1140.11128,
|
||||
1122.99876,
|
||||
0.9735344999999143,
|
||||
1.2432044999999334,
|
||||
1.2845025000000305,
|
||||
7480,
|
||||
8090
|
||||
],
|
||||
[
|
||||
"sparse",
|
||||
10,
|
||||
2,
|
||||
579.425198,
|
||||
585.6239385000001,
|
||||
1.435258000000033,
|
||||
1.9801919999999882,
|
||||
0.5092425000000276,
|
||||
50387,
|
||||
50995
|
||||
],
|
||||
[
|
||||
"turnover",
|
||||
1,
|
||||
1,
|
||||
1965.9803270000002,
|
||||
2002.67703,
|
||||
197.7599379999998,
|
||||
201.9273004999999,
|
||||
0.6505395000001499,
|
||||
9784124,
|
||||
10004689
|
||||
],
|
||||
[
|
||||
"turnover",
|
||||
10,
|
||||
2,
|
||||
2466.477757,
|
||||
2465.8275665,
|
||||
431.99900449999996,
|
||||
438.7678484999997,
|
||||
0.8527414999998655,
|
||||
19408576,
|
||||
19431138
|
||||
]
|
||||
],
|
||||
"validation": "Counterbalanced format order; removing reporting fields and normalizing format to projection yields the identical complete projection, including valuation/all fill fields; matches initial baseline. Repeated full report/analytics hashes and integer-cent oracle pass. Independent final audit verified recorded raw/harness hashes, all 48 trials, medians and limitations.",
|
||||
"scope": "Both formats collect reporting. Additional export median 0.24-6.77ms; adapter 0.50-1.28ms. Fixture has one partial session, zero complete periodic samples; not long-session-history statistics, storage/queue throughput, arbitrary strategies or pure NAPI costs.",
|
||||
"rows_columns": [
|
||||
"profile",
|
||||
"assets",
|
||||
"owners",
|
||||
"projection_run_ms",
|
||||
"report_run_ms",
|
||||
"projection_finalize_ms",
|
||||
"report_finalize_ms",
|
||||
"analytics_ms",
|
||||
"projection_bytes",
|
||||
"report_bytes"
|
||||
]
|
||||
},
|
||||
"projection_rows_columns": [
|
||||
"profile",
|
||||
"assets",
|
||||
"owners",
|
||||
"initial_baseline_ms",
|
||||
"candidate_ms",
|
||||
"contemporaneous_control_ms",
|
||||
"candidate_vs_control_percent",
|
||||
"full_result_hash"
|
||||
]
|
||||
},
|
||||
"limitations": [
|
||||
"Session-end/terminal sampled drawdown, not intraday maximum; partial periods visible/excluded from periodic ratios.",
|
||||
"Marks are last available; per-session freshness not certified. Sequential equal-time risk halt limitation unchanged; R05 owner policy gate unresolved.",
|
||||
"Benchmark-dependent and round-trip metrics unsupported/null with reasons. Fills are not round trips; no invented legacy position financial fields.",
|
||||
"Legacy financial paths/results/UI remain active until separately gated migration. No DSL/cache/journal deletion or unrelated hot-loop rewrite."
|
||||
],
|
||||
"cleanup": "Stopped only exact --rm fixture containers a4edf7d7b61f944d9b42f93fe2fb77c9be565efabfa9292aeb8d34de3d1c8c85 and 604c940db286ab408bd60963116355428f0efa216725ca2e269639e1572fc1dd. Development services untouched; isolated worktrees/logs retained.",
|
||||
"next": "After acceptance, S01 stateful TS decisions requires ADR-005 approval; R01/R11 require ADR-006. No pending ADR implicitly approved."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,3 +125,11 @@ reporting: {
|
|||
- Rust: boundary sample after observations versus unchanged earlier risk reset; equal-time sequential risk halt still latched; first/final partial periods and exact terminal-boundary deduplication; exposure overlap/open positions/same-time owner handoff; no trade/stale marks; restore after every event including within observation groups; unchanged financial checkpoint/trace/project results.
|
||||
- TS/native: report format/identity/calendar/terminal-value validation; worker format/cancellation/failure guards; two sessions 100 → 110 → 99 yield +10%/−10%; partial returns retained but not annualized as full sessions; missing rates/benchmark; constant negative and nonbinary constant returns; unsupported round trips remain null; genuine zero exposure survives the additive adapter.
|
||||
- Run existing calculation, mapping and frontend metric/provenance fixtures, full repository checks and scoped strict test TypeScript. Worker changes require disposable PostgreSQL/Redis recovery gates. Measure reporting overhead against the accepted compact path with identical economic hashes; no timing assertions, new cache/DSL, journal deletion, or unrelated hot-loop optimization.
|
||||
|
||||
## Reviewed implementation handoff — 2026-10-23
|
||||
|
||||
Implemented in `financial/reporting.rs` and replay hooks, native `FinancialReplaySession.report()`, the existing TS native/worker contract, additive `CanonicalBacktestAnalytics` types and `backtest/canonical-result.ts`. Existing reviewed calculations supply statistical reporting; no legacy DTO or default runner cutover.
|
||||
|
||||
Independent review, exact owner-source integration, repository gates, disposable recovery and release-format comparisons passed. Full check initially found an incomplete decision trace in the new integration fixture; the corrected test explicitly submits every due hold and passes. See [wave handoff](../../ROADMAP.md#thirteenth-wave-execution--2026-10-23) and the canonical manifest validation record for commands, counts, hashes, initial unfavorable timings and the unchanged-artifact control. New implementation remains uncommitted.
|
||||
|
||||
R05 must consume the additive contract without filling unsupported round-trip/benchmark statistics or legacy position fields with invented values. S01 does not need another reporting contract. Long-session statistical throughput remains unmeasured; the six benchmark fixtures each contain one partial account period.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue