updates
All checks were successful
Zone / build (push) Successful in 13s

This commit is contained in:
2026-06-04 14:18:21 +01:00
parent 43135bcec9
commit 569c9853bf
11 changed files with 1841 additions and 1163 deletions

83
scripts/gated-analysis.ps1 Normal file → Executable file
View File

@@ -32,6 +32,64 @@ function Get-ProjectFiles {
}
}
function Test-ManifestSchema {
Write-Host 'Validating data/manifest.json...'
$manifestPath = Join-Path (Get-Location) 'data/manifest.json'
if (-not (Test-Path -LiteralPath $manifestPath)) {
Add-SmellFailure 'data/manifest.json is missing.'
return $false
}
try {
$manifest = Get-Content -Raw -LiteralPath $manifestPath | ConvertFrom-Json
} catch {
Add-SmellFailure "data/manifest.json is not valid JSON: $($_.Exception.Message)"
return $false
}
$requiredRoots = @('dashboard', 'links', 'builds', 'status')
foreach ($key in $requiredRoots) {
if (-not ($manifest.PSObject.Properties.Name -contains $key)) {
Add-SmellFailure "manifest missing required key '$key'."
return $false
}
}
$linkIds = New-Object 'System.Collections.Generic.HashSet[string]'
foreach ($link in @($manifest.links)) {
if ([string]::IsNullOrWhiteSpace($link.id)) {
Add-SmellFailure 'manifest link missing id.'
return $false
}
if (-not $linkIds.Add([string]$link.id)) {
Add-SmellFailure "duplicate manifest link id '$($link.id)'."
return $false
}
}
$buildIds = New-Object 'System.Collections.Generic.HashSet[string]'
foreach ($build in @($manifest.builds)) {
if ([string]::IsNullOrWhiteSpace($build.id)) {
Add-SmellFailure 'manifest build missing id.'
return $false
}
if (-not $buildIds.Add([string]$build.id)) {
Add-SmellFailure "duplicate manifest build id '$($build.id)'."
return $false
}
foreach ($pathKey in @('start', 'status', 'logs')) {
$section = $build.$pathKey
if ($null -eq $section -or [string]::IsNullOrWhiteSpace($section.path)) {
Add-SmellFailure "manifest build '$($build.id)' missing $pathKey.path."
return $false
}
}
}
Write-Host 'Manifest schema validation passed.'
return $true
}
function Test-CodeSmells {
Write-Host 'Running gated smell checks...'
@@ -120,7 +178,7 @@ function Send-DiscordReport {
return
}
$status = if ($SmellsPassed -and $Tests.Passed) { 'passed' } else { 'failed' }
$status = if ($SmellsPassed -and $Tests.Passed -and $manifestPassed) { 'passed' } else { 'failed' }
$color = if ($status -eq 'passed') { 5763719 } else { 15548997 }
$shaShort = if ($Sha -and $Sha.Length -ge 7) { $Sha.Substring(0, 7) } else { $Sha }
$repoText = if ($Repository) { $Repository } else { 'zone' }
@@ -178,6 +236,27 @@ Tests: $testStatus
Write-Host 'Discord report published.'
}
function Test-ManifestV2Validator {
Write-Host 'Running scripts/validate-manifest.mjs...'
$validator = Join-Path (Get-Location) 'scripts/validate-manifest.mjs'
if (-not (Test-Path -LiteralPath $validator)) {
Add-SmellFailure 'scripts/validate-manifest.mjs is missing.'
return $false
}
$output = & node $validator 2>&1 | Out-String
if ($LASTEXITCODE -ne 0) {
Add-SmellFailure "validate-manifest.mjs failed: $output"
return $false
}
Write-Host $output.Trim()
return $true
}
$manifestPassed = (Test-ManifestSchema) -and (Test-ManifestV2Validator)
if (-not $manifestPassed) {
$exitCode = 1
}
$smellsPassed = Test-CodeSmells
if (-not $smellsPassed) {
$exitCode = 1
@@ -188,5 +267,5 @@ if (-not $tests.Passed) {
$exitCode = $tests.ExitCode
}
Send-DiscordReport -SmellsPassed $smellsPassed -Tests $tests
Send-DiscordReport -SmellsPassed ($smellsPassed -and $manifestPassed) -Tests $tests
exit $exitCode