param([string]$RepositoryRoot = '') Set-StrictMode -Version 3.0 $ErrorActionPreference = 'Stop' if ([string]::IsNullOrWhiteSpace($RepositoryRoot)) { $RepositoryRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..\..')) } $senseRoot = Join-Path $RepositoryRoot 'Sense' $passed = 0 function Assert-True([bool]$Condition, [string]$Message) { if (-not $Condition) { throw "ASSERT FAILED: $Message" } $script:passed++ } function Read-Utf8([string]$Path) { return [IO.File]::ReadAllText($Path, [Text.Encoding]::UTF8) } $baseline = Get-Content -LiteralPath (Join-Path $RepositoryRoot 'goadmin-baseline.json') -Raw -Encoding utf8 | ConvertFrom-Json Assert-True ($baseline.sources.'go-admin'.commit -eq 'f06540883b41d03782bb6b2c4150f298f328c6b6') 'Sense backend baseline drifted' Assert-True ($baseline.sources.'go-admin-ui'.commit -eq '67d393d713877572fab0b897296a4c1d525fc81d') 'Sense UI baseline drifted' Assert-True (Test-Path (Join-Path $senseRoot 'server\LICENSE.md')) 'go-admin MIT license is missing' Assert-True (Test-Path (Join-Path $senseRoot 'ui\LICENSE')) 'go-admin-ui MIT license is missing' $requiredBackend = @( 'server\cmd\cobra.go', 'server\common\middleware\auth.go', 'server\app\admin\router\router.go', 'server\cmd\migrate\migration\init.go' ) foreach ($relative in $requiredBackend) { Assert-True (Test-Path (Join-Path $senseRoot $relative)) "GoAdmin backend path missing: $relative" } $requiredFrontend = @( 'ui\src\router\index.js', 'ui\src\store\index.js', 'ui\src\store\modules\permission.js', 'ui\src\utils\request.js', 'ui\src\layout\index.vue', 'ui\src\directive\permission\permission.js' ) foreach ($relative in $requiredFrontend) { Assert-True (Test-Path (Join-Path $senseRoot $relative)) "go-admin-ui path missing: $relative" } $router = Read-Utf8 (Join-Path $senseRoot 'ui\src\store\modules\permission.js') Assert-True ($router.Contains("item.component === 'Layout' ? Layout")) 'dynamic routes no longer preserve GoAdmin Layout' $request = Read-Utf8 (Join-Path $senseRoot 'ui\src\utils\request.js') Assert-True ($request.Contains("Authorization") -and $request.Contains("axios.create")) 'Axios/JWT request chain is missing' $auth = Read-Utf8 (Join-Path $senseRoot 'server\common\middleware\auth.go') Assert-True ($auth.Contains('jwt.New') -and $auth.Contains('sense_session')) 'GoAdmin JWT chain is missing' $fixtureFiles = Get-ChildItem -LiteralPath (Join-Path $senseRoot 'tests\fixtures') -Recurse -File foreach ($file in $fixtureFiles) { $content = Read-Utf8 $file.FullName Assert-True ($content -notmatch '(?i)(admin123|password123|BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY)') "fixture contains a forbidden credential marker: $($file.Name)" if ($file.Extension -eq '.json') { [void]($content | ConvertFrom-Json); $passed++ } } Write-Host "Sense compatibility regression passed: $passed assertions."