Files
jiapuapp/tests/g03-bootstrap-client-release-gate.ps1
T
2026-07-24 07:56:33 +08:00

62 lines
2.2 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$issues = New-Object System.Collections.Generic.List[string]
function Read-RequiredFile {
param([string]$RelativePath)
$path = Join-Path $root $RelativePath
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
$script:issues.Add("missing required G03 file: $RelativePath")
return ''
}
return Get-Content -Raw -Encoding UTF8 -LiteralPath $path
}
function Assert-Contains {
param([string]$Content, [string]$Label, [string]$Expected)
if (-not $Content.Contains($Expected)) {
$script:issues.Add("$Label missing: $Expected")
}
}
function Assert-DoesNotContain {
param([string]$Content, [string]$Label, [string]$Forbidden)
if ($Content.Contains($Forbidden)) {
$script:issues.Add("$Label must not claim unsupported remote ownership: $Forbidden")
}
}
$page = Read-RequiredFile 'pages/genealogy/g03-create-genealogy.vue'
$flowContract = Read-RequiredFile 'tests/g03-create-flow-contract.ps1'
$flowRuntime = Read-RequiredFile 'tests/g03-create-flow-runtime-smoke.js'
# Apifox only declares two independent writes. There is no recoverable atomic
# bootstrap or result-query operation, so G03 remains an explicit local preview.
Assert-Contains $page 'G03 page' 'flow-success-dialog__copy'
Assert-Contains $page 'G03 page' 'createLocalGenealogyPreview'
Assert-Contains $page 'G03 page' 'updateLocalGenealogyPreviewAncestor'
Assert-Contains $page 'G03 page' 'removeLocalGenealogyPreview'
Assert-Contains $flowContract 'G03 flow contract' 'createLocalGenealogyPreview'
Assert-Contains $flowRuntime 'G03 runtime smoke' 'local-created-'
foreach ($forbidden in @(
'createGenealogyBootstrapCoordinator',
'genealogy-bootstrap-operations',
'Idempotency-Key',
'/genealogy/app/region/search',
'requestStrict(',
'appApi.'
)) {
Assert-DoesNotContain $page 'G03 page' $forbidden
}
if ($issues.Count -gt 0) {
Write-Output 'G03-BOOTSTRAP-CLIENT-RELEASE BLOCKED'
foreach ($issue in $issues) { Write-Output "- $issue" }
Write-Output '- Keep the two-step visual preview local until Apifox supplies a recoverable create/result contract with a stable lexical genealogyId.'
exit 1
}
Write-Output 'G03-BOOTSTRAP-CLIENT-RELEASE PASS'