rehearsal-9 Task 4: Health + door of a service the panel never deployed — fixtures/serviceAtRest.ts (monitoring on the Services tab + status.php probe; Services-tab Open door) #1488

Closed
opened 2026-09-15 13:14:30 +00:00 by ben · 2 comments
Owner

Phase 9 (provision on founding) task 4 of 6. Spec: docs/superpowers/specs/2026-09-15-183-phase-9-provision-on-founding-rehearsal-design.md. Plan (read the header, Global Constraints and plan-time inventory first — the Interfaces block below is how tasks learn each other's names): docs/superpowers/plans/2026-09-15-183-phase-9-provision-on-founding-rehearsal.md.

Acceptance = every checkbox step below done, its verification commands green, one commit in the repo's voice. A blocked_by edge on this ticket names the task whose Interfaces it consumes.


Task 4: Health + door of a service the panel never deployed (rest-state readers)

Files:

  • Create: app/tests/e2e/fixtures/serviceAtRest.ts
  • Test: app/tests/e2e/fixtures/serviceAtRest.test.ts

Interfaces:

  • Produces:

    • export const REST_WARMUP_HORIZON_MS = 6 * 60_000; export const REST_POLL_MS = 10_000;
    • export async function openServicesTab(page: Page): Promise<void> — [data-action="back-to-fleet"] if present (re-entry guard, as browseCatalogueArchive does), click [data-action="tab-services"], wait [data-field="service-catalogue"].
    • export type RestVerdict = { healthy: boolean; reason: string }
    • export function monitoringVerdict(input: { allHealthy: boolean; downPill: string | null; cardStatus: string | null }, slug: string): RestVerdict — PURE: healthy iff downPill === null && cardStatus === 'installable-running'; reason names which failed ("monitoring names files down: <pill text>" / "the Services-tab card stands data-status=<x>, not installable-running").
    • export function statusPhpVerdict(status: number, body: string): RestVerdict — PURE: healthy iff status === 200 and JSON installed === true && maintenance !== true; reason otherwise.
    • export async function expectServiceHealthyAtRest(page: Page, slug: string, door: string): Promise<void> — polls to the horizon: openServicesTab once, then each poll reads [data-field="fleet-services-status"] [data-field="all-healthy"] count, [data-field="service-<slug>"] text (null when absent), the catalogue card's data-status, feeds monitoringVerdict; then page.evaluate(fetch(doorPath(door,'/status.php'), {cache:'no-store'})) → statusPhpVerdict. Returns when BOTH healthy; at the horizon throws "<slug> is not healthy after 360s at rest: <monitoring reason>; <status.php reason>".
    • export async function readServiceDoorAtRest(page: Page, slug: string, apex: string): Promise<string> — on the Services tab, [data-field="catalogue-card"][data-service="<slug>"] [data-action="open-service"] href; the visible [data-field="service-url"] text must be <slug>.<apex> (the card shows the host, hostOf); throws naming the selector when absent.
  • Step 1: Failing test (serviceAtRest.test.ts):

import { describe, expect, it } from 'vitest';
import { monitoringVerdict, statusPhpVerdict } from './serviceAtRest';

describe('serviceAtRest — the phase-9 verdict for a founding-provisioned service', () => {
  it('monitoring: healthy only when no down pill names it AND the card runs', () => {
    expect(monitoringVerdict({ allHealthy: true, downPill: null, cardStatus: 'installable-running' }, 'files').healthy).toBe(true);
    const down = monitoringVerdict({ allHealthy: false, downPill: 'Files is down', cardStatus: 'installable-running' }, 'files');
    expect(down.healthy).toBe(false);
    expect(down.reason).toMatch(/monitoring names files down/);
    const unplaced = monitoringVerdict({ allHealthy: true, downPill: null, cardStatus: 'installable' }, 'files');
    expect(unplaced.healthy).toBe(false);
    expect(unplaced.reason).toMatch(/installable-running/);
  });
  it('monitoring silence alone never passes — an all-healthy line with no card is not health', () => {
    expect(monitoringVerdict({ allHealthy: true, downPill: null, cardStatus: null }, 'files').healthy).toBe(false);
  });
  it('status.php: 200 + installed:true, not in maintenance', () => {
    expect(statusPhpVerdict(200, '{"installed":true,"maintenance":false,"version":"30.0.1.2"}').healthy).toBe(true);
    expect(statusPhpVerdict(200, '{"installed":true,"maintenance":true}').healthy).toBe(false);
    expect(statusPhpVerdict(502, '').reason).toMatch(/502/);
    expect(statusPhpVerdict(200, '<html>').reason).toMatch(/not JSON/);
  });
});
  • Step 2: Run, expect FAIL.

  • Step 3: Implement the pure functions and the two page readers as specified (poll loop shape = expectServiceHealthy's, provision.ts:751-778, without the Retry branch). statusPhpVerdict:

export function statusPhpVerdict(status: number, body: string): RestVerdict {
  if (status !== 200) return { healthy: false, reason: `status.php answered HTTP ${status}` };
  let doc: { installed?: unknown; maintenance?: unknown };
  try {
    doc = JSON.parse(body);
  } catch {
    return { healthy: false, reason: `status.php body is not JSON: ${body.slice(0, 80)}` };
  }
  if (doc.installed !== true) return { healthy: false, reason: `status.php reports installed=${String(doc.installed)}` };
  if (doc.maintenance === true) return { healthy: false, reason: 'status.php reports maintenance mode' };
  return { healthy: true, reason: '' };
}

The fetch runs in page.evaluate (renderer-side, never page.request — the Electron page carries the session, and the door's TLS is real DNS; #658's lesson).

  • Step 4: Run, expect PASS; pnpm --filter app build; root pnpm lint.

  • Step 5: Commit — e2e: phase 9 — expectServiceHealthyAtRest / readServiceDoorAtRest: monitoring's verdict on the Services tab plus a direct status.php probe, for a service the panel never deployed (no P4 Active screen exists to read).


Phase 9 (provision on founding) task 4 of 6. Spec: `docs/superpowers/specs/2026-09-15-183-phase-9-provision-on-founding-rehearsal-design.md`. Plan (read the header, Global Constraints and plan-time inventory first — the Interfaces block below is how tasks learn each other's names): `docs/superpowers/plans/2026-09-15-183-phase-9-provision-on-founding-rehearsal.md`. Acceptance = every checkbox step below done, its verification commands green, one commit in the repo's voice. A blocked_by edge on this ticket names the task whose Interfaces it consumes. --- ### Task 4: Health + door of a service the panel never deployed (rest-state readers) **Files:** - Create: `app/tests/e2e/fixtures/serviceAtRest.ts` - Test: `app/tests/e2e/fixtures/serviceAtRest.test.ts` **Interfaces:** - Produces: - `export const REST_WARMUP_HORIZON_MS = 6 * 60_000; export const REST_POLL_MS = 10_000;` - `export async function openServicesTab(page: Page): Promise<void>` — `[data-action="back-to-fleet"]` if present (re-entry guard, as `browseCatalogueArchive` does), click `[data-action="tab-services"]`, wait `[data-field="service-catalogue"]`. - `export type RestVerdict = { healthy: boolean; reason: string }` - `export function monitoringVerdict(input: { allHealthy: boolean; downPill: string | null; cardStatus: string | null }, slug: string): RestVerdict` — PURE: healthy iff `downPill === null && cardStatus === 'installable-running'`; reason names which failed (`"monitoring names files down: <pill text>"` / `"the Services-tab card stands data-status=<x>, not installable-running"`). - `export function statusPhpVerdict(status: number, body: string): RestVerdict` — PURE: healthy iff `status === 200` and JSON `installed === true && maintenance !== true`; reason otherwise. - `export async function expectServiceHealthyAtRest(page: Page, slug: string, door: string): Promise<void>` — polls to the horizon: `openServicesTab` once, then each poll reads `[data-field="fleet-services-status"] [data-field="all-healthy"]` count, `[data-field="service-<slug>"]` text (null when absent), the catalogue card's `data-status`, feeds `monitoringVerdict`; then `page.evaluate(fetch(doorPath(door,'/status.php'), {cache:'no-store'}))` → `statusPhpVerdict`. Returns when BOTH healthy; at the horizon throws `"<slug> is not healthy after 360s at rest: <monitoring reason>; <status.php reason>"`. - `export async function readServiceDoorAtRest(page: Page, slug: string, apex: string): Promise<string>` — on the Services tab, `[data-field="catalogue-card"][data-service="<slug>"] [data-action="open-service"]` href; the visible `[data-field="service-url"]` text must be `<slug>.<apex>` (the card shows the host, `hostOf`); throws naming the selector when absent. - [ ] **Step 1: Failing test** (`serviceAtRest.test.ts`): ```ts import { describe, expect, it } from 'vitest'; import { monitoringVerdict, statusPhpVerdict } from './serviceAtRest'; describe('serviceAtRest — the phase-9 verdict for a founding-provisioned service', () => { it('monitoring: healthy only when no down pill names it AND the card runs', () => { expect(monitoringVerdict({ allHealthy: true, downPill: null, cardStatus: 'installable-running' }, 'files').healthy).toBe(true); const down = monitoringVerdict({ allHealthy: false, downPill: 'Files is down', cardStatus: 'installable-running' }, 'files'); expect(down.healthy).toBe(false); expect(down.reason).toMatch(/monitoring names files down/); const unplaced = monitoringVerdict({ allHealthy: true, downPill: null, cardStatus: 'installable' }, 'files'); expect(unplaced.healthy).toBe(false); expect(unplaced.reason).toMatch(/installable-running/); }); it('monitoring silence alone never passes — an all-healthy line with no card is not health', () => { expect(monitoringVerdict({ allHealthy: true, downPill: null, cardStatus: null }, 'files').healthy).toBe(false); }); it('status.php: 200 + installed:true, not in maintenance', () => { expect(statusPhpVerdict(200, '{"installed":true,"maintenance":false,"version":"30.0.1.2"}').healthy).toBe(true); expect(statusPhpVerdict(200, '{"installed":true,"maintenance":true}').healthy).toBe(false); expect(statusPhpVerdict(502, '').reason).toMatch(/502/); expect(statusPhpVerdict(200, '<html>').reason).toMatch(/not JSON/); }); }); ``` - [ ] **Step 2: Run, expect FAIL.** - [ ] **Step 3: Implement** the pure functions and the two page readers as specified (poll loop shape = `expectServiceHealthy`'s, `provision.ts:751-778`, without the Retry branch). `statusPhpVerdict`: ```ts export function statusPhpVerdict(status: number, body: string): RestVerdict { if (status !== 200) return { healthy: false, reason: `status.php answered HTTP ${status}` }; let doc: { installed?: unknown; maintenance?: unknown }; try { doc = JSON.parse(body); } catch { return { healthy: false, reason: `status.php body is not JSON: ${body.slice(0, 80)}` }; } if (doc.installed !== true) return { healthy: false, reason: `status.php reports installed=${String(doc.installed)}` }; if (doc.maintenance === true) return { healthy: false, reason: 'status.php reports maintenance mode' }; return { healthy: true, reason: '' }; } ``` The `fetch` runs in `page.evaluate` (renderer-side, never `page.request` — the Electron page carries the session, and the door's TLS is real DNS; #658's lesson). - [ ] **Step 4: Run, expect PASS**; `pnpm --filter app build`; root `pnpm lint`. - [ ] **Step 5: Commit** — `e2e: phase 9 — expectServiceHealthyAtRest / readServiceDoorAtRest: monitoring's verdict on the Services tab plus a direct status.php probe, for a service the panel never deployed (no P4 Active screen exists to read)`. ---

swarm-claim host=matou-dev-server-01 run=24539
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=24539 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1488 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1488,
  "status": "success",
  "commits": [
    "7dc15420"
  ],
  "changed_files": [
    "app/tests/e2e/fixtures/serviceAtRest.ts",
    "app/tests/e2e/fixtures/serviceAtRest.test.ts"
  ],
  "tests": [
    {
      "command": "CI=true pnpm exec vitest run tests/e2e/fixtures/serviceAtRest.test.ts",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm --filter app build",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm lint",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Step 1: failing test authored (serviceAtRest.test.ts) importing monitoringVerdict/statusPhpVerdict": "app/tests/e2e/fixtures/serviceAtRest.test.ts in commit 7dc15420",
    "Step 2: run, expect FAIL": "vitest reported the suite unresolvable (./serviceAtRest missing) before the impl landed",
    "Step 3: implemented pure functions + two page readers per interface (poll shape of expectServiceHealthy minus Retry; status.php verbatim; fetch via page.evaluate #658)": "app/tests/e2e/fixtures/serviceAtRest.ts — REST_WARMUP_HORIZON_MS/REST_POLL_MS, openServicesTab, monitoringVerdict, statusPhpVerdict, expectServiceHealthyAtRest, readServiceDoorAtRest",
    "Step 4: run PASS; app build; root lint": "vitest 3 passed; pnpm --filter app build exit 0; pnpm lint exit 0",
    "Step 5: single commit in the repo's voice": "7dc15420"
  },
  "summary": "Add the phase-9 rest-state health/door fixtures for a founding-provisioned service: pure monitoring/status.php verdicts plus the Services-tab poller and door reader.",
  "blockers": []
}
**close-report** for #1488 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1488, "status": "success", "commits": [ "7dc15420" ], "changed_files": [ "app/tests/e2e/fixtures/serviceAtRest.ts", "app/tests/e2e/fixtures/serviceAtRest.test.ts" ], "tests": [ { "command": "CI=true pnpm exec vitest run tests/e2e/fixtures/serviceAtRest.test.ts", "exit_code": 0 }, { "command": "CI=true pnpm --filter app build", "exit_code": 0 }, { "command": "CI=true pnpm lint", "exit_code": 0 } ], "criteria": { "Step 1: failing test authored (serviceAtRest.test.ts) importing monitoringVerdict/statusPhpVerdict": "app/tests/e2e/fixtures/serviceAtRest.test.ts in commit 7dc15420", "Step 2: run, expect FAIL": "vitest reported the suite unresolvable (./serviceAtRest missing) before the impl landed", "Step 3: implemented pure functions + two page readers per interface (poll shape of expectServiceHealthy minus Retry; status.php verbatim; fetch via page.evaluate #658)": "app/tests/e2e/fixtures/serviceAtRest.ts — REST_WARMUP_HORIZON_MS/REST_POLL_MS, openServicesTab, monitoringVerdict, statusPhpVerdict, expectServiceHealthyAtRest, readServiceDoorAtRest", "Step 4: run PASS; app build; root lint": "vitest 3 passed; pnpm --filter app build exit 0; pnpm lint exit 0", "Step 5: single commit in the repo's voice": "7dc15420" }, "summary": "Add the phase-9 rest-state health/door fixtures for a founding-provisioned service: pure monitoring/status.php verdicts plus the Services-tab poller and door reader.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1488
No description provided.