76 lines
6.4 KiB
Markdown
76 lines
6.4 KiB
Markdown
# O02 — Expose truthful research and paper readiness diagnostics
|
|
|
|
Parent epic: E9. Priority/severity: P1 / High. Relative complexity: M. Recommended specialization: Infrastructure/observability.
|
|
|
|
Scheduling source of truth: [manifest entry O02](../manifest.json). No task is authorized until the plan is approved. Dependencies and decision references below describe the design; the manifest controls current readiness.
|
|
|
|
## Evidence and root cause
|
|
|
|
- **OPS-02 — Needs Investigation:** Paper/live operational readiness is not demonstrated end-to-end. Live is deliberately disabled; preserve that gate until feed, reconciliation and broker-specific recovery are verified. [apps/stock/orchestrator/src/core/ModeManager.ts:33](../../../../apps/stock/orchestrator/src/core/ModeManager.ts#L33); [apps/stock/orchestrator/src/container.ts:152](../../../../apps/stock/orchestrator/src/container.ts#L152).
|
|
- **WEB-02 — Verified:** Detail exposes native-unsupported pause/resume controls, omits cancel wiring, and overlapping polling/selection can apply stale responses. [apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx:379](../../../../apps/stock/web-app/src/features/backtest/BacktestDetailPageV2.tsx#L379); [apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts:160](../../../../apps/stock/orchestrator/src/backtest/RustBacktestAdapter.ts#L160).
|
|
- **KEEP-02 — Verified:** Preserve frozen/hash-verified historical snapshots and fenced durable runner attempts; extend them instead of creating a second job engine. [apps/stock/orchestrator/src/data/historical-dataset.ts:98](../../../../apps/stock/orchestrator/src/data/historical-dataset.ts#L98); [apps/stock/orchestrator/src/backtest/BacktestRunner.ts:190](../../../../apps/stock/orchestrator/src/backtest/BacktestRunner.ts#L190).
|
|
|
|
## Intended behavior and implementation scope
|
|
|
|
Report actual worker/queue/lease, engine version/capability, dataset load failure, paper feed freshness and recovery/halt state. Replace unmeasured zeros/always-healthy assumptions with unknown/unavailable. Attach run/attempt/strategy IDs to diagnostics; avoid a new telemetry stack.
|
|
|
|
Measurable benefit: Makes failures diagnosable from the primary product.
|
|
|
|
## Exclusions
|
|
|
|
No speculative distributed infrastructure or weakened correctness gates.
|
|
|
|
## Likely files and ownership
|
|
|
|
- apps/stock/web-api/src/routes/monitoring.routes.ts
|
|
- apps/stock/web-api/src/services/
|
|
- apps/stock/orchestrator/src/api/rest/
|
|
- apps/stock/web-app/src/features/monitoring/
|
|
|
|
Write locks: readiness-api. One agent owns this change. Lock names do not override actual overlapping files.
|
|
|
|
## Dependencies and blockers
|
|
|
|
Implementation requires [S04](S04.md) integrated.
|
|
|
|
No additional economic-policy approval is needed for this narrowly scoped task.
|
|
|
|
Deferred: Optional cross-service monitoring expansion; required run diagnostics belong to W01/F07 and paper readiness to S04.
|
|
|
|
Parallel eligibility: only with disjoint actual files and reserved write locks; read FIRST-WAVE.md for the initial exact ownership boundaries.
|
|
|
|
## Acceptance criteria
|
|
|
|
- Missing orchestrator/native worker/DB or stale feed cannot report ready.
|
|
- Run failure includes phase and actionable cause, with secrets excluded.
|
|
- Research availability and paper readiness are separate indicators; live-disabled is explicit.
|
|
|
|
## Mandatory tests
|
|
|
|
- dependency_unavailable_readiness, stale_feed_status, failed_attempt_diagnostics, no_secret_logs.
|
|
- API/UI tests show unknown versus measured zero and retryable error.
|
|
|
|
Apply the relevant [quality gates](../../QUALITY-GATES.md); submit exact commands, outcomes and skipped checks. Named cases above are required regression scenarios, not claims that those tests already exist.
|
|
|
|
## Regression risks and rollback
|
|
|
|
Performance measurements can hide semantic changes; require economic hash equivalence.
|
|
Keep migrations additive and previous results readable. Do not add a switch that restores a correctness defect. Versioned cutover/migration is required only when persisted contracts or active engines change; never silently fall back to old economics.
|
|
|
|
## Web/API contract and user states
|
|
|
|
- API: Extend current health/monitoring and run diagnostics contracts; no separate monitoring API silo.
|
|
- Backend/data dependencies: Persisted attempts and real service probes; no additional time-series platform.
|
|
- Loading/error/empty behavior: Unknown, degraded, stale and disconnected states; actionable retry; do not display fake healthy cards.
|
|
- User-facing completion is demonstrated by the acceptance criteria and interaction tests above; a backend-only implementation is insufficient where a UI is in scope.
|
|
## Handoff
|
|
|
|
Report scope changes (if any), fixture expectations, API/schema changes, measurements, remaining limitations and commit/PR references once authorized. Request independent review; only the integration/planning owner may mark the manifest done.
|
|
|
|
## Activated scope — October 28, 2026
|
|
|
|
Owner authorized judgment on all remaining conditions. Implement a read-only composite snapshot on the existing monitoring API, using the actual research queue, SQL attempts/leases, existing pool/runner state, artifact identity and existing paper readiness. Missing observations remain unavailable/unknown. A readable native binary or a BullMQ worker is **not proof of native execution**: report `unverified-until-run`, rather than launching synthetic jobs or adding a health-probe worker protocol. Research status remains unknown when prerequisites are observed but execution has not been probed. This is a deliberate truthful limitation, not a ready signal.
|
|
|
|
The UI shows observation time, explicit refresh/loading/error/retry, local run/attempt/strategy phase, expired leases, paper freshness/recovery/halt and live-disabled. Existing deployment-specific readiness remains authoritative; no activation or recovery is performed by monitoring. Capture the runner's actual phase in its existing fenced failure string and reuse logger redaction, without migrations or a second execution history.
|
|
|
|
Correct unavailable cache/queue/service/metric values; include the research queue and avoid observer-created workers. Remove the hardcoded Redis diagnostic route. Original WEB-02 controls/polling defects and OPS-02 legacy composition paths above are historical: W01/S04/S06 already addressed those paths. No broker, live capability, financial policy or worker lifecycle change. Root self-review and repository/recovery regressions are used in this solo continuation; no independent agent review is claimed.
|