接口开始5%

This commit is contained in:
rain
2026-07-22 17:31:33 +08:00
parent eced3d1e6e
commit 9b0ad62df4
426 changed files with 20111 additions and 28472 deletions
@@ -0,0 +1,77 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$visualBaselinePath = Join-Path $root 'docs/视觉资产与构建基线.md'
if (-not (Test-Path -LiteralPath $visualBaselinePath -PathType Leaf)) {
throw '缺少视觉资产与构建基线文档'
}
$visualBaseline = Get-Content -Raw -Encoding UTF8 -LiteralPath $visualBaselinePath
# 第一步:锁定证据语义。浏览器仍可做逻辑调试,但最终视觉通过只能由当轮 MuMu 复核得出。
foreach ($requiredPolicy in @(
'浏览器截图只可用于逻辑调试,不能作为视觉通过证据。',
'最终视觉复核只能使用用户当前在线的 MuMu 安卓模拟器'
)) {
if (-not $visualBaseline.Contains($requiredPolicy)) {
throw "视觉验收边界缺少权威规则:$requiredPolicy"
}
}
# 第二步:退役固定截图助手及其自证合同,避免把截图工具存在本身误报为产品行为覆盖。
$retiredPaths = @(
'scripts/capture-chrome-page.js',
'scripts/create-horizontal-contact-sheet.ps1',
'tests/capture-chrome-page-contract.ps1',
'tests/capture-f-series-states-contract.ps1',
'tests/capture-g03-states-contract.ps1',
'tests/capture-g08-states-contract.ps1',
'tests/capture-g09-states-contract.ps1',
'tests/capture-g10-states-contract.ps1',
'tests/capture-g11-g12-states-contract.ps1',
'tests/capture-t03-t06-states-contract.ps1',
'tests/n-series-all-states-visual-contract.ps1'
)
foreach ($relativePath in $retiredPaths) {
if (Test-Path -LiteralPath (Join-Path $root $relativePath)) {
throw "仍存在已退役的浏览器截图链文件:$relativePath"
}
}
$unexpectedCaptureContracts = @(
Get-ChildItem -LiteralPath (Join-Path $root 'tests') -File -Filter 'capture-*-contract.ps1'
)
if ($unexpectedCaptureContracts.Count -gt 0) {
throw "仍存在未登记的浏览器截图自证合同:$($unexpectedCaptureContracts.Name -join ', ')"
}
# 第三步:只移除截图副作用,三个有业务价值的运行时合同必须继续存在。
$retainedRuntimeContracts = @(
'tests/g01-switch-dialog-runtime-smoke.js',
'tests/t03-t08-business-specialization-runtime-smoke.js',
'tests/t07-module-baseline-runtime-smoke.js'
)
foreach ($relativePath in $retainedRuntimeContracts) {
if (-not (Test-Path -LiteralPath (Join-Path $root $relativePath) -PathType Leaf)) {
throw "误删了应保留的浏览器逻辑合同:$relativePath"
}
}
# 第四步:全部已跟踪与未跟踪的 JS 系文件都不得提交自动截图证据链;CDP、视口模拟和 DOM 断言仍可用于逻辑与布局调试。
$javascriptPaths = @(
& git -c core.excludesFile=NUL -C $root ls-files --cached --others --exclude-standard -- '*.js' '*.mjs' '*.cjs'
)
if ($LASTEXITCODE -ne 0) {
throw '无法枚举仓库中的 JavaScript 文件'
}
foreach ($relativePath in @($javascriptPaths | Sort-Object -Unique)) {
$absolutePath = Join-Path $root $relativePath
if (-not (Test-Path -LiteralPath $absolutePath -PathType Leaf)) { continue }
$content = Get-Content -Raw -Encoding UTF8 -LiteralPath $absolutePath
if ($content.Contains('Page.captureScreenshot')) {
throw "禁止提交自动浏览器截图证据链:$relativePath"
}
}
Write-Output 'MUMU-VISUAL-ACCEPTANCE-BOUNDARY-CONTRACT PASS'