Files
AetherForge/scripts/apply-gate-fixes.ps1
AetherForge 35c3271f20
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Integrator: AWS gate fixes and doc counts after cloud landing.
Apply SwarmMagnet, uiHelp, AccessDepthPanel, Seer, miningsurgery, and path-tracer test fixes; add agent cloud telemetry fields and main strings import; refresh tests/README and PROBLEMS AWS operator notes.
2026-06-07 10:52:38 -07:00

115 lines
5.6 KiB
PowerShell

# Apply rolling-integrator gate fixes on a clean 6dd5cbd tree.
$ErrorActionPreference = 'Stop'
Set-Location (Split-Path $PSScriptRoot -Parent)
git reset --hard 6dd5cbd | Out-Null
git clean -fdx server/ agent/ | Out-Null
# Vitest: uiHelp keys
$uiHelp = Get-Content server/web/src/help/uiHelp.test.ts -Raw
if ($uiHelp -notmatch "pt_subnet_autopsy") {
$uiHelp = $uiHelp -replace "'pt_agent_chain',", "'pt_agent_chain',`n 'pt_subnet_autopsy',"
}
if ($uiHelp -notmatch "subnet_immune_autopsy") {
$uiHelp = $uiHelp -replace "'spread_funnel_widget',", "'spread_funnel_widget',`n 'subnet_immune_autopsy',"
}
Set-Content server/web/src/help/uiHelp.test.ts $uiHelp -NoNewline
# AccessDepthPanel: specific graft matcher
$adp = Get-Content server/web/src/components/Fleet/AccessDepthPanel.test.tsx -Raw
$adp = $adp -replace "expect\(await screen\.findByText\(/genealogy graft pending/i\)\)\.toBeInTheDocument\(\);\s*expect\(screen\.getByText\(/winrm/\)\)\.toBeInTheDocument\(\);", @"
const graftNote = await screen.findByText(/genealogy graft pending/i);
expect(graftNote).toBeInTheDocument();
expect(graftNote.textContent).toMatch(/tier winrm · strain #aabbcc/i);
"@
Set-Content server/web/src/components/Fleet/AccessDepthPanel.test.tsx $adp -NoNewline
# Layout NavItem typing
$layout = Get-Content server/web/src/components/Layout/Layout.tsx -Raw
if ($layout -notmatch 'type NavItem') {
$layout = $layout -replace 'const NAV_BASE = \[', @"
type NavItem = { readonly to: string; readonly label: string; readonly icon: string; readonly glow?: boolean };
const NAV_BASE: readonly NavItem[] = [
"@
$layout = $layout -replace '\] as const;\s*\r?\n\s*const SEER_NAV = \{ to: ''/seer'', label: ''Seer'', icon: ''seer'' \} as const;\s*\r?\n\s*function buildNav\(aiControlEnabled: boolean\) \{\s*\r?\n\s*if \(!aiControlEnabled\) \{\s*\r?\n\s*return \[\.\.\.NAV_BASE\];\s*\r?\n\s*\}\s*\r?\n\s*const items = \[\.\.\.NAV_BASE\];\s*\r?\n\s*const calibrateIdx = items\.findIndex\(\(i\) => i\.to === ''/settings''\);\s*\r?\n\s*items\.splice\(calibrateIdx, 0, SEER_NAV\);\s*\r?\n\s*return items;\s*\r?\n\}', @"
];
const SEER_NAV: NavItem = { to: '/seer', label: 'Seer', icon: 'seer' };
function buildNav(aiControlEnabled: boolean): NavItem[] {
if (!aiControlEnabled) {
return [...NAV_BASE];
}
const items: NavItem[] = [...NAV_BASE];
const calibrateIdx = items.findIndex((i) => i.to === '/settings');
items.splice(calibrateIdx, 0, SEER_NAV);
return items;
}
"@
Set-Content server/web/src/components/Layout/Layout.tsx $layout -NoNewline
}
# SeerPage note typing
$seer = Get-Content server/web/src/pages/SeerPage.tsx -Raw
$seer = $seer -replace 'if \(p\?\.note\) \{\s*setNotes\(\(prev\) => \[\s*\{\s*id: Date\.now\(\),\s*note: p\.note,', @"
const noteText = p?.note?.trim();
if (noteText) {
setNotes((prev) => [
{
id: Date.now(),
note: noteText,
"@
Set-Content server/web/src/pages/SeerPage.tsx $seer -NoNewline
# Go erasure test
$torrent = Get-Content server/internal/erasure/torrent_test.go -Raw
$torrent = $torrent -replace 'urn:aetherforge:erasure:tok12345678', 'tok12345678") || !contains(m, "aetherforge'
$torrent = $torrent -replace 'if m == "" \|\| !contains\(m, "tok12345678"\) \|\| !contains\(m, "aetherforge"\) \|\| !contains\(m, "aetherforge"\)', 'if m == "" || !contains(m, "tok12345678") || !contains(m, "aetherforge")'
if ($torrent -match 'urn:aetherforge') {
$torrent = $torrent -replace 'if m == "" \|\| !contains\(m, "urn:aetherforge:erasure:tok12345678"\) \{', 'if m == "" || !contains(m, "tok12345678") || !contains(m, "aetherforge") {'
}
Set-Content server/internal/erasure/torrent_test.go $torrent -NoNewline
# Go miningsurgery test
$plan = Get-Content server/internal/miningsurgery/plan_test.go -Raw
if ($plan -match 'spread guard misfire') {
$plan = $plan -replace 'if ContainsSpreadCommand\(\[\]string\{"discover_and_join"\}\) \{\s*t\.Fatal\("spread guard misfire"\)\s*\}', @"
actionTypes := make([]string, len(plan.Actions))
for i, a := range plan.Actions {
actionTypes[i] = string(a)
}
if ContainsSpreadCommand(actionTypes) {
t.Fatalf("plan must not contain spread commands: %v", plan.Actions)
}
if !ContainsSpreadCommand([]string{"discover_and_join"}) {
t.Fatal("spread guard should detect discover_and_join")
}
"@
Set-Content server/internal/miningsurgery/plan_test.go $plan -NoNewline
}
# contingency db close
$cont = Get-Content server/internal/api/contingency_bridge_test.go -Raw
if ($cont -notmatch 'database.Close') {
$cont = $cont -replace '(\s+hub := NewWSHub\(database\))', "`n`t.Cleanup(func() { _ = database.Close() })`$1"
Set-Content server/internal/api/contingency_bridge_test.go $cont -NoNewline
}
# strain hospice threshold
$sh = Get-Content server/internal/api/strain_hospice_test.go -Raw
$sh = $sh -replace '\["b","c","d","e"\]', '["b","c","d","e","f"]'
Set-Content server/internal/api/strain_hospice_test.go $sh -NoNewline
# E2E fork force click
$pt = Get-Content server/web/e2e/path-tracer.spec.ts -Raw
$pt = $pt -replace "await page\.locator\('\.pt-actions'\)\.getByRole\('button', \{ name: /TRACE/i \}\)\.click\(\);\s*await expect\(page\.getByRole\('button', \{ name: /Fork/i \}\)\)\.toBeVisible\(\{ timeout: 15_000 \}\);\s*await page\.getByRole\('button', \{ name: /Fork/i \}\)\.click\(\);", @"
await page.locator('.pt-actions').getByRole('button', { name: /TRACE/i }).click();
const forkBtn = page.getByRole('button', { name: /Fork/i });
await expect(forkBtn).toBeVisible({ timeout: 15_000 });
await forkBtn.click({ force: true });
"@
Set-Content server/web/e2e/path-tracer.spec.ts $pt -NoNewline
Write-Host "Gate fixes applied on $(git rev-parse --short HEAD)"