$ErrorActionPreference = 'Stop' function ConvertFrom-Utf8Base64 { param([string]$Value) return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Value)) } function Assert-Contains { param([string]$Content, [string]$Expected, [string]$Message) if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message } } function Assert-NotContains { param([string]$Content, [string]$Unexpected, [string]$Message) if ($Content -match [regex]::Escape($Unexpected)) { throw $Message } } $root = Split-Path -Parent $PSScriptRoot $pagePath = Join-Path $root 'pages/auth/a05-reset-password.vue' $pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json $catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8 $page = Get-Content -LiteralPath $pagePath -Raw -Encoding utf8 $resetCopy = ConvertFrom-Utf8Base64 '6YeN6K6+5a+G56CB' $confirmPasswordCopy = ConvertFrom-Utf8Base64 '56Gu6K6k5paw5a+G56CB' $getCodeCopy = ConvertFrom-Utf8Base64 '6I635Y+W6aqM6K+B56CB' $loginCopy = ConvertFrom-Utf8Base64 '6L+U5Zue55m75b2V' $sliderPendingCopy = ConvertFrom-Utf8Base64 '5ruR5Yqo6aqM6K+B5b6F5o6l5Y+j5o6l5YWl' if (-not ($pages.pages.path -contains 'pages/auth/a05-reset-password')) { throw 'A-05 route must remain declared in pages.json' } Assert-NotContains -Content $page -Unexpected 'ModulePage' -Message 'A-05 must not remain a ModulePage shell' foreach ($required in @( '', 'const submitReset = () =>', 'const fieldErrors = ref({', 'const successVisible = ref(false)', 'class="feedback-toast"', 'class="success-layer"', 'const prepareLogin = () => uni.redirectTo({ url: "/pages/auth/a01-entry" });', 'if (!/^1\d{10}$/.test(phone.value))', 'if (!/^\d{6}$/.test(verificationCode.value))', 'validatePassword(password.value)', 'PASSWORD_POLICY_MESSAGE', 'if (password.value !== confirmPassword.value)', 'adaptive.adaptive-feedback-toast;', 'top: calc(var(--status-bar-height, 0px) + 24rpx);', 'max-height: calc(var(--app-viewport-height) - 40px);' )) { Assert-Contains -Content $page -Expected $required -Message "Missing A-05 reset-password contract: $required" } Assert-Contains -Content $page -Expected $resetCopy -Message 'A-05 must visibly identify the password-reset task' Assert-Contains -Content $page -Expected $confirmPasswordCopy -Message 'A-05 must require password confirmation' Assert-Contains -Content $page -Expected $getCodeCopy -Message 'A-05 must expose the verification-code action' Assert-Contains -Content $page -Expected $loginCopy -Message 'A-05 must provide the A01 return path' Assert-Contains -Content $page -Expected $sliderPendingCopy -Message 'A-05 must defer the real slider to the interface stage' Assert-NotContains -Content $catalog -Unexpected 'a05:' -Message 'A-05 must not remain in the temporary page catalog' foreach ($forbidden in @('class="page-canvas"', 'class="page-backdrop"', 'mode="scaleToFill"', '1665rpx', 'a01-red-hall-ink-backdrop-v1.png')) { Assert-NotContains -Content $page -Unexpected $forbidden -Message "A05 retains rejected page coordinates: $forbidden" } foreach ($obsoleteVisual in @( 'a01-primary-button.png', 'a01-secondary-button.png', 'a02-login-panel.png', 'auth-divider-knot.png', 'feedback-toast__skin', 'codeRequested', 'verificationVisible', 'verification-layer', 'closeVerification', 'confirmVerification', 'font-family:' )) { Assert-NotContains -Content $page -Unexpected $obsoleteVisual -Message "A-05 must not retain obsolete visual or placeholder state: $obsoleteVisual" } $primarySkinCount = ([regex]::Matches($page, 'a01-scroll-primary-v3\.png')).Count if ($primarySkinCount -ne 2) { throw "A-05 must use the approved primary skin exactly twice, found $primarySkinCount" } foreach ($nativeUi in @('uni.showToast', 'uni.showModal', 'uni.showLoading', 'uni.showActionSheet')) { Assert-NotContains -Content $page -Unexpected $nativeUi -Message "A-05 must not use native UniApp feedback: $nativeUi" } Assert-NotContains -Content $page -Unexpected '/pages/auth/a02-login' -Message 'A-05 must not return to the retired A02 route.' foreach ($forbidden in @( '(?s)\.reset-panel\s*\{[^}]*\bborder\s*:', '(?s)\.reset-panel\s*\{[^}]*\bbackground\s*:', '(?s)\.reset-submit\s*\{[^}]*\bborder\s*:', '(?s)\.reset-submit\s*\{[^}]*\bbackground\s*:' )) { if ($page -match $forbidden) { throw "A-05 retains forbidden CSS visual construction: $forbidden" } } $contentRule = [regex]::Match($page, '(?ms)^\.reset-content\s*\{(?.*?)^\}') if (-not $contentRule.Success) { throw 'A05 reset content rule is missing.' } foreach ($required in @('display: flex;', 'flex: 1;', 'flex-direction: column;', 'max-width: 480px;', 'margin: 0 auto;')) { Assert-Contains -Content $contentRule.Groups['Body'].Value -Expected $required -Message "A05 reset content must use document flow: $required" } $headingRule = [regex]::Match($page, '(?ms)^\.page-heading\s*\{(?.*?)^\}') if (-not $headingRule.Success) { throw 'A05 page heading rule is missing.' } Assert-Contains -Content $headingRule.Groups['Body'].Value -Expected 'grid-template-columns: minmax(0, 1fr);' -Message 'A05 heading must center against the full content width.' foreach ($selector in @('page-title', 'page-subtitle', 'reset-divider')) { $rule = [regex]::Match($page, "(?ms)^\.$selector\s*\{(?.*?)^\}") if (-not $rule.Success) { throw "A05 heading child rule is missing: $selector" } Assert-Contains -Content $rule.Groups['Body'].Value -Expected 'grid-column: 1;' -Message "A05 heading child must remain in the full-width grid column: $selector" } Write-Output 'A05-RESET-PASSWORD-CONTRACT PASS'