docs(research): plan retained risk-state visibility (RP19)

This commit is contained in:
Boki 2026-10-27 19:36:45 -04:00
parent 6976f1a25e
commit 7a86b15e27
4 changed files with 56 additions and 4 deletions

View file

@ -8,7 +8,7 @@
[manifest.json](manifest.json) owns scheduling metadata: status, priorities, dependencies, ADR approvals, assignments and write locks. Task Markdown owns implementation scope/evidence/acceptance. This index and the [graph](dependencies.mmd) are derived views. Only the planning/integration owner updates scheduling state.
**Current total: 94 retained IDs — 83 done, 7 deferred, 4 merged.** RP18 completes the bounded October multi-session pilot; RP01–RP17 add the authorized real-data workflow and its dataset reuse, export and workflow recovery follow-ups. The earlier 68 IDs retain their state. E11 adds seven authorized cleanup tasks and one conditional replay extraction; see the manifest for current scheduling. The original backlog accounted for 55 IDs. F09/P07 added projection/profiling work; the owner deferred P08's TypeScript optimization. Merged records preserve traceability; never execute them separately. Deferred work requires its stated trigger and explicit activation.
**Current total: 95 retained IDs — 83 done, 1 in progress, 7 deferred, 4 merged.** RP18 completes the bounded October multi-session pilot; RP01–RP17 add the authorized real-data workflow and its dataset reuse, export and workflow recovery follow-ups. The earlier 68 IDs retain their state. E11 adds seven authorized cleanup tasks and one conditional replay extraction; see the manifest for current scheduling. The original backlog accounted for 55 IDs. F09/P07 added projection/profiling work; the owner deferred P08's TypeScript optimization. Merged records preserve traceability; never execute them separately. Deferred work requires its stated trigger and explicit activation.
States: ready, claimed, in_progress, review, done, blocked, deferred, merged. “Ready” means no code/ADR prerequisite, not execution authority. Implementation dependencies require accepted integration. `release_gates` govern enabling an end-to-end feature, not component coding or integration; conditional gates apply only to the named capability. F05 may integrate before F06, but its replay behavior is not released until F06 proves it.
@ -188,3 +188,5 @@ Owner authorized planning and per-task implementation commits. [Execution plan a
- [RP17: Candidate default parameters](tasks/RP17.md) — done, `1502ab41`; decode normalized validation children without changing original inputs or hashes.
- [RP18: October multi-session pilot](tasks/RP18.md) — done; nine retained native runs, exact reproduction, independent accounting/provenance review and opened web findings passed. The seven conditional tasks stay deferred.
- [RP19: Final risk state](tasks/RP19.md) — in progress; show existing native halt flags and retained limits in canonical results without reconstructing a halt history.

View file

@ -1,8 +1,8 @@
{
"schema_version": 1,
"plan_revision": "2026-10-27.110",
"plan_revision": "2026-10-27.111",
"repository_base": "b7aeca4",
"plan_status": "october_multisession_pilot_complete",
"plan_status": "final_risk_visibility_in_progress",
"execution_authorized": true,
"execution_scope": {
"authorized_by": "Owner: commit and continue with the rest of the tasks till 100%",
@ -3589,6 +3589,34 @@
"integration_base": "1a60c04603622629354a4fc48d203a30634be1b5",
"authorization": "Owner commit-and-continue follows the recommended longer pilot; reuse the existing approved version. Prior October 1 approval record and deferred-task activation gates remain unchanged.",
"review_notes": "Nine predeclared native runs completed, baseline/reproduction/cost-baseline economic hashes match and receipt retries retain nine IDs. Independent file audit passed 109207 assertions over prices, fees, ownership, cash/equity, provenance, phase selection, reporting and finding references. Actual Chromium reopened results/trades/report/costs and finding body with 18 evidence links. Source review passed 25297 assertions. No application source changes; runtime records are not Git commits. File-only audit does not establish absence of unrelated database writes; see real-data-research.md."
},
{
"id": "RP19",
"title": "Show retained final risk state in research results",
"epic": "E12",
"priority": "P2",
"severity": "Medium",
"status": "in_progress",
"dependencies": [
"W03",
"RP18"
],
"decision_dependencies": [],
"task_file": "backlog/tasks/RP19.md",
"complexity": "S",
"assignment": "/root/audit_research_entry_recovery",
"write_locks": [
"canonical-results-ui"
],
"blocker": null,
"integration_state": "in_progress",
"completion_evidence": "real-data-research.md",
"release_gates": [],
"review_status": "pending",
"completed_commit": null,
"integration_base": "6976f1a2",
"authorization": "Owner commit-and-continue authorizes the pilot-driven final risk visibility correction; no new research execution or deferred work.",
"review_notes": "Verified canonical result component omits retained final risk fields despite RP18 halted outcomes. Native financial semantics and stored contracts unchanged."
}
],
"review_note": "Independent skeptical revision: four superseded tasks retain stable IDs; deferred work is not a dependency of scheduled tasks. Release gates are distinct from implementation prerequisites.",

View file

@ -0,0 +1,22 @@
# RP19 — Show retained final risk state in research results
Parent E12. Priority P2 / Medium interpretation gap. Complexity S. Dependencies W03 and RP18. Owner's “commit and continue” authorizes this follow-up and validated commits. One frontend implementer owns `CanonicalResults.tsx` and its workbench component tests; root owns browser integration and planning state. Independent review required.
Verified evidence: `apps/stock/web-app/src/features/backtest/components/CanonicalResults.tsx` displays valuation, sampled metrics and policy JSON but never reads `financial.view.risk`. An independent actual-result render probe (`/tmp/stock-bot-post-rp18-result-audit.tsx`) produces identical HTML when both flags are flipped in each of the three retained cost scenarios. The validated result already supplies those fields through `apps/stock/config/src/contracts/canonical-replay.ts` and the existing result endpoint. RP18's baseline and stressed-cost results have `drawdownHalted: true`; understanding why their paths differ currently requires downloading JSON. The cost experiment already explains independent execution and retained spread; do not duplicate it.
Scope: add a compact, read-only **Final risk state** section to the canonical result overview, using only the retained financial view and policy. Show daily-loss and drawdown halt flags, their exact monetary limits, daily equity baseline, peak equity, risk session identity/start and last processed risk-event time. Use existing currency/time formatting and exact native decimal strings. A true flag means risk-increasing orders are halted at that snapshot; a false flag is not proof that no earlier halt or other rejection occurred.
Explain the snapshot's limits: daily-loss state can reset at an account risk-session boundary; price recovery alone does not clear a latched drawdown halt. The last event time is not a first-halt timestamp. Compact results do not supply halt history or rejection counts. Do not derive halt state from sampled drawdown, final equity or trade counts. Keep loaded-result rendering synchronous with no extra requests or mutable template lookup.
Exclusions: API/schema/database/native changes, risk resets or new controls, financial calculations, event/rejection journals, new research runs, paper/live activation, strategy changes, performance work and broad result-page refactoring. Existing parent loading/error behavior and legacy result views remain in place; an empty fill list must not hide retained risk facts. The existing fills-only view remains focused on fills.
Acceptance and mandatory tests:
- Overview renders both flags and exact retained limits/baselines, session and timestamp for a completed canonical result. Clear state labels distinguish active-at-end from inactive-at-end.
- Component regressions cover neither/either/both flags, a latched drawdown despite recovered terminal equity, final daily state after a session reset, an empty fill list and switching between runs without stale risk details. Assert no extra API request, no mutation of the result and no inferred halt timestamp/rejection count. Existing downloads, metrics and fills-only tests still pass.
- A disposable PostgreSQL/Redis/native browser fixture completes a real halted run, opens its saved result, checks the displayed flags/limits against retained Rust output, reloads it, and also verifies a non-halted result. Viewing/reloading adds no runs or dispatches and does not change saved financial results. Existing same-flow browser scenarios remain valid.
- Focused component tests, application/authored-test types, scoped lint/formatting, repository check and relevant real browser integration pass. No new economic policy tests are needed because financial semantics are unchanged.
Regression risk: presenting final false flags as historical absence, labeling the last processed event as a halt timestamp, or implying all orders must stop when exposure-reducing orders remain permitted. Review wording against `risk.rs` (`increase_check`, `observe_equity`, risk-session boundary handling). Preserve the existing distinction between authoritative native risk and sampled research analytics.
Implementation agents work in an isolated branch/worktree. Root integrates the narrow diff after baseline/focused validation, runs combined gates and records evidence in `real-data-research.md` before marking the task done. All seven conditional tasks remain deferred.