stock-bot/docs/development/real-data-research.md

523 lines
92 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.

# Real-data research workflow
Authorized follow-up to cleanup on October 26, 2026. Baseline `bd9332b2`. The manifest owns scheduling. RP01 adds read-only source inspection; RP02 exercises existing research paths with actual stored data. Performance, conditional CL21 and paper/live activation remain deferred.
## Independent cleanup reviews
- CL01/CL04: foundation reviewer accepted; CL02/CL03 required owned-cache corrections before acceptance. Real adapter probes reproduced transport leakage, cross-container endpoint reuse and ignored options. The correction owns DI/queue cache transports, preserves shared callers and namespaces, wires supported retries/TTL and diagnoses obsolete controls. Foundation reviewer accepted the fix; root scoped tests passed 38/190 assertions and application types. Expanded implementer gates passed 75/280. Three historical queue-utils expectations independently fail on the old baseline; no claim those passed.
- CL05/CL08/CL12: backend reviewer accepted; 154 domain/admission cases, 15 retained-worker cases, and 55 disposable PostgreSQL cases passed. Dataset/report moves preserve algorithms and transaction/receipt boundaries.
- CL06/CL07/CL09/CL10/CL11/CL13: frontend reviewer accepted; 390 UI/transport and 41 dataset/architecture cases passed. A pre-existing body-read abort diagnostic limitation remains nonblocking because cancelled generations are fenced.
Reviewers: `/root/review_cleanup_foundations`, `/root/review_cleanup_backend`, `/root/review_cleanup_frontend`. Exact logs under `/tmp/stock-bot-*-review*.log` and `/tmp/stock-bot-research-next-20261026/`. Combined integration evidence follows.
## Rechecked source
Read-only Mongo query reproduced the previous AAPL October 2024 snapshot exactly: 1,816 five-minute rows, 22 null volumes at 20:00 UTC, no duplicate timestamps; raw query JSON hash `a8772d01d388b8fc9bca0d2790ad0d37146570fd09d057fcf1f1fcb5e6113bde`. PostgreSQL initially contained zero retained datasets/strategy versions and no experiments; existing runs are not evidence of this pilot. The development API responds on port 2003.
## RP01 — Accepted scoped source inspection
The stored-EOD preparation panel now accepts an instrument and timeframe, explicitly loads that series' coverage, and diagnoses a selected half-open UTC window. It reports field errors, null volume and duplicate timestamps without changing rows or granting dataset eligibility. Editing these controls does not dirty or submit the enclosing backtest setup; cancellation and changed drafts fence late replies. An already dispatched Mongo query is not interrupted by the current database wrapper.
The first proposal grouped every archived row. Actual Mongo estimates were 3,402,612,960 one-minute, 1,075,367,880 five-minute and 110,450,096 hourly records, so that proposal was rejected during integration. The final query requires one instrument/timeframe and starts with an exact match. Actual Mongo explain selected `eodSearchCode_1_timestamp_1`; no index migration, cache or input cap was introduced. Coverage does not establish complete calendar sessions. Window queries cannot diagnose timestamps that cannot be located in that query; coverage counts invalid timestamps separately.
Independent backend and frontend reviewers accepted the final implementation. Corrections included BSON Decimal128 timestamp consistency, strict zero-warning lint, and preventing inspector Enter/change events from submitting or dirtying the parent setup.
Validation on the combined checkout:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,251 integration and 150 Rust tests; 14 conditional integration skips and 4 ignored Rust measurement tests remain.
- Disposable PostgreSQL/Redis suite: 274 passed, 2,630 assertions. The first invocation crashed inside Bun 1.2.17 after 83 seconds; the complete retry passed. This is not reported as a successful initial invocation.
- Chromium: all 18 existing scenarios passed in the full run. The new scenario initially used a draft-only navigation button on an already-configured template; after correcting that test navigation, its focused rerun passed with 20 assertions. Together these cover all 19 scenarios; no application change followed the full suite.
- Real Mongo BSON aggregation: passed, including Decimal128 rejection, supported numeric representations and missing selection. Selected AAPL coverage and inspection succeeded; the session has 78 rows with zero invalid or duplicate rows. Source history was read only.
- Implementer focused regressions: 106 tests / 521 assertions. Independent frontend: 91 / 319; backend: 6 / 46. Production frontend build, authored-test types, strict lint and diff checks passed.
Logs: `/tmp/stock-bot-research-next-20261026/combined-check-scoped.log`, `combined-postgres-retry.log`, `combined-browser.log`, `source-browser-focused.log`, `source-mongo-explain.log`. Tests used disposable stores; the development research records below were not test fixtures.
## RP02 — Completed after explicit strategy approval
The following inputs were created and reopened through existing research APIs. The owner then explicitly approved the exact SMA artifact for this bounded pilot; nine runs completed:
| Record | Identity |
| --- | --- |
| Frozen dataset | `6b72d7fc3ebf87a52aefb5683d1bdaea344546daea1a988533c66871e56ed687` |
| Raw selected-query file SHA256 | `343a025b15ffe695479f940ca7eaa6511dd4270deaeaf9bc49b4e28961c1b15c` |
| SMA strategy version | `a67fb31d-7d13-4337-91fb-b49745983160` — explicitly approved for the research pilot |
| Strategy artifact SHA256 | `008a42dc373168ba17d5e73a1cc769de6b0bc24b7e487f07a422ceaa3618aa71` |
| Clean strategy source commit | `b4ac6460efd40734f55d12bc94f1969583fd8587` |
| Draft backtest | `373e1046-64fc-409e-b414-da46fb20bea3` |
| Research project | `59027da7-4e84-4c71-ac3e-10cab219f0c4` |
| Hypothesis | `a0fb1cb7-6202-470e-aa9d-8f2f22918c6a` |
| Preparation note | `9c077001-3309-4a29-ae95-0891ec8488c5` — AI-origin, unvalidated, no performance evidence |
Local durable input package: `.data/research-pilots/aapl-20241001/`. It contains raw query bytes, complete metadata, source evidence, retained package/lock, API receipts, reopened dataset/draft, preparation scripts and `execution-plan.json`. PostgreSQL retains the canonical dataset and immutable strategy artifact. Local raw files are ignored runtime data, not Git documentation.
The declared session is October 1, 2024, 13:30–20:00 UTC. All 78 consecutive five-minute bars remain unchanged. The explicitly half-open query excludes after-hours rows; no filtering within the query, interpolation or null-volume coercion occurred. Evaluation begins at 14:30 after sufficient SMA warmup.
Evidence and limits:
- [Nasdaq's 2024 calendar](https://www.nasdaqtrader.com/content/technicalsupport/2024tradingcalendar.pdf) and [regular hours](https://www.nasdaq.com/market-activity/stock-market-holiday-schedule?display=b2b) support the declared ordinary session. The normalizer validates the declaration; it does not certify exchange evidence.
- [EOD intraday documentation](https://eodhd.com/financial-apis/intraday-historical-data-api) defines UTC Unix-second bar starts. Availability at interval end is an explicit zero-delay assumption; actual historical arrival times are unavailable.
- Action-free coverage for this one session is an inference from [Apple's dividend/split history](https://investor.apple.com/dividend-history/), not a certified complete action feed.
- [Apple's August 2024 release](https://www.apple.com/newsroom/2024/08/apple-reports-third-quarter-results/) establishes common shares before the session. The fixed AAPL universe uses that historical membership, but the asset/window were selected retrospectively for a workflow proof. This is not a point-in-time universe-selection study; the stored vendor vintage was captured in 2026.
The predeclared plan has at most nine runs: baseline SMA 3/8, its exact reproduction, two training candidates (fast 2/4, slow 8), two held-out phases for the server-selected training winner, and three cost scenarios including the automatic baseline. Capital is $10,000 with a $1,000 strategy budget and explicit native limits. Fees, spread and slippage are scenario assumptions. Training evaluates 14:30–16:00, validation 16:00–18:00 and test 18:00–20:00; each phase resets capital and has one hour of prior warmup. These tiny partial-session partitions cannot establish alpha, regime robustness or statistically meaningful out-of-sample performance. Do not interpret annualized CAGR or unavailable daily-period statistics as such evidence.
The original capability check correctly rejected execution pending human approval. The owner subsequently answered “Approve this research pilot” for the exact version/artifact above. That approval was recorded through the existing review endpoint before any submission; `owner-approval.json` and `approved-version.json` retain the scope and response. No paper/live deployment was activated.
All nine runs used the existing durable `BacktestRunner` / `RustBacktestAdapter`, invoked only for their newly admitted IDs; no generic queue was drained. The runner claimed attempts and stored canonical native results through the existing repository. All six submission operations were replayed with their original bodies, principals and idempotency keys; the pilot still has exactly nine completed runs. Results, the sealed chronological report and the cost experiment were reopened through normal APIs.
| Completed evidence | Identity / result |
| --- | --- |
| Baseline run | `3f87ca4c-b61c-4eba-996a-94fdb525369d`; 8 fills, terminal cash/equity `9994.54250007`, fees `7.20654989` |
| Reproduction run | `41ace77c-4c13-44e6-915f-593e3d914147`; exact match |
| Economic hash, both runs and cost baseline | `f1d0111dad1d33d6d53225b598ede56ecb9c31c9264436fbcf065d72f2982daa` |
| Chronological validation | `0e4a8a73-e25f-4256-82a1-905cc5d57bab`; training selected SMA 2/8, both holdouts preserved that choice |
| Sealed report | `96dff56c-1840-4925-b2b2-9edd738c694c`; hash `20ab18f465c46bbf141dee53f35c2db1652f67e8c831be2c5c11a49df770136c` |
| Cost experiment | `2a8d767f-0770-47b1-8377-2dd18d038a08`; three comparable completed trials |
| Finding | `9942626c-0684-40d3-a15b-45fb1d00579b`; 19 retained scalar references, AI-authored, unvalidated research conclusion |
| Native engine binary SHA256 | `df0ecbd5c3772d7e8aeb0226b40ae290cfaddf9d87fb3a7375f2a31c2acf05e5` |
Baseline total return was approximately -0.054575%. The fixed SMA 3/8 cost scenarios ended at `10002.46970496` with zero fees/slippage but spread retained, and `9984.45333211` with stressed fees/slippage. These are observed scenario results, not calibrated execution estimates or a general monotonicity claim. Annualized CAGR was deliberately excluded from the finding; there are zero complete daily reporting periods.
Independent reviewer `/root/review_cleanup_backend` accepted 2,374 file-only assertions across the nine results and finding: fixed-eight cash/fee/quantity/P&L/owner reconciliation, no negative cash or position quantity in the observed fills, exact artifact/lock and sliced-dataset identities, reproduction hashes, sealed report/selection hashes, training-only winner, unchanged non-cost policy and all 19 evidence references. This audit does not claim to cover every possible risk path or independently prove unrelated database state was untouched. Full failure-oriented repository/PostgreSQL tests provide the broader regression gate.
Actual development Chromium signed in and reopened the [saved baseline and trades](http://localhost:5173/backtests/373e1046-64fc-409e-b414-da46fb20bea3/run/3f87ca4c-b61c-4eba-996a-94fdb525369d) and the [project finding](http://localhost:5173/research/59027da7-4e84-4c71-ac3e-10cab219f0c4). That browser context blocked every non-read API operation except authentication. Local `browser-reopened.json`, `execution-summary.json`, `execution-status.json`, `independent-audit.json` and `independent-review.mts` retain the completion evidence. The original execution plan and pending capability snapshots remain historical records; they were not rewritten to conceal the approval sequence.
## RP03 / RP04 — Session preparation and result interpretation
Owner continuation on October 27 authorized these two follow-ups; planning commit `76eb1b12` records their scope. RP03 (`d2b78eac`) adds an explicit declared-session choice to the existing stored-EOD preparation panel and API. RP04 (`302ba60e`) shows retained UTC evaluation bounds and exact elapsed calendar duration beside canonical metrics, explains CAGR's 365-calendar-day extrapolation, and distinguishes periodic-statistics annualization. No financial calculations, dataset hash format, risk policy or native execution semantics changed.
Session selection intersects the chosen series' declared calendar with its bounds, reads each window sequentially through the existing strict reader, snapshots returned values before another read and assigns global deterministic ordinals. The default continuous query and response remain compatible. Missing sessions, invalid selected rows and partial bars fail; no rows are coerced or post-filtered. The web client checks the echoed selection, fences stale responses and retains/retries the captured input and hash without source rereads. [Usage and limitations](../backtest-datasets.md#stored-eod-preparation-across-declared-sessions-v2).
Independent backend and frontend reviews accepted RP03. The backend's 44 focused tests / 361 assertions plus eight adversarial probes covered selected-calendar identity, invalid/empty windows, cancellation and mutation isolation. Independent frontend review passed 96 tests / 361 assertions covering selection echo, stale replies and retention locking. RP04's independent review passed 21 UI tests / 157 assertions; the duration formatter uses retained reporting facts and preserves all stored metrics/null reasons and the fills-only view. Root-authored PostgreSQL/browser tests were also independently reviewed.
Actual read-only AAPL five-minute source validation used explicitly declared October 1 and 2 windows, each 13:30–20:00 UTC:
| Evidence | Result |
| --- | --- |
| Continuous source query | 157 rows; preparation rejects the interior October 1 20:00 null-volume marker |
| Declared-session preview | Exactly two strict-reader queries; 156 unchanged bars, 78 per session |
| Repeated preview | Exact input rows, global ordinals and v2 hash reproduced |
| Raw selected capture SHA256 | `7e2925c8c97bcbb01406efdb5a5a8557c2135c0a1f28aa557c7ccf0e6f8dd067` |
| Prepared dataset hash | `3b2411cecc4014e7090f04d4220732968aec1a58041fce82b7149765d9ba00a3` |
| Independent actual-source validation | 2,366 assertions passed; no retention, database writes or research runs |
Ignored local evidence and the reproducible validator are under `.data/research-pilots/aapl-20241001-02-preparation/`. The calendar/action metadata explicitly declares engineering validation scope; eligibility means contract validity, not certified market coverage. Sequential reads are not an atomic database snapshot. Captured values define the eventual dataset; cancellation fences later reads/results but does not interrupt an already dispatched Mongo query. This two-session check is not evidence of strategy performance, market-data vintage or general completeness.
Combined checkout gates:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,266 integration and 150 Rust tests; 14 conditional integration skips and 4 ignored Rust measurement tests remain. Build, application/contract types, lint and secret audit passed.
- Relevant disposable PostgreSQL suites (`stored-dataset-preparation`, `dataset-source-preparation`, `canonical-research`): 14 passed / 169 assertions. Preview writes nothing; retention after source changes and retries save one exact dataset, with unrelated tables unchanged.
- Full Chromium workbench: 20 passed / 685 assertions. New coverage checks both displayed UTC windows, exact source queries, captured-input retention after source removal, unchanged template/no runs or dispatch, and the actual-native result horizon/CAGR explanation.
- Authored application/test types, focused zero-warning lint, production frontend build, formatting and diff checks passed. No development data was used as a mutable test fixture.
The initial sandbox checks could not reach fixture ports/launch Chromium or complete native workers. Authorized reruns passed. One browser attempt also overlapped the general frontend build and picked up the wrong API target; it was stopped, then the complete browser suite passed after serializing builds. Those interrupted attempts are not counted as successful validation. Logs: `/tmp/stock-bot-rp03-root-check-escalated.log`, `stock-bot-rp03-postgres.log`, `stock-bot-rp03-browser-final.log`, `stock-bot-rp03-root-test-types.log` and independent `stock-bot-rp03-*-review*.log` / `stock-bot-rp04-independent-review.log`.
Both stories are accepted. All 69 scheduled tasks are complete; seven conditional tasks and four merged redirects remain in the 80-ID manifest. Performance work, CL21 and paper/live activation remain deferred.
## RP05 / RP06 — Retained dataset reuse and settings custody
Owner continuation authorized two independently verified workflow corrections, recorded in planning commit `5319bd1b`. RP05 (`6d549542`) fixes the canonical picker's first-page-only limitation; RP06 (`c838e3d0`) fixes loss of settings and preparation on same-backtest tab changes. The backend, database schema and Rust financial behavior are unchanged. [Workbench usage](../backtest-datasets.md#reusing-a-retained-dataset-in-the-web-workbench).
RP05 uses existing paginated catalog and exact-hash endpoints. Load-more preserves prior choices and retries a failed page at the same offset; refresh and retention fence stale requests. The deliberate hash action verifies identity/availability before saving. Catalog/detail parsing now rejects malformed successful responses while preserving valid unavailable entries and converted v2 manifests with parent hashes. Browsing and typing a lookup do not save a template or submit a run.
RP06 first reproduced the baseline defect: an edited name reverted after Settings → Runs → Settings. Settings now mount only after the first visit and stay hidden across tabs and index/run routes for that backtest. Captured source input and ambiguous-retention retry remain owned by the editor; changing backtest ID disposes it and fences old completions. Explicit discard and saved-definition replacement retain their behavior. Hidden controls are excluded from accessible role queries. This is in-memory same-backtest preservation, not persistent draft recovery or a general navigation guard.
Independent reviewer `/root/review_cleanup_backend` accepted both changes: RP05 29 workbench tests / 245 assertions plus eight independent transport probes; RP06 45 lifecycle tests / 279 assertions. Implementer focused suites passed 119 / 570 and 198 / 967 respectively. Reviewer `/root/review_cleanup_frontend` independently checked root's browser fixtures and usage documentation. That review caught a fixture timestamp UPDATE forbidden by the evidence-immutability trigger; the fixture now sets ordering on initial INSERT and verifies custody through the normal retention helper, without altering the trigger.
Combined validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,279 integration and 150 Rust tests; existing 14 conditional integration skips / 4 ignored Rust measurements remain. Build, types, contract checks, strict lint and secret audit passed.
- Chromium full workbench run: 20 scenarios passed. The new dataset-reuse scenario correctly remained unable to save because its test omitted the existing explicit strategy-parameter validation step. After adding that step to the test, its focused rerun passed with 13 assertions. Together these cover all 21 scenarios; no application change followed the full browser run. The initial full invocation is not reported as an all-pass run.
- The new browser scenario inserts 52 distinct valid older snapshots in its disposable schema, selects a hash absent from the first page, loads the older page, saves the verified dataset and reopens it. It asserts zero runs and dispatch records.
- The retention browser scenario commits through the actual HTTP/database route, deliberately loses the response, changes tabs and retries the identical input/hash after removing the fixture source rows. Exactly two original session reads remain; the saved template and run/dispatch counts do not change. The actual-native smoke preserves an unsaved name across index-to-run navigation while the persisted definition remains unchanged.
- Application and authored-test types, focused lint, formatting/diff checks and production frontend build passed. The browser used isolated PostgreSQL/Redis fixtures, removed after validation. No development dataset, research execution or paper/live state was changed.
Logs: `/tmp/stock-bot-rp05-root-check.log`, `/tmp/stock-bot-rp05-browser.log`, `/tmp/stock-bot-rp05-browser-focused.log`, `/tmp/stock-bot-rp05-root-test-types.log`, and `/tmp/stock-bot-rp06-baseline-regression.log`. Current manifest: 71 accepted scheduled tasks, seven deferred conditional tasks and four merged redirects, 82 IDs total. No conditional performance or monitoring work was activated.
## RP07 — Retained dataset export for local research
Owner continuation on October 27 authorized this follow-up; planning commit `43ea2cc9` records the frozen API/UI contract. Existing catalog endpoints returned descriptors without bars, forcing local exploration to reach into the database. The new `GET /api/v2/datasets/canonical/:hash/export` reuses `readCanonicalDataset` once to return the validated full v2 `{manifest,bars}` snapshot. It preserves canonical identity, converted parent hashes, timestamps, availability delays, source ordinals and null VWAP. JSON formatting and downloaded-file byte hashes are not dataset identity guarantees.
Implementation commit `b959779a` is accepted. The manifest now contains 72 completed scheduled tasks, seven deferred conditional tasks and four merged redirects: 83 IDs total.
The loader's typed rejection extends its existing request-error base, preserving admission/catalog catches and messages. Invalid, missing, corrupt/mismatched and unsupported datasets return 400, 404, 409 and 422 respectively; unexpected errors are sanitized. Route-handled responses are no-store/nosniff, and only validated success receives an attachment filename. Cancellation fences delivery. Existing authentication is unchanged; tests use the real research-credential resolver to prove dataset routes remain unavailable to research-agent tokens.
A shared download action appears for a verified setup selection and full canonical results. Result downloads use the original immutable request hash, independently of the editable template. The browser checks the response envelope/identity, preserves the received text, supports retry, prevents duplicate clicks and fences pending bodies on hash change/unmount. Full content/hash validation stays on the server; there is no browser financial engine or new export format. [Usage](../backtest-datasets.md#downloading-a-retained-snapshot-for-local-exploration) covers VS Code/notebook inspection and the existing CLI importer.
Independent backend review accepted both implementation halves: 66 focused tests / 591 assertions and 25 additional transport/authentication probes passed. The reviewer also accepted root's PostgreSQL/browser fixtures; independent frontend review accepted the usage documentation. Implementer checks passed application/authored-test types, strict lint and production builds.
Root validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,316 integration and 150 Rust tests. Existing 14 conditional integration skips and 4 ignored Rust measurements remain. Build, types, contract checks, strict lint and secret audit passed.
- Disposable PostgreSQL: 14 tests / 183 assertions across dataset-source preparation, stored-source preparation and canonical research. The actual export performs one payload read; its received JSON validates, is imported through the real CLI twice, and leaves every fixture table unchanged. Unsupported/corrupt retained rows return no attachment.
- Root-authored browser/PostgreSQL test typecheck and formatting/diff checks passed.
- Chromium: all 21 workbench scenarios passed with 721 assertions. Actual downloaded files from a verified selection and a reopened native result validate in full. The latter's template is deliberately changed to a distinct retained dataset first; export still delivers the original run dataset and leaves the replacement settings, one run and one dispatch unchanged. The fills-only view exposes no download action.
Logs: `/tmp/stock-bot-rp07-root-check.log`, `/tmp/stock-bot-rp07-postgres.log`, `/tmp/stock-bot-rp07-browser.log`, `/tmp/stock-bot-rp07-root-test-types.log`, `/tmp/stock-bot-rp07-api-independent.log` and `/tmp/stock-bot-rp07-ui-independent.log`. Tests use disposable PostgreSQL/Redis fixtures; no development research runs or paper/live operations were performed. Export retains the existing eligible single-asset/single-series gate. Performance, monitoring and conditional replay extraction remain deferred.
## RP08 — Original run result download
Implementation `e8a6b709` and fixture correction `8e9d0cf6` are accepted. The manifest now contains 73 completed scheduled tasks, seven deferred conditional tasks and four merged redirects: 84 IDs total.
Owner continuation authorized a small companion to the dataset download; planning commit `dd1545b9` records the scope. The full canonical result view now offers **Download run result**, saving its already loaded `CanonicalRunResult` as `run-<runId>.json`. It serializes the entire original object, preserving decimal strings, null metric reasons, financial views, analytics and admitted request/build provenance. There is no new API, request on click, financial calculation or upload format.
The existing results service validates stored financial content and request/analytics identity; the existing monitoring hook binds it to the selected run/backtest. The new action reuses that ownership instead of introducing another loader or validator. A private per-run component owns local error/retry state. A 15-line JSON-text download helper is shared with RP07, preserving its raw text, cancellation and resource cleanup behavior. Legacy and fills-only views remain unchanged.
Independent reviewer `/root/find_research_followup` accepted the implementation and root browser test: 64 focused UI tests / 457 assertions passed independently and in the implementer worktree. The existing canonical report fixture verifies complete JSON equality, unchanged input, distinct run filenames/contents, zero extra requests, error reset and URL/click failure retry with cleanup. No duplicate financial fixture or download framework was added. Review corrected two guide details: orders are under `financial.view`, and the button says **Retry run result download**. [Usage](../guide/backtest-walkthrough.md#take-the-result-into-a-notebook-or-local-ai-workflow) explains local inspection and the separate dataset/runtime requirements for replay.
Root validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,320 integration and 150 Rust tests. Existing 14 conditional integration skips / 4 ignored Rust measurements remain. Build, types, contracts, strict lint and secret audit passed.
- Authored Chromium-test typecheck and formatting/diff checks passed. Implementer application/authored-test types, focused strict lint and production build also passed.
- Final Chromium suite: all 21 scenarios passed with 726 assertions. An actual result file deep-equals the original API response after the editable template changes dataset. Downloading issues zero additional API requests and leaves the replacement settings, run and dispatch counts unchanged. The existing dataset download also passes through the shared helper.
The first full browser invocation passed 20 scenarios but failed the archive scenario during fixture shutdown (`pendingWebSockets=1`, no tracked sockets). All archive application assertions completed; the shutdown failure repeated in isolation. The fixture now returns WebSocket upgrades synchronously while keeping ordinary HTTP handling asynchronous. The focused archive test and then the complete suite passed; original cleanup deadlines/errors remain enforced. No timing probes or timeout increases were retained, and the production server wrapper was not changed. This is observed fixture validation, not a claim that a Bun internals defect has been proven or a production reliability issue fixed.
Logs: `/tmp/stock-bot-rp08-root-check.log`, `/tmp/stock-bot-rp08-root-test-types-final.log`, `/tmp/stock-bot-rp08-browser.log` (initial failure), `/tmp/stock-bot-rp08-browser-archive-sync.log`, `/tmp/stock-bot-rp08-browser-final.log` and `/tmp/stock-bot-rp08-independent.log`. Browser tests use disposable PostgreSQL/Redis fixtures. No development research runs, paper/live operations or deferred optimization were activated.
## RP09 / RP10 — Strategy custody and experiment recovery
Implementation commits `49da701a` (RP09) and `f0e7d074` (RP10) are accepted. The manifest now contains 75 completed scheduled tasks, seven deferred conditional tasks and four merged redirects: 86 IDs total.
Owner continuation authorized two reproduced workflow corrections; planning commit `c24410e5` freezes their scope. RP09's baseline UI tests showed **Use in backtest** navigating away during pending and lost-response clones without consulting the discard confirmation, losing the route's retry receipt. RP10's baseline hook/editor tests showed a missing linked backtest hiding a successfully loaded catalog of valid alternatives.
RP09 reuses existing parent state to block backtest handoff until publication/clone work is finished or cleared. It prevents competing publication and clone operations in both UI orders; normal validated parameter transfer and the existing metadata confirmation remain unchanged. There is no new modal, router blocker, persistence mechanism or backend change. The browser's deliberately abandoned routes retain their existing behavior; this correction is scoped to handoff and competing operations. [Usage](../guide/strategy-development.md#from-source-code-to-a-saved-candidate).
RP10 publishes the valid catalog before attempting an optional linked-template lookup and reports that lookup's failure separately. The unavailable selection remains explicit; choosing another template keeps the name and parameter grid. Retry and pagination preserve the current ownership fences and canonical eligibility filter. No automatic selection, save, preview or submission was added. [Usage](../guide/backtest-walkthrough.md#grow-one-run-into-a-research-workflow).
Independent reviewer `/root/review_recovery_changes` accepted both implementations and root's browser fixtures: RP09 29 focused tests / 199 assertions; RP10 38 / 207. RP10's implementer also passed 193 tests / 784 assertions across five suites with a temporary browser-origin preload for existing static browser-parser imports. That preload was not needed for the independent focused suite or root's full repository gate; no test harness workaround was committed.
Root validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,334 integration and 150 Rust tests. Existing 14 conditional integration skips and 4 ignored Rust measurements remain. Build, types, contracts, strict lint and secret audit passed.
- Root-authored browser tests passed TypeScript checking after correcting a fixture-only array-index assertion. Implementer application/authored types, strict lint, formatting and production builds passed.
- Chromium: 20 scenarios passed in the full invocation. The augmented clone scenario completed the receipt-recovery checks but failed a fixture assertion that assumed no earlier parent-linked revision existed. The catalog automatically links a new publication to the latest family version when no parent is supplied. The corrected test snapshots that count and requires exactly one additional version; its focused rerun passed with 50 assertions. Together these cover all 21 scenarios; the initial full invocation is not reported as all-pass. No application code changed after it.
- The clone browser regression delays the actual committed response, verifies blocked handoff, loses that response and retries through the existing route. Both attempts use the same body/key and recover the same original version; normal parameter handoff and saved-draft behavior remain covered. The independent reviewer accepted the count correction after checking the catalog's default lineage behavior.
- The experiment browser regression opens a real missing-UUID link, observes 404, keeps another valid template selectable and preserves name/grid when it is chosen. It checks unchanged template and zero experiments/runs/dispatch records before explicit preview, then completes the existing durable experiment workflow.
Logs: `/tmp/stock-bot-rp09-rp10-root-check.log`, `/tmp/stock-bot-rp09-root-test-types-final.log`, `/tmp/stock-bot-rp09-rp10-browser.log`, `/tmp/stock-bot-rp09-browser-clone-final.log`, `/tmp/stock-bot-rp09-independent.log` and `/tmp/stock-bot-rp10-independent.log`. Browser tests use disposable PostgreSQL/Redis. No development research runs, paper/live operations or conditional optimization were activated.
## RP11 / RP12 — Partial-read recovery
Planning commit `f4cee5af` scopes two verified UI defects. Implementation commits `32f40ee7` (RP11) and `a050c710` (RP12) are independently accepted. The manifest contains 77 completed tasks, seven deferred tasks and four merged redirects: 88 IDs total.
RP11 retains a verified exact hypothesis/revision link when another hypothesis history fails. An incomplete lookup without a match remains retryable through project refresh; a fully checked history without a match reports absence. Existing ownership checks and stale-response fencing remain. The browser advances the cited hypothesis, creates an unrelated hypothesis, fails only that unrelated history read, then opens the original cited revision and its original proposition.
RP12 renders current run records immediately and loads each completed result independently. Status polling preserves unchanged reads; slow or failed metrics cannot hide saved runs. Failed reads offer a row-local retry, and removed, changed-parent or unmounted requests lose ownership. A small component-local request map coordinates this lifecycle. The browser delays an actual completed result, opens another saved run while the first read remains pending and verifies unchanged saved-run IDs/statuses. No API, shared table, financial semantics or global cache changed.
Both baseline probes failed before implementation. Independent reviewer `/root/review_recovery_changes` accepted RP11 with 20 focused tests / 90 assertions and RP12 with 41 / 344, plus both browser additions. Tests include partial failure, retry, status polling, identity checks and late-response ownership.
Root validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,347 integration and 150 Rust tests. Existing 14 conditional integration skips and four ignored Rust measurements remain. Build, application types, contracts, strict lint and secret audit passed.
- Complete Chromium suite: 21 scenarios passed, zero failures, 750 assertions. Fresh disposable PostgreSQL/Redis fixtures were used. Both new regressions passed in this full invocation.
- Authored test types, scoped formatting and diff checks passed. Implementer package-local declaration checking initially encountered the existing `paperApi.ts` TS4023 issue; repository typechecking and the proper no-emit application check passed. No workaround was committed.
Logs: `/tmp/stock-bot-rp11-baseline.log`, `/tmp/stock-bot-rp12-baseline.log`, `/tmp/stock-bot-rp11-independent.log`, `/tmp/stock-bot-rp12-independent.log`, `/tmp/stock-bot-rp11-rp12-root-check.log`, `/tmp/stock-bot-rp11-rp12-browser-types.log` and `/tmp/stock-bot-rp11-rp12-browser.log`. No development research execution, paper/live activation or conditional performance work was performed.
## RP13 — Isolated candidate reproduction
Planning commit `8807d9e5` scopes the browser/backend contract mismatch; implementation `773314d2` is accepted. The manifest contains 78 completed tasks, seven deferred tasks and four merged redirects: 89 IDs total.
The backend already permits eligible isolated candidates without a human review, including reproduction with a null review receipt. The browser incorrectly required a current approval receipt for every available preview. RP13 applies that requirement only to built-ins, preserves strict candidate runtime/request validation and displays absent versus unavailable review information accurately. Backend eligibility, revocation, original input custody and financial semantics are unchanged.
The baseline actual component/transport probe failed with a schema-valid candidate preview. Independent reviewer `/root/review_recovery_changes` accepted 41 UI/API tests / 238 assertions, including reviewed/unreviewed candidates, missing built-in approval, unavailable/revoked candidates, malformed execution data, identity checks and exact-source/key retries.
Root validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,358 integration and 150 Rust tests. Existing 14 conditional integration skips and four ignored Rust measurements remain. Build, application types, contracts, strict lint and secret audit passed.
- Focused `test/postgres/isolated-candidates.test.ts` candidate retry/reproduction case: passed, 8 assertions. This exercises retained candidate inputs after template edits, null-review admission, native economic matching, revocation and recovery of an already accepted receipt. Five unrelated cases were excluded by the name filter.
- Complete Chromium suite: all 21 scenarios passed, zero failures, 770 assertions. The added flow reproduces an actually unreviewed controlled candidate through the durable isolated runner, recovers the same run from its receipt, verifies original strategy/runtime/dataset and analytics, reopens the economic-match result and confirms zero review records before and after reproduction. The existing built-in reproduction and later human-reviewed promotion fixtures also passed. These are disposable test records, not real trading activation.
- Application and authored test types, scoped lint/formatting and diff checks passed. An additional economic-comparison suite could not load `zod` in the isolated implementation worktree; all four comparison cases passed in the root full check. No dependency workaround was committed.
Logs: `/tmp/stock-bot-rp13-baseline.log`, `/tmp/stock-bot-rp13-independent.log`, `/tmp/stock-bot-rp13-comparison.log`, `/tmp/stock-bot-rp13-root-check.log`, `/tmp/stock-bot-rp13-root-test-types.log`, `/tmp/stock-bot-rp13-postgres.log` and `/tmp/stock-bot-rp13-browser.log`. PostgreSQL/Redis were fresh disposable fixtures. Conditional performance work and development/paper/live execution remain inactive.
## RP14 — Backtest creation navigation
Planning commit `cf04fb36` scopes the verified dialog-owned navigation defect; implementation `0d022ecc` is accepted. The manifest contains 79 completed tasks, seven deferred tasks and four merged redirects: 90 IDs total.
The creation dialog's Close controls already protected an edited draft or pending Save, but its immutable-strategy link bypassed both rules. A dialog-local click capture now reuses the same pending ref and discard confirmation for ordinary same-tab links. Clean and deliberately confirmed navigation still works; modified/middle clicks, explicit new contexts and already-prevented events retain their behavior. The shared selector, router, backend and financial contracts are unchanged. This correction covers links inside the creation dialog, not global navigation.
Both original baseline probes failed on `dcffa2ea`; three new regression cases also failed before the fix. Independent reviewer `/root/review_recovery_changes` accepted 72 focused backtest/strategy UI tests / 488 assertions. Coverage includes exact draft preservation, accepted/clean navigation, Save plus link before rerender, pending ownership, failed-save confirmation, new-context defaults and existing Close/unmount behavior.
Root validation:
- `CARGO_BUILD_JOBS=2 bun run check`: passed — 134 tooling, 43 utility, 44 calculation, 1,364 integration and 150 Rust tests. Existing 14 conditional integration skips and four ignored Rust measurements remain. Build, application types, contracts, strict lint and secret audit passed.
- Complete Chromium suite: 21 scenarios passed, zero failures, 783 assertions. The catalog workflow declines navigation and preserves its draft, then holds the real save response after the database commit. Clicking the strategy link while pending neither navigates nor prompts; releasing the response opens that exact saved definition with original parameters. Exactly one definition and zero runs/dispatches are verified.
- Application and authored test types, focused lint/formatting and diff checks passed. The browser fixture waits for the initial backtest catalog read to finish before delaying the save, so that unrelated read cannot consume its delay.
Logs: `/tmp/stock-bot-rp14-baseline.log`, `/tmp/stock-bot-rp14-red.log`, `/tmp/stock-bot-rp14-independent.log`, `/tmp/stock-bot-rp14-root-check.log`, `/tmp/stock-bot-rp14-root-test-types-final.log` and `/tmp/stock-bot-rp14-browser.log`. PostgreSQL/Redis were fresh disposable fixtures. No development research execution, paper/live activation or conditional performance work was performed.
## RP15 / RP16 — AI client recovery and candidate revisions
Planning commit `14b28a34`; accepted implementations `e3d6512b` (RP15) and `cc49f038` (RP16). The manifest now contains 81 completed tasks, seven deferred tasks and four merged redirects: 92 IDs total.
RP15 preserves the exact structured `ResearchCycleStopped` event at the executable error boundary when receipt persistence fails. Cleanup failure cannot replace the original recovery event. Rejected operations retain their original uncertainty; failures before admission do not invent accepted receipts. The journal remains exclusively created, execution stops with exit 1, and no automatic retry or alternate journal is introduced.
RP16 fixes a client/catalog contract mismatch: a null publication parent asks the catalog to select its latest version, rather than requiring the response parent to remain null. Explicit parents still require an exact match. Existing schema, candidate origin, family and package checks remain. Receipt retries use the original body/key and recover the original lineage even after newer publications.
Independent reviewer `/root/review_recovery_changes` accepted both patches: RP15 had 26 client/cycle tests / 164 assertions, including seven actual CLI subprocess regressions without network access; RP16 had 22 client/cycle tests / 138 assertions. These isolated counts overlap and are not additive. The real-agent PostgreSQL lineage regression failed before the fix, then the complete authenticated AI workflow suite passed **3 tests / 148 assertions**, including native execution and quota/evidence rejection. The added case verifies automatic and explicit parents, delayed receipt replay, exactly four versions and zero research runs from publication alone.
Root `CARGO_BUILD_JOBS=2 bun run check` passed: **144 tooling, 43 utility, 44 calculation, 1,364 integration and 150 Rust tests**. Existing 14 conditional integration skips and four ignored Rust measurements remain. Build, application and authored test types, contracts, lint, formatting, diff check and secret audit passed. No browser suite was rerun for these script-only changes. The PostgreSQL fixture was disposable and stopped afterward.
Evidence: `/tmp/stock-bot-cycle-journal-probe/`, `/tmp/stock-bot-rp16-regression-red.log`, `/tmp/stock-bot-rp15-independent.log`, `/tmp/stock-bot-rp16-independent.log`, `/tmp/stock-bot-rp16-postgres.log`, `/tmp/stock-bot-rp15-rp16-root-check.log`, `/tmp/stock-bot-rp15-rp16-types.log` and `/tmp/stock-bot-rp15-rp16-lint.log`. Development research execution, paper/live activation and conditional performance work remain inactive.
## RP17 — Candidate parameter defaults
Planning `f185f2e2`; accepted implementation `1502ab41`. The manifest contains 82 completed tasks, seven deferred tasks and four merged redirects: 93 IDs total.
Two comparisons rejected supported empty/partial candidate inputs. The response decoder compared a normalized training child with raw root parameters; SQL29's admission guard made the same assumption about the source preview. The first was verified with real builders/service readers and read-only rows, while actual authenticated PostgreSQL submission proved the second failed before admission with SQLSTATE 23514. These are distinct baseline observations.
The decoder now uses its already validated phase parameters: normalized training request or frozen holdout winner. Forward migration `32-candidate-parameter-defaults.sql` expands only declared defaults and overlays explicit caller values for the SQL comparison. It retains every other admission guard, leaves built-in template equality unchanged, and performs no row writes. Original root inputs, hashes, receipt keys and child generation are preserved. Migration 32 is included in the existing additive startup allowlist; development databases were not changed during verification.
Independent reviewer `/root/review_recovery_changes` accepted both corrections, with 40 focused tests / 297 assertions. Review caught an operator-precedence issue in the initial SQL expression; the real API tests reproduced it, and explicit parentheses resolved it before acceptance. Direct guard tests reject changed explicit/default values, malformed or undeclared parameters, forged package defaults and altered built-in parameters. Applying the migration twice preserves existing experiment, run and strategy-version rows.
Root validation passed:
- Full repository check: 144 tooling, 43 utility, 44 calculation, 1,371 integration and 150 Rust tests; existing 14 integration skips and four ignored Rust measurements remain. Build, application types, contracts, lint and secret audit passed.
- Authenticated AI workflow and migration startup suite: 9 tests / 217 assertions. Empty and partial inputs survive admission, reopen and exact retry without duplicate runs. The full native AI cycle uses a partial candidate through training, holdouts, saved findings and costs. Startup concurrency, rollback and historical-data preservation remain covered.
- Direct SQL guard/upgrade tests: 2 tests / 25 assertions. Complete browser suite: 21 scenarios / 785 assertions, including reopening partial-default validation and its sealed report.
- Authored test types, scoped lint/formatting and diff checks passed. Isolated worktree execution hit the known `zod/index.js` packaging read failure; the same direct SQL tests passed in the fully built root checkout. No dependency workaround was committed.
Logs: `/tmp/candidate-validation-defaults-probe.log`, `/tmp/stock-bot-rp17-defaults-debug.log`, `/tmp/stock-bot-rp17-postgres-initial-sql.log`, `/tmp/stock-bot-rp17-independent-decoder.log`, `/tmp/stock-bot-rp17-independent-phases.log`, `/tmp/stock-bot-rp17-root-check.log`, `/tmp/stock-bot-rp17-postgres.log`, `/tmp/stock-bot-rp17-root-sql-guards.log`, `/tmp/stock-bot-rp17-browser.log` and `/tmp/stock-bot-rp17-root-types.log`. Disposable PostgreSQL/Redis fixtures were stopped. No development research execution, paper/live activation or conditional performance work occurred.
## RP18 — October multi-session pilot
Plan commit `40f00e16` fixed the dataset, financial policy, two-candidate grid, chronological windows and nine-run bound before execution. This is real local research using existing application functionality; no application source changed. The existing SMA version remained approved, and template admission verified the configured dataset and policy. No new catalog review was fabricated and the historical October 1 approval record was preserved.
Local artifacts are under `.data/research-pilots/aapl-202410-month/`, intentionally outside Git: source capture, metadata, exact plan, preparation/repeat, immutable API receipts, original results, scripts, build identity and finding revisions. The source file hash is `1328c9f32a4a1b5a88a67de52c29cba0c7341da53d220d903d0ee41b12f8a793`; predeclared plan hash is `1f5a9d9c9d0cc88f950104121366dbb3af60ab8e2db00dd550b8cceff6380024`. The retained dataset is `9624ee17fd1b7f7b6787226a004704c5c92461355734a6b01891079816ec8e4b`.
The raw capture contains 1,816 rows. Explicit half-open regular sessions select 1,794 unchanged bars, exactly 78 on each of 23 dates. The remaining 22 rows are 20:00 UTC markers with null volume; October 29 has no marker. They remain in the raw capture and are excluded by query bounds, not removed from selected data or coerced. Independent source review passed 25,297 assertions; actual API preparation repeated exactly, including the normalized dataset hash.
Root rendered and visually inspected the [Nasdaq 2024 calendar](https://www.nasdaqtrader.com/content/technicalsupport/2024tradingcalendar.pdf): October has no exchange closure or early-close marks. [Regular hours](https://www.nasdaq.com/market-activity/stock-market-holiday-schedule) give 13:30–20:00 UTC for these dates. Action-free coverage is an inference from [Apple's published dividend/split history](https://investor.apple.com/dividend-history/), not a certified full corporate-action feed. Historical listing is supported by [Apple's June 2024 10-Q](https://www.sec.gov/Archives/edgar/data/320193/000032019324000081/aapl-20240629.htm), [filed August 2](https://www.sec.gov/Archives/edgar/data/320193/000032019324000081/0000320193-24-000081-index.htm); metadata uses August 3 as its listing cutoff. Asset/window selection remains retrospective. [EODHD's intraday documentation](https://eodhd.com/financial-apis/intraday-historical-data-api) describes UTC bar starts and delayed finalization: simulated availability at interval end is an explicit zero-delay assumption, not observed historical vendor arrival. The 2026 snapshot does not establish 2024 data vintage.
Exactly nine runs completed through the existing `BacktestRunner` and `RustBacktestAdapter`, scoped to newly admitted IDs. Replaying six accepted submission receipts retained exactly those nine IDs. Baseline, exact reproduction and the cost experiment's baseline have identical economic hash `7574c19ff41fa0d1cd01d08c7a71dea99f456276214bcb3b740bf8ee122f1199`. The native binary hash remained `df0ecbd5c3772d7e8aeb0226b40ae290cfaddf9d87fb3a7375f2a31c2acf05e5`; complete worker/wrapper/lock/runtime identities are retained in `execution-provenance.json` and every request.
All accounts start at USD 10,000 with the unchanged USD 1,000 owner budget. Returns below use total account capital, not only deployed strategy capital. Training uses October 2–11, validation October 14–18 and test October 21–31, with prior-session warmup and fresh accounts. Training total return selected SMA 4/8 over SMA 2/8; neither holdout influenced selection. The baseline and cost scenarios use fixed SMA 3/8 over October 2–31.
| Outcome | Final equity (USD) | Fees (USD) | Account return | Fills | Complete reporting periods |
| --- | ---: | ---: | ---: | ---: | ---: |
| SMA 3/8 baseline, reproduced exactly | 9,810.10157801 | 165.51893827 | -1.898984% | 180 | 21 |
| Training SMA 2/8 | 9,882.93199484 | 92.36706460 | -1.170680% | 102 | 7 |
| Training SMA 4/8, selected | 9,904.04487297 | 76.03153611 | -0.959551% | 84 | 7 |
| Validation SMA 4/8 | 9,977.38710995 | 46.48247089 | -0.226129% | 50 | 4 |
| Test SMA 4/8 | 9,846.01047963 | 109.74987085 | -1.539895% | 118 | 8 |
| Cost baseline SMA 3/8 | 9,810.10157801 | 165.51893827 | -1.898984% | 180 | 21 |
| Zero fee/slippage, spread retained | 9,964.80450548 | 0.00000000 | -0.351955% | 262 | 21 |
| Stressed fee/slippage 0.002/0.0005 | 9,805.24661534 | 152.09169682 | -1.947534% | 84 | 21 |
Baseline and stressed-cost runs finished with the configured USD 200 drawdown halt latched; zero fee/slippage did not. Their last observed fills were October 24 13:35, October 11 17:45 and October 31 19:40 UTC respectively. Compact results expose final risk state and fill times, not complete rejection/event histories: exact first halt times and rejection counts are unverified. These are cost-dependent trading paths under risk constraints, not fees subtracted from a common trade list. The fixed-baseline cost study is not a cost validation of the selected winner.
Reporting samples account session openings; the final close is partial. The verified complete counts 21/7/4/8 are not close-to-close daily returns. Accounts reset across phases, so phase returns must not be compounded into one portfolio. Annualized metrics and sampled drawdown are excluded from strategy-quality conclusions. One retrospectively chosen asset/month and two candidates cannot establish alpha, significance or regime robustness. The test interval is now inspected; subsequent strategy changes need genuinely fresh holdouts.
Saved identities and web reopening:
- Project `d4687b34-24cd-4ead-ab2b-d0d71afef153`; backtest `faab4e06-60d1-4d54-a570-41cb1f5ff9cc`; baseline run `5a77c377-4e37-4396-97fc-d60b622d993b`; reproduction `3ceccd32-e562-40e0-a165-8d972663b5c2`.
- Validation `fbdc6b2f-1a39-47e4-af2b-889b57585082`; report `1e0e9150-a903-48f0-88a2-7c2e9a2aba11`, hash `784b7390c7d36ccd679d7c8aa1d8f1816201a2500dabd3862f5553e68329d3e0`; cost experiment `800bd042-b5f3-4152-ad91-7b36ee756536`.
- Finding `0e8c21bd-ba4a-4499-82a5-2efcd56699c8`, revision 2, retains 18 exact metric references. It remains AI-authored and unvalidated; revision 2 adds the verified risk-state interpretation without replacing original evidence.
- Actual Chromium reopening passed for the canonical result, buy fills, saved validation report/hash, cost trial view and opened finding body, including its risk interpretation and exactly 18 cited-run links. The browser blocked every non-read API request except authentication. `browser-reopened.json` retains exact URLs and assertions.
Independent reviewer `/root/review_recovery_changes` accepted 109,207 assertions over all nine results: exact decimal fill pricing/notional/fees/basis/P&L, cash and owner/equity reconciliation, executed quantity/exposure bounds, raw/dataset/slice/package/build hashes, prior-session warmup, training-only selection, reporting counts and finding references. `independent-review.mts` and `independent-audit.json` retain the checks. This file-only audit does not prove absence of unrelated database writes, reconstruct every rejected/reserved order path or establish absence of all possible leakage. Root also validated manifest references/dependencies/counts and `git diff --check`; the application suite was not repeated because no application code changed. The manifest now records 83 done, seven deferred and four merged IDs (94 total). No paper/live deployment or deferred optimization work was activated. The observed losses supply no positive evidence for promotion; the useful next research step is a predeclared economic hypothesis and fresh unseen coverage, not tuning against this inspected month.
## RP19 — Final risk-state visibility
Planning `7a86b15e`; accepted implementation `e6616fdc`. The pilot exposed a result-interpretation gap: `CanonicalResults` never read `financial.view.risk`. An independent render probe across the three retained cost scenarios produced identical HTML after reversing both halt flags. Four component regressions and the real native browser regression failed on the absent section before the fix.
The overview now displays the authoritative final daily-loss/drawdown flags, exact monetary limits, baseline and peak equity, risk calendar/session and last processed event time. It reads only the retained native view/policy. Copy distinguishes risk-increasing orders from permitted reductions, final inactive state from historical absence, daily-session resets from latched drawdown, and last event time from first halt time. No new request, financial calculation, API/schema/engine change or halt-history reconstruction was introduced. Fills-only rendering is preserved.
Independent reviewer `/root/review_recovery_changes` accepted all 48 component tests / 445 assertions and checked wording against Rust admission/reset semantics. Cases cover all four flag combinations, recovered-equity latches, later daily-session snapshots, empty fills, run changes, exact decimals, no requests/input mutation and fills-only exclusion.
Root verification:
- Full repository check passed: 144 tooling, 43 utility, 44 calculation, 1,378 integration and 150 Rust tests. Existing 14 conditional integration skips and four ignored Rust measurements remain. Build, application types, contracts, lint and secret audit passed.
- Four targeted Chromium scenarios passed, zero failures, 91 assertions: final risk state, canonical native smoke, run-history switching and legacy history. Eighteen unrelated scenarios were excluded by name. The new case executes real halted/unhalted Rust runs against disposable PostgreSQL/Redis, verifies every displayed field against saved results before/after reload, and confirms two unchanged run/dispatch identities and unchanged result payloads.
- Authored-test types, scoped lint/formatting and diff checks passed. Disposable fixtures were stopped after verification.
The initial restricted full-check attempt timed out in native child-worker tests and was interrupted; the permitted rerun passed. The first browser rerun used a manual build without `NODE_ENV=production` and failed at authentication before reaching the panel. Rebuilding with explicit production mode and empty `VITE_API_BASE_URL` restored the existing same-origin fixture setup; the four scenarios then passed. A test-only missing-braces lint error was corrected before acceptance. No application workaround was added for those setup failures.
Logs: `/tmp/stock-bot-post-rp18-result-audit.log`, `/tmp/stock-bot-rp19-red.log`, `/tmp/stock-bot-rp19-browser-red.log`, `/tmp/stock-bot-rp19-independent-ui.log`, `/tmp/stock-bot-rp19-root-check.log`, `/tmp/stock-bot-rp19-root-check-escalated.log`, `/tmp/stock-bot-rp19-browser-green.log`, `/tmp/stock-bot-rp19-browser-final.log`, `/tmp/stock-bot-rp19-root-types.log`, `/tmp/stock-bot-rp19-root-lint.log` and `/tmp/stock-bot-rp19-root-format.log`. The manifest now has 84 done, seven deferred and four merged tasks: 95 IDs. No development research runs, paper/live activation or deferred performance work occurred in RP19.
## RP20 — Production research authentication
The bounded AI-study preflight exposed a production composition defect: normal API startup supplied security without the research resolver, bypassing `createRoutes`' working default. Operator provisioning returned 403 and research bearer authentication was unavailable. Existing test hosts installed their own resolver and missed the startup discrepancy.
Plan `fd90d172`; accepted implementation `7de497e9`. `createWebApiSecurity` now composes the existing resolver once for the running server's HTTP and WebSocket routes and supplies the same default for standalone routes. Explicit supplied-security capabilities remain unchanged. Configuration validation still precedes store initialization; research authentication remains asynchronous HTTP-only, without gaining browser-session, WebSocket, operator or trading privileges. Financial semantics, schemas and native code are unchanged.
Validation:
- Failing baseline captured the extracted production behavior: operator provisioning expected the existing policy-validation 400, but received the erroneous capability 403. Corrected composition passes 21 focused security tests / 175 assertions, independently rerun by `/root/review_recovery_changes`.
- Full `CARGO_BUILD_JOBS=2 bun run check` passed: 144 tooling, 43 utility, 44 calculation, 1,382 integration and 150 Rust tests. Fourteen existing conditional integration cases were skipped and four Rust measurement tests remained ignored; these are not evidence of new isolated-candidate execution.
- Disposable PostgreSQL `test/postgres/research-agents.test.ts`: 13 tests / 143 assertions passed. The production helper and full route factory issue a real token through the operator endpoint, retain only its hash, authenticate scoped AI writes, preserve experiment/trial agent ownership, enforce quota with 429 and no extra admission, and reject after revocation. The original broader concurrency/recovery/budget cases still pass.
- Authored-test types, scoped ESLint, Prettier and diff checks passed. The PostgreSQL container was stopped. No development database test, actual research admission, deployed-process restart or new browser E2E run was performed; existing session/CORS/WebSocket behavior was exercised through its actual route composition.
Two new database assertions initially used the wrong existing contracts: admission is 202 rather than 201, and trial ownership uses `research_agent_id` while experiment submission uses `submission_principal`. Both were corrected against the route and SQL28 contracts; no application change followed. Logs: `/tmp/stock-bot-rp20-baseline.log`, `/tmp/stock-bot-rp20-independent-security.log`, `/tmp/stock-bot-rp20-check.log`, `/tmp/stock-bot-rp20-postgres.log`, `/tmp/stock-bot-rp20-postgres-final.log`, `/tmp/stock-bot-rp20-postgres-accepted.log`, `/tmp/stock-bot-rp20-root-types.log` and `/tmp/stock-bot-rp20-root-lint.log`.
Next, [RP21](backlog/tasks/RP21.md) predeclares a September volatility-filter comparison using the existing bundled mean-reversion candidate and at most ten runs. Only timestamps, counts and missing-volume counts were inspected for that window so far; no September price/return analysis or research submission occurred. Reusing the already-tested isolated artifact avoids new strategy code. The plan labels the earlier-than-October window as retrospective holdout research and keeps all seven conditional tasks deferred.
## RP21 — Bounded volatility-filter study
Completed October 27, 2026 (America/Toronto; runtime receipts extend into October 28 UTC). The predeclaration was committed in `2949680b`; execution claim/source freeze was `86013538`. Both candidate versions use identical existing mean-reversion bundle bytes in OS isolation, with only `regimeFilter` differing. No strategy, indicator, financial-policy or performance optimization was implemented for this study.
The source capture contains 1,580 rows. Exactly 20 session-close null-volume markers fall outside declared half-open sessions; all 1,560 selected bars remain unchanged and pass strict OHLCV/grid validation. Repeated API preparation produces the same dataset. The package and numeric rules were frozen before September prices were captured. September precedes the previously inspected October pilot, so this is retrospective holdout research, not prospective validation or proof against global selection bias.
| Retained identity | Value |
| --- | --- |
| Dataset | `f116a5d8107fe1dba62d7e019167d56df75cc634e3b6b601e5962d39b36e9804` |
| Raw capture SHA256 | `fe26c5981caef9e74a5ce896b6dc428e30fbac204e572bd107b67b0703ba83f9` |
| Strategy source revision | `86013538a15a9153b721ea99ddcad4c6b6beaede` |
| Shared candidate artifact SHA256 | `83a4a9c99dd779a02370efd00a8374f279d5121068950201cdd8cb45245f04d6` |
| Native binary SHA256 | `df0ecbd5c3772d7e8aeb0226b40ae290cfaddf9d87fb3a7375f2a31c2acf05e5` |
| Project / template | `47b266ab-7b26-43a1-afcd-05549a42ea6a` / `58101664-11cd-4a4b-b1a2-6f50aa0d819d` |
| Filtered / control versions | `dd1d183f-fbda-4fd6-85f9-15deab39c79e` / `cb90aeff-9cc9-4ae1-abcd-27b827e724d3` |
| Filtered / control validations | `711c3582-b7ff-4f1b-9530-d481b4e5b3ad` / `54f0528c-fdf4-46ab-a836-ec00950942aa` |
| Filtered / control cost experiments | `e92b2e25-faf4-40c7-8b79-e41722d96a7c` / `7fe11ce2-cd76-481c-aa97-d78ea55f362e` |
| Summary finding | `9a06b519-3b40-4a34-a2ff-56cef093c594` |
All **ten trials completed once**, with no manual retry or replacement run. Each variant used one training run, independent validation/test accounts, and baseline/stressed whole-window costs. Training evaluated September 4–16, validation September 17–23 and test September 24–30; every phase used its declared preceding session as warmup. Each singleton training selection froze its own parameters, rather than selecting between the two variants before holdouts.
The following are native net returns, displayed as percentages (stored metrics are fractions):
| Phase | Volatility filter | Unfiltered control | Complete reporting periods |
| --- | ---: | ---: | ---: |
| Training | −0.245725% | −0.279616% | 8 |
| Validation | +0.052139% | +0.052139% | 4 |
| Test | −0.007529% | −0.008730% | 4 |
| Whole-window baseline costs | −0.201115% | −0.236207% | 18 |
| Whole-window stressed costs | −0.802065% | −0.886521% | 18 |
Filtered/control test equity was `9999.24714560` / `9999.12700558` from capital `10000`. Validation economics match; test executions differ slightly despite equal 12-fill counts. Whole-window baseline fills numbered 48 / 52, with fees `42.92498589` / `46.45098852`. Baseline gross realized P&L was `22.81348996` / `22.83027744`: the filtered variant's higher net result in that window reflects lower assumed fees despite slightly lower gross P&L. This is descriptive accounting, not proof of predictive value.
Within each variant, the baseline and stress scenarios have matching executed timestamps, sides, quantities and instruments, with different prices/fees. All retained terminal marked holdings are zero and final daily/drawdown halt flags are false. Final snapshots do not establish every earlier halt or rejection. No liquidation was invented. Phase accounts reset; returns are not a compounded portfolio. Reporting periods are opening-to-opening, with terminal partial periods, not exchange-close daily returns. Four complete periods per holdout and retrospective single-asset selection do not establish significance, robust alpha or useful annualized performance. The test interval is now inspected; no new tuning/search was authorized by these results.
Three AI-authored, unvalidated findings were saved through the dedicated research credential: two sealed-report findings and the cross-variant conclusion. Their 42 stored scalar references represent 34 distinct run/metric pairs. The credential was revoked after the final write, and its actual budget request returned 401. No paper/live deployment or additional experiment was activated.
Independent `/root/review_recovery_changes` accepted file-only audits of **25,078 input**, **49,406 financial/result**, and **513 closure assertions**. These reconcile exact fixed-eight fills, fees, released basis, ownership, cash/equity/marks, exposure bounds, package/build/policy identities, phase slices and report hashes, single-attempt run inventory, receipt recovery and all evidence references. File audits do not independently prove absence of unrelated database writes or certify vendor availability/action assumptions.
Actual Chromium reopened both test results and fills, both sealed reports and both cost experiments, plus the [project and summary finding](http://localhost:5173/research/47b266ab-7b26-43a1-afcd-05549a42ea6a). It checked report hashes, 30 visible summary evidence links and unchanged saved run rows. The final-risk **section** survived result reload; numerical flags were verified separately from retained native artifacts. The browser blocked all non-read API requests except authentication.
Runtime evidence remains in ignored `.data/research-pilots/aapl-202409-signals/`: immutable predeclaration/package/source, original and continuation journals, requests/results, reopened reports, findings, revocation proof, browser record and independent audit scripts/reports. `execution-status.json` and `execution-summary.json` index the completed work. Source/availability limitations remain those in the committed RP21 task and `evidence.json`.
Pre-execution gates passed: 53 strategy/package/cycle tests / 367 assertions, 14 actual sandbox tests / 58 assertions, and four actual AI workflow tests / 178 assertions using a disposable PostgreSQL database. The first read-only sandbox identity attempt was denied by filesystem permissions and succeeded with the permitted rerun. A helper's wrong validation argument was corrected before any package/data write. No host-execution fallback or rebuild occurred. Logs: `/tmp/stock-bot-rp21-preflight-{strategy,sandbox,ai-workflow}.log`, `rp21-execution.log`, `rp21-recovery.log`, `rp21-close.log` and `rp21-browser.log`, all under `/tmp/stock-bot-`. The initial real admission failure is explained below.
## RP22 — Decimal admission and exact receipt recovery
The first real filtered training submission returned HTTP 500. PostgreSQL's SQL32 guard compared raw `minNotionalVolume: "0"` against the known program's normalized `"0.00000000"`. Existing workflow fixtures supplied already-normalized parameters and missed this valid-input failure. Read-only inspection of the exact principal/key and template established **zero committed experiments and zero runs**; the client preserved its stopped receipt. No candidate outcome was replaced or hidden.
Plan `b51612e5`, implementation `b7116473`. Additive migration33 retains original input/preview hashes and all other guards. It normalizes only the known mean-reversion parameter for comparison, matching the existing plain fixed-eight grammar/range and negative-zero behavior. Arbitrary candidate strings remain literal; malformed, excessive-precision, out-of-range or negative nonzero values are rejected without rounding. Previous migrations and financial engine semantics remain unchanged.
The running development API had already registered migration33 by the time the explicit normal-runner verification executed, consistent with its watch-mode startup. Verification retained the exact installed function and migration hashes, unchanged worker/native identity and zero study runs/receipt before recovery. No historical rows were rewritten.
The original journal and script were preserved. A reviewed local continuation reopened and verified the four acknowledged resources (hypothesis, family, project link, version), returned their saved acknowledgements without new writes, and separately marked them in a new exclusive fsynced journal. Before retrying, it required the same original training body, key and preview hash. Existing `runResearchCycle` then performed the remaining ordinary admissions; its original recipe, numeric parameters, raw `"0"`, ten-trial bound and Rust financial policy stayed frozen. There was no blind CLI restart or new filtered version.
Verification:
- Direct candidate/default and startup migration regressions demonstrate SQL32 rejection with no row changes, then exact-body/key/hash success and replay after SQL33, strict paired-invalid-value rejection, arbitrary-string preservation and migration reapplication without history changes.
- Final combined PostgreSQL gate: **14 passed / 310 assertions**. Independent review noticed the AI fixture initially installed only through SQL32; after adding SQL33 to that fixture, its actual isolated/native workflow reran **4 passed / 178 assertions**. These overlapping runs are not additive test totals.
- Integration: **1,382 passed / 14 existing conditional skips**, 10,415 assertions. Application/authored-test types, contracts, strict lint, formatting, secret audit and diff checks passed. Repository builds and the complete build-driving `check` command were intentionally not rerun during the frozen study; installed worker/native/sandbox bytes stayed unchanged. No Rust source changed.
- Independent source and recovery review accepted the correction and requested the stronger malformed-value tests and explicit AI fixture migration above. The disposable PostgreSQL container was stopped after all gates.
Logs: `/tmp/stock-bot-rp22-postgres.log` (initial 10 / 123), `rp22-postgres-final.log`, `rp22-ai-sql33.log`, `rp22-integration.log`, `rp22-types.log`, `rp22-lint.log`, `rp22-format.log` and `rp22-apply.log`, all under `/tmp/stock-bot-`. All seven conditional tasks remain deferred. RP21 and RP22 are complete; no further study was admitted automatically.
## RP23 — Typed cross-study findings
Plan `27d2bc96`, implementation `8dc8724c`. RP21's summary compared several studies and therefore had no single attached experiment/report. Its custom authenticated POST exposed a client mismatch: `ResearchClient.saveFinding` required a source although the shared API schema permits null or omission. Two client lines now accept those inputs and compare the response against the server's null normalization. Request bodies preserve explicit null versus omission; supplied sources still match exactly.
Canonical, version-specific, nonempty evidence remains mandatory. Values come from completed retained Rust results; findings remain AI-authored and unvalidated. This does not establish comparability or turn a comparison into a sealed report. Existing response identity, availability, project authorization and uncertain-write behavior remain enforced. No backend/schema, financial engine, candidate isolation or cycle recovery behavior changed. README documents the existing client method; no new API or framework was added.
Verification:
- Both new null/omitted-source cases failed at the original truthiness guard before the fix. Client/cycle tests then passed **34 / 294 assertions**, independently repeated by `/root/review_recovery_changes`.
- Complete tooling suite: **149 passed / 14,250 assertions**, zero failures. This includes the focused cases above; counts are not additive.
- Actual authenticated PostgreSQL/isolated-native workflow: **4 passed / 215 assertions**. The comparison regression reused two existing successful candidate versions, saved/reopened both null and omitted-source findings, compared native metric/version/dataset identities and confirmed no additional runs. Missing/failed runs, incorrect versions and ungranted projects were rejected without new artifacts. The disposable database was stopped after verification.
- Authored-test/application types, contracts, explicit scoped ESLint, formatting, secret audit and diff checks passed. The initial lint invocation warned that scripts were ignored; rerunning with `--no-ignore` checked them successfully. No full build or full integration-suite rerun was needed for this client-only correction.
Logs: `/tmp/stock-bot-rp23-client-red.log`, `rp23-client-cycle-green.log`, `rp23-independent-client.log`, `rp23-postgres.log`, `rp23-tooling.log`, `rp23-authored-types.log`, `rp23-typecheck.log`, `rp23-contracts.log`, `rp23-lint.log`, `rp23-format.log` and `rp23-secrets.log`, all under `/tmp/stock-bot-`. Independent review accepted the source, test coverage and final gates. RP21's real findings were not rewritten and no new real-data research was executed. The seven conditional tasks remain deferred; generic CLI resume was not introduced.
## RP24 — Single-run finding acknowledgements
Plan `2da899da`, implementation `f80ae2f3`. The web dialog verified returned evidence identities only for findings attached to an aggregate experiment/report. A single-run finding has null aggregate context, so even an empty or substituted citation list appeared saved. A missing list could crash the evidence view. Nine focused cases reproduced those failures before the source change.
The existing verification now applies to every finding. It compares selected run, metrics version, metric path and strategy version, plus aggregate source identity. Absent/null source and absent/null historical strategy versions normalize consistently with existing server responses; canonical versions remain exact. Unverifiable acknowledgements preserve the draft and use the existing uncertain-save controls. The browser displays server-resolved values and performs no financial recalculation. The older canonical success fixture now contains the actual selected references instead of an empty list.
Verification:
- Finding/source UI suites: **62 passed / 328 assertions**, including missing/empty/extra and substituted citations, source mismatches, canonical null/omitted source, legacy null/omitted version, report findings and draft custody.
- Complete production-built Chromium workbench: **23 passed / 852 assertions**, zero failures. The new scenario executes one native fixture run and commits one actual finding, strips evidence only from the acknowledgement, verifies the blocked draft and single POST, then reopens/reloads the original correct finding. Runs/dispatch/artifacts remain 1/1/1. Existing real single-run, report, legacy-history and isolated-candidate workflows also pass. The browser fixture now includes the already accepted SQL33 migration.
- Web production build, application/authored-test types, contracts, strict scoped lint, formatting, secret audit and diff checks passed. Root reviewed the correction against canonical and historical response shapes. No independent agent review, full repository check or full integration-suite rerun is claimed. The build retains the existing nonblocking Vite chunk-size warning.
Logs: `/tmp/stock-bot-rp24-red.log`, `rp24-ui.log`, `rp24-browser.log`, `rp24-typecheck.log`, `rp24-authored-types.log`, `rp24-contracts.log`, `rp24-lint.log`, `rp24-format.log` and `rp24-secrets.log`, all under `/tmp/stock-bot-`. Browser records use disposable stores; their PostgreSQL and Redis containers were stopped after verification. No saved real study was edited or new real-data research admitted. All seven conditional tasks remain deferred.
## RP25 — Typed artifact and history reads
Plan `f9b97c30`, implementation `e39989c4`. AI callers can now reopen saved findings/notes with `ResearchClient.artifact(id, signal?)` and their immutable histories with `artifactRevisions(id, signal?)`. These use the existing authenticated GET endpoints. The original saved revision ID selects the original interpretation even after later edits; README documents checking for its presence instead of substituting latest.
Read decoders preserve ownership, archival state, revision IDs/ordinals, actual authorship, source, evidence units, availability and legacy qualifications. Parent identities, duplicate history IDs/ordinals, metric references and result/engine labels are checked. Human revisions and service notes can be read without weakening the existing strict AI/canonical finding-creation contract. A shared availability predicate preserves its previous behavior. No financial calculation or backend/schema change was introduced.
Verification:
- Two baseline capability tests failed before implementation. Final client/cycle suites: **40 passed / 399 assertions**. Cases include exact historical selection after a human revision, qualified legacy evidence, archived service notes, malformed/foreign responses, duplicate histories, invalid IDs, aborts and HTTP failures. Reads issue no writes or automatic retries.
- Complete tooling: **155 passed / 14,355 assertions**, zero failures; includes the focused tests, so counts are not additive.
- Actual authenticated PostgreSQL/isolated-native workflow: **4 passed / 236 assertions**. Existing sealed-report findings reopen exactly. The cross-study findings are read through the new client, revised by a fixture-only human service call, and both immutable revisions are recovered with identical native evidence and distinct authorship. Service notes remain readable; revoking the actual research credential returns 401 on both reads. Run counts remain unchanged. The initial 4 / 232 run preceded additional sealed-source readback assertions and is not added to the final total.
- Application/authored-test types, contracts, explicit scoped lint, formatting, secret audit and diff checks passed. Initial authored-test checks caught fixture type widening and optional-source typing; corrected fixtures passed. Root reviewed the read/create and canonical/legacy boundaries. No independent review, build, browser or full integration-suite rerun is claimed for this client-only addition.
Logs: `/tmp/stock-bot-rp25-red.log`, `rp25-client-green.log`, `rp25-tooling.log`, `rp25-postgres.log`, `rp25-postgres-final.log`, `rp25-typecheck.log`, `rp25-authored-types.log`, `rp25-contracts.log`, `rp25-lint.log`, `rp25-format.log` and `rp25-secrets.log`, all under `/tmp/stock-bot-`. The disposable PostgreSQL container was stopped after verification. No real study was edited or executed, automatic cycle resume was not added, and all seven conditional tasks remain deferred.
## RP26 — Saved research revision download
Plan `6ce3b68b`, implementation `54349502`. The web research entry now offers **Download saved revision** for hypotheses, notes and findings, including archived and explicitly selected historical revisions. The JSON contains `research-revision-export/v1`, project/entry identity and the complete saved revision displayed. The filename includes both entry and revision IDs. It preserves narrative, authorship, exact hypothesis linkage, source/report hashes, raw scalar values, units, unavailable reasons and limitations.
Download uses the loaded saved record without an API call. Draft text is excluded and retained; pending saves disable the control. Loading, failed/missing history and stale responses cannot expose an old download. Local browser failures use a separate retry and cleanup path. The existing JSON download helper moved unchanged from the backtest feature into shared UI utilities; its result and dataset consumers use the new location. The walkthrough documents the analysis-file format and separate run/dataset downloads. No backend, financial engine or execution policy changed.
Verification:
- Baseline capability checks: six failures at the missing action, one existing loading/error case passed. Final workspace/finding/source/canonical UI suites: **137 passed / 921 assertions**, including current/historical export, archival state, raw precision/nulls, draft preservation, pending-save guard, failures/retry, temporary URL cleanup and existing result/dataset downloads.
- Complete production-built Chromium workbench: **23 passed / 862 assertions**, zero failures. Actual downloaded files match an older finding after a later human edit and the exact earlier AI hypothesis revision. API request collection remains empty during download, and run/dispatch/artifact-revision/hypothesis-revision counts are unchanged. Existing native financial/reproduction workflows pass.
- Web production build, application/authored-test types, contracts, explicit scoped lint, formatting, secret audit and diff checks passed. Initial test-style brace/format findings were corrected. The moved helper compares byte-for-byte with its original implementation; no old source import remains. Root reviewed selection/draft custody. No independent review, full repository check or full integration-suite rerun is claimed. The existing nonblocking Vite chunk warning remains.
Logs: `/tmp/stock-bot-rp26-red.log`, `rp26-ui.log`, `rp26-browser.log`, `rp26-typecheck.log`, `rp26-authored-types.log`, `rp26-contracts.log`, `rp26-lint.log`, `rp26-format.log` and `rp26-secrets.log`, all under `/tmp/stock-bot-`. The disposable PostgreSQL/Redis containers were stopped after verification. No real study was changed or run. All seven conditional tasks remain deferred.
## RP27 — Complete canonical run inspection
Plan `65c65948`, implementation `66af201d`. `ResearchClient.canonicalRunResult(runId, signal?)` now reads the existing authenticated result endpoint. AI callers can inspect complete retained requests, native fills/positions/risk, analytics and provenance. Legacy/malformed results and missing results remain read errors; no replacement run is created.
The backend's existing canonical validation is shared through `parseCanonicalRunResult` in the research library. It reuses the native report parser and existing statistical projection, checks completion/metadata, run/backtest/request identity and origin-derived execution kind, and returns the original payload with raw strings/nulls preserved. The database reader separately parses and compares its trusted SQL snapshot/backtest; the embedded request cannot replace a missing or different snapshot. Legacy backend reads and missing-canonical-result refusal remain intact. This adds no financial arithmetic, simulation path, permission or endpoint.
Verification:
- The capability regression failed at the missing method before implementation. Contract tests use actual Rust-produced SMA finances, including exact `9969.30000000` terminal equity and `0.70000000` fees. Negative cases cover foreign identities, execution kind, native policy/dataset/session, analytics and metadata. Fixture wall-time/package metadata is synthetic; real admission is covered separately below.
- The first sandboxed focused run timed out in an existing native-worker subprocess and reported its terminated child. The permitted rerun passed **47 tests / 494 assertions**, with no application change to address the timeout.
- Full integration: **1,403 passed / 14 existing conditional skips**, 10,592 assertions. Complete tooling: **158 passed / 14,394 assertions**. Focused cases overlap these totals.
- Actual PostgreSQL AI/canonical/reproduction suites: **20 passed / 409 assertions**. Research credentials read actual isolated-candidate results and match retained service results. Failed/missing runs return 404; revoked credentials return 401. Run counts remain unchanged. A valid but different SQL snapshot and a null snapshot both fail result reads, alongside existing malformed snapshot/analytics cases.
- Application/authored-test types, contracts, strict scoped lint, formatting, secret audit and diff checks passed. Authored assertions were corrected for branded decimal types and nullable result narrowing. Root reviewed embedded-versus-SQL binding and unchanged financial/statistical authority. No independent review, engine build, browser or full repository `check` rerun is claimed; no UI or Rust source changed.
Logs: `/tmp/stock-bot-rp27-red.log`, `rp27-focused.log`, `rp27-focused-permitted.log`, `rp27-integration.log`, `rp27-tooling.log`, `rp27-postgres.log`, `rp27-typecheck.log`, `rp27-authored-types.log`, `rp27-contracts.log`, `rp27-lint.log`, `rp27-format.log` and `rp27-secrets.log`, all under `/tmp/stock-bot-`. The disposable PostgreSQL container was stopped after verification. No real study was changed or executed. All seven conditional tasks remain deferred.
## RP28 — Frozen market data reads for research
Plan `04892a59`, implementation `4b9c6428`. Research credentials now permit only the existing exact GET/HEAD canonical dataset export path with a lowercase 64-character hash. This deliberately extends the shared research catalog/result read model to known frozen snapshots. Listing, provider inspection/preparation/retention, other dataset paths and all data writes remain denied. It adds no per-dataset grant model or new endpoint. The operator page describes the expanded read permission.
`ResearchClient.canonicalDataset(hash, signal?)` reuses `validateDatasetV2` to verify all retained content, derived policies and the requested hash, returning detached, deeply frozen bars and metadata. Callers can use a saved canonical result's `request.datasetHash`. Reads do not query providers, create runs, retry failures or substitute an editable template's current dataset. README documents predeclared training inputs and untouched holdouts; isolated candidate callbacks retain their existing prefix-only context and have no network or research credentials. No financial semantics, storage, simulation or execution policy changed.
Verification:
- Two baseline capability/permission regressions failed before implementation. Final focused client/cycle/security/export suites passed **58 tests / 716 assertions**. Cases cover immutable original bars/metadata, mismatched valid hashes, content/availability/policy tampering, invalid paths/hashes, aborts, HTTP failures and no retries or writes.
- Full integration: **1,404 passed / 14 existing conditional skips**, 10,605 assertions. The initial sole failure was the old export test's intentional research-denial expectation; it now verifies the new read permission and continued revocation/data-write denials. Complete tooling: **161 passed / 14,435 assertions**. Focused counts overlap those suites.
- Actual PostgreSQL AI/agent suites: **18 passed / 417 assertions**. Issued credentials retrieve exact retained snapshots and HEAD attachment headers; revoked credentials return 401. Missing/corrupt snapshots return 404/409. Reads leave dataset/experiment/run counts unchanged. After a template selects another retained snapshot, the original result and its original dataset hash reopen unchanged. The first fixture changed only the template hash and correctly failed existing bounds validation; updating its matching dates/assets/frequency fixed the fixture without relaxing application validation.
- Application/authored-test types, contracts, strict scoped lint, formatting, secrets, web production build and diff checks passed. Authored adversarial fixtures were corrected to construct malformed wire copies without assigning to readonly typed fields. The build retains the existing nonblocking Vite chunk warning. Root reviewed exact-path permission and strict content/hash validation; no independent review, native rebuild, browser rerun or full repository `check` is claimed.
Logs: `/tmp/stock-bot-rp28-red.log`, `rp28-focused-final.log`, `rp28-integration-final.log`, `rp28-tooling.log`, `rp28-postgres-final.log`, `rp28-typecheck.log`, `rp28-authored-types.log`, `rp28-contracts.log`, `rp28-lint.log`, `rp28-format.log`, `rp28-secrets.log` and `rp28-web-build.log`, all under `/tmp/stock-bot-`. The disposable PostgreSQL container was stopped after verification. No real study was changed or executed. All seven conditional tasks remain deferred.
## RP29 — Original hypothesis and revision reads
Plan `bbcec1c4`, implementation `fa78b6a7`. `ResearchClient.hypothesis(id, signal?)` and `hypothesisRevisions(id, signal?)` read the existing authenticated endpoints. They preserve complete ownership/archive metadata and immutable revision IDs, ordinals, title, proposition, validation criteria, timestamps and actual authorship. Reads accept human/AI/unknown origins and operator/service/agent authors; the existing creation acknowledgement still requires an AI-authored, unvalidated hypothesis. History checks parent identity and unique revision IDs/ordinals without reordering the response.
README documents selecting the exact revision ID saved in the journal or finding and stopping if it is absent. A human edit to the latest proposition cannot substitute for the original question. Archived questions remain readable, and a finding's immutable hypothesis-revision linkage remains unchanged. No route, permission, database, financial engine, candidate execution, recovery or UI behavior changed. These reads issue no mutations, retries or replacement research jobs.
Verification:
- Two missing-capability tests failed before implementation. Final client/cycle suites passed **54 tests / 600 assertions**, covering complete original text/criteria, human edits and archival, service authorship, strict creation acknowledgements, wrong identities, malformed fields, empty/mixed-parent/duplicate history, missing selection, invalid IDs, HTTP failures, aborts and both read deadlines with an uncooperative transport.
- Complete tooling: **169 passed / 14,558 assertions**, zero failures. Focused counts overlap that suite. The initial 168 / 14,546 run preceded the added creation-acknowledgement regression and is not added to the final total.
- Actual authenticated PostgreSQL AI workflow: **6 passed / 299 assertions**. Issued credentials reopen AI-created questions after fixture-only human revision and archival, recover both exact immutable revisions, and read service questions. Missing IDs return 404 and revoked credentials return 401. Read requests remain GET-only and hypothesis/revision/artifact/experiment/run counts stay unchanged. Existing isolated-candidate/native runs still pass; their findings retain the original hypothesis revision after a later human edit.
- Application/authored-test types, contracts, strict scoped lint, formatting, secret audit and diff checks passed. Initial authored-test typing caught widened fixture authorship strings; explicit fixture typing and a string comparison corrected the assertions without changing runtime behavior. Root reviewed read-versus-create validation and original revision selection. No independent review, full integration/repository check, native rebuild or browser rerun is claimed for this client-only addition.
Logs: `/tmp/stock-bot-rp29-red.log`, `rp29-client-final.log`, `rp29-tooling-final.log`, `rp29-postgres.log`, `rp29-typecheck.log`, `rp29-authored-types.log`, `rp29-contracts.log`, `rp29-lint.log`, `rp29-format.log` and `rp29-secrets.log`, all under `/tmp/stock-bot-`. The disposable PostgreSQL container was stopped after validation. No real study was changed or executed. All seven conditional tasks remain deferred.