diff --git a/docs/development/QUALITY-GATES.md b/docs/development/QUALITY-GATES.md index 014a1b59..cc5a8e29 100644 --- a/docs/development/QUALITY-GATES.md +++ b/docs/development/QUALITY-GATES.md @@ -56,7 +56,9 @@ bun run check bun run test:postgres ``` -`bun run check` runs build/types/contracts/tooling/utils/calculations/integration/native/lint and secret audit; it **does not include** disposable PostgreSQL, browser E2E or Python analytics. Run new browser task command after W04; `bun run test:analytics-api` if Python API behavior is touched. Native command is `cargo test -p engine --lib --offline`; missing dependencies are a reported blocker, not a pass. +`bun run check` runs build/types/contracts/tooling/utils/calculations/integration/native/lint and secret audit; it **does not include** disposable PostgreSQL, browser E2E or Python analytics. Run `bun run test:e2e` separately for the web workbench and `bun run test:analytics-api` if Python API behavior is touched. Native command is `cargo test -p engine --lib --offline`; missing dependencies are a reported blocker, not a pass. + +The browser gate requires a built checkout, explicit `PIPELINE_TEST_DATABASE_URL` pointing to a disposable `stock_bot_safety*` database, dedicated Redis DB15 in `BACKTEST_TEST_REDIS_URL`, and Chromium. Install the pinned browser explicitly with `bun run test:e2e:install` if missing; do not install browsers implicitly during checks. The command rebuilds the frontend for same-origin production use. It exercises authenticated HTTP/WebSocket routes, durable dispatch and SQL persistence with deterministic UI fixtures plus an actual native smoke run. Fixture results are not financial-correctness evidence. Never use a development trading database or queue. Before making canonical Rust the default: all in-scope approved economic fixtures pass, every implemented strategy mode shares the same financial transition semantics/hashes (an unimplemented DSL is not a gate), canonical results render/reopen/reproduce, and paper migration passes fault tests if paper is switched. Keep a versioned rollback route for software deployment, but never silently downgrade a failed run's economics or mutate accounts between incompatible schemas. diff --git a/docs/development/ROADMAP.md b/docs/development/ROADMAP.md index e049a989..23e8a84f 100644 --- a/docs/development/ROADMAP.md +++ b/docs/development/ROADMAP.md @@ -1,8 +1,8 @@ # Revised development roadmap -Baseline `b7aeca4` · reviewed 2026-10-22 · **First four waves committed; W04 authorized; see manifest execution_scope** +Baseline `b7aeca4` · reviewed 2026-10-22 · **First five waves committed; next implementation policy-gated; see manifest execution_scope** -Authorization update: the first four waves are independently reviewed, validated and committed. The owner's “commit and continue” authorizes the W03 closeout and continuation with next-ready W04. Other tasks and economic/timing/trust-model decisions remain gated. Fifth-wave implementation commits, pushes, PRs and trading operations require further approval. +Authorization update: the first five waves are independently reviewed, validated and committed. The latest “commit and continue” authorized the W04 implementation and planning closeout commits. Continuation readiness was checked: no remaining scheduled task has both code and architecture-policy prerequisites satisfied. Explicit approval is requested for ADR-002/003/004 before F01 and D01; no policy approval is inferred from a generic continuation request. Pushes, PRs and trading operations remain outside scope. ## Strategy and review outcome @@ -81,7 +81,7 @@ Completed wave; the table records its original rationale. Exact prompts, paths, Recommend **3 simultaneous implementers**, reserving one slot for coordination/independent review. Start C01 + C03 + W01; rotate C04 into the first freed slot, or start C04 first if runtime containment is the immediate operational need. These four have no mutual code dependencies and disjoint writable files. Four concurrent implementers are technically possible but not recommended without separate review capacity. -O01/P01 and W03 are committed. W04 now adds real-browser end-to-end verification of the existing workbench. F01/D01 still require their ADR approvals; subsequent tasks are not included in this execution scope. +O01/P01, W03 and W04 are committed. W04 adds validated real-browser end-to-end verification of the existing workbench. F01/D01 still require their ADR approvals; no subsequent implementation starts before its prerequisites are satisfied. ## Second-wave handoff — 2026-10-22 @@ -145,7 +145,29 @@ Independent review caught and corrected premature list refresh while saving and Limits: UI retry identities are component-lifetime state, not recovery across reload/navigation. Definition POST response loss is not covered by run-submission idempotency. Operator/service scopes are the existing single-operator security model, not new user accounts or AI authorization. DOM tests do not prove browser layout, virtualized rows or full browser/API execution; that is W04. Existing native economic limitations remain visible and unchanged. -W03 was committed with owner approval; no push, PR or trading operation occurred. W04 is authorized next; canonical Rust finance still requires ADR-002/003/004 approval. +W03 was committed with owner approval; no push, PR or trading operation occurred. W04's subsequent execution is recorded below; canonical Rust finance still requires ADR-002/003/004 approval. + +## Fifth-wave handoff — 2026-10-22 + +W04 is independently reviewed and `validated_committed` as `550d8b7` on base `95842c3`, following owner approval. The sole implementation owner used `/tmp/stock-bot-wave5.t2GVG7/w04`; the independent reviewer accepted the frozen five-file implementation and reran all browser cases. Integration and pre-commit verification preserved all five hashes. No production application source, financial behavior or business API changed. + +- **Real product path:** Chromium uses the built frontend, authenticated existing routes/websocket projection, SQL repository, durable dispatcher and worker against isolated fixtures. Save-only creates no run/outbox; explicit submission, persisted progress, unsupported-control absence, completion, trades, limitations, frozen inputs and reopening survive navigation/reload. +- **Failure and race evidence:** Separate cases cover cancellation acknowledgement versus worker settlement, failed and zero-trade results, missing results/run, network failure/retry, actual client websocket disconnect/reconnect, and a delayed real API response after switching selected runs. The stale-response assertion waits for the exact old request to finish or fail before inspecting the selected run. +- **Native smoke:** The existing Rust adapter/subprocess executes 70 synthetic bars, persists native results and dataset provenance, and renders trades/reopened results. Fixed lifecycle fixture outputs are UI test data, not an alternate financial simulator or correctness oracle. +- **Harness:** `bun run test:e2e` requires explicit disposable `stock_bot_safety*` PostgreSQL, Redis DB15, a local build/addon and explicitly installed Chromium. It rebuilds the UI in production mode with same-origin API routing. It blocks external browser requests and unrelated fixture API routes, isolates schemas/queues/listeners, and reports prerequisite/readiness/cleanup failures instead of skipping tests. Playwright 1.53.2 is now an explicit dependency; no additional runner framework was introduced. + +Combined validation: + +- `CARGO_BUILD_JOBS=2 bun run check`: all gates passed; 60 tooling, 43 utility, 35 calculation, 310 integration and 37 Rust tests, zero failures. Build, typecheck, contracts, lint and secret audit passed. +- `bun run test:postgres`: 58 tests, 345 assertions, zero failures against disposable PostgreSQL/Redis after integration. +- `bun run test:e2e`: 4 tests, 42 assertions, zero failures on the final main-workspace build (18.99s). Author and independent reviewer also passed all four cases on the frozen implementation. These are additional gates, not included in the repository-check totals. +- Standalone strict TypeScript and explicit ESLint passed for all three new harness files. Frozen offline dependency installation passed. Missing fixture settings, unsafe PostgreSQL/Redis databases and a missing browser installation each failed explicitly before execution. + +Logs, five reviewed file hashes and native artifact identities are recorded in the manifest. Exact disposable PostgreSQL/Redis containers and their recreatable fixture data, including leftovers from aborted diagnostic attempts, were removed after validation. Development services were untouched; worktree and local logs are retained. W04 was committed with owner approval; no push, PR or trading operation occurred. + +Limits: Chromium only (138.0.7204.23). A standalone probe reproduced a Bun 1.2.17 server-initiated websocket close/reconnect shutdown hang; final coverage uses an actual client-initiated disconnect and does not suppress server cleanup failures or claim server-initiated shutdown coverage. An author-reported first clean-worktree build had a browser/logger type-resolution ordering failure; a retry and the combined check passed, but no fix or reproducible diagnosis is claimed. Existing build warnings remain. UI fixtures and native smoke do not certify same-bar execution, canonical accounting, ownership or funding semantics. + +Next: approve ADR-002/003/004 before F01, ADR-003 before D01, and ADR-006 before the parallel R01 product lane. The post-commit readiness review found 32 remaining scheduled tasks and no ungated candidate. F01, D01 and R01 have satisfied code prerequisites but pending ADRs; optimization/deferred work is not a substitute. Do not start financial or trust-model changes by interpreting this test completion or the continuation request as policy approval. ## Deferred and rejected diff --git a/docs/development/backlog/README.md b/docs/development/backlog/README.md index d483670d..215afc1c 100644 --- a/docs/development/backlog/README.md +++ b/docs/development/backlog/README.md @@ -1,6 +1,6 @@ # Canonical development backlog -**First four waves committed; W04 browser verification authorized.** Consult manifest execution_scope, [ROADMAP](../ROADMAP.md), [skeptical review](../REVIEW.md) and [first-wave handoff](../FIRST-WAVE.md). Other tasks and unresolved policies remain gated. +**First five waves committed; further implementation awaits architecture-policy approval.** Consult manifest execution_scope, [ROADMAP](../ROADMAP.md), [skeptical review](../REVIEW.md) and [first-wave handoff](../FIRST-WAVE.md). Other tasks and unresolved policies remain gated. ## One source of truth @@ -65,7 +65,7 @@ Relative size: S narrow correction, M coherent boundary, L sensitive owner-contr | [W01 Make existing run controls and selection truthful](tasks/W01.md) | P1 / done | None | — | Full-stack React/API / M | | [W02 Expose result provenance and legacy correctness limitations](tasks/W02.md) | P1 / done | W01 | — | Full-stack research UX / M | | [W03 Separate save, submit and repeat-safe run creation](tasks/W03.md) | P1 / done | O01 | — | Full-stack durable workflow / M | -| [W04 Verify the first research vertical slice in a browser](tasks/W04.md) | P1 / claimed | W01, W02, W03, C06 | — | Full-stack test engineering / M | +| [W04 Verify the first research vertical slice in a browser](tasks/W04.md) | P1 / done | W01, W02, W03, C06 | — | Full-stack test engineering / M | ### E6 — Research product, provenance and validation @@ -115,4 +115,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. -First wave **C01, C03, C04, W01** and second wave **C06, C02, W02** are independently reviewed, validated and committed with owner approval. Evidence is recorded in [FIRST-WAVE.md](../FIRST-WAVE.md#execution-record--2026-10-22), [second-wave handoff](../ROADMAP.md#second-wave-handoff--2026-10-22) and the manifest. Only **O01/P01** are authorized next; pending architecture policies and other tasks remain gated. +The first five waves are independently reviewed, validated and committed with owner approval. **W04** is committed as `550d8b7`; its five implementation/dependency hashes still match the reviewed and tested versions. Evidence is recorded in [FIRST-WAVE.md](../FIRST-WAVE.md#execution-record--2026-10-22), the [ROADMAP handoffs](../ROADMAP.md#fifth-wave-handoff--2026-10-22) and the manifest. The latest continuation request cannot satisfy unresolved policy choices: F01 needs ADR-002/003/004, D01 needs ADR-003, and R01 needs ADR-006. These are the only remaining scheduled tasks with satisfied code prerequisites; none is approval-ready yet. Deferred work remains deferred. diff --git a/docs/development/backlog/manifest.json b/docs/development/backlog/manifest.json index 99f1787a..3056f6e6 100644 --- a/docs/development/backlog/manifest.json +++ b/docs/development/backlog/manifest.json @@ -1,8 +1,8 @@ { "schema_version": 1, - "plan_revision": "2026-10-22.12", + "plan_revision": "2026-10-22.14", "repository_base": "b7aeca4", - "plan_status": "fifth_wave_authorized", + "plan_status": "fifth_wave_committed_awaiting_policy_approval", "execution_authorized": true, "execution_scope": { "authorized_by": "User: commit and continue (2026-10-22); commit validated W03 and continue next-ready W04", @@ -13,10 +13,11 @@ "isolated_implementation", "local_tests", "local_integration_review", - "planning_progress_updates" + "planning_progress_updates", + "fifth_wave_implementation_commit", + "planning_closeout_commit" ], "excluded": [ - "fifth_wave_commits_without_further_approval", "push", "pull_requests", "live_or_paper_operations", @@ -26,8 +27,11 @@ "ADR-002", "ADR-003", "ADR-004", + "ADR-006", "ADR-007" - ] + ], + "commit_authorized_by": "User: commit and continue (2026-10-22), after W04 validated handoff", + "continuation": "Requested; no remaining scheduled task has satisfied code AND ADR prerequisites. Explicit ADR-002/003/004 approval requested before F01/D01. No policy decision or deferred activation inferred." }, "canonical_metadata": "This manifest alone owns task status, dependency edges, approvals, assignments and write locks. Task Markdown owns scope and acceptance criteria. Index/roadmap are derived views.", "decisions": [ @@ -1005,7 +1009,7 @@ "epic": "E5", "priority": "P1", "severity": "High", - "status": "claimed", + "status": "done", "dependencies": [ "W01", "W02", @@ -1028,12 +1032,16 @@ "assignment": "/root/wave5_w04", "branch": "wave5/w04-browser-workbench", "pull_request": null, - "completed_commit": null, + "completed_commit": "550d8b769baae13f60dd22490a4e3ab42abd008b", "blocker": null, "release_gates": [], "worktree": "/tmp/stock-bot-wave5.t2GVG7/w04", - "integration_base": "9b9403e36be2c6ffbdd939331450d70b0e2a8f0e", - "contract_notes": "Real browser against existing API/dispatcher and isolated PostgreSQL/Redis; deterministic fixture worker plus native smoke. No financial policy, broker activation, new business endpoint or other task scope. One implementation owner for browser harness." + "integration_base": "95842c39d0b26dccd594279f3a632e9afe20186f", + "contract_notes": "Real browser against existing API/dispatcher and isolated PostgreSQL/Redis; deterministic fixture worker plus native smoke. No financial policy, broker activation, new business endpoint or other task scope. One implementation owner for browser harness.", + "integration_state": "validated_committed", + "reviewed_by": "/root/wave5_design_review", + "verification_reference": "ROADMAP.md#fifth-wave-handoff--2026-10-22", + "review_notes": "Independent source review and browser rerun accepted the frozen five-file implementation. Combined repository, PostgreSQL, browser, strict TypeScript and scoped lint gates passed. Pre-commit independent review verified unchanged hashes and scope; owner authorized commit. No production application source or financial policy changed." }, { "id": "R01", @@ -1857,7 +1865,7 @@ } ], "review_note": "Independent skeptical revision: four superseded tasks retain stable IDs; deferred work is not a dependency of scheduled tasks. Release gates are distinct from implementation prerequisites.", - "integration_base": "9b9403e36be2c6ffbdd939331450d70b0e2a8f0e", + "integration_base": "95842c39d0b26dccd594279f3a632e9afe20186f", "validation": { "date": "2026-10-22", "integration_base": "1148673", @@ -2416,7 +2424,7 @@ "fourth_wave_validation": { "date": "2026-10-22", "integration_base": "5eb0985057c11d899b155d2dd154416e6ec93f0b", - "application_commit": null, + "application_commit": "9b9403e36be2c6ffbdd939331450d70b0e2a8f0e", "repository_check": { "command": "CARGO_BUILD_JOBS=2 bun run check", "status": "passed", @@ -2491,10 +2499,136 @@ "Frontend Save and run retains the saved definition on submit failure, gates immediate duplicate clicks, distinguishes submission/polling errors and suppresses late navigation.", "Explicit frontend typecheck/source lint/build and diff checks passed. Existing 12 curly findings in the old DOM test harness remain; repository lint gate passes.", "Existing Rust/frontend build warnings remain. No financial-engine change, browser E2E claim, AI permission expansion or paper/live operation.", - "No fourth-wave commit, push or PR. After acceptance/commit, W04 is the next dependency-ready task; F01 still requires ADR-002/003/004 approval." + "W03 committed as 9b9403e with owner approval; planning closeout 95842c3. No push, PR or trading operation. W04 continuation was authorized; F01 still requires ADR-002/003/004 approval." ] }, "fifth_wave": [ "W04" - ] + ], + "fifth_wave_validation": { + "date": "2026-10-22", + "integration_base": "95842c39d0b26dccd594279f3a632e9afe20186f", + "application_commit": "550d8b769baae13f60dd22490a4e3ab42abd008b", + "repository_check": { + "command": "CARGO_BUILD_JOBS=2 bun run check", + "status": "passed", + "tooling": 60, + "utils": 43, + "calculations": 35, + "integration": 310, + "native": 37, + "failed": 0 + }, + "postgres_recovery_tests": { + "command": "bun run test:postgres", + "passed": 58, + "failed": 0, + "assertions": 345, + "environment": "Disposable stock_bot_safety PostgreSQL and dedicated Redis DB15; exact test containers and recreatable fixture data removed after validation; development services untouched" + }, + "browser_tests": { + "command": "bun run test:e2e", + "passed": 4, + "failed": 0, + "assertions": 42, + "duration_seconds": 18.99, + "cases": [ + "browser_saved_run_lifecycle", + "browser_cancel_failure", + "browser_reopen_and_switch", + "native_smoke" + ], + "environment": "Playwright 1.53.2 / Chromium 138.0.7204.23 revision 1179; Bun 1.2.17; random loopback listeners, isolated SQL schemas and unique queues", + "independent_review": "Accepted; reviewer rerun passed 4 cases and 42 assertions in 18.24s; frozen hashes unchanged", + "author": "Final frozen rerun passed 4 cases and 42 assertions in 18.25s", + "scope": "Real browser/API/SQL/dispatcher/worker evidence. Fixed lifecycle output is UI fixture data; separate actual native smoke is integration evidence, not financial certification." + }, + "scoped_checks": { + "strict_typescript": { + "command": "bun run --bun tsc --noEmit --skipLibCheck --strict --module ESNext --moduleResolution Bundler --target ESNext --allowImportingTsExtensions --types bun scripts/test-e2e.ts test/e2e/fixture.ts test/e2e/workbench.test.ts", + "status": "passed" + }, + "explicit_eslint": { + "command": "bun run --bun eslint --no-ignore scripts/test-e2e.ts test/e2e/fixture.ts test/e2e/workbench.test.ts --max-warnings 0", + "status": "passed" + }, + "frozen_offline_install": { + "command": "bun install --frozen-lockfile --offline", + "status": "passed; no changes" + }, + "negative_prerequisites": { + "status": "passed; each exits 1 with explicit diagnostic before build/browser/database execution", + "cases": [ + "Missing both fixture URLs", + "PostgreSQL database /development", + "Redis database /0", + "Missing Chromium installation via PLAYWRIGHT_BROWSERS_PATH" + ] + }, + "diff_check": "passed; task IDs/references, acyclic dependency graph and reviewed source/native hashes also verified" + }, + "reviewed_files": { + "package.json": "211984683879b6cff148b541c2bfd54ae0c1f88a3fbeb6940f7b0f052d4e7865", + "bun.lock": "1a2b653bbaaeb5075785b860487557b8fc379f0c50cbe8f2554c90e4a3ac4514", + "scripts/test-e2e.ts": "1a3d1ebb82c054c1167993d668bf92ff6ce27ba8ce4ea561d8ba6e0850ad56f5", + "test/e2e/fixture.ts": "323cb37474dcd274153143f4dff356c17baf5e9e919c0860dd2a856f189f2bbd", + "test/e2e/workbench.test.ts": "fb247c815bc933e911fb3eca0fea7e8494ca52e474a85e9bae2cf34831461b19" + }, + "native_addon": { + "path": "apps/stock/engine/dist/engine.node", + "sha256": "833332fbfefcc65e91671d5b42bb714f6e257a7689c18c79acbd740efcc2a791", + "build": "Root integration debug addon rebuilt by combined check; native source unchanged" + }, + "author_review_native_addon": { + "path": "/tmp/stock-bot-wave5.t2GVG7/w04/apps/stock/engine/dist/engine.node", + "sha256": "9facb5b059280e579fc551b5a27f20c4b037e37b41ad7d1bc443e6d0a9c3e636", + "build": "Isolated worktree build; correct local package resolution verified; not byte-identical to root artifact" + }, + "logs": { + "repository_check": "/tmp/stock-bot-wave5.t2GVG7/check.log", + "postgres": "/tmp/stock-bot-wave5.t2GVG7/postgres.log", + "browser": "/tmp/stock-bot-wave5.t2GVG7/e2e.log", + "author_browser": "/tmp/stock-bot-wave5.t2GVG7/w04-final-e2e.log", + "reviewer_browser": "/tmp/stock-bot-wave5.t2GVG7/reviewer-e2e.log" + }, + "notes": [ + "All five authored files match the frozen independently reviewed worktree; no application source, financial semantics or business API changed.", + "Browser and PostgreSQL gates are separate from repository check counts. New harness strict TypeScript and scoped lint passed; old DOM harness baseline lint findings unchanged.", + "Standalone probe reproduced Bun 1.2.17 server-initiated websocket close/reconnect pendingWebSockets leak and server.stop(true) hang. Final test uses actual client-initiated disconnect/reconnect; server cleanup failures remain fatal. No server-initiated shutdown coverage or runtime fix claimed.", + "Author reported initial clean-worktree browser/logger type-resolution build failure; retry and root combined check passed. Logger is declared as a peer dependency. Original failing log was overwritten; build-order diagnosis remains unverified, not fixed.", + "Disposable test containers and recreatable fixture data, including leftovers from aborted diagnostic attempts, removed after final tests. Development services untouched; isolated worktree and local logs retained.", + "Existing build warnings remain. Native smoke and synthetic UI fixtures do not establish valid same-bar execution, canonical accounting, ownership or funding.", + "W04 committed as 550d8b7 with owner approval. No push, PR or trading operation. Continuation is policy-gated: F01 requires ADR-002/003/004, D01 requires ADR-003, R01 requires ADR-006. No pending policy was approved implicitly." + ] + }, + "continuation_readiness": { + "date": "2026-10-22", + "after_commit": "550d8b769baae13f60dd22490a4e3ab42abd008b", + "remaining_scheduled_tasks": 32, + "tasks_with_satisfied_code_and_decision_dependencies": [], + "code_ready_pending_decisions": [ + { + "id": "F01", + "decision_dependencies": [ + "ADR-002", + "ADR-003", + "ADR-004" + ] + }, + { + "id": "D01", + "decision_dependencies": [ + "ADR-003" + ] + }, + { + "id": "R01", + "decision_dependencies": [ + "ADR-006" + ] + } + ], + "requested_approval": "ADR-002/003/004 as written before F01 financial contracts/regression fixtures and D01 availability-aware datasets; awaiting explicit owner response", + "notes": "Deferred optimization triggers remain unmet; no alternative task started. Readiness checked independently by /root/next_ready_audit." + } } diff --git a/docs/development/backlog/tasks/W04.md b/docs/development/backlog/tasks/W04.md index 627bb0c9..dc558c1b 100644 --- a/docs/development/backlog/tasks/W04.md +++ b/docs/development/backlog/tasks/W04.md @@ -65,3 +65,13 @@ Keep migrations additive and previous results readable. Do not add a switch that ## Handoff Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done. + +## Execution commands + +Build this checkout with `bun run build`. If Chromium is not installed, explicitly run `bun run test:e2e:install`; missing browser/system prerequisites are failures, not skipped tests. Set the same disposable-database variables required by `bun run test:postgres`, then run: + +```sh +bun run test:e2e +``` + +The browser command rebuilds the frontend with production mode and a same-origin API override. Tests run serially against random loopback listeners, isolated SQL schemas and unique queues. Keep lifecycle fixtures separate from the real native smoke case; neither certifies the unresolved financial policies. Run repository and PostgreSQL gates separately before handoff.