update_dragon_reports.ps1 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. param(
  2. [switch]$OpenReport,
  3. [switch]$StrictGate
  4. )
  5. $ErrorActionPreference = "Stop"
  6. Set-Location -LiteralPath $PSScriptRoot
  7. Write-Host "[dragon] running forward observation pipeline..."
  8. py .\dragon_forward_observation_pipeline.py
  9. $statePath = Join-Path $PSScriptRoot "dragon_rollout_state.json"
  10. $manifestPath = Join-Path $PSScriptRoot "dragon_daily_rc1_manifest.json"
  11. $state = $null
  12. $manifest = $null
  13. if (Test-Path -LiteralPath $statePath) {
  14. $state = Get-Content -Raw -LiteralPath $statePath | ConvertFrom-Json
  15. }
  16. if (Test-Path -LiteralPath $manifestPath) {
  17. $manifest = Get-Content -Raw -LiteralPath $manifestPath | ConvertFrom-Json
  18. }
  19. Write-Host "[dragon] reports updated:"
  20. Write-Host " - dragon_reports_index.html"
  21. Write-Host " - dragon_daily_signal_report.html"
  22. Write-Host " - dragon_forward_weekly_review.html"
  23. Write-Host " - dragon_rollout_governance_report.md"
  24. if ($null -ne $manifest) {
  25. Write-Host ("[dragon] latest bar: {0} | request date: {1}" -f $manifest.latest_bar_date, $manifest.as_of_request_date)
  26. }
  27. if ($null -ne $state) {
  28. $ok = 0
  29. $warn = 0
  30. $hard = 0
  31. if ($null -ne $state.gate_status_counts) {
  32. if ($state.gate_status_counts.PSObject.Properties.Name -contains "ok") { $ok = [int]$state.gate_status_counts.ok }
  33. if ($state.gate_status_counts.PSObject.Properties.Name -contains "warning") { $warn = [int]$state.gate_status_counts.warning }
  34. if ($state.gate_status_counts.PSObject.Properties.Name -contains "hard_fail") { $hard = [int]$state.gate_status_counts.hard_fail }
  35. }
  36. Write-Host ("[dragon] rollout decision: {0}" -f $state.decision)
  37. Write-Host ("[dragon] active/fallback: {0} / {1}" -f $state.active_branch, $state.fallback_branch)
  38. Write-Host ("[dragon] gate counts: ok={0}, warning={1}, hard_fail={2}" -f $ok, $warn, $hard)
  39. if ($StrictGate -and $state.decision -ne "FORWARD_OK") {
  40. Write-Error ("[dragon] strict gate blocked: decision={0}" -f $state.decision)
  41. exit 2
  42. }
  43. }
  44. if ($OpenReport) {
  45. Start-Process (Join-Path $PSScriptRoot "dragon_reports_index.html")
  46. }