31 KiB
Milestone M2 Master Audit & Closure Plan (T-208)
Bottom Line: HOLD M2 CLOSURE / HOLD M3 — Core M2 infrastructure is ~80% landed on current master (including T-190 send-ilp, T-205 mcp:research-copilot, T-206 curate-qm-bars-1m, and T-207 curate-macro), with 6 concrete code/wiring gaps and 1 host/quant verification gate remaining before M2 can close.
All sandbox-runnable TypeScript, ESLint, contract, and Rust native gates passed on local fixtures (including loopback TCP, with zero external network or QA DB contact; 0 errors, 0 warnings; 1,563 Rust tests across 58 suites and 1,050 targeted M2 Bun tests across 65 files). Exit Criterion 2 (2D PIT Q1-after-Q2 restatement non-overwrite) is Done in both Rust and real-DuckDB TypeScript fixtures; Exit Criteria 1 and 3 remain Partial pending event-kind/glob alignment, MarketDataStore read-path completions (macroAsOf, crossSection, fx('1m')), Python stockbot M2 parity, notebook:snapshot CLI + E2E test, and operator-run host/quant QuestDB 10.2.0 verification.
Scope, Provenance & Constraints
- Read-only, docs-only audit: Only
design/m2-master-audit.mdanddesign/README.mdare modified. Zero production code, schema, test, build config, or CI changes (project CI is off; zero CI workflows proposed).- Audited
masterbaseline vs. review branch: Audited againstmasteranddevat verified commitd45014a1f6dfc5ba5a73bcc0d6e57e486c2c7c52(with accepted M1d52aa20bff3f5c259fb6e2bcfc2d3a78ad5224b1confirmed as an ancestor). The review branch isfeat/m2-audit(prior review HEADefd73bda3b9937274be6a47663ac20010922cfbd, superseded by this revision). When checking the audited baseline outside the sandbox, rungit rev-parse master— notgit rev-parse HEAD(which returns thefeat/m2-auditdocumentation commit).- Supersedes prior T-203/T-204 snapshots: Unlike
design/m2-completion-audit.md(T-204), currentmaster(d45014a1) now includesT-190(send-ilp),T-205(scripts/research-copilot-mcp.ts+"mcp:research-copilot"),T-206(curate-qm-bars-1mCLI), andT-207(curate-macroCLI). Every status below was re-verified from current source files and test runs.- Documentation path drift: Canonical specs reside under
design/*.md, whileAGENTS.md(lines 43–48),CLAUDE.md(lines 3, 7–11),README.md(lines 7, 9, 11–13, 142, 264, 435), andstudio.config.json(lines 46–54) still referencedocs/*.md. Cleanup is queued inm2-ec1-snapshot-cli-and-doc-paths.- Strict database safety: Zero connections to QA MongoDB (
27017/stock) or QA PostgreSQL (5432/trading_bot).
1. Baseline Verification: M1 (d52aa20), T-127 & Option B Rust Architecture
| Baseline Item | Verified State on master |
Impact on M2 |
|---|---|---|
Accepted M1 (d52aa20bff3f5c259fb6e2bcfc2d3a78ad5224b1) |
Landed and intact: security-master & research SQL schemas (database/postgres/init/34-security-master.sql, 35-security-master-exchange-seed.sql, 36-trial-ledger.sql, 37-research-findings.sql), Rust Option B --from-mongo runners for all 6 M1 commands (tools/curate-etl/src/run_mongo.rs:1-100, mongo_stream.rs, mongo_safety.rs), and Python stockbot M1 SDK (python/stockbot/{__init__,calculations,data,ledger,signals,vault}.py). |
Solid foundation; M2 builds directly on these schemas, adapters, and ReadOnlyMongoClient. |
T-127 (Deferred M1 Equity Eligibility & Vault File Isolation) |
Explicitly accepted as deferred in backlog per settled director decision (d52aa20). |
Non-blocking for M2. Does not block EC-1, EC-2, or EC-3. |
Settled Rust ETL / data-pipeline Decision (Option B) |
Confirmed in design/data-pipeline/rust-migration-evaluation.md (including 2026-11-30 Addendum §§A.1–A.4): keep apps/stock/data-pipeline in TypeScript (42 files, 20,349 LOC) for security master Passes 1–6, TSV export, probes, and BullMQ/Hono; keep bulk curation in Rust tools/curate-etl (mongodb = "=3.10.2" sync RawDocumentBuf cursors). |
M2's 6 collections (qmFinancials, qmFinancials-old, ceoPosts, teData, eodIntraday1M, qmIntraday) still lack --from-mongo wiring in tools/curate-etl/src/mongo_stream.rs:53-62 (currently 8 M1 collections only). |
Post-T-204 Merges (T-190, T-205, T-206, T-207) |
All four verified landed: T-190 send-ilp (tools/curate-etl/src/{ilp_send,cli,main}.rs), T-205 desktop MCP stdio entrypoint (scripts/research-copilot-mcp.ts, package.json:56, scripts/test/research-copilot-mcp.test.ts), T-206 curate-qm-bars-1m (tools/curate-etl/src/{run_curate_qm_bars_1m,cli,main}.rs), and T-207 curate-macro (tools/curate-etl/src/{run_curate_macro,cli,main}.rs). |
Removes the T-204 desktop-launch and curate-qm-bars-1m CLI blockers. |
2. Verification Gate Evidence & Research Governance
2.1 Sandbox Local Fixture Runs (Programmer-Reported on feat/m2-audit, Including Loopback TCP — Zero External Network or QA DB Contact)
| Gate / Suite | Command | Exit | Observed Outcome & Counts |
|---|---|---|---|
| Typecheck | bun run typecheck |
0 |
PASS — 0 errors (tsc --project tsconfig.check.json --noEmit) |
| Contracts | bun run test:contracts |
0 |
PASS — 0 errors (tsc --project tsconfig.contracts.json --noEmit) |
| Lint | bun run lint:check |
0 |
PASS — 0 errors, 0 warnings (--max-warnings 0) |
| Utils | bun run test:utils |
0 |
PASS — 32 pass, 0 fail (59 expects, 3 files) |
| Calculations | bun run test:calculations |
0 |
PASS — 144 pass, 0 fail (76,602 expects, 12 files) |
| Native Rust | CARGO_BUILD_JOBS=2 bun run test:native |
0 |
PASS — 1,563 passed, 0 failed, 4 ignored across 58 suites (engine 150 passed + curate-etl unit & integration suites using local fixtures, including loopback TCP in tools/curate-etl/tests/cli.rs:1787 for send-ilp, plus binary tests in curate_qm_bars_1m.rs and curate_macro.rs, fundamentals_tests.rs, parquet_fundamentals_tests.rs, and run_curate_bars_1m_tests.rs) |
| Targeted M2 Suites | bun test scripts/test/research-copilot-mcp.test.ts scripts/test/security.test.ts libs/research/test/ libs/data/duckdb/test/ libs/data/questdb/test/ libs/data/postgres/test/research-copilot-executor.test.ts libs/data/postgres/test/research-copilot-executor-edge.test.ts |
0 |
PASS — 1,050 pass, 0 fail (80,699 expects, 65 files; includes 7/7 pass in scripts/test/research-copilot-mcp.test.ts, real-DuckDB fundamentalsAsOf restatement suite, and MCP Vault-fence suite) |
| Python SDK | python3 -m pytest python/tests |
1 |
SKIPPED (env) — /usr/bin/python3: No module named pytest in sandbox |
2.2 Audited Baseline, Studio Unsandboxed & Host-Only Verification Boundary
| Verification Layer | Command / Scope | Status | Notes |
|---|---|---|---|
Audited master Baseline Check |
git rev-parse master / git rev-parse dev |
Verified (d45014a1) |
Reviewer verified master and dev both at d45014a1f6dfc5ba5a73bcc0d6e57e486c2c7c52 with accepted M1 (d52aa20bff3f5c259fb6e2bcfc2d3a78ad5224b1) as an ancestor; feat/m2-audit review HEAD is tracked separately. |
| Studio Unsandboxed Runner (Audit Revision) | bun run build and bun --env-file=/home/boki/.studio/test-env/stock-bot.env test && CARGO_BUILD_JOBS=2 cargo test --workspace --lib --offline |
Authoritative post-handoff | Prior revision passed Studio build #1621 and test run #1622; Studio re-runs authoritatively on this revision covering workspace build, audit:secrets, worktree-git tooling tests (scripts/test/), integration tests, and isolated stock_bot_safety* PostgreSQL suites unreachable inside the sandbox. |
| Future Host M2 Closure Revision | git rev-parse master (at M2 closure), CARGO_BUILD_JOBS=2 bun run check, bun --env-file=/home/boki/.studio/test-env/stock-bot.env test test/postgres/ |
PENDING (host closure) | Future closure commit after M2 code tasks merge; required with retained logs in design/m2-close-evidence.md before M2 closure. |
quant (10.0.0.51) & Workstation Live Gates |
Read-only QA Mongo M2 field-shape probe, Quant Research-approved curate-macro --series-map, QuestDB 10.2.0 preflight (vm.max_map_count, nofile), bulk 3-feed intraday load + read-back reconciliation (eodIntraday1M, qmIntraday, CAD.FOREX), 0x10 TCP ILP v2 commit, observed NEXM.V/NVDA.US split check, 1y 1m PGWire latency, and desktop Claude Code + real marimo EC-1 receipt |
PENDING (host/quant) |
Tracked in m2-host-quant-verification-and-closure (with director replan flag in §4–§5). |
2.3 Research Governance & Replay / Financial Invariants Verified
- Economic owner & durable inputs: Quant data curation owns immutable Zstd Parquet partitions (
bars_1d,adj_factors,corporate_actions,events,shorts,fx_1d,fundamentals_pit,macro,features/<name>/v<version>) and published QuestDB ILP v2 shard files; Quant Research owns thecurate-macro--series-mapseries and lag-class selections (the approved TSV and its identifier must be retained with macro curation evidence); PostgreSQL owns append-onlytrial_ledger,vault_evaluations,findings, andprovider_caveats(database/postgres/init/36-trial-ledger.sql,37-research-findings.sql, protected byreject_research_evidence_mutation()). - Holdout Vault &
known_atboundaries: Verified bylibs/research/test/mcp-query-data.test.ts(rejectsscope/vault_evaluation_only, clamps bounds strictly< vaultCutoffTs, drops leaky post-cutoff rows) andopenResearchCopilotStore(libs/data/duckdb/src/research-copilot-store.ts:40, hardcodingvaultOperatorAuthorized: false). Open FX1mavailability gap:tools/curate-etl/src/run_curate_fx_1m.rs:24-26preserves bar-starttsandlibs/data/questdb/src/schema.ts:33-47definesfx_1mwithoutknown_at, so filtering ontsalone can leak an unclosed bar's close across a cutoff (director confirmation required in §4). - Baselines & single-source metrics:
@stock-bot/calculations(144/144tests passing) remains the sole authority for Sharpe/Sortino/IC/Newey-West/DSR/event-study/recency math;RET_1D_V1inlibs/research/src/feature-library.ts:29documents its zero-return comparison baseline and zero-cost assumption. - 2D PIT restatement & synthetic split-boundary conservation:
- Q1 restated after Q2 never overwrites Q2 and updates TTM: verified in Rust (
tools/curate-etl/src/fundamentals_tests.rs:104restatement_of_q1_after_q2_updates_q1_and_ttm_without_overwriting_q2,parquet_fundamentals_tests.rs:1107restatement_of_q1_after_q2_preserves_q2_on_disk_and_updates_ttm) and real-DuckDB TypeScript (libs/data/duckdb/test/duckdb-market-data-store.test.ts:251). NVDA.US(10:1) andNEXM.V(1:20) split-unadjustment conservation within0.5%: verified on synthetic fixtures (tools/curate-etl/src/run_curate_bars_1m_tests.rs:402split_boundary_nvda_and_nexm_match_raw_bars_1d_closes); observed comparison against retained rawbars_1dcloses remains open onquant.
- Q1 restated after Q2 never overwrites Q2 and updates TTM: verified in Rust (
- Database safety & execution boundary: Read-only MongoDB/PostgreSQL guards (
assertEnvironmentSafety(),MongoDBClientmongoReadOnly: true, Rustmongo_safety.rs+ sealedReadOnlyMongoClient) remain intact. Paper and live execution write access is strictly absent from all M2 MCP/research surfaces and remains out of scope until M5.
3. Milestone M2 Deliverables & Exit Criteria Matrix
3.1 Deliverables (design/MILESTONES.md lines 87–98)
| Deliverable | Status | Landed on master (Exact Paths, Symbols & Tests) |
Missing / Remaining Gaps |
|---|---|---|---|
| M2.1 MCP Server & Notebook Snapshots | Partial | - T-205 landed: Runnable stdio entrypoint runResearchCopilotMcp in scripts/research-copilot-mcp.ts:77, "mcp:research-copilot" in package.json:56, 7/7 tests in scripts/test/research-copilot-mcp.test.ts.- All 6 MCP tools ( search_symbols, query_data, analyze_signal, event_study, file_finding, read_knowledge) in libs/research/src/mcp/tools/ + createResearchCopilotMcpServer (libs/research/src/mcp/copilot-server.ts) + parseResearchCopilotHostConfig / runResearchCopilotStdioHost (libs/research/src/mcp/host/stdio-host.ts).- Real Postgres executor ( openResearchCopilotExecutor in libs/data/postgres/src/research-copilot-executor.ts) + real DuckDB store (openResearchCopilotStore in libs/data/duckdb/src/research-copilot-store.ts:33) + read-only library.yml card reader (libs/research/src/mcp/adapters/library-cards.ts) + database/postgres/init/37-research-findings.sql.- exportNotebookSnapshot & Node subprocess adapter (libs/research/src/notebook-snapshot.ts, libs/research/src/notebook-snapshot-node.ts:67, libs/research/test/notebook-snapshot*.test.ts). |
1. openResearchCopilotStore (libs/data/duckdb/src/research-copilot-store.ts:37) and stdio-host.ts:49-79 open DuckDB-only; optional RESEARCH_MCP_QUESTDB_* config + createRoutedMarketDataStore composition is missing.2. analyze_signal (libs/research/src/mcp/tools/analyze-signal.ts:121-123) supports only source: 'shorts' | 'fundamentals' (no source: 'feature' for versioned Feature Library signals).3. No runnable scripts/export-notebook-snapshot.ts / "notebook:snapshot" CLI wrapping @stock-bot/research/notebook-snapshot-node.4. No automated E2E stdio test covering search_symbols → query_data → analyze_signal → event_study (with ceo_post) → exportNotebookSnapshot → file_finding → read_knowledge.5. No apps/stock/web-api SSE wrapper (recommended deferred to M4; see §4). |
M2.2 PIT Fundamentals, ceoPosts & Lagged teData |
Partial | - File-mode Rust CLIs wired in tools/curate-etl/src/cli.rs & main.rs: curate-fundamentals (cli.rs:102,1636, run_curate_fundamentals.rs), curate-posts (cli.rs:101,1317, run_curate_posts.rs), and T-207 curate-macro (cli.rs:103,1689, run_curate_macro.rs; binary tests in tools/curate-etl/tests/curate_macro.rs:178 cli_publishes_runner_equivalent_macro_parquet_with_pit_lag_and_no_forecast_leakage, :471 cli_publishes_runner_equivalent_macro_parquet_and_excludes_forecast_sentinel, :709 cli_rerun_on_same_inputs_is_byte_deterministic).- Real-DuckDB fundamentalsAsOf (libs/research/src/market-data-store-duckdb.ts:2287, libs/data/duckdb/test/duckdb-market-data-store.test.ts:251).- 2D PIT restatement tests ( fundamentals_tests.rs:104, parquet_fundamentals_tests.rs:1107). |
1. ceoPosts event-kind & partition mismatch: EVENT_KIND_POST = "post" (tools/curate-etl/src/parquet_posts.rs:22) mismatches 'ceo_post' expected by market-data-store-duckdb.ts and python/stockbot/data.py:21; run_curate_posts.rs:133 fails with EventsDatasetExists when <out>/events exists from curate-events; both market-data-store-duckdb.ts:1448 and python/stockbot/data.py:71 glob only events/year=*/part.parquet instead of events/year=*/*.parquet.2. MarketDataStore.macroAsOf throws MarketDataStoreNotImplementedError (libs/research/src/market-data-store-duckdb.ts:2294-2296).3. CurateFundamentalsArgs (tools/curate-etl/src/run_curate_fundamentals.rs:113-118) accepts only a single --qm-financials path (no --qm-financials-old merge or --curate-inputs resolution).4. export-curate-inputs.ts:20-24 does not emit listing_venues.tsv (us_tsx / tsxv_cse).5. SourceCollection (mongo_stream.rs:53-62), RAW_BSON_EXPORT_COLLECTIONS (export-raw-bson.ts:11-20), and FIELD_SHAPE_PROBE_COLLECTIONS (source-field-shapes.ts:8-17) allowlist only the 8 M1 collections (missing qmFinancials, qmFinancials-old, ceoPosts, teData).6. python/stockbot/data.py lacks fundamentals_as_of and macro_as_of. |
M2.3 QuestDB 10.2.0 Intraday & send-ilp |
Partial | - T-190 landed: send-ilp multi-socket TCP sender (tools/curate-etl/src/ilp_send.rs, cli.rs:104,2461, main.rs:22, ilp_send_tests.rs; binary tests in tools/curate-etl/tests/cli.rs:1747 send_ilp_cli_help_missing_flag_success_and_partial_error_routing, :1877 send_ilp_cli_shard_gap_exits_without_partial_report_or_connect_and_bad_prefix_prints_usage, :1939 send_ilp_cli_ignores_questdb_env_vars_and_requires_explicit_addr).- T-206 landed: curate-qm-bars-1m CLI (tools/curate-etl/src/run_curate_qm_bars_1m.rs, cli.rs:99,2277, main.rs:39; binary tests in tools/curate-etl/tests/curate_qm_bars_1m.rs:336 curate_qm_bars_1m_binary_matches_direct_runner_bytes_report_and_invariants, :527 curate_qm_bars_1m_binary_refuses_overwrite_and_coexists_with_eod_bars_1m_shards, :622 curate_qm_bars_1m_binary_applies_date_effective_mapping_and_reports_dropped_unmapped) alongside curate-bars-1m (cli.rs:98,2110) and curate-fx-1m (cli.rs:100,2381).- QuestDB 10.2.0 query layer, ILP v2 writer, and opt-in M2_INTRADAY_SCHEMAS / getM2IntradayDDL() (libs/data/questdb/src/schema.ts:13-63,139, libs/data/questdb/test/).- Vault-fenced QuestDB bars('1m') reader (libs/research/src/market-data-store-questdb.ts) + createRoutedMarketDataStore (libs/research/src/market-data-store-routed.ts).- docker-compose.quant.yml:30-45 (nofile: 1048576, QDB_RAM_USAGE_LIMIT_BYTES=21474836480, mem_limit: 28g). |
1. fx({ timeframe: '1m' }) throws MarketDataStoreNotImplementedError in TS (libs/research/src/market-data-store-duckdb.ts:1529-1534, delegated unchanged by market-data-store-routed.ts:184-186) and NotImplementedError in Python (python/stockbot/data.py:258-259); market-data-store-questdb.ts reads bars_1m only (no fx_1m reader). Moreover, run_curate_fx_1m.rs:24-26 preserves bar-start ts and fx_1m (schema.ts:33-47) has no known_at column, so Vault fencing for both FX adapters requires a confirmed bar-close availability rule (see §4).2. getM2IntradayDDL() (libs/data/questdb/src/schema.ts:139) is pure/opt-in with no runnable initializer script/helper wired to apply it.3. No --from-mongo streaming in mongo_stream.rs / run_mongo.rs (and no allowlist entries in export-raw-bson.ts / source-field-shapes.ts) for eodIntraday1M (3.40B) or qmIntraday (173.3M).4. Live quant preflight (vm.max_map_count, nofile), 0x10 binary-double TCP ILP acceptance (ilp_send.rs:15-21), bulk load & PGWire read-back reconciliation of all three approved feeds (eodIntraday1M US 2003–2025, qmIntraday CA/US 2024–2025, CAD.FOREX 1m ~5.2M bars, including EOD/QM (ts, listing_id) overlap reconciliation), observed NEXM.V/NVDA.US split check, and 1y 1m PGWire latency benchmark are unverified. |
M2.4 Versioned Feature Library (D04 / D11) |
Partial | - Declarative DuckDB SQL feature definitions, immutable registerSignal, Vault-fenced yearly Zstd Parquet runFeatureBatch, and built-in RET_1D_V1 in libs/research/src/feature-library.ts (libs/research/test/feature-library.test.ts). |
1. MarketDataStore.crossSection throws MarketDataStoreNotImplementedError (libs/research/src/market-data-store-duckdb.ts:2283-2285), blocking read-back of features/<name>/v<version>/year=*/part.parquet.2. FEATURE_INPUT_DATASETS (libs/research/src/feature-library.ts:61-68) omits 'macro' and 'corporate_actions'.3. Python stockbot (python/stockbot/{__init__,data,signals}.py) lacks register_signal(...), batch feature materialization, and cross_section(...). |
3.2 Exit Criteria (design/MILESTONES.md lines 100–103)
| Exit Criterion | Status | Verified Evidence & Remaining Work |
|---|---|---|
EC-1: Desktop Claude Code via MCP executes a fundamental + alt-data signal study and event study end-to-end, exports a marimo check-clean static HTML snapshot, and files a finding. |
Partial | Landed: scripts/research-copilot-mcp.ts (mcp:research-copilot) + all 6 MCP tools + exportNotebookSnapshot.Missing: ceo_post event compatibility (m2-ceo-posts-events-compat), notebook:snapshot CLI + automated E2E stdio test (m2-ec1-snapshot-cli-and-doc-paths), and desktop Claude Code + real marimo session receipt (m2-host-quant-verification-and-closure). |
EC-2: Restatement fixture test proves a restated Q1 (known_at > Q2) never overwrites Q2 in fundamentalsAsOf. |
Done (Offline Rust + Real-DuckDB) | Proven offline in tools/curate-etl/src/fundamentals_tests.rs:104, tools/curate-etl/src/parquet_fundamentals_tests.rs:1107, and real-DuckDB libs/data/duckdb/test/duckdb-market-data-store.test.ts:251. Python fundamentals_as_of parity is tracked in m2-python-sdk-m2-parity. |
EC-3: Split-boundary test on NEXM.V (1:20) and NVDA.US (10:1) confirms bars_1m session closes match raw bars_1d closes within 0.5%, and 1y of 1m bars for one listing loads in < 250 ms warm / < 1 s cold. |
Partial (Synthetic Done; Live quant Missing) |
Done (synthetic): tools/curate-etl/src/run_curate_bars_1m_tests.rs:402 (split_boundary_nvda_and_nexm_match_raw_bars_1d_closes).Missing (live quant): Host/container vm.max_map_count/nofile preflight, getM2IntradayDDL() execution, QuestDB 10.2.0 0x10 TCP ILP v2 commit check, bulk 3-feed load & PGWire read-back reconciliation (eodIntraday1M, qmIntraday, CAD.FOREX + EOD/QM (ts, listing_id) overlap rule), observed NEXM.V + NVDA.US bars_1m vs. retained raw bars_1d close check (<= 0.5%), and pinned 1-year single-listing PGWire latency benchmark (< 250 ms warm / < 1 s cold). |
4. Concrete Blockers, Director Trade-Offs & Backlog Replan Flags
Confirm these seven items (4 design trade-offs + 3 operational/environment prerequisites) and the three backlog replan adjustments below before coding/closing M2:
4.1 Design Trade-Offs Requiring Director Confirmation
- Option B
--from-mongofor the 6 M2 collections vs..bsonstaging: Extendtools/curate-etlSourceCollection+run_mongo.rswith direct read-only MongoDB streaming forqmFinancials,qmFinancials-old,ceoPosts,teData,eodIntraday1M, andqmIntraday, or stay on.bsonstaging files for M2?- Recommended: Extend Option B
--from-mongoto all 6 M2 collections (m2-curate-etl-mongo-and-financials-old) so3.40BeodIntraday1Mrows never require~500–832 GiBof NVMe scratch space, while keeping file mode for offline tests.
- Recommended: Extend Option B
- MCP stdio-only for M2 vs.
web-apiSSE wrapper: Close M2 with the landed desktop stdio server (bun run mcp:research-copilot), or also add an HTTP/SSE wrapper insideapps/stock/web-apinow?- Recommended: Keep M2 stdio-only for desktop Claude Code (EC-1) and defer the network-isolated HTTP/SSE MCP endpoint to M4 containerized campaigns.
fundamentals_pit-only vs. physicalfundamentals_bitemporal/part.parquet: Keepcurate-fundamentalswriting pre-resolved 2D PIT snapshots (fundamentals_pit/year=YYYY/part.parquet), or also materialize a separate rawfundamentals_bitemporal/part.parquettable in M2?- Recommended: Keep
fundamentals_pit-only for M2 (DATA-CONTRACTS.md§3A and EC-2 both targetfundamentalsAsOfoverfundamentals_pit), and materializefundamentals_bitemporalonly if a downstream M3/M4 use case requires unflattened multi-period history.
- Recommended: Keep
fx_1mbar-close availability & Vault fencing rule (Unresolved — blocks both TS & Python FX adapters):tools/curate-etl/src/run_curate_fx_1m.rs:24-26preserves EODHD bar-starttsandlibs/data/questdb/src/schema.ts:33-47definesfx_1mwithout aknown_atcolumn. Filtering ontsalone can return a bar whose start is beforevaultCutoffTs(orasOf) while its close is at or after the cutoff, leaking an unobservable FX close.- Recommended: Enforce bar-close availability in both TypeScript (
m2-store-macro-cross-section-fx1m) and Python (m2-python-sdk-m2-parity) FX adapters (bar_close = ts + 60sstrictly< vaultCutoffTsand<= asOf), backed by a boundary fixture proving a bar spanning or ending atvaultCutoffTsis excluded — keeping thefx_1mschema unchanged. (Alternative: add aknown_atTIMESTAMPcolumn tofx_1mDDL + ILP writer set tots + 60s.)
- Recommended: Enforce bar-close availability in both TypeScript (
4.2 Operational & Environment Prerequisites
- Live read-only QA MongoDB M2 field-shape probe &
curate-macro--series-mapownership: Runprobe-source-field-shapes.tsread-only (studio_stock_bot_read@stock) oncem2-data-pipeline-m2-inputs-and-probesallowlists the 6 M2 collections, to confirm liveceoPostsnumeric timestamp unit (SecondsvsMillis),qmFinancials/qmFinancials-oldmetric paths, andteDatalabels before production curation. Quant Research owns theteDataseries selection and lag-class choices in the caller-supplied--series-mapTSV; retain the approved mapping TSV and its version/hash identifier alongside the macro curation evidence indesign/m2-close-evidence.md. quant(10.0.0.51) QuestDB10.2.0operator access: Required for sysctl (vm.max_map_count >= 1048576) & containernofile = 1048576preflight, applyinggetM2IntradayDDL(), verifying0x10binary-double TCP ILP v2 commits via PGWirewal_tables(), loading and reconciling all three approved intraday feeds (eodIntraday1M,qmIntraday,CAD.FOREX), running the observedNEXM.V/NVDA.USsplit check, and timing the 1-year1mPGWire latency gate.- Workstation
marimo+ desktop Claude Code setup: Required on the operator workstation withbun run mcp:research-copilot, Studiolibrary.yml, realmarimo, and isolated PostgreSQL to record the EC-1 sign-off receipt.
4.3 Substantive Backlog Replan Flags for Director (Before Merging Follow-Ups)
The approved 7-key implementation backlog has three gaps discovered during audit review that should be replanned within the existing keys before scheduling:
m2-store-macro-cross-section-fx1m&m2-python-sdk-m2-parity(FX1mavailability boundary): Add the confirmedfx_1mbar-close availability rule (item 4 above) and a boundary fixture in both TS and Python tests verifying bar-close observability and Vault exclusion for a minute bar spanning or ending atvaultCutoffTs.m2-ec1-snapshot-cli-and-doc-paths(missing prerequisite): Addm2-ceo-posts-events-compattodependsOn(currently onlym2-store-macro-cross-section-fx1m). Without it, the EC-1 integration task can start beforecurate-postsemits'ceo_post'and co-publishes alongsidecurate-events; require the E2E stdio test to consume co-publishedcurate-events+curate-postsfixture output soevent_studyproves it reaches the curated CEO post.m2-host-quant-verification-and-closure(bulk 3-feed intraday coverage & reconciliation): Add acceptance requiring retained bulk load and PGWire read-back evidence in QuestDB for all three approved feeds fromdesign/MILESTONES.md:96—eodIntraday1M(US equity 2003–2025),qmIntraday(CA/US equity 2024–2025), andCAD.FOREX1m(~5.2M bars) — recording source/date coverage, row counts, skipped/dropped counts, and the explicit reconciliation/precedence rule where EOD and QM share a(ts, listing_id)dedup key inbars_1m.
5. Ordered M2 Closure Backlog (7 Tasks)
Aligned 1-to-1 with the approved implementation backlog keys (with the three director replan flags marked inline):
| Order | Key | Task | Depends On | Primary Acceptance |
|---|---|---|---|---|
| 1 | m2-ceo-posts-events-compat |
M2.2u — Fix ceoPosts event kind ('ceo_post') and co-publish under <curatedRoot>/events |
(none) | EVENT_KIND_POST = "ceo_post"; non-clobbering events/year=YYYY/part-posts.parquet; TS (market-data-store-duckdb.ts) & Python (data.py) glob events/year=*/*.parquet verified in real-DuckDB combined filing/earnings/ceo_post test. |
| 2 | m2-store-macro-cross-section-fx1m |
M2.3s — Implement MarketDataStore.macroAsOf, crossSection, QuestDB fx('1m'), and copilot 1m routing |
(none) | Vault-fenced DuckDB macroAsOf & crossSection tests; QuestDB fx_1m reader + createRoutedMarketDataStore fx('1m') routing + getM2IntradayDDL() initializer; optional RESEARCH_MCP_QUESTDB_* in stdio-host.ts/openResearchCopilotStore; analyze_signal source: 'feature' + FEATURE_INPUT_DATASETS ('macro', 'corporate_actions'). [Director replan §4.3: confirm fx_1m bar-close availability rule + add cutoff-spanning/ending boundary fixture.] |
| 3 | m2-data-pipeline-m2-inputs-and-probes |
M2.2v — Export listing_venues.tsv and extend field-shape probe & BSON fixture exporter for M2 collections |
(none) | Atomic listing_venues.tsv (us_tsx / tsxv_cse) in export-curate-inputs.ts; all 14 M1+M2 collections allowlisted in source-field-shapes.ts & export-raw-bson.ts with mongoReadOnly: true. |
| 4 | m2-curate-etl-mongo-and-financials-old |
M2.3t — Add --qm-financials-old merge and Option B --from-mongo streaming for M2 collections in curate-etl |
m2-ceo-posts-events-compat, m2-data-pipeline-m2-inputs-and-probes |
curate-fundamentals --qm-financials-old + --curate-inputs; sealed read-only --from-mongo streaming for all 6 M2 collections with byte-identical offline parity tests and zero new crates. |
| 5 | m2-python-sdk-m2-parity |
M2.4b — Add Python stockbot register_signal, batch feature runner, and M2 MarketDataStore methods |
m2-ceo-posts-events-compat, m2-store-macro-cross-section-fx1m |
Vault-fenced fundamentals_as_of, macro_as_of, cross_section, optional QuestDB 1m bars/fx, and register_signal(...) writing contract Zstd Parquet readable identically by TS and Python. [Director replan §4.3: enforce confirmed fx_1m bar-close availability rule + cutoff-spanning/ending boundary fixture.] |
| 6 | m2-ec1-snapshot-cli-and-doc-paths |
M2.1w — Add notebook snapshot CLI, MCP E2E study+snapshot+finding test, and fix docs/ → design/ path drift |
m2-store-macro-cross-section-fx1m, m2-ceo-posts-events-compat (replan §4.3) |
Fail-closed scripts/export-notebook-snapshot.ts ("notebook:snapshot"); E2E stdio MCP test (search_symbols → file_finding + snapshot) consuming co-published curate-events + curate-posts fixture output so event_study reaches the curated ceo_post; docs/*.md → design/*.md updated in AGENTS.md, CLAUDE.md, README.md, studio.config.json, tools/curate-etl/README.md. |
| 7 | m2-host-quant-verification-and-closure |
M2.5 — Execute host/quant M2 preflight, bulk 3-feed intraday load, observed split-boundary & latency checks, and desktop Claude Code EC-1 sign-off |
m2-curate-etl-mongo-and-financials-old, m2-python-sdk-m2-parity, m2-ec1-snapshot-cli-and-doc-paths |
Retained host git rev-parse master, CARGO_BUILD_JOBS=2 bun run check + test/postgres/ + live read-only M2 probe + Quant Research-approved curate-macro --series-map TSV/ID + quant QuestDB 10.2.0 preflight/0x10 ILP/observed NEXM.V & NVDA.US split/latency checks + desktop Claude Code EC-1 receipt in design/m2-close-evidence.md, marking M2 closed in design/MILESTONES.md. [Director replan §4.3: require retained bulk load + PGWire read-back reconciliation for EOD equity, QM equity, and CAD.FOREX FX — source/date coverage, row counts, skips, and EOD/QM (ts, listing_id) overlap precedence rule.] |