Shadow run (ROADMAP M5, phase-1 acceptance form): SHADOW runtime mode records
bids without submitting them, simulates the market answer from the actual
day-ahead clearing price, dispatches to the simulation gateway, runs the D+1
review, and scores every day shadow-vs-human-vs-hindsight (ShadowDayRecord)
with a lineage-completeness audit. KpiReport regenerated after every day per
docs/12 §4 definitions (C1/C2 placeholders as named config).
Kill switches (docs/13 §8): BreakerService with L0 permit revocation, L1
envelope suspension, L2 loss breaker (mark-to-market, reduce-only bids),
L3 channel breaker (bids fall back to the file channel, dispatch BLOCKED),
L4 AI-off (templates run, no Proposal created); abnormal-day protocol on
EXTREME situations; per-level authority (B8 placeholder); auditable drill.
Runtime: shadow-close workflow, shadow schedule entries, live-data ingestion
through the quality gate, human-bid ingestion, breaker/KPI/shadow endpoints
and insight cards, replay CLI (npm run shadow). Ledger, time series and
streak counters are file-backed so a multi-week run survives restarts.
Domain: HumanBidRecord, ShadowDayRecord, KpiReport, BreakerRecord, SHADOW
receipt channel; contracts, fixtures and pydantic models regenerated.
Services: L2 metrics moved from evals so the shadow run and the harness
share one implementation.
Fixes: envelope/permit validity compared ISO timestamps as strings
('…00Z' vs '…00.000Z'); L2 baseline was stale since M4 (skill_versions only,
metrics unchanged) — rewritten from the live service.
Docs: docs/14 shadow-run runbook (timeline, breaker trigger/authority/
recovery, KPI definitions as implemented); README and CLAUDE.md status.
Tests: 21 consecutive shadow days with complete lineage, KPI report, WIDEN
recommendation produced but not acted on; restart durability; drill; L2/L3/L4
and abnormal-day paths; API.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wrZgPL9LoKaD69BpEQU4v
454 lines
10 KiB
JSON
454 lines
10 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"market_date": {
|
|
"type": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
},
|
|
"shadow": {
|
|
"type": "object",
|
|
"properties": {
|
|
"proposal_id": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"digest": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"pattern": "^[0-9a-f]{64}$"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"outcome": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"expected_revenue_yuan": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"line": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"cleared_energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"realised_revenue_yuan": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
}
|
|
},
|
|
"required": [
|
|
"energy_mwh",
|
|
"cleared_energy_mwh",
|
|
"realised_revenue_yuan"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"llm_used": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"proposal_id",
|
|
"digest",
|
|
"outcome",
|
|
"expected_revenue_yuan",
|
|
"line",
|
|
"llm_used"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"human": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"record_id": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"source": {
|
|
"type": "string",
|
|
"enum": [
|
|
"TRADING_PLATFORM_EXPORT",
|
|
"MANUAL_ENTRY",
|
|
"SYNTHETIC_NAIVE"
|
|
]
|
|
},
|
|
"line": {
|
|
"type": "object",
|
|
"properties": {
|
|
"energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"cleared_energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"realised_revenue_yuan": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
}
|
|
},
|
|
"required": [
|
|
"energy_mwh",
|
|
"cleared_energy_mwh",
|
|
"realised_revenue_yuan"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"required": [
|
|
"record_id",
|
|
"source",
|
|
"line"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"hindsight": {
|
|
"type": "object",
|
|
"properties": {
|
|
"energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"cleared_energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"realised_revenue_yuan": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
}
|
|
},
|
|
"required": [
|
|
"energy_mwh",
|
|
"cleared_energy_mwh",
|
|
"realised_revenue_yuan"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"naive": {
|
|
"type": "object",
|
|
"properties": {
|
|
"energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"cleared_energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"realised_revenue_yuan": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
}
|
|
},
|
|
"required": [
|
|
"energy_mwh",
|
|
"cleared_energy_mwh",
|
|
"realised_revenue_yuan"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"award": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"energy_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"energy_mwh"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"dispatch": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"proposal_id": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"outcome": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"shortfall_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
}
|
|
},
|
|
"required": [
|
|
"proposal_id",
|
|
"outcome",
|
|
"shortfall_mwh"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"execution": {
|
|
"anyOf": [
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"planned_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"delivered_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"deviation_mwh": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"fulfillment_ratio": {
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
"within_band": {
|
|
"type": "boolean"
|
|
},
|
|
"simulated": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"planned_mwh",
|
|
"delivered_mwh",
|
|
"deviation_mwh",
|
|
"fulfillment_ratio",
|
|
"within_band",
|
|
"simulated"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"forecast": {
|
|
"type": "object",
|
|
"properties": {
|
|
"load_mape": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"pv_nrmse": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"price_mape": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"price_coverage_p10_p90": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"pattern": "^-?\\d+(\\.\\d+)?$"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"load_mape",
|
|
"pv_nrmse",
|
|
"price_mape",
|
|
"price_coverage_p10_p90"
|
|
],
|
|
"additionalProperties": false
|
|
},
|
|
"decision_latency_ms": {
|
|
"anyOf": [
|
|
{
|
|
"type": "integer",
|
|
"minimum": 0,
|
|
"maximum": 9007199254740991
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"review_finding_id": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"envelope_recommendations": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"envelope_id": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"action": {
|
|
"type": "string",
|
|
"enum": [
|
|
"WIDEN",
|
|
"NARROW",
|
|
"SUSPEND",
|
|
"KEEP"
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"envelope_id",
|
|
"action"
|
|
],
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"breakers_tripped": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"enum": [
|
|
"L0",
|
|
"L1",
|
|
"L2",
|
|
"L3",
|
|
"L4"
|
|
]
|
|
}
|
|
},
|
|
"abnormal_day": {
|
|
"type": "boolean"
|
|
},
|
|
"lineage_complete": {
|
|
"type": "boolean"
|
|
},
|
|
"lineage_gaps": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"generated_at": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"market_date",
|
|
"shadow",
|
|
"human",
|
|
"hindsight",
|
|
"naive",
|
|
"award",
|
|
"dispatch",
|
|
"execution",
|
|
"forecast",
|
|
"decision_latency_ms",
|
|
"review_finding_id",
|
|
"envelope_recommendations",
|
|
"breakers_tripped",
|
|
"abnormal_day",
|
|
"lineage_complete",
|
|
"lineage_gaps",
|
|
"generated_at"
|
|
],
|
|
"additionalProperties": false,
|
|
"$id": "https://vpp-ai-platform/contracts/shadow_day_record.json",
|
|
"title": "ShadowDayRecord"
|
|
}
|