{"openapi":"3.1.0","info":{"title":"KattralX Dashboard","version":"0.3.0"},"paths":{"/api/health":{"get":{"summary":"Health","operationId":"health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/economy":{"get":{"summary":"Economy","operationId":"economy_api_economy_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/round_robin":{"get":{"summary":"Round Robin","operationId":"round_robin_api_round_robin_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/cycles":{"get":{"summary":"Cycles","operationId":"cycles_api_cycles_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/news":{"get":{"summary":"News","operationId":"news_api_news_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/metrix":{"get":{"summary":"Metrix","description":"H-71 §3 stage-transition funnel per lane, reconstructed from engine logs.\n\nxmetrix is in-process only (single-writer registry inside the engine\nprocess); the engine's run_engine summary line is what actually persists,\nso we parse that. Same source as /api/cycles, expanded to every stage.","operationId":"metrix_api_metrix_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/guardian":{"get":{"summary":"Guardian","description":"Failure-routing + veto counters (xguardian) from engine logs.\n\nxguardian.route_failure absorbs stage failures — parsed here from log\nkeywords. Real veto counts land in cycle summaries as `stage4_veto:vetoed`\n/ `stage3_5_leap_gate:vetoed` etc; free-form guardian log lines land as\n`[guardian]` / `route_failure=` in the engine log body.","operationId":"guardian_api_guardian_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/performance":{"get":{"summary":"Performance","description":"xperformance REALIZED trade outcomes (populates as trades close in paper).\n\nRows are the realized outcomes of the performance log (honours INSPIREX_PERFORMANCE_LOG), filtered by the\ncohort_rollup ALLOWLIST, after dedupe_records (key = trade_id, else order_id, else (persona, strategy,\ntimestamp); last occurrence wins, but a lifecycle row never displaces a counted or unknown row; so a\nduplicated row counts once and every figure and count below is post-dedupe): lifecycle markers and unknown outcome_kind rows are excluded and COUNTED\nseparately (lifecycle_excluded / unknown_outcome_kind_count); legacy rows (no outcome_kind) are counted\nas realized and reported (legacy_row_count). A line that is not valid JSON is a named 500, never\nskipped; a valid JSON line that is not an object is counted on the raw list (malformed_row_count)\nand is never realized; an unusable roi is UNKNOWN (counted, excluded from avg_roi), never 0; a log with no\nrealized rows is status EMPTY, never an implied pass. ``limit`` caps ``recent`` (0 = none; negative = 422).\nA row whose id / persona / strategy / result is unhashable (a list or object) is a named 500, never an\nunnamed TypeError; an int roi too large for a float is UNKNOWN like any other unusable roi.","operationId":"performance_api_performance_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":25,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/logs":{"get":{"summary":"Logs","description":"Whitelisted tails of critical logs (news, IBKR, Tradier, service logs).","operationId":"logs_api_logs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/grid":{"get":{"summary":"Grid","description":"xgrid fleet state. NOTE: xgrid has no cross-process sink yet — this\nsurfaces whatever's under data/fleet/ (locks + any registered state) so\nwhen a fleet-jobs writer lands, this panel starts populating automatically.","operationId":"grid_api_grid_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/positions":{"get":{"summary":"Positions Endpoint","description":"SDD §20.8 — /api/positions (full 3-collection PositionsResponse).","operationId":"positions_endpoint_api_positions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/positions/{strategy_instance_id}":{"get":{"summary":"Positions By Id Endpoint","description":"SDD §20.8 — /api/positions/{sid} (single StrategyPosition filter).","operationId":"positions_by_id_endpoint_api_positions__strategy_instance_id__get","parameters":[{"name":"strategy_instance_id","in":"path","required":true,"schema":{"type":"string","title":"Strategy Instance Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/risk":{"get":{"summary":"Risk Endpoint","description":"SDD §20.8 — /api/risk (aggregate limits/greeks/concentration/drawdown).","operationId":"risk_endpoint_api_risk_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/limits":{"get":{"summary":"Risk Limits Endpoint","description":"SDD §20.8 — /api/risk/limits (signed utilization + distance metrics).","operationId":"risk_limits_endpoint_api_risk_limits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/greeks":{"get":{"summary":"Risk Greeks Endpoint","description":"SDD §20.8 — /api/risk/greeks (portfolio greeks + contributions[]).","operationId":"risk_greeks_endpoint_api_risk_greeks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/concentration":{"get":{"summary":"Risk Concentration Endpoint","description":"SDD §20.8 — /api/risk/concentration (buckets per axis).","operationId":"risk_concentration_endpoint_api_risk_concentration_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/drawdown":{"get":{"summary":"Risk Drawdown Endpoint","description":"SDD §20.8 — /api/risk/drawdown (time-series slice).","operationId":"risk_drawdown_endpoint_api_risk_drawdown_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/latency":{"get":{"summary":"Latency Endpoint","description":"SDD §20.8 — /api/latency (summary + stages + recent_orders).","operationId":"latency_endpoint_api_latency_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/latency/orders":{"get":{"summary":"Latency Orders Endpoint","description":"SDD §20.8 — /api/latency/orders (RecentOrderLatency list, cap 50).","operationId":"latency_orders_endpoint_api_latency_orders_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/latency/stages":{"get":{"summary":"Latency Stages Endpoint","description":"SDD §20.8 — /api/latency/stages (per-stage percentiles + state).","operationId":"latency_stages_endpoint_api_latency_stages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/freshness":{"get":{"summary":"Freshness Endpoint","description":"SDD §20.8 — /api/freshness (per-domain + per-feed).\n\nReads the freshness snapshot directly via SnapshotReader per the\nrouting note in the task brief.","operationId":"freshness_endpoint_api_freshness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/reconciliation":{"get":{"summary":"Reconciliation Endpoint","description":"SDD §20.8 — /api/reconciliation (records + summary).\n\nReads the reconciliation snapshot directly via SnapshotReader per the\nrouting note in the task brief.","operationId":"reconciliation_endpoint_api_reconciliation_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/reconciliation/realized":{"get":{"summary":"Realized Reconciliation Endpoint","description":"Proof 2 (ruling cbe8cef38): the persisted broker-authoritative realized reconciliation, as LINES (ruling\ne2bc5d646 i). Thin routing only — the service returns the artifact's amounts verbatim or a named UNAVAILABLE\nstatus (503); this handler never computes or defaults an amount.","operationId":"realized_reconciliation_endpoint_api_reconciliation_realized_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/outcome_channel/projection":{"get":{"summary":"Outcome Projection Endpoint","description":"A3 outcome-channel projection criterion C: the latest persisted projection's validation verdict, reason codes\nand counts (never an amount, account key or file name), or a named UNAVAILABLE status (503). Thin routing only.","operationId":"outcome_projection_endpoint_api_outcome_channel_projection_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/orders/open":{"get":{"summary":"Open Orders Endpoint","description":"SDD §20.8 — /api/orders/open (compact working-order list).\n\nReads the positions snapshot directly (v0.3 emits orders under the\npositions bundle per SDD §20.6 / §20.9.1); when v0.9 lands orders as\nits own domain, the reader domain flips to ``orders`` with no\nhandler change.","operationId":"open_orders_endpoint_api_orders_open_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/regime":{"get":{"summary":"Regime Endpoint","description":"SDD §21.4 — /api/regime (RegimeResponse per SDD §21.1).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``;\nv0.4 payload additions land under ``data``. Handler is a thin\nrouting layer per SDD §5.3 — every regime field is passthrough\nfrom the engine-side ``regime_assembler`` per operator ruling §3\n(*\"Display: dashboard reads the emitted regime snapshot ONLY\"*).","operationId":"regime_endpoint_api_regime_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/regime/history":{"get":{"summary":"Regime History Endpoint","description":"SDD §21.4 — /api/regime/history (RegimeHistoryResponse).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\n``window_days`` round-trips into the response so the panel can label\nthe sparkline (TDD_V04 §6 regression guard). Series points are\npassthrough from the on-disk snapshot per operator ruling §3.","operationId":"regime_history_endpoint_api_regime_history_get","parameters":[{"name":"window_days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Window Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/regime/gates":{"get":{"summary":"Regime Gates Endpoint","description":"SDD §21.4 — /api/regime/gates (RegimeGatesResponse per SDD §21.2).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\nGate-transition log is passthrough from the on-disk snapshot per\noperator ruling §3 — this handler never computes L0 scale.","operationId":"regime_gates_endpoint_api_regime_gates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/attribution":{"get":{"summary":"Attribution Endpoint","description":"SDD §21.4 — /api/attribution (AttributionResponse cohort roll-up).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\n``dimension`` selects one of the SDD §21.3 cohort dimensions —\n{strategy_family, strategy_kind, persona, decision_tier, regime}.\nAn unknown dimension routes to a fail-closed error envelope per\nSDD §20.7 (never crashes uvicorn).","operationId":"attribution_endpoint_api_attribution_get","parameters":[{"name":"dimension","in":"query","required":false,"schema":{"type":"string","default":"strategy_family","title":"Dimension"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/attribution/cohorts":{"get":{"summary":"Attribution Cohorts Endpoint","description":"SDD §21.4 — /api/attribution/cohorts (AttributionCohortsResponse).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\nSame roll-up as /api/attribution but surfaces the collection under\nthe canonical wire key ``\"cohorts\"`` per SDD §21.4.","operationId":"attribution_cohorts_endpoint_api_attribution_cohorts_get","parameters":[{"name":"dimension","in":"query","required":false,"schema":{"type":"string","default":"strategy_family","title":"Dimension"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/attribution/timeseries":{"get":{"summary":"Attribution Timeseries Endpoint","description":"SDD §21.4 — /api/attribution/timeseries (AttributionTimeseriesResponse).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\n``granularity`` ∈ {daily, weekly}; ``dimension`` ∈ SDD §21.3 cohort\ndimensions. Points are monotone-increasing in ``bucket_date`` by\nconstruction (AC-V04-08 tripwire).","operationId":"attribution_timeseries_endpoint_api_attribution_timeseries_get","parameters":[{"name":"granularity","in":"query","required":false,"schema":{"type":"string","default":"daily","title":"Granularity"}},{"name":"dimension","in":"query","required":false,"schema":{"type":"string","default":"strategy_family","title":"Dimension"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/attribution/trades":{"get":{"summary":"Attribution Trades Endpoint","description":"SDD §21.4 — /api/attribution/trades (AttributionTradesResponse).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\nFlat list of AttributionTradeRecord — each preserves\n``regime_at_entry`` verbatim per AC-V04-06 (no re-computation from\nthe current regime state).","operationId":"attribution_trades_endpoint_api_attribution_trades_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/models":{"get":{"summary":"Models Endpoint","description":"SDD §21.4 — /api/models (ModelFleetResponse).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\nEvery entry carries ``advisory_only=True`` and the envelope carries\n``advisory_only_guarantee=True`` (three-layer defense per\nADR-cp10-4-model-metadata §3.1 — schema Literal[True] pin + service\nstamp + envelope guarantee).","operationId":"models_endpoint_api_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/explain":{"get":{"summary":"Explain Endpoint","description":"SDD §21.4 — /api/explain (ExplainResponse).\n\nPer operator ruling §1 the wire ``schema_version`` stays ``\"0.3.0\"``.\n``target`` is required (non-empty). Response carries\n``advisory_only=True`` + the pinned ``ADVISORY_BADGE`` constant per\nADR-cp10-4-model-metadata §3.1 defense-in-depth. An empty target\nroutes to a fail-closed 400 envelope per SDD §20.7.","operationId":"explain_endpoint_api_explain_get","parameters":[{"name":"target","in":"query","required":true,"schema":{"type":"string","title":"Target"}},{"name":"model_id","in":"query","required":false,"schema":{"type":"string","default":"default","title":"Model Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rebalancing":{"get":{"summary":"Rebalancing Endpoint","description":"SDD §22.6 — /api/rebalancing (RebalancingResponse v0.5-A).\n\nPer operator ruling §1 (CP-10-5-INTERFACE-CONTRACT-GAP-RULING) the wire\n``schema_version`` stays ``\"0.3.0\"``; v0.5 payload additions live under\n``data``. Handler is a thin routing layer per SDD §5.3 — the response is\nbyte-for-byte passthrough from ``rebalancing_service.get_rebalancing``\nper SDD §22.3 (cuFOLIO is ADVISORY-ONLY, MUST NOT override xrisk) +\noperator ruling §3 (*\"Display: dashboard reads the emitted rebalancing\nsnapshot ONLY\"*).\n\nPOST /api/rebalancing/run (v0.5-B) is DEFERRED per TDD §1.","operationId":"rebalancing_endpoint_api_rebalancing_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/rebalancing/interpreted":{"get":{"summary":"Rebalancing Interpreted Endpoint","description":"NT160 — read-only GET of ``latest/rebalancing_interpreted.json``.\n\nThe snapshot dir is resolved per request, so a replaced file is read on the\nnext call. The service result is passed through as-is: ``available`` → 200,\n``unavailable`` → 503 with ``data`` null (no last-known-good payload, no\nsynthesized envelope timestamp). ``upstream_age`` stays ``UNKNOWN``. The raw\n``/api/rebalancing`` route above is unchanged.","operationId":"rebalancing_interpreted_endpoint_api_rebalancing_interpreted_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/gates":{"get":{"summary":"Risk Gates Endpoint","description":"SDD §23.3 — /api/risk/gates (GatesResponse two-gate roll-up).\n\nPer CP-10-6-OPENING-RULING §1 + CP-10-4-SCAFFOLD-RULINGS §1 the wire\n``schema_version`` stays ``\"0.3.0\"``; v0.6 money-line payload lives\nunder ``data``. Handler is a thin routing layer per SDD §5.3 — every\nfield (wheel_ruin, bracket_d, summary) is passthrough from\n``gates_service.get_gates`` which is itself a PURE projection over the\nxrisk-authored gates snapshot per SDD §5.2 state direction FIXED +\n``wheel-ruin-is-entry-gate-blind`` doctrine (authority in xrisk).","operationId":"risk_gates_endpoint_api_risk_gates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/gates/wheel-ruin":{"get":{"summary":"Risk Gates Wheel Ruin Endpoint","description":"SDD §23.1 — /api/risk/gates/wheel-ruin (WheelRuinGateResponse).\n\nPer CP-10-6-OPENING-RULING §1 the wire ``schema_version`` stays\n``\"0.3.0\"``. Handler is a thin routing layer per SDD §5.3 — every\nfield (state, proximity, trend, dominant_contributors, breach_action)\nis passthrough from ``gates_service.get_wheel_ruin`` per\n``wheel-ruin-is-entry-gate-blind`` doctrine (authority in xrisk;\ndashboard NEVER computes gate state).","operationId":"risk_gates_wheel_ruin_endpoint_api_risk_gates_wheel_ruin_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/gates/bracket-d":{"get":{"summary":"Risk Gates Bracket D Endpoint","description":"SDD §23.2 — /api/risk/gates/bracket-d (BracketDGateResponse).\n\nPer CP-10-6-OPENING-RULING §1 the wire ``schema_version`` stays\n``\"0.3.0\"``. Handler is a thin routing layer per SDD §5.3 — every\nfield (state, convexity_score, structure, dominant_contributors,\nbreach_action) is passthrough from ``gates_service.get_bracket_d``\nper ``bracket-d-is-backspreads-not-long-call`` doctrine (D = TWO call\nbackspreads; dashboard NEVER computes convexity).","operationId":"risk_gates_bracket_d_endpoint_api_risk_gates_bracket_d_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/risk/gates/history":{"get":{"summary":"Risk Gates History Endpoint","description":"SDD §23.6 — /api/risk/gates/history (GatesHistoryResponse rolling 60d).\n\nPer CP-10-6-OPENING-RULING §1 + CP-10-4-SCAFFOLD-RULINGS §1 the wire\n``schema_version`` stays ``\"0.3.0\"``. Handler is a thin routing layer\nper SDD §5.3 — the response is byte-for-byte passthrough from\n``gates_service.get_gates_history`` which is itself a PURE projection\nover the append-only gates-history JSONL emitted by xrisk per SDD\n§20.9.1 + §23.6 (rolling 60-day window authority).\n\n``window_days`` is a declarative FastAPI query-param binding — the\nonly wire-level input; NOT a mutable-state or DI arg, preserving the\nBP-ADR-002 thin-routing intent. Mirrors the ``regime_history_endpoint``\nquery-param precedent at ``/api/regime/history``. Deferred import\n``from xdashboard import gates_service`` per BP-ADR-001.\n\nREAD-ONLY dashboard-boundary discipline per\n``CP-10-6-DASHBOARD-CONTROL-PLANE-REJECTION-2026-08-01`` §2.2:\nNO POST/disarm surface, NO xrisk import, NO state mutation. The\ntournament-gate authority stays in xrisk per\n``[[tournament-gate-armed-refuses-not-selects]]`` — the dashboard\nRENDERS gate transitions but NEVER selects/disarms.\n\nFreshness is sourced solely via ``freshness_helpers.compute_freshness_ms``\non the snapshot file (source_timestamp + mtime max) per SDD §14.2 +\n``CP10-3-FRESHNESS-FIXED-CONTRACT-RESTORE`` PREFERRED OWNERSHIP §2 —\nno independent history-entry-age math.","operationId":"risk_gates_history_endpoint_api_risk_gates_history_get","parameters":[{"name":"window_days","in":"query","required":false,"schema":{"type":"integer","default":60,"title":"Window Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stream/risk":{"get":{"summary":"Stream Risk Endpoint","description":"SDD §13.2 + §13.3 — GET /stream/risk Server-Sent-Events transport.\n\nv0.6 READ-ONLY streaming projection over the state-bridge risk\nsnapshot per CP-10-6-OPENING-RULING-2026-08-01 §1 and\nCP-10-6-DASHBOARD-CONTROL-PLANE-REJECTION-2026-08-01 §2 (dashboard\nexposes NO write authority; this wire is a server->client fire-hose\nonly, never a client->server command channel). The route is a\npresentation-side thin routing layer per SDD §5.3 — every envelope\nis minted by `xdashboard.sse` (the computation seam) which owns the\nper-channel monotonic sequence + gap detection + resync-hint patch\n(SDD §13.3).\n\nWire contract\n-------------\n* Response class: ``StreamingResponse`` (media type\n  ``text/event-stream`` per SDD §13.2 W3C SSE transport).\n* HTTP 200 on connect; the bounded generator emits at most\n  ``1 (snapshot) + 4 (per-channel deltas) = 5`` frames per open\n  then terminates (BP-ADR-007 no perpetual thread / no while-True).\n* On missing state-bridge snapshot: the iterator's fail-closed arm\n  yields a single ``event='error'`` envelope carrying a\n  ``snapshot_unavailable`` warning and returns (SDD §5.4 admissible\n  path (b) — HTTP 200 SSE stream with error event, closing cleanly;\n  the SDD §12.1 503 JSON envelope path IS rejected for B6 because\n  it would fork the fail-closed decision surface between route and\n  iterator).\n\nBoundary discipline\n-------------------\n* Deferred import of ``xdashboard.sse`` inside the generator body\n  per BP-ADR-001 keeps the module import graph narrow at app load.\n* Route imports NO money-line module (``xstrategyengine`` /\n  ``xmodels.registry`` / ``xxecution``); the SSE data source is the\n  state-bridge snapshot loaded by ``xdashboard.snapshot_reader``\n  (SDD §5.2 engine->dashboard direction FIXED). The 3-layer defense\n  remains intact.\n* Route handler signature carries ONLY wire-level FastAPI params\n  per BP-ADR-002 (here: no query params needed for the initial\n  surface; v0.7+ can additively grow the surface if operator ruling\n  authorizes).\n\nSequence + gap-detection contract (SDD §13.3)\n---------------------------------------------\nPer-channel monotonic sequence is stamped by ``sse.build_delta_event``\nvia ``sse.next_sequence``. The route tracks a local\n``previous_sequence`` dict keyed by channel, snapshotted from the\nmodule's ``_last_emitted`` state at the START of this connection so\n(a) the first-ever open sees ``previous_sequence == 0`` and\n``inject_test_gap`` correctly surfaces ``resync_hint=True``; (b)\nsubsequent opens see the last-emitted value so a fresh delta with\n``current - previous == 1`` is NOT mislabeled as a gap. This is a\ndoctrine-compliant use of the module's public API (the underscore\non ``_last_emitted`` is Python convention, not access enforcement;\nthe sse module is intra-package computation seam per SDD §5.3).\n``sse.publish()`` is intentionally NOT used here because its\n``previous > 0`` first-publish mask suppresses gap detection on the\nfirst per-channel delta, defeating the ``inject_test_gap`` seam.","operationId":"stream_risk_endpoint_stream_risk_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/reconciliation/ack":{"post":{"summary":"Reconciliation Ack Endpoint","description":"POST /api/reconciliation/ack — SOLE approved command-channel route.\n\nDoctrine anchors (BP-ADR-004 durable-trace citations):\n  * SDD §5.1 advisory/authority split — dashboard is the AUTHORITY for\n    operator-metadata acknowledgment ONLY; NEVER for market/risk state.\n  * SDD §5.4 fail-closed — feature flag unset / bad body / missing key\n    all short-circuit to a closed-vocab error envelope, never a silent\n    200.\n  * SDD §6.2 READ-ONLY invariants — narrowly excepted per\n    CP-10-6-DASHBOARD-CONTROL-PLANE-REJECTION §2.1 which lists this\n    POST as APPROVED specifically because it 'changes operator\n    metadata (records operator has reviewed this), NOT market/risk\n    state. Alters NONE of: positions / gates / orders / strategies /\n    execution / broker state'.\n  * SDD §12.1 envelope shape — response wraps the ADR §3.2 8-field\n    audit record verbatim in ``data``; status/warnings/environment\n    preserved across every branch.\n  * SDD §12.3 closed-vocab warnings — {authorization_error,\n    validation_error, idempotent_replay, idempotency_conflict,\n    internal_error} only.\n  * SDD §12.4 HTTP status closed vocab — 200 (fresh + replay) / 400\n    (validation / conflict / bad key / missing header) / 403 (flag\n    off) / 500 (audit write failure) / 503 (snapshot unavailable).\n  * SDD §12.5 idempotency TIGHTENED — RESOLVED HERE. Idempotency-Key\n    header REQUIRED; audit_service.was_idempotent_replay drives the\n    replay warning; same-key/different-body raises IdempotencyConflict.\n  * SDD §15.5 manual reconciliation ack — RESOLVED HERE from D-002\n    deferred; operator's ack persists to the immutable JSONL under\n    ``data/xdashboard/audit/reconciliation_ack.jsonl``.\n  * SDD §16.2 audit trail — 8-field ADR §3.2 record persisted per\n    successful append; hash-chain deferred to v0.9 per SDD D-005.\n  * ADR-CP10-6-COMMAND-CHANNEL §1.2 (route scope) + §2.3 (STRICT\n    lowercase 'true' feature flag; no aliases) + §3.1..§3.5 (audit\n    record shape + fail-closed write posture) + §4.1..§4.4\n    (idempotency-key regex, cache line, replay/conflict semantics) +\n    §6.1 (SOLE approved POST for v0.6).\n  * CP-10-6-OPENING-RULING §1 (authorizes command-channel POST paths\n    + audit trail; envelope ``schema_version`` stays '0.3.0').\n  * CP-10-6-DASHBOARD-CONTROL-PLANE-REJECTION §2.1 (READ-ONLY narrow\n    exception carved for THIS route only; §2.2 rejects\n    POST /api/risk/gates/disarm; §2.3 rejects broker mutations).\n\nmoney-line-unchanged: this handler records OPERATOR REVIEW METADATA\nonly under dashboard-owned ``data/xdashboard/audit/``; NO import of\nxrisk / xxecution / xstrategyengine / xmodels.registry / xfolio /\nxbroker (grep-enforceable by the CC2 tester static probe). The\npre-existing money-line 3-layer defense markers (ModelEntry /\nADVISORY_BADGE / Literal[True]) on advisory ML surfaces upstream\nare UNTOUCHED per BP-ADR-005.\n\nException map (BP-ADR-001 narrow-except):\n  * IdempotencyKeyFormatError → 400 validation_error\n  * IdempotencyConflict       → 400 idempotency_conflict\n  * AuditWriteError           → 500 internal_error\n  * SnapshotUnavailable       → 503 snapshot_invalid\n  * pydantic.ValidationError  → 400 validation_error","operationId":"reconciliation_ack_endpoint_api_reconciliation_ack_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tearsheet/{cohort_id}":{"get":{"summary":"Tearsheet Endpoint","description":"GET /api/tearsheet/{cohort_id} — HTML default; ?format=json envelope.\n\nDoctrine anchors (BP-ADR-004 durable-trace citations):\n  * SDD §24.4 (on-demand rendering + per-cohort HTML cache) — the\n    dashboard reads the cache-first surface built by B4\n    ``tearsheet_cache.load_or_render``; that helper cites SDD §24.4\n    TTL + §24.7 AC-V07-03 (< 100ms cached-serve budget) and never\n    re-writes HTML B3 already materialized (BP-ADR-005 additive-only).\n  * SDD §24.5 (JSON export via ``?format=json``; PDF DEFERRED to\n    v0.8). Handler branches ON THE WIRE (single @app.get decorator,\n    same path); the FastAPI routing table cannot register two\n    @app.get decorators on the same path+method (the second silently\n    overrides), so single-handler + response branching is the ONLY\n    idiomatic representation of the SDD §24.5 \"same path,\n    ?format=json\" contract.\n  * SDD §12.1 (envelope shape) — JSON branch emits\n    ``{schema_version, generated_at, envelope:{state}, data}`` with\n    the ``data`` sub-object carrying the cohort metrics /warnings\n    surface. Envelope goes through ``_envelope_v05`` (established\n    CP-10.5 / CP-10.6 pattern; state maps to HTTP code via the\n    module-level ``_V05_STATE_HTTP_CODES`` table).\n  * SDD §12.3 (closed-vocab warnings) + SDD §12.4 (HTTP status\n    closed vocab) — unknown ``format`` returns a MANUAL\n    400 validation_error envelope (never FastAPI's default 422)\n    so the closed status vocab is preserved.\n  * SDD §12.7 (envelope embed in HTML) is an ASPIRATIONAL /\n    additive HTML enrichment — the current HTML shell does NOT\n    embed the envelope block. Deferred to CP-10.7 close-out /\n    CP-10.8 (non-breaking; no RED xfail exercises it).\n  * SDD §5.2 (state direction) — READ-ONLY over\n    ``data/xperformance/normalized_by_cohort/`` (upstream) + WRITE\n    confined to ``data/xdashboard/tearsheets/`` via the cache/render\n    seam (dashboard-owned).\n  * SDD §5.3 (presentation vs computation) — handler is a THIN\n    routing layer: (a) manual format validation, (b) delegate to\n    ``tearsheet_cache.load_or_render`` (which delegates to\n    ``tearsheet_service.render`` on MISS), (c) wire branch.\n  * SDD §5.4 (fail-closed) — every branch (unknown format, missing\n    cohort JSONL, cache lock timeout) returns a closed-vocab\n    envelope; NEVER a raw 500 or silent 200.\n  * SDD §6.2 (dashboard MUST-NOT set) — NO broker touch, NO\n    xstrategyengine / xmodels.registry / xxecution / xbroker /\n    xrisk / xfolio import; NO state mutation on the money-line\n    surface. The 3-layer defense (ModelEntry / ADVISORY_BADGE /\n    Literal[True] markers on ``xdashboard/schemas.py``) is\n    UNTOUCHED per BP-ADR-005.\n  * SDD §20.7 (panel-state closed vocab) reused via\n    ``_envelope_v05`` HTTP-code mapping — ``ok`` / ``empty`` both\n    map to 200; ``unavailable`` -> 503 (unused on this route because\n    PDF returns a manual 501, not the ``_envelope_v05`` wrapper).\n  * CP-10-7-OPENING-RULING §1.1 (Batch B5 — SINGLE additive GET\n    on ``/api/tearsheet/{cohort_id}``; @app.post stays EXACTLY 1;\n    route-count increment reconciled to +1 in the CP-10.7 close-out\n    note — the ruling's \"+2\" is INCOMPATIBLE with FastAPI routing\n    (see rationale above), and no RED test asserts route-count==41).\n  * CP-10-6-DASHBOARD-CONTROL-PLANE-REJECTION §2 (READ-ONLY\n    invariant) — this GET honors the rejection posture; no POST /\n    PUT / PATCH / DELETE variant is registered.\n  * CP-10-4-SCAFFOLD-RULINGS §1 (wire ``schema_version`` stays\n    ``\"0.3.0\"`` through v0.5+; additive payload expansion does\n    NOT bump the wire version).\n\nResponse contract\n-----------------\n* ``format=html`` (default) → ``HTMLResponse(content=result.html,\n  media_type='text/html; charset=utf-8')`` — matches SDD §24.4 +\n  the RED xfail\n  ``test_tearsheet_html_default_content_type_is_text_html``.\n* ``format=json`` → ``_envelope_v05(envelope)`` with the shape\n  ``{schema_version:'0.3.0', generated_at:<iso>, envelope:{state},\n  data:{cohort_id, metrics, warnings, generated_at,\n  source_timestamp, trade_count}}``. State derivation: ``ok`` if\n  ``trade_count>0`` and ``source_missing`` NOT in warnings, else\n  ``empty`` — both map to HTTP 200 via ``_V05_STATE_HTTP_CODES``.\n  NaN / Inf floats in metrics are scrubbed to ``None`` so\n  Starlette's ``allow_nan=False`` JSON serializer never sinks the\n  envelope (fail-closed per SDD §5.4).\n* ``format=pdf`` → HTTP 501 Not Implemented + envelope\n  ``{state:'unavailable', warnings:['format_pdf_deferred_to_v08']}``.\n  501 is the semantically-canonical DEFERRED-capability code per\n  SDD §24.5 + TDD_V07 §9; ``xdashboard/schemas.py`` untouched.\n* ``format=<other>`` → 400 validation_error envelope. Manual\n  whitelist check (NOT FastAPI ``Literal[...]``) so the SDD §12.4\n  closed HTTP-status vocab holds (Literal would auto-422).\n* Unknown ``cohort_id`` → 200 with envelope carrying\n  ``warnings=['source_missing']`` + ``state='empty'`` (propagated\n  from B3's fail-closed shell at\n  ``tearsheet_service.render`` L453-L454). Opening ruling §6's\n  404-via-``is_known_cohort`` cannot be honored in B5 scope: the\n  helper does not exist on ``xperformance/cohorts.py`` (verified\n  2026-08-01). Add ``is_known_cohort`` + upgrade to 404 in CP-10.7\n  close-out or CP-10.8 (additive, non-breaking).\n\nBoundary discipline\n-------------------\n* Deferred import of ``xdashboard.tearsheet_cache`` per BP-ADR-001\n  (keeps the module import graph narrow at app load; also keeps\n  the ``filelock`` third-party dep out of the app-startup path).\n  ``tearsheet_cache`` in turn transitively imports\n  ``tearsheet_service`` — both modules preserve the CP-10.6\n  zero-forbidden-import invariant per their B3/B4 docstrings.\n* Route handler signature carries ONLY wire-level FastAPI\n  ``Path()`` + ``Query()`` params per BP-ADR-002 (no arbitrary\n  state args, no ``**kwargs``).\n* No perpetual background thread; handler returns synchronously\n  per BP-ADR-007.\n\nNon-blocking notes (documented in the B5 handoff):\n  * B1 emits monthly ``normalized_<YYYY-MM>.jsonl``; this route\n    (via B3+B4) reads per-cohort ``<cohort_id>.jsonl`` under\n    ``_TEARSHEET_SOURCE_DIR``. Production per-cohort partition\n    task DEFERRED to CP-10.7 close-out per BP-ADR-006 (wiring\n    atlas deferred).\n  * Cohort IDs containing ``::`` (composite) are URL-legal but\n    Windows/NTFS-illegal in filenames; a sanitizing layer at the\n    cache-key boundary is a CP-10.7 close-out follow-up if\n    composite IDs enter B2's ratified default set.","operationId":"tearsheet_endpoint_api_tearsheet__cohort_id__get","parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","description":"Cohort identifier — resolves to source_dir/{cohort_id}.jsonl.","title":"Cohort Id"},"description":"Cohort identifier — resolves to source_dir/{cohort_id}.jsonl."},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Response format; closed vocab: html (default) | json | pdf.","default":"html","title":"Format"},"description":"Response format; closed vocab: html (default) | json | pdf."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/safety/kill_auth":{"get":{"summary":"Kill Auth List","description":"Pending requests (prefill source) + recent operator actions. Read-only, always available.","operationId":"kill_auth_list_api_safety_kill_auth_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/safety/kill_auth/approve":{"post":{"summary":"Kill Auth Approve","description":"Mint the token for a pending request. LOOPBACK-ONLY + flag-gated + fully audited.","operationId":"kill_auth_approve_api_safety_kill_auth_approve_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/safety/kill_auth/deny":{"post":{"summary":"Kill Auth Deny","operationId":"kill_auth_deny_api_safety_kill_auth_deny_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/safety/service_lifecycle":{"get":{"summary":"Service Lifecycle List","description":"Pending service-lifecycle (systemctl stop) requests + recent operator actions.\n\nRead-only, always available. Mirrors kill_auth_list exactly (DASHBOARD-SERVICE-LIFECYCLE-\nAPPROVAL-SURFACE-2026-09-25).","operationId":"service_lifecycle_list_api_safety_service_lifecycle_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/safety/service_lifecycle/approve":{"post":{"summary":"Service Lifecycle Approve","description":"Mint the manifest bundle for a pending service-lifecycle request. LOOPBACK-ONLY + flag-gated\n+ fully audited.\n\nADR §3 request_id-only tightening — reads ONLY request_id + operator_note from the body; any\nhost/units/manifest_hash/ttl_secs/session_id/verb the caller supplies is IGNORED and never\npassed to the backend. approve_service_lifecycle_request() reloads the manifest from the stored\npending request and recomputes manifest_hash itself, so an injected body cannot alter what gets\napproved.","operationId":"service_lifecycle_approve_api_safety_service_lifecycle_approve_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/safety/service_lifecycle/deny":{"post":{"summary":"Service Lifecycle Deny","operationId":"service_lifecycle_deny_api_safety_service_lifecycle_deny_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/search/usage":{"get":{"summary":"Search Usage","description":"Search-gate counters + the economy's signed value for retrieval.","operationId":"search_usage_api_search_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/alarms":{"get":{"summary":"Alarms","description":"Active alarms (FIRING / NOT_REPORTING / unreadable) from the alarm record store.","operationId":"alarms_api_alarms_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"summary":"Overview","operationId":"overview__get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}