# ============================================================================== # ClassNotify P1-RC2 Gate Acceptance — Suite RC-3C: Windows Reboot Recovery # Phase 1: Pre-Reboot State Snapshot, Scheduled Task Registration & Reboot Trigger # Release Candidate: P1-RC2-20260922-151442-F2C14966 # Target Host: DESKTOP-DJ40RL2 (Windows 11 Enterprise x64) # Remote Host: 158.179.179.29 (Ubuntu 22.04 LTS ARM64, Tokyo) # Reviewer Mandate: https://chatgpt.com/c/6aaf9c23-6244-83ed-9446-172266b0ce50 # Production Source: 100% FROZEN (0 lines modified) # ============================================================================== [CmdletBinding()] param( [string]$BaseUrl = "https://classnotify.paradise.eu.org", [string]$ExpectedInstallerSha256 = "F2C14966E99B47A5A67436F7E4E1FB72A363FCB560BF19C07BDF23DEA5BDADD9", [string]$RCArtifactId = "P1-RC2-20260922-151442-F2C14966", [string]$TargetDeviceId = "dev_59e35e79", [string]$TargetClassId = "cls_802", [switch]$DryRun ) $ErrorActionPreference = "Stop" $scriptStartTime = Get-Date $timestampStr = $scriptStartTime.ToString("yyyyMMdd-HHmmss") $evidenceId = "EVIDENCE-RC3-REBOOT-$timestampStr" $localEvidenceDir = "C:\Users\Administrator\.gemini\antigravity\scratch\ClassNotify\acceptance_evidence\$evidenceId" New-Item -ItemType Directory -Path $localEvidenceDir -Force | Out-Null $transcriptPath = Join-Path $localEvidenceDir "console-output.txt" Start-Transcript -Path $transcriptPath -Force | Out-Null Write-Host "==========================================================================" -ForegroundColor Cyan Write-Host " ClassNotify P1 RC2 — Gate RC-3C: Windows Reboot Recovery Initiation " -ForegroundColor Cyan Write-Host " Target RCArtifactId: $RCArtifactId" -ForegroundColor Cyan Write-Host " Evidence ID: $evidenceId" -ForegroundColor Cyan Write-Host " DryRun: $DryRun" -ForegroundColor Cyan Write-Host "==========================================================================" -ForegroundColor Cyan # 1. Pre-flight checks Write-Host "`n>>> [Pre-Flight] Verifying Pre-Reboot Baseline..." -ForegroundColor Yellow $svcProc = Get-Process -Name ClassNotify.Service -ErrorAction SilentlyContinue | Select-Object -First 1 $cliProc = Get-Process -Name ClassNotify.Client -ErrorAction SilentlyContinue | Select-Object -First 1 $installerPath = "C:\Users\Administrator\.gemini\antigravity\scratch\ClassNotify\rc2_artifacts\ClassNotifySetup.exe" $localSha = (Get-FileHash -Path $installerPath -Algorithm SHA256).Hash.ToUpper() if (-not $svcProc) { throw "ClassNotifyService is not running!" } if (-not $cliProc) { throw "ClassNotify.Client is not running!" } if ($localSha -ne $ExpectedInstallerSha256) { throw "Installer SHA256 mismatch!" } Write-Host " Service PID: $($svcProc.Id) in Session $($svcProc.SessionId)" -ForegroundColor White Write-Host " Client PID: $($cliProc.Id) in Session $($cliProc.SessionId)" -ForegroundColor White Write-Host " Installer: $localSha" -ForegroundColor White # 2. Save reboot-state-before.json Write-Host "`n>>> [Phase 1.1] Persisting reboot-state-before.json..." -ForegroundColor Yellow $stateBefore = @{ RCArtifactId = $RCArtifactId InstallerSha256 = $localSha DeviceId = $TargetDeviceId ClassId = $TargetClassId ServicePid = $svcProc.Id ServiceSessionId = $svcProc.SessionId ClientPid = $cliProc.Id ClientSessionId = $cliProc.SessionId InteractiveSessionId = 4 RebootRequestedTimestamp = (Get-Date).ToString("o") } $stateBeforePath = Join-Path $localEvidenceDir "reboot-state-before.json" $stateBefore | ConvertTo-Json -Depth 5 | Set-Content $stateBeforePath -Encoding UTF8 Write-Host " Saved pre-reboot state to $stateBeforePath" -ForegroundColor Green # Copy test script to evidence folder Copy-Item -Path "C:\Users\Administrator\.gemini\antigravity\scratch\ClassNotify\tests\test_rc3_reboot_recovery.ps1" -Destination $localEvidenceDir -Force Copy-Item -Path "C:\Users\Administrator\.gemini\antigravity\scratch\ClassNotify\tests\resume_rc3_reboot.ps1" -Destination $localEvidenceDir -Force # 3. Register Scheduled Task Write-Host "`n>>> [Phase 1.2] Registering Scheduled Task 'ClassNotify-RC3-Reboot-Resume'..." -ForegroundColor Yellow $taskName = "ClassNotify-RC3-Reboot-Resume" $resumeScript = "C:\Users\Administrator\.gemini\antigravity\scratch\ClassNotify\tests\resume_rc3_reboot.ps1" # Unregister any existing task Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -WindowStyle Hidden -File `"$resumeScript`" -EvidenceId `"$evidenceId`"" $trigger = New-ScheduledTaskTrigger -AtStartup $principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit (New-TimeSpan -Minutes 30) $regTask = Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Principal $principal -Settings $settings Write-Host " Scheduled task registered successfully as SYSTEM." -ForegroundColor Green # 4. Export task XML Write-Host "`n>>> [Phase 1.3] Exporting task XML definition..." -ForegroundColor Yellow $xmlExportPath = Join-Path $localEvidenceDir "startup-task-export.xml" $taskXml = Export-ScheduledTask -TaskName $taskName $taskXml | Set-Content $xmlExportPath -Encoding UTF8 # Verify no secrets in XML if ($taskXml -match "password" -or $taskXml -match "bearer" -or $taskXml -match "token") { throw "Security violation: Scheduled Task XML contains credentials or tokens!" } Write-Host " Task XML exported and verified secret-free at $xmlExportPath" -ForegroundColor Green Stop-Transcript | Out-Null if ($DryRun) { Write-Host "`n[DRY RUN] Phase 1 completed successfully. Reboot was NOT triggered (-DryRun active)." -ForegroundColor Yellow exit 0 } # 5. Trigger Physical Windows Reboot Write-Host "`n==========================================================================" -ForegroundColor Magenta Write-Host " TRIGGERING PHYSICAL WINDOWS REBOOT IN 5 SECONDS... " -ForegroundColor Magenta Write-Host " Scheduled Task will automatically resume and complete Gate RC-3C. " -ForegroundColor Magenta Write-Host "==========================================================================" -ForegroundColor Magenta shutdown.exe /r /t 5 /c "ClassNotify Gate RC-3C Automated Reboot Recovery Acceptance"