# Whole-application architecture cleanup **Complete: 14/14 cleanup tasks; 113/113 selected backlog tasks.** Baseline `1a9f07b2`. The owner authorized all October 28 audit recommendations and a commit after each validated task. Five optional extensions remain deferred; four merged IDs are redirects. Agents worked on root-reserved, disjoint files in the integration worktree. Root reviewed and committed each task and built shared outputs. Independent reviews checked shared custody, composition, transactions, analytics startup and queue/handler lifecycle. No isolated native agent-build claim is made. ## Changes and commits | Task | Result | Commits | | --- | --- | --- | | [CL22](backlog/tasks/CL22.md) | Own queue transports without deleting pending payloads | `3fc0a272`, `1aa35d2d` | | [CL23](backlog/tasks/CL23.md) | Reject retired backtest creation before persistence | `cd1aa614` | | [CL24](backlog/tasks/CL24.md) | Remove prototype dashboard from normal navigation | `5400dba4` | | [CL25](backlog/tasks/CL25.md) | Share validated product response contracts | `366a6054`, `2a9382a2`, `ed7429cf` | | [CL26](backlog/tasks/CL26.md) | Replace private application imports with explicit shared modules | `b4589d5a`, `33e22404` | | [CL27](backlog/tasks/CL27.md) | Initialize enabled ingestion handlers once per container | `5c9e32d0`, `dac49ac1` | | [CL28](backlog/tasks/CL28.md) | Compose research services with explicit collaborators | `24487d35` | | [CL29](backlog/tasks/CL29.md) | Share transactional experiment run and dispatch insertion | `731acc41` | | [CL30](backlog/tasks/CL30.md) | Separate research UI workflow state from rendering | `a411f9a6` | | [CL31](backlog/tasks/CL31.md) | Publish a stable strategy authoring contract | `3a63b203` | | [CL32](backlog/tasks/CL32.md) | Separate paper safety enforcement from readiness projection | `2165a2ef` | | [CL33](backlog/tasks/CL33.md) | Isolate legacy repository writers from production capabilities | `ec582bd5` | | [CL34](backlog/tasks/CL34.md) | Normalize provider symbols and remove unused scaffolding | `e2292e48` | | [CL35](backlog/tasks/CL35.md) | Make optional Python analytics composition honest and testable | `7ae6ac21` | The API and orchestrator now share server-side historical storage, admission and lazy artifact inspection through `libs/trading-runtime`. Browser-safe contracts remain in `stock-config`, and strategy authors use the type-only `@stock-bot/research/strategy-api`. Rust remains authoritative for financial semantics. Existing compatibility paths preserve historical readers and tests. Independent review caught the queue's previous worker timeout of two seconds and manager timeout of five seconds falsely completing shutdown. Follow-up commits retain the actual drain promise; the regression runs beyond both former deadlines and proves transports stay usable until the worker completes. A real Redis fixture verifies pending payload survival and later consumption. ## Final verification - `CARGO_BUILD_JOBS=2 bun run check`: all gates passed — build, source/contract types, secret audit, lint, 179 tooling, 43 utility, 44 calculation, 1,609 integration and 150 Rust tests. - `bun run test:postgres`: **287 passed**, 2949 assertions, 0 conditional skips; disposable PostgreSQL/Redis only. Covers transaction rollback, duplicate submissions, numbering, holdout boundaries, leases, recovery, paper safety, provider mapping and queue shutdown. - `bun run test:e2e`: **27 Chromium workflows passed**, 971 assertions, against the same disposable stores and a fresh production web build. - `bun run test:analytics-api`: **11 passed**, including actual FastAPI app import/lifespan with missing optional dependencies, structured unavailable responses and successful runtime stubs. - Additional new-test lint, scoped formatting and whitespace checks passed. Native addon SHA256: `df0ecbd5c3772d7e8aeb0226b40ae290cfaddf9d87fb3a7375f2a31c2acf05e5`. The first combined check exposed Bun bundling descriptor interference and two old web fixtures using incomplete records/wrong success statuses. Bundling probes now use isolated processes, fixtures match actual 202 run and 201 review responses, and the complete repository gate passed on rerun. Chromium also caught valid historical SQL-null configuration rejected by the new response schema; nullable read contracts and guarded UI access now preserve those records, with regression coverage. Browser error assertions now follow the actual server and transport diagnostics. The subprocess replay regression now has a 30-second deadline (`8c54eb7e`); its financial and hash assertions are unchanged. Its previous five-second deadline timed out during concurrent browser verification. The final repository check ran sequentially and passed. Four manual Rust cases remain ignored, and 14 opt-in real OS-isolated candidate integration tests were not enabled. Python successful scientific and multipart paths use stubs; heavy optional runtimes were not installed. This cleanup does not claim new market-data coverage, faster backtests, or live-trading readiness. Full command logs for this session are `/tmp/stock-bot-architecture-cleanup-check-final.log`, `/tmp/stock-bot-architecture-cleanup-postgres.log`, `/tmp/stock-bot-architecture-cleanup-browser.log` and `/tmp/stock-bot-cl35-root.log`. Task files retain focused acceptance evidence; [manifest.json](backlog/manifest.json) remains the canonical status record.