Add phenotype cloning, failure atlas, AI court session, and clearance L0-L4
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

This commit is contained in:
AetherForge
2026-06-07 02:41:54 -07:00
parent 4b94776432
commit d9f36f182c
47 changed files with 4859 additions and 94 deletions

View File

@@ -15,14 +15,52 @@ export function e2eAuthHeaders(): Record<string, string> {
};
}
/** Reads fleet_secret from live server config (generated on first server start). */
/**
* Reads fleet_secret for stub agent auth.
* Prefer AETHERFORGE_FLEET_SECRET (test-suite.ps1 seeds from data/config.json).
*/
export async function fetchFleetSecret(request: APIRequestContext): Promise<string> {
const res = await request.get('/api/v1/config', { headers: e2eAuthHeaders() });
const fromEnv = process.env.AETHERFORGE_FLEET_SECRET?.trim();
if (fromEnv) return fromEnv;
const res = await request.get('/api/v1/config', {
headers: e2eAuthHeaders(),
timeout: 10_000,
});
if (!res.ok()) {
throw new Error(`config fetch failed: ${res.status()}`);
}
const body = (await res.json()) as { server?: { fleet_secret?: string } };
return body.server?.fleet_secret ?? '';
const secret = body.server?.fleet_secret?.trim() ?? '';
if (!secret) {
throw new Error(
'fleet_secret missing — set AETHERFORGE_FLEET_SECRET from data/config.json in the E2E runner',
);
}
return secret;
}
/** Poll /api/v1/health until status ok or timeout (mirrors test-suite.ps1 phase 8). */
export async function waitForServerHealth(
request: APIRequestContext,
opts?: { timeoutMs?: number; intervalMs?: number },
): Promise<boolean> {
const timeoutMs = opts?.timeoutMs ?? 30_000;
const intervalMs = opts?.intervalMs ?? 1_000;
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
try {
const res = await request.get('/api/v1/health', { timeout: 2_000 });
if (res.ok()) {
const body = (await res.json()) as { status?: string };
if (body.status === 'ok') return true;
}
} catch {
/* retry */
}
await new Promise((r) => setTimeout(r, intervalMs));
}
return false;
}
export async function loginToDashboard(page: Page): Promise<void> {
@@ -31,5 +69,5 @@ export async function loginToDashboard(page: Page): Promise<void> {
await page.getByLabel('Username').fill(E2E_USER);
await page.getByLabel('Password').fill(E2E_PASS);
await page.getByRole('button', { name: /enter command deck/i }).click();
await expect(page.getByRole('heading', { name: 'Command Deck' })).toBeVisible({ timeout: 15_000 });
await expect(page.getByRole('heading', { name: 'Command Deck' })).toBeVisible({ timeout: 20_000 });
}