16 KiB
Milestone M2 Closure Evidence (T-215)
Host, read-only QA MongoDB, quant (10.0.0.51) QuestDB 10.2.0, and desktop Claude Code EC-1 verification evidence closing Milestone M2 (M2.5 / T-215).
- Date:
2026-12-06 - Audited
master/devbase SHA:87ae19e5f955c55b3ad411d3380c7e673a2ac533 - Closure branch:
feat/m2-5-execute-host-quant - Safety boundary: Zero writes to QA MongoDB (
27017/stock, queried strictly read-only asstudio_stock_bot_read) and zero writes to QA PostgreSQL (5432/trading_bot; all PostgreSQL tests and EC-1 sign-off ran against disposable schemas instock_bot_safetyvia/home/boki/.studio/test-env/stock-bot.env).quantQuestDB verification ran in an isolated container (stock-bot-m2-questdb) on dedicated ports (19000/18812/19009) and storage (/mnt/data/stockbot/m2-isolated/questdb-v2).
1. Host Build & Full Test Verification
Final post-edit host verification on feat/m2-5-execute-host-quant:
| Gate / Command | Result | Details |
|---|---|---|
CARGO_BUILD_JOBS=2 bun run check |
PASS | All 10/10 gates passed (2m18s, 0 errors, 0 warnings): audit:secrets, build (29/29 Turbo packages), typecheck, test:contracts, test:tooling (352 pass), test:utils (32 pass), test:calculations (144 pass), test:integration (1,494 pass), test:native (150 engine + 1,023 curate-etl lib + all integration targets, 0 failed), lint:check (--max-warnings 0) |
bun --env-file=/home/boki/.studio/test-env/stock-bot.env test test/postgres/ |
PASS | 184 pass, 0 fail, 2,352 expect() calls across 24 files (109.34s, isolated schemas in stock_bot_safety) |
python/.venv/bin/pytest python/tests |
PASS | 28 passed (1.59s) |
(All EC-2 restatement non-overwrite fixtures pass inside curate-etl Rust tests, DuckDB MarketDataStore tests, and Python stockbot tests.)
2. Read-Only QA MongoDB M2 Field-Shape Probe & Live-Corpus Findings
2.1 Field-Shape Probe & Retained Artifacts
- Command:
bun --env-file=.env.dev run apps/stock/data-pipeline/src/security-master/probe-source-field-shapes.ts --collections ceoPosts,eodIntraday1M,qmFinancials,qmFinancials-old,qmIntraday,teData --limit 1000 - Connection: Read-only (
readOnly: true,studio_stock_bot_read@stockon27017/stock),6collections /6,000sampled documents. - Committed probe report: m2-source-field-shapes.md (
sha256: 832cb8ff1c8aed67ca5061fb0f9335f292f3f625ecf397730c8274696e00b4ea), verified byte-identical (diffexit0) to the live probe output. - Committed macro series map: m2-macro-series-map.tsv (
sha256: 7b99bfac0b42113653adabd4703e4fb9c73ff58178c86c0fd9774359527abbb0), mapping 6 conflict-free US+CA monthly/quarterly series (CPI YOY,USURTOT,GDP CQOQ,CACPIYOY,CANLXEMR,CGE9QOQ).curate-etl curate-macro --from-mongostreamed all14,794liveteDatadocuments into4,901curated Parquet rows (30,033bytes) with zero conflicts or forecast leakage.
2.2 Live QA Corpus Document Counts
Verified identically on local 27017/stock and quant 10.0.0.51:27017/stock via studio_stock_bot_read:
| Collection | Live Document Count | Notes |
|---|---|---|
eodIntraday1M |
3,402,612,960 |
Includes 5,202,056 CAD.FOREX 1m rows (2009-09-25..2025-07-28) |
qmIntraday |
173,281,224 |
Raw US + CA intraday (2024–2025) |
qmFinancials |
1,864,342 |
Contains Apple-duplication ingestion defect on non-Apple symbols (see §2.3) |
qmFinancials-old |
907,764 |
Distinct issuer-specific statements; reportDate acts as periodEndDate |
ceoPosts |
14,779,267 |
Curated with bot == "1" separation and edited timestamp guard |
teData |
14,794 |
Macro regime series (4,901 curated rows across 6 conflict-free US+CA series) |
2.3 Empirical Live-Corpus Findings & Code/Contract Remediations
eodIntraday1MOHLCV is already raw (unadjusted) across US splits: Audited across 7/7 major US forward & reverse splits (2014–2024:AAPL.US7:1&4:1,GE.US1:8,AMZN.US20:1,GOOGL.US20:1,CMG.US50:1,AVGO.US10:1) and 24/25 audited2018–2025splits (CSAN.US2021-05-10was the lone split-adjusted outlier). Furthermore,eodIntraday1MlacksNVDA.US,MSFT.US,TSLA.US, andWMT.US, and itsNEXM.V(33rows at~$24.25) is a corrupt ticker collision rather than a1:20split adjustment.- Remediation: Defaulted
tools/curate-etlcurate-bars-1mto--split-mode raw(retaining--split-mode unadjustwhen un-adjustment is explicitly requested), updated DATA-CONTRACTS.md §1 and CLAUDE.md invariant 3, and enforcedqm_rawwrite-after-EOD precedence in QuestDB (DEDUP UPSERT KEYS(ts, listing_id)).
- Remediation: Defaulted
qmIntradaydate gaps around split ex-dates: LiveqmIntradayhas ingestion gaps2024-05-22..2024-06-30forNVDA(51,822docs) and2025-06-18..2025-06-24forNEXM:CA(4,766docs).- Remediation: Extended
scripts/verify-m2-quant.tswith validated split-straddling window flags (--nvda-from/--nvda-to,--nexm-from/--nexm-to) and optional extra EOD split-case flags (--eod-split-*), verified with24/24unit tests.
- Remediation: Extended
qmFinancialsApple-duplication defect vsqmFinancials-old:qmFinancialsstamps Apple's financial figures (2011-12-31revenue$46.333B/ net income$13.064B,2025-03-29revenue$95.359B,currency="USD") onto unrelated tickers (BMO:CA,RY:CA,SHOP:CA,CNQ:CA,X:CA).qmFinancials-oldcarries distinct issuer-specific figures.- Remediation: Documented in DATA-CONTRACTS.md §1 and CLAUDE.md; EC-1
fundamentals_pitwas curated from issuer-specificqmFinancials-old.
- Remediation: Documented in DATA-CONTRACTS.md §1 and CLAUDE.md; EC-1
teDataintra-month policy-rate bucketing: Daily policy-rate series (FDTR,CCLR) bucket multiple intra-month rate changes ontoYYYY-MM-01, creating conflicting duplicate period dates.- Remediation: Scoped m2-macro-series-map.tsv to the 6 conflict-free monthly/quarterly US+CA series (
CPI YOY,USURTOT,GDP CQOQ,CACPIYOY,CANLXEMR,CGE9QOQ).
- Remediation: Scoped m2-macro-series-map.tsv to the 6 conflict-free monthly/quarterly US+CA series (
3. quant (10.0.0.51) QuestDB 10.2.0 Verification
3.1 Host Kernel & Isolated Container Preflight
- Host kernel:
sysctl -n vm.max_map_count→1048576(>= 1048576). - Container:
stock-bot-m2-questdbrunningQuestDB 10.2.0(JDK25.0.2, commit14d560b27e6911828f7315496e90d0209aec8831),--ulimit nofile=1048576:1048576,--memory 28g,--cpus 12,QDB_RAM_USAGE_LIMIT_BYTES=21474836480,JAVA_OPTS=-Xms2g -Xmx4g, ports10.0.0.51:19000(HTTP),10.0.0.51:18812(PGWire),10.0.0.51:19009(ILP TCP), volume/mnt/data/stockbot/m2-isolated/questdb-v2. - DDL preflight (
scripts/verify-m2-quant.ts --ddl-only):ok: true; appliedgetM2IntradayDDL()tablesbars_1m,fx_1m,bar_revisions; allsuspended: false(writerTxn: 0,sequencerTxn: 0).
3.2 curate-etl --from-mongo + send-ilp (0x10 Binary-Double) Load & Idempotent Resend
Curated directly from quant MongoDB (studio_stock_bot_read@stock) using the release curate-etl binary (11.7 s total across 3 feeds) and streamed to 10.0.0.51:19009 via curate-etl send-ilp:
| Feed / Prefix | Window & Universe | Curated Rows | Size / Curate Time | Send Time | Post-Dedup Retained Rows |
|---|---|---|---|---|---|
bars_1m (eod_unadj, raw) |
2024-02-01..2025-02-13 (AAPL.US, AVGO.US, CMG.US) |
611,630 |
110.6 MB / 1.09 s |
0.37 s |
490,618 |
bars_1m_qm (qm_raw) |
2024-05-15..2025-07-02 (AAPL, AVGO, CMG, NVDA, NEXM:CA) |
250,622 |
44.5 MB / 0.53 s |
0.13 s |
250,622 |
fx_1m (USDCAD / eod) |
2009-09-25..2025-07-28 (all CAD.FOREX) |
5,202,056 |
577.4 MB / 10.06 s |
1.86 s |
5,202,056 |
- Deduplication & Precedence (
DEDUP UPSERT KEYS(ts, listing_id)):121,012real(ts, listing_id)overlaps betweeneod_unadjandqm_raw;qm_rawwon 100% of overlaps (611,630 - 121,012 = 490,618eod_unadj+250,622qm_raw=741,240totalbars_1mrows). - Binary-double
0x10round-trip probes (absDiff = 0on all 4):bars_1m(listing_id=10970,ts_us=1709293140000000):eod_unadj, close1312.19,absDiff = 0.bars_1m_qm(listing_id=10970,ts_us=1750870560000000):qm_raw, close264.94,absDiff = 0.fx_1m(pair=USDCAD,ts_us=1253836800000000):eod, close0.9176,absDiff = 0.dedup_overlap(listing_id=11806,ts_us=1728055620000000):qm_raw, close56.66,absDiff = 0.
- Table content digests (Pass 1 & Pass 2 identical):
bars_1m:ac7d2566a2b6cb3c4e2c7dcdfbb76052f722b833aa5e5bc70ee92808b1a16a61fx_1m:0352cfc3f7619696c6c2a36ccd38b00a191b7acf4c595527ab88a9befabd418b
- Pass 2 Idempotent Resend (
--resend-baseline):ok: true,resendVerification.ok: true, WAL advanced (bars_1m4 → 5,bars_1m_qm5 → 8,fx_1m11 → 21, livebars_1m=8/fx_1m=22,suspended: false),shardHashesMatched: true,bars1mRowCountsUnchanged: true,fx1mRowCountsUnchanged: true,bars1mContentDigestMatched: true,fx1mContentDigestMatched: true.
3.3 Split-Boundary Parity (bars_1m Session Closes vs Raw bars_1d, Threshold <= 0.5%)
| Listing | Split & Ex-Date | Source | Window | Pre / Post Sessions | Max Rel Diff | Sample Session Closes (1m vs 1d) |
|---|---|---|---|---|---|---|
NVDA.US (20815) |
10:1 (2024-06-10) |
qm_raw |
2024-05-20..2024-07-02 |
2 / 2 |
0.0965% |
Pre: 948.34/947.80, 953.51/953.86; Post: 124.18/124.30, 122.66/122.67 |
NEXM.V (50044) |
1:20 (2025-06-20) |
qm_raw |
2025-06-17..2025-06-27 |
1 / 3 |
0.0000% |
Pre: 0.405/0.405; Post: 9.52/9.52, 9.80/9.80, 10.20/10.20 |
AVGO.US (10970) |
10:1 (2024-07-15) |
eod_unadj (raw) |
2024-07-11..2024-07-17 |
2 / 3 |
0.0408% |
Pre: 1706.49/1705.95, 1700.87/1700.67; Post: 171.49/171.42, 169.40/169.375, 155.96/155.98 |
All three split boundaries passed well under the 0.5% (0.005) EC-3 gate.
3.4 1-Year 1m PGWire Latency (< 250 ms Warm / < 1,000 ms Cold)
Target: CMG.US (listingId: 11806), window 2024-02-01..2025-02-05 (371 days, 137,382 bars), Vault-fenced (vaultCutoffTs = 2025-02-13T00:00:00.000Z, clampedTo: false), result digest 32502098586198f10c717fa2f1c82aeb78fa0f15a6627cba1ce16b8ed5dd54f2:
| Run | Cold Latency (< 1,000 ms) |
Warm Runs (5×, < 250 ms) |
Warm Median | Status |
|---|---|---|---|---|
| Pass 1 | 291.65 ms |
168.86, 133.32, 128.74, 126.16, 122.22 ms |
128.74 ms |
PASS |
| Pass 2 (post-resend) | 207.88 ms |
141.47, 124.60, 127.94, 123.67, 132.47 ms |
127.94 ms |
PASS |
4. Desktop Claude Code EC-1 Sign-Off (mcp:research-copilot + Real marimo)
4.1 Real-Runtime Bugs Caught & Fixed During Sign-Off
Running real desktop Claude Code (2.1.84) exposed two integration defects not covered by mock handshakes, both fixed and unit-tested on this branch:
- MCP
initializeclientInfoschema (libs/research/src/mcp/protocol.ts): Strict object validation rejected optional MCPImplementationfields (title,description,websiteUrl) sent by Claude Code2.1.84. UpdatedclientInfoschema to accept optional spec fields with.passthrough()and added regression coverage inlibs/research/test/mcp-protocol.test.ts. - PostgreSQL
postgresSchemasearch_path(libs/data/postgres/src/research-copilot-executor.ts):openResearchCopilotExecutordid not applyconfig.postgresSchematopoolConfig.options(-c search_path=<schema>,public), causingtrial_ledgerwrites/DSR reads to fail against non-publicschemas. Added validatedpostgresSchemahandling and unit tests inlibs/data/postgres/test/research-copilot-executor.test.ts.
4.2 End-to-End Sign-Off Receipt
- Client: Desktop Claude Code
2.1.84(session5303dcf3-28d9-4e9f-9f90-e110f9ffdccb,--strict-mcp-config,12turns,70.6 s). - Server:
bun run mcp:research-copilotconnected to:- Curated live Parquet corpus (
12XTSE listings,fundamentals_pit772rows fromqmFinancials-old,shortsfromceoShorts,events5,002ceo_postrows inyear=2024/2025,macro4,901rows fromteData, Vault cutoff2025-02-13T00:00:00.000Z). - Real Studio quant library (
/home/boki/repos/studio/catalog/quant/library). - Disposable PostgreSQL schema
m2_ec1_signoffinstock_bot_safety. - Real
marimo 0.26.0viabun run notebook:snapshot.
- Curated live Parquet corpus (
- Zero execution access: Exactly
6MCP tools exposed (search_symbols,read_knowledge,query_data,analyze_signal,event_study,file_finding);paperOrLiveOrderOrExecutionTools: [],zeroExecutionAccess.confirmed: true. - Discovery, Knowledge & Vault Fence:
search_symbols("RY", country="CA"): returnedlistingId=5024(Royal Bank of Canada,XTSE,CAD).read_knowledge: returned9Studiolibrary.ymlcards +1PostgreSQLprovider_caveatsentry (cav-eod-intraday-raw).query_data(2025-02-05..2025-02-20): clamped at Vault cutoff (clampedTo: true,6rows through2025-02-12).query_data(2025-02-14..2025-02-20): fail-closed rejected withVaultHoldoutFenceError(0rows returned).
- Logged
trial_ledgerStudies (all honest null results on the 12-name post-2023 TSX slice;passesGate=false):
| Trial | Tool & Study | expressionHash |
Sample / Obs | Key Metrics | DSR (passesGate) |
|---|---|---|---|---|---|
1 |
analyze_signal (fundamentals / ttm_net_income, 5d, allowEstimatedLag=true) |
6ab7b9376592870fa096c6980abe8b60c3bcbee6e47645e0a4440d34d3b99e57 |
2024-01-02..2025-02-05 (n=277) |
Rank IC 0.0044 (t=0.16), Pearson IC 0.0375 (t=1.07), Q5-Q1 0.00087 (t=0.22) |
0.6087 (false) |
2 |
analyze_signal (shorts / shares_short, 5d) |
fd3b320e3e230ec77752907ec96e297bc2b58d6ffba61f7f35400164c695a1c9 |
2024-01-22..2025-02-05 (n=263) |
Rank IC 0.0209 (t=0.61), Pearson IC -0.0025 (t=-0.07), Q5-Q1 -0.00035 (t=-0.16) |
0.7777 (false) |
3 |
event_study (ceo_post, [-2,+5], equal-weight) |
be6b0d20b4d0ec0a22588a5dd309c4024aea0070df9467723e84b1fbd3d5f795 |
2024-01-05..2025-02-05 (1,773 used / 274 dates) |
CAAR(-2..+5)=0.000246, clustered CAR 0.000485 (t=0.67) |
0.6424 (false) |
marimoStatic HTML Snapshot (bun run notebook:snapshot,marimo 0.26.0):exitOk: true,39,509bytes,sha256:9a046686eefd64586ffcf39dcdf13391f4b469305819c36b7115c50e63d53092,marimo checkdiagnostics:total_files: 1,files_with_issues: 0,total_issues: 0,errored: false.- Filed Finding (
file_finding): Persisted rowid="0293bdad-ebcb-436e-9900-e9e2126d0907",created: true,title="M2 EC-1 TSX Fundamental + Alt-Data & CEO Posts Study",trialRefs: ["1", "2", "3"],evidenceRefs: ["sha256:9a046686eefd64586ffcf39dcdf13391f4b469305819c36b7115c50e63d53092"],idempotencyKey: "m2-ec1-desktop-claude-signoff-v1".
5. Exit Criteria Sign-Off Matrix
| Criterion | Status | Evidence |
|---|---|---|
EC-1: Desktop Claude Code via MCP runs fundamental + alt-data signal study and event study end-to-end, exports marimo check-clean static HTML snapshot, and files a finding with zero execution access |
PASS | §4 (Claude Code 2.1.84, 6 tools, Trials 1–3, marimo 0.26.0 0 issues, finding 0293bdad-ebcb-436e-9900-e9e2126d0907) |
EC-2: Restatement fixture proves restated Q1 (known_at > Q2) never overwrites Q2 in fundamentalsAsOf |
PASS | §1 (curate-etl Rust tests, DuckDB MarketDataStore tests, Python stockbot tests) |
EC-3: Split-boundary bars_1m closes match raw bars_1d within 0.5% (NEXM.V 1:20, NVDA.US 10:1, plus AVGO.US 10:1 EOD raw) and 1y 1m loads < 250 ms warm / < 1 s cold on quant QuestDB 10.2.0 |
PASS | §3 (NVDA.US 0.0965%, NEXM.V 0.0000%, AVGO.US 0.0408%; 1y CMG.US 137,382 bars 291.65 ms cold / 128.74 ms warm median Pass 1, 207.88 ms cold / 127.94 ms warm median Pass 2; idempotent resend digest-identical) |