stock-bot/design/m2-baseline-report.md
2026-12-01 20:42:35 -05:00

95 lines
9.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Milestone M2 Baseline Verification Report (T-128 / M2.0)
- **Date:** `2026-11-30`
- **Target Baseline:** `master` / `dev` at `56b73b7e663d293079ab7bac264950dfa7a68b00` (contains accepted M1 closure commit `d52aa20bff3f5c259fb6e2bcfc2d3a78ad5224b1`)
- **Verdict:** **GREEN — Ready to start Milestone M2 implementation** (`0` real failures across all sandbox gates, full unfiltered `bun test`, and Studio's authoritative unsandboxed verification; previous Auto Mode baseline blocker on `d52aa20b` is confirmed resolved in `56b73b7e`).
- **Scope Compliance:** Zero M2 feature code, zero CI workflow changes, zero T-127 edits, and zero `studio.config.json` modifications.
---
## 1. Repository Provenance
Executed from workspace root (`/home/boki/repos/stock-bot`):
| Check | Command | Exit Code | Output (Verbatim) |
| --- | --- | ---: | --- |
| `HEAD` SHA | `git rev-parse HEAD` | `0` | `56b73b7e663d293079ab7bac264950dfa7a68b00` |
| `master` SHA | `git rev-parse master` | `0` | `56b73b7e663d293079ab7bac264950dfa7a68b00` |
| Current branch | `git branch --show-current` | `0` | `dev` (`HEAD == master == dev`) |
| M1 ancestry check | `git merge-base --is-ancestor d52aa20bff3f5c259fb6e2bcfc2d3a78ad5224b1 HEAD` | `0` | *(empty stdout/stderr — confirms `d52aa20b` is an ancestor of `56b73b7e`)* |
**Note on `.git` sandbox access:** Because this workspace (`/home/boki/repos/stock-bot`) is the main repository checkout rather than a linked `.git/worktrees/...` worktree, read-only git commands and the 5 git-dependent tests in `scripts/test/` succeeded inside the sandbox without indirection errors.
---
## 2. Gate-by-Gate Verification Table
### 2.1 Sandbox-Runnable Gates (Sequential)
| Gate | Command | Exit Code | Result / Exact Counts |
| --- | --- | ---: | --- |
| Typecheck | `bun run typecheck` | `0` | **PASS** (`tsc --project tsconfig.check.json --noEmit`, 0 errors) |
| Contracts | `bun run test:contracts` | `0` | **PASS** (`tsc --project tsconfig.contracts.json --noEmit`, 0 errors) |
| Lint | `bun run lint:check` | `0` | **PASS** (`eslint apps/stock libs tools test --ext .ts,.tsx --max-warnings 0`, 0 errors, 0 warnings) |
| Utils tests | `bun run test:utils` | `0` | **PASS** (`32 pass`, `0 fail`, `59 expect()` calls across `3` files, `201ms`) |
| Calculations tests | `bun run test:calculations` | `0` | **PASS** (`144 pass`, `0 fail`, `76,602 expect()` calls across `12` files, `814ms`) |
| Native Rust tests | `CARGO_BUILD_JOBS=2 bun run test:native` | `0` | **PASS** (`1,078 passed`, `0 failed`, `4 ignored` across `49` test suites: `engine` lib `150 passed / 4 ignored`, `curate-etl` unit + integration/contract + doc-tests `928 passed / 0 failed`) |
| Workspace Rust lib tests | `CARGO_BUILD_JOBS=2 cargo test --workspace --lib --offline` | `0` | **PASS** (`732 passed`, `0 failed`, `4 ignored` across `2` crates: `curate-etl` `582 passed`, `engine` `150 passed / 4 ignored`) |
| Workspace build | `bun run build` | `0` | **PASS** (`29/29` packages succeeded via Turbo) |
### 2.2 Authoritative Unsandboxed Verification (`studio.config.json`)
| Gate | Command | Exit Code | Result / Exact Counts |
| --- | --- | ---: | --- |
| Studio build | `bun run build` | `0` | **PASS** (`29/29` packages) |
| Studio full test suite | `bun --env-file=/home/boki/.studio/test-env/stock-bot.env test` | `0` | **PASS** (`3,648 pass`, `15 skip`, `0 fail`, `889,698 expect()` calls across `282` files, `193.45s`; isolated on `stock_bot_safety*` and Redis DB15) |
| Sandbox-blocked Postgres pair rerun | `bun --env-file=/home/boki/.studio/test-env/stock-bot.env test test/postgres/security-master-run.test.ts test/postgres/security-master-export-curate-inputs.test.ts` | `0` | **PASS** (`2 pass`, `0 fail`, `116 expect()` calls across `2` files, `880ms`) |
| Studio Rust half | `CARGO_BUILD_JOBS=2 cargo test --workspace --lib --offline` | `0` | **PASS** (`732 passed`, `0 failed`, `4 ignored`) |
### 2.3 Supplemental Python / Marimo Verification (Not Wired Into Automated Gates)
| Check | Command | Exit Code | Result |
| --- | --- | ---: | --- |
| Python SDK tests | `python/.venv/bin/pytest python/tests/ -v` | `0` | **PASS** (`5 passed` in `0.62s`) |
| Marimo notebook check | `python/.venv/bin/marimo check --format=json research/notebooks/ca_shorts_filings_study.py` | `0` | **PASS** (`0 issues`, `errored: false`) |
---
## 3. Full Sandbox `bun test` Failure Classification
Unfiltered `bun test` was executed inside the sandbox (`5,838` lines captured to `/tmp/m2-baseline-bun-test.log`, subsequently deleted after analysis):
- **Exit code:** `1`
- **Totals:** `3,536 pass`, `125 skip`, `2 fail`, `888,395 expect()` calls across `282` files (`111.79s`).
- **Git-dependent tooling suites in `scripts/test/`:** All 5 passed inside the sandbox (`43/43` tests: `audit-secrets-repo.test.ts` `11/11`, `benchmark-replay.test.ts` `12/12`, `benchmark-research.test.ts` `8/8`, `benchmark-sma.test.ts` `2/2`, `strategy-packaging.test.ts` `10/10`).
- **Previous Auto Mode baseline failure attribution:** On `d52aa20b`, `test/unit/data-pipeline-rust-evaluation-doc.test.ts > contains all seven required sections in order` failed because `design/data-pipeline/rust-migration-evaluation.md` appended a numbered `## 8.` heading. Commit `56b73b7e` renamed that section to `## Addendum: ...`, and all `13/13` tests in `test/unit/data-pipeline-rust-evaluation-doc.test.ts` now pass.
### Complete Failure Classification Table (Every `(fail)` Entry in Full Log)
| # | Test File | Test Name | Exact Error (Verbatim) | Classification | Authoritative Unsandboxed Status |
| ---: | --- | --- | --- | --- | --- |
| 1 | `test/postgres/security-master-run.test.ts` (line 37) | `composeSecurityMasterRun -> persistSecurityMaster PostgreSQL integration > persists FB vs FB-ETF distinct listing_ids, SIVB -> SIVBQ continuity, Pass 4 conflicts (including shared left endpoint), and is idempotent on re-run` | `error: Dedicated stock_bot_safety database required` (`createIsolatedFixture`, missing `PIPELINE_TEST_DATABASE_URL` pointing to `/stock_bot_safety*` because `/home/boki/.studio/test-env/stock-bot.env` and `127.0.0.1:5432` are outside the sandbox) | **(a) Expected sandbox-only** (PostgreSQL safety-URL guard; unlike `describe.skipIf(!url)` suites, fails closed inside `createIsolatedFixture()`) | **PASS** (`302ms`) |
| 2 | `test/postgres/security-master-export-curate-inputs.test.ts` (line 35) | `exportCurateInputs PostgreSQL integration (isolated stock_bot_safety_*) > exports exact TSV bytes read-only and matches across chunkSize=1 and chunkSize=5000` | `error: Dedicated stock_bot_safety database required` (`createIsolatedFixture`, same missing `PIPELINE_TEST_DATABASE_URL` guard outside Studio's env) | **(a) Expected sandbox-only** (PostgreSQL safety-URL guard) | **PASS** (`318ms`) |
- **Real failures found (`(b)`):** **0**
---
## 4. Read-Only M2 Planning Facts (Zero Code/Config Edits)
1. **`@modelcontextprotocol/sdk` absence & sandbox network allowlist:**
- `@modelcontextprotocol/sdk` is **not present** in `bun.lock` or any `package.json` across the repository (`0` matches in `bun.lock`, root `package.json`, `apps/`, `libs/`, `tools/`).
- `studio.config.json` (`agentExecution.programmer.networkDomains` lines 6–10 and `agentExecution.qa.networkDomains` lines 14–18) allows **only** `["crates.io", "index.crates.io", "static.crates.io"]` (no `registry.npmjs.org`).
- **M2 implication:** Before implementing the MCP copilot server in `web-api` / standalone stdio+SSE wrapper, either pre-install/lock `@modelcontextprotocol/sdk` on the host outside the sandbox, extend the network allowlist, or implement the MCP JSON-RPC 2.0 stdio/SSE protocol directly with zero new npm dependencies.
2. **Python SDK test suite is outside automated gates:**
- Neither `python/tests/test_stockbot_sdk.py` nor `pytest` under `python/` is referenced or invoked by root `package.json`, `scripts/check.ts`, or `studio.config.json` `test.command` (`bun --env-file=/home/boki/.studio/test-env/stock-bot.env test && CARGO_BUILD_JOBS=2 cargo test --workspace --lib --offline`).
- **M2 implication:** `python/tests/test_stockbot_sdk.py` (`5/5` currently passing locally) and `marimo check` will not run automatically during Studio gates unless explicitly wired in a future task; M2 PIT fundamentals / Feature Library Python work should account for this.
3. **`studio.config.json` `docs.*` path mismatch (left untouched):**
- `studio.config.json` sets `"designDir": "design"` (line 42), `"docs.pitch": "design/pitch.md"` (line 44), and `"docs.pillars": "design/pillars.md"` (line 45), while `docs.brand`, `docs.index`, `docs.plan`, `docs.milestones`, `docs.dataContracts`, `docs.validation`, `docs.dataPipeline`, and `docs.servers` (lines 46, 48–54) point to `docs/...`.
- No `docs/` directory exists at the repository root (`ls: cannot access 'docs': No such file or directory`). All milestone and platform documents live under `design/` (specifically `design/MILESTONES.md` lines 83–103 for M2). `studio.config.json` was intentionally left untouched in this baseline verification task.
---
## 5. Verdict
**GREEN.** Baseline commit `56b73b7e663d293079ab7bac264950dfa7a68b00` (`master` / `dev`, descending from accepted M1 commit `d52aa20b`) passes all sandbox-runnable gates, has `0` real failures in full unfiltered `bun test` (`2` sandbox-only `PIPELINE_TEST_DATABASE_URL` guard errors that pass in Studio's unsandboxed run), and passes Studio's authoritative unsandboxed verification (`29/29` packages built, `3,648 pass / 15 skip / 0 fail` across `282` test files, `732` Rust workspace lib tests passing). Milestone M2 implementation is unblocked to proceed (starting with the MCP copilot server, then PIT fundamentals, QuestDB `10.2.0` intraday, and the Feature Library; T-127 remains deferred).