T-203: Audit M2 exit criteria on master against docs/MILESTONES.md
This commit is contained in:
parent
19f9bb1e4a
commit
6829a94d5f
1 changed files with 107 additions and 0 deletions
107
design/m2-gap-audit.md
Normal file
107
design/m2-gap-audit.md
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# Milestone M2 Gap Audit Report (T-203)
|
||||
|
||||
**Verdict:** **OPEN — M2 is not ready for closure.** All sandbox-safe code quality, contract, native Rust, and real-DuckDB fixture gates pass on the checked-out workspace, and core M2 libraries (`curate-macro`, `send-ilp`, MCP server/adapters, `fundamentalsAsOf`, QuestDB `10.2.0` primitives, and TS Feature Library) are present. However, six concrete code/wiring gaps remain (led by the missing desktop MCP entry point and a `ceo_post` vs `post` event-kind mismatch), and all host-only `quant` / desktop / full-check closure gates remain pending.
|
||||
|
||||
> **Scope & Provenance Notes:**
|
||||
> - Milestone and contract documents live under `design/` (`design/MILESTONES.md`, `design/DATA-CONTRACTS.md`, `design/PLATFORM-PLAN.md`), not `docs/`.
|
||||
> - Exact `master` SHA and `studio/auto-*` branch checks could not run inside the sandbox because worktree `.git` metadata lives outside the sandbox boundary; those checks are recorded under **Manual Host-Only Closure Gates**.
|
||||
> - Per settled director decision, **T-127** (M1 equity eligibility / Vault file isolation) stays deferred in the backlog and does not block M2.
|
||||
> - Project CI is off; no CI workflows were planned, added, or modified.
|
||||
|
||||
---
|
||||
|
||||
## 1. Sandbox-Safe Verification Gate Results
|
||||
|
||||
Executed directly against the checked-out worktree:
|
||||
|
||||
| Gate / Suite | Command | Exit Code | Result |
|
||||
| --- | --- | --- | --- |
|
||||
| Typecheck | `bun run typecheck` | `0` | **PASS** (0 errors) |
|
||||
| Contracts | `bun run test:contracts` | `0` | **PASS** (0 errors) |
|
||||
| Lint | `bun run lint:check` | `0` | **PASS** (0 errors, 0 warnings) |
|
||||
| Native Rust | `CARGO_BUILD_JOBS=2 bun run test:native` | `0` | **PASS** (`1,548` passed, `0` failed, `4` ignored across `57` suites) |
|
||||
| Real-DuckDB M2 Fixtures | `bun test libs/data/duckdb/test/` | `0` | **PASS** (`25` pass, `0` fail across `4` files; includes Exit 2 restatement fixture & `openResearchCopilotStore`) |
|
||||
| Research + QuestDB + Copilot Executor | `bun test libs/research/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** (`999` pass, `0` fail across `59` files) |
|
||||
| Exit 3 Split-Boundary Fixture | `CARGO_BUILD_JOBS=2 cargo test -p curate-etl --offline split_boundary_nvda_and_nexm_match_raw_bars_1d_closes` | `0` | **PASS** (`1` passed, `0` failed) |
|
||||
| Utils | `bun run test:utils` | `0` | **PASS** (`32` pass, `0` fail across `3` files) |
|
||||
| Calculations | `bun run test:calculations` | `0` | **PASS** (`144` pass, `0` fail across `12` files) |
|
||||
|
||||
---
|
||||
|
||||
## 2. Verified on `master`
|
||||
|
||||
- **PASS · MCP Copilot Libraries & Snapshot Exporter.**
|
||||
- `libs/research/src/mcp/copilot-server.ts` exposes all six M2 tools (`search_symbols`, `query_data`, `analyze_signal`, `event_study`, `file_finding`, `read_knowledge`).
|
||||
- `libs/research/src/mcp/adapters/postgres-copilot.ts` (`createPostgresResearchCopilotServer`) wires the read-only Studio library reader, PostgreSQL findings/caveats, trial lookup, and exchange calendars.
|
||||
- `openResearchCopilotStore` (`libs/data/duckdb/src/research-copilot-store.ts`, T-184) and `openResearchCopilotExecutor` (`libs/data/postgres/src/research-copilot-executor.ts`, T-189/T-200) are exported and tested.
|
||||
- `exportNotebookSnapshot` (`libs/research/src/notebook-snapshot.ts`) and its Node/Bun adapters (`libs/research/src/notebook-snapshot-node.ts`) implement the `marimo check` → static HTML export sequence.
|
||||
- **PASS · `tools/curate-etl` CLI Subcommands.**
|
||||
- `tools/curate-etl/src/cli.rs` and `tools/curate-etl/src/main.rs` wire `curate-bars-1d`, `curate-adj-factors`, `curate-corporate-actions`, `curate-fx-1d`, `curate-shorts`, `curate-events`, `curate-bars-1m`, `curate-fx-1m`, `curate-posts`, `curate-fundamentals`, `curate-macro`, and `send-ilp`.
|
||||
- `curate-macro` (T-194/T-202) connects `run_curate_macro` to `curate_and_write_macro`; `send-ilp` (T-190) connects `run_send_ilp` to shard discovery and one TCP connection per shard. Both pass offline native tests.
|
||||
- **PASS · Exit 2 (PIT Restatement) & Exit 3 (Split-Boundary) Fixtures.**
|
||||
- `tools/curate-etl/src/fundamentals.rs` builds deduplicated 2D PIT snapshots and 4-quarter TTM with venue lag provenance.
|
||||
- `libs/data/duckdb/test/duckdb-market-data-store.test.ts` passes the real-DuckDB `fundamentalsAsOf` restatement fixture proving a restated Q1 (`known_at > Q2`) never overwrites Q2.
|
||||
- `tools/curate-etl/src/run_curate_bars_1m_tests.rs` passes `split_boundary_nvda_and_nexm_match_raw_bars_1d_closes` with the `0.5%` threshold and negative controls.
|
||||
- **PASS · QuestDB `10.2.0` Primitives & TS Feature Library.**
|
||||
- `docker-compose.yml`, `docker-compose.dev.yml`, and `docker-compose.prod.yml` pin `questdb/questdb:10.2.0`.
|
||||
- `libs/data/questdb/src/{schema,client,query-builder,ilp-v2-writer}.ts` provide monthly WAL DDL (`M2_INTRADAY_SCHEMAS`, `getM2IntradayDDL`), parameterized PGWire, `LATEST ON`, and the ILP v2 binary batch writer.
|
||||
- `libs/research/src/feature-library.ts` implements `registerSignal`, `runFeatureBatch`, and Zstd Parquet writing for versioned DuckDB SQL features.
|
||||
|
||||
---
|
||||
|
||||
## 3. Remaining M2 Code Gaps
|
||||
|
||||
1. **FAIL · Desktop MCP Entry Point & Exit 1 Wiring**
|
||||
- T-196 target `scripts/research-copilot-mcp.ts` and root `package.json` script `mcp:research-copilot` are absent.
|
||||
- `runResearchCopilotStdioHost` (`libs/research/src/mcp/host/stdio-host.ts`) still requires caller-injected store/executor factories rather than a runnable default entrypoint.
|
||||
- `apps/stock/web-api/src/` has no MCP/SSE route.
|
||||
- Impact: Desktop Claude Code cannot yet launch the copilot end-to-end to satisfy M2 Exit Criterion 1.
|
||||
|
||||
2. **FAIL · `ceoPosts` Event-Kind & Output-Root Interoperability**
|
||||
- `tools/curate-etl/src/parquet_posts.rs` emits `EVENT_KIND_POST = "post"`, whereas `libs/research/src/market-data-store.ts` (`EventKind`), `libs/research/src/market-data-store-duckdb.ts` (`EVENT_KINDS`), `libs/research/src/mcp/tools/event-study.ts`, and `python/stockbot/data.py` (`EventKind`) all expect `"ceo_post"`.
|
||||
- `tools/curate-etl/src/run_curate_posts.rs` writes `<out_dir>/events/year=YYYY/part.parquet` and fails closed (`RunCuratePostsError::EventsDatasetExists`) if `<out_dir>/events` already has `year=*` partitions from `curate-events`, while the copilot store takes a single curated root.
|
||||
- Impact: Published `ceoPosts` cannot be queried alongside filings and earnings through the DuckDB store or MCP `event_study` as shipped.
|
||||
|
||||
3. **PARTIAL · Fundamentals & Macro Contract Gaps**
|
||||
- `build_fundamentals_rows` (`tools/curate-etl/src/fundamentals.rs`) links filings using listing/fiscal-class plus report-date or filing-window heuristics because sampled filings lack statement period, whereas `design/DATA-CONTRACTS.md` specifies a direct period-end join.
|
||||
- `run_curate_fundamentals` (`tools/curate-etl/src/run_curate_fundamentals.rs`) takes one caller-prepared financials BSON dump and requires `listing_venues.tsv`, which `exportCurateInputs` (`apps/stock/data-pipeline/src/security-master/export-curate-inputs.ts`) does not emit. No physical `fundamentals_bitemporal` writer or `eodFinancialsOLD` backfill path exists.
|
||||
- `createDuckDbMarketDataStore().macroAsOf` (`libs/research/src/market-data-store-duckdb.ts:2294`) still rejects with `MarketDataStoreNotImplementedError`, so curated `teData` Parquet (`macro/part.parquet`) has no DuckDB reader.
|
||||
|
||||
4. **PARTIAL · Intraday Operating Path**
|
||||
- `run_curate_qm_bars_1m` (`tools/curate-etl/src/run_curate_qm_bars_1m.rs`) is implemented as a library function but has no binary subcommand dispatch in `tools/curate-etl/src/{cli,main}.rs`.
|
||||
- `curate-bars-1m` and `curate-fx-1m` operate in file-mode BSON only (no `--from-mongo` streaming).
|
||||
- `tools/curate-etl/src/bars_1m.rs` applies fixed Eastern session tags (venue/date overrides exist in close validation, not curation), and loaders stamp caller-supplied `--known-at-micros` whose historical availability semantics must be defined before as-of studies.
|
||||
|
||||
5. **PARTIAL · QuestDB Startup Wiring & FX Schema Alignment**
|
||||
- `getM2IntradayDDL` (`libs/data/questdb/src/schema.ts:139`) is opt-in with no checked-in startup caller applying it.
|
||||
- `QuestDBClient` (`libs/data/questdb/src/client.ts:232`) still instantiates legacy `QuestDBInfluxWriter` (`libs/data/questdb/src/influx-writer.ts`).
|
||||
- `createRoutedMarketDataStore` (`libs/research/src/market-data-store-routed.ts`) routes equity `1m` bars to QuestDB, but `fx()` delegates to the daily store rather than QuestDB `fx_1m`.
|
||||
- `M2_INTRADAY_SCHEMAS.fx_1m` matches `design/DATA-CONTRACTS.md` (`DEDUP UPSERT KEYS(ts, pair)`), while `design/MILESTONES.md:96` wording can be read as `(ts, listing_id)` for both `bars_1m` and `fx_1m`.
|
||||
|
||||
6. **PARTIAL · Feature Library & Documentation Drift**
|
||||
- `python/stockbot/__init__.py` and `python/stockbot/signals.py` do not expose `register_signal(...)` (only TS `libs/research/src/feature-library.ts` has `registerSignal`).
|
||||
- `createDuckDbMarketDataStore().crossSection` (`libs/research/src/market-data-store-duckdb.ts:2283`) still rejects with `MarketDataStoreNotImplementedError`.
|
||||
- `tools/curate-etl/README.md` still describes landed `curate-fundamentals` and `curate-macro` CLI wiring as deferred/follow-up in older stage sections (e.g., lines 1697, 1744, 1752, 1836, 1859).
|
||||
- `AGENTS.md` and `studio.config.json` still reference `docs/` paths instead of `design/`.
|
||||
- `design/MILESTONES.md:97` labels the Feature Library `D04` reopened, whereas `design/PLATFORM-PLAN.md` assigns the `register_signal` promotion bridge to `D11`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Manual Host-Only Closure Gates
|
||||
|
||||
These checks cannot run inside the sandbox and must be executed on the host / `quant` before closing M2:
|
||||
|
||||
1. **Host Git Revision, Unmerged Branches & Full Check Gate**
|
||||
- Record the exact audited `master` SHA and inspect `studio/auto-*` branches for any unmerged M2 commits (in particular T-196 desktop MCP wiring).
|
||||
- Run `CARGO_BUILD_JOBS=2 bun run check` outside the sandbox (covering `build`, `audit:secrets`, worktree-git tooling tests, and `stock_bot_safety*` PostgreSQL suites via `/home/boki/.studio/test-env/stock-bot.env`).
|
||||
- Never mutate QA MongoDB (`localhost:27017/stock`) or QA PostgreSQL (`localhost:5432/trading_bot`).
|
||||
|
||||
2. **Desktop Claude Code End-to-End Verification (Exit 1)**
|
||||
- After runnable MCP entry-point wiring lands, connect desktop Claude Code against the read-only Studio library (`~/repos/studio/catalog/quant/library/library.yml`) and isolated PostgreSQL.
|
||||
- Exercise all six MCP tools: run a PIT fundamentals + alt-data signal study and an event study, verify actual `marimo check`-clean static HTML export, and retrieve the filed finding with its trial and artifact references.
|
||||
|
||||
3. **Live `quant` QuestDB `10.2.0` Load & Latency Verification (Exit 3)**
|
||||
- Verify on `quant`: QuestDB `10.2.0` image, `vm.max_map_count >= 1048576`, container `ulimits.nofile = 1048576`, memory limits, and pre-created `PARTITION BY MONTH` WAL tables with documented dedup keys (`(ts, listing_id)` for `bars_1m`, `(ts, pair)` for `fx_1m`).
|
||||
- Run `send-ilp` for `bars_1m`, `bars_1m_qm`, and `fx_1m`; reconcile source counts vs. QuestDB PGWire row counts and WAL state (TCP `send-ilp` success confirms socket delivery only, not committed rows), and verify overlapping EOD/QM bar dedup and repeat-load idempotency.
|
||||
- Compare `NEXM.V` (`1:20`) and `NVDA.US` (`10:1`) split-boundary `bars_1m` session closes against independently sourced raw `bars_1d` closes (`<= 0.5%`).
|
||||
- Benchmark a pinned 1-year single-listing `1m` read through the real consumer at **`< 250 ms` warm / `< 1 s` cold**, recording listing ID, date range, row count, elapsed times, and cache conditions.
|
||||
Loading…
Add table
Add a link
Reference in a new issue