-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
245 lines (202 loc) · 8.64 KB
/
Copy pathsetup.ps1
File metadata and controls
245 lines (202 loc) · 8.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
param(
[string]$RepoRoot = ".",
[string]$PythonExe = "python",
[string]$DataRoot = "",
# Execution modes
[switch]$BootstrapOnly,
[switch]$SkipBootstrap,
[switch]$SkipSmoke,
# Forward to Bootstrap / RepoSmoke (Path B foundation)
[switch]$OfflineValidationMode,
[switch]$RunStageProbes,
[switch]$RunOrchestrator,
# Phase5 / validator control
[switch]$SkipPhase5,
[switch]$SkipDeterminism,
[switch]$SkipSchema,
[switch]$SkipContract,
[switch]$SkipCoverage,
[switch]$SkipIntegrity,
[switch]$SkipDrift,
[switch]$SkipRegression,
[double]$RegressionTolerance = 0.0,
[double]$DriftTolerance = 0.10,
# Align with RepoSmoke / Phase5 Batch
[switch]$EnableCaseExpectOverride,
[string[]]$RequiredEventTypes = @(),
[switch]$RequireInterpretationOutput,
[switch]$SkipNonFeedbackCases,
[switch]$StrictValidation,
[string]$SummaryOutputPath = "",
# ------------------------------------------------------------
# NEW: Path A / intersection wiring (additive only)
# ------------------------------------------------------------
[switch]$RunPathABaseline,
[switch]$RunPathAIngestion,
[switch]$RunDeploymentGate,
[switch]$SkipPathAVerify,
[switch]$RunOfflineAnalysis
)
$ErrorActionPreference = "Stop"
# --------------------------------------------------
# logging
# --------------------------------------------------
function Write-Info($msg) { Write-Host "[SETUP] $msg" -ForegroundColor Cyan }
function Write-Warn2($msg) { Write-Host "[SETUP][WARN] $msg" -ForegroundColor Yellow }
function Write-Ok($msg) { Write-Host "[SETUP][OK] $msg" -ForegroundColor Green }
function Write-Fail($msg) { Write-Host "[SETUP][FAIL] $msg" -ForegroundColor Red }
# --------------------------------------------------
# helpers
# --------------------------------------------------
function Resolve-AbsolutePath($Path, $BaseDir) {
if ([string]::IsNullOrWhiteSpace($Path)) { return $Path }
if ([System.IO.Path]::IsPathRooted($Path)) { return $Path }
return (Join-Path $BaseDir $Path)
}
function Test-FileExists($Path, $Label) {
if (-not (Test-Path -LiteralPath $Path)) {
throw "$Label not found: $Path"
}
}
function Get-ProjectPython($RepoRoot, $PythonExe) {
$venv = Join-Path $RepoRoot ".venv\Scripts\python.exe"
if (Test-Path -LiteralPath $venv) {
Write-Ok "Using venv python: $venv"
return $venv
}
Write-Warn2 "venv python not found -> using: $PythonExe"
return $PythonExe
}
# --------------------------------------------------
# script targets (repo-level)
# --------------------------------------------------
$BootstrapScript = ".\bootstrap.ps1"
$RepoSmokeScript = ".\Run-RepoSmoke.ps1"
$RuntimeDbBuildScript = ".\Run_UpdateRuntimeDbs.ps1"
$IngestionRuntimeScript = ".\Run_Ingestion.ps1"
$DeploymentGateScript = ".\Run-DeploymentGate.ps1"
# --------------------------------------------------
# main
# --------------------------------------------------
Push-Location $RepoRoot
try {
$resolvedRoot = (Resolve-Path ".").Path
$pythonBin = Get-ProjectPython $resolvedRoot $PythonExe
$resolvedDataRoot = Resolve-AbsolutePath $DataRoot $resolvedRoot
Write-Host ""
Write-Host "============================================="
Write-Host "RGA Setup Entry"
Write-Host "============================================="
Write-Host "RepoRoot : $resolvedRoot"
Write-Host "Python : $pythonBin"
if (-not [string]::IsNullOrWhiteSpace($resolvedDataRoot)) {
Write-Host "DataRoot : $resolvedDataRoot"
}
Write-Host ""
# --------------------------------------------------
# STEP 1: Bootstrap
# --------------------------------------------------
if (-not $SkipBootstrap) {
Test-FileExists $BootstrapScript "bootstrap.ps1"
Write-Info "Running bootstrap..."
$bootstrapParams = @{
RepoRoot = $resolvedRoot
PythonExe = $PythonExe
SkipInstall = $true
SkipOneDriveCheck = $true
}
if (-not [string]::IsNullOrWhiteSpace($resolvedDataRoot)) {
$bootstrapParams["DataRoot"] = $resolvedDataRoot
}
if ($OfflineValidationMode) { $bootstrapParams["OfflineValidationMode"] = $true }
if ($RunStageProbes) { $bootstrapParams["RunStageProbes"] = $true }
if ($RunOrchestrator) { $bootstrapParams["RunOrchestrator"] = $true }
& $BootstrapScript @bootstrapParams
if ($LASTEXITCODE -ne 0) {
throw "bootstrap.ps1 failed"
}
Write-Ok "Bootstrap completed"
}
else {
Write-Warn2 "Skipping bootstrap"
}
# --------------------------------------------------
# EXIT EARLY (bootstrap only mode)
# --------------------------------------------------
if ($BootstrapOnly) {
Write-Ok "Bootstrap-only mode complete"
exit 0
}
# --------------------------------------------------
# STEP 2: Repo Smoke / Path A + Path B harness
# IMPORTANT:
# setup.ps1 is the outer orchestrator. If bootstrap already ran
# successfully above, RepoSmoke must NOT run bootstrap again.
# --------------------------------------------------
if (-not $SkipSmoke) {
Test-FileExists $RepoSmokeScript "Run-RepoSmoke.ps1"
Test-FileExists $RuntimeDbBuildScript "Run_UpdateRuntimeDbs.ps1"
Test-FileExists $IngestionRuntimeScript "Run_Ingestion.ps1"
Test-FileExists $DeploymentGateScript "Run-DeploymentGat.ps1"
Write-Info "Running repo smoke..."
$smokeParams = @{
ProjectRoot = $resolvedRoot
PythonExe = $PythonExe
# Always skip bootstrap inside RepoSmoke when called from setup.ps1
SkipBootstrap = $true
# Path A / intersection wiring
RuntimeDbBuildScript = $RuntimeDbBuildScript
IngestionRuntimeScript = $IngestionRuntimeScript
DeploymentGateScript = $DeploymentGateScript
}
# Existing Path B controls
if ($SkipPhase5) { $smokeParams["SkipPhase5"] = $true }
if ($OfflineValidationMode) { $smokeParams["OfflineValidationMode"] = $true }
if ($RunStageProbes) { $smokeParams["RunStageProbes"] = $true }
if ($RunOrchestrator) { $smokeParams["RunOrchestrator"] = $true }
if ($SkipDeterminism) { $smokeParams["SkipDeterminism"] = $true }
if ($SkipSchema) { $smokeParams["SkipSchema"] = $true }
if ($SkipContract) { $smokeParams["SkipContract"] = $true }
if ($SkipCoverage) { $smokeParams["SkipCoverage"] = $true }
if ($SkipIntegrity) { $smokeParams["SkipIntegrity"] = $true }
if ($SkipDrift) { $smokeParams["SkipDrift"] = $true }
if ($SkipRegression) { $smokeParams["SkipRegression"] = $true }
$smokeParams["RegressionTolerance"] = $RegressionTolerance
$smokeParams["DriftTolerance"] = $DriftTolerance
# Forward newer RepoSmoke / Phase5 Batch controls
if ($EnableCaseExpectOverride) { $smokeParams["EnableCaseExpectOverride"] = $true }
if ($RequireInterpretationOutput) { $smokeParams["RequireInterpretationOutput"] = $true }
if ($SkipNonFeedbackCases) { $smokeParams["SkipNonFeedbackCases"] = $true }
if ($StrictValidation) { $smokeParams["StrictValidation"] = $true }
if ($RequiredEventTypes -and $RequiredEventTypes.Count -gt 0) {
$smokeParams["RequiredEventTypes"] = $RequiredEventTypes
}
if ($SummaryOutputPath -and $SummaryOutputPath.Trim() -ne "") {
$smokeParams["SummaryOutputPath"] = $SummaryOutputPath
}
# NEW: Path A execution controls
if ($RunPathABaseline) { $smokeParams["RunPathABaseline"] = $true }
if ($RunPathAIngestion) { $smokeParams["RunPathAIngestion"] = $true }
if ($RunDeploymentGate) { $smokeParams["RunDeploymentGate"] = $true }
if ($SkipPathAVerify) { $smokeParams["SkipPathAVerify"] = $true }
if ($RunOfflineAnalysis) { $smokeParams["RunOfflineAnalysis"] = $true }
& $RepoSmokeScript @smokeParams
if ($LASTEXITCODE -ne 0) {
throw "Run-RepoSmoke.ps1 failed"
}
Write-Ok "Repo smoke completed"
}
else {
Write-Warn2 "Skipping repo smoke"
}
# --------------------------------------------------
# FINAL
# --------------------------------------------------
Write-Host ""
Write-Host "============================================="
Write-Host "SETUP COMPLETE"
Write-Host "============================================="
}
finally {
Pop-Location
}