rehearsal-9 Task 2: founding-state services reader (foundingServiceRows / foundingPlacementOf) + catalogue pick + gateway placement fixtures (pickServices / placeOnGateway; v2-fleet re-pointed) #1486

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

Phase 9 (provision on founding) task 2 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 2: Founding-state services reader + catalogue pick + gateway placement fixtures

Files:

  • Modify: app/tests/e2e/fixtures/selfhosted.ts (foundingServiceRows, foundingPlacementOf)
  • Test: app/tests/e2e/fixtures/selfhosted.test.ts
  • Modify: app/tests/e2e/fixtures/wizard.ts (pickServices, placeOnGateway)
  • Modify: app/tests/e2e/journey.v2-fleet.spec.ts:264-287, 328-340 (call the shared helpers — same selectors, same assertions)

Interfaces:

  • Produces:

    • export interface FoundingServiceRow { service: string; name: string; short?: string; address?: string; status: 'done' | 'todo' | 'failed'; detail?: string }
    • export function foundingServiceRows(stateJson: string): FoundingServiceRow[] — reads standup.deploy.services; throws naming the path when absent.
    • export function foundingPlacementOf(stateJson: string, service: string): string — reads draft.placement.where[service]; throws when absent.
    • export async function pickServices(live: LaunchedApp, slugs: string[]): Promise<void> — on the catalogue section: waits for the front door CHOSEN (#1474), picks each slug, asserts unpick-service, Continue → Access.
    • export async function placeOnGateway(live: LaunchedApp, slug: string): Promise<string> — on the bench: reads the first device-card's data-device (the gateway), drags the pill via placeServiceOnMachine, returns the gateway id. Does NOT press Continue.
  • Consumes: placeServiceOnMachine(page, slug, deviceId) from fixtures/foundingFleet.ts:289.

  • Step 1: Failing fixture test — append to selfhosted.test.ts:

import { foundingPlacementOf, foundingServiceRows } from './selfhosted';

describe('foundingServiceRows / foundingPlacementOf — the phase-9 seam reads', () => {
  const state = JSON.stringify({
    draft: { placement: { where: { 'front-door': 'gw', files: 'gw' } } },
    standup: {
      deploy: {
        services: [
          { service: 'files', name: 'Files & documents', short: 'files', address: 'https://files.x.idss.nz', status: 'done' },
          { service: 'chat', name: 'Chat', status: 'todo', detail: 'not ready to set up here yet — you can add Chat from the control panel' },
        ],
      },
    },
  });
  it('returns every services row with its status and address', () => {
    const rows = foundingServiceRows(state);
    expect(rows.map((r) => `${r.service}:${r.status}`)).toEqual(['files:done', 'chat:todo']);
    expect(rows[0].address).toBe('https://files.x.idss.nz');
  });
  it('throws naming the path when the deploy carries no services (never an empty pass)', () => {
    expect(() => foundingServiceRows(JSON.stringify({ standup: { deploy: {} } }))).toThrow(
      /standup\.deploy\.services/,
    );
  });
  it('reads where a service was placed, and throws when it was not', () => {
    expect(foundingPlacementOf(state, 'files')).toBe('gw');
    expect(() => foundingPlacementOf(state, 'chat')).toThrow(/draft\.placement\.where\.chat/);
  });
});
  • Step 2: Run, expect FAIL — cd app && pnpm exec vitest run tests/e2e/fixtures/selfhosted.test.ts.

  • Step 3: Implement in selfhosted.ts (extend FoundingStateDoc):

export interface FoundingServiceRow {
  service: string;
  name: string;
  short?: string;
  address?: string;
  status: 'done' | 'todo' | 'failed';
  detail?: string;
}

interface FoundingStateDoc {
  draft?: {
    address?: { host?: string; secret?: string };
    access?: { ip?: string };
    placement?: { where?: Record<string, string> };
  };
  standup?: { deploy?: { services?: FoundingServiceRow[] } };
}

/**
 * The S11 services rows the founding's own deploy wrote (#1392, `DeployStatus.Services`)
 * — the ONE record of whether a founding-time service stood up: a founding never fails
 * over a service, so the hand-off is green either way. Read BEFORE sign-in: the state
 * file is scrubbed when the hand-off completes.
 */
export function foundingServiceRows(stateJson: string): FoundingServiceRow[] {
  const rows = parseFoundingState(stateJson)?.standup?.deploy?.services;
  if (!rows || rows.length === 0) {
    throw new Error(
      'founding-state.json carries no standup.deploy.services — the S11 deploy recorded no service rows ' +
        '(nothing was placed on the gateway, or the deploy never reached the services stage)',
    );
  }
  return rows;
}

/** Where the bench placed a service (`draft.placement.where[<slug>]`); throws when unplaced (ADR 0243: unplaced = not built). */
export function foundingPlacementOf(stateJson: string, service: string): string {
  const id = parseFoundingState(stateJson)?.draft?.placement?.where?.[service] ?? '';
  if (id === '') {
    throw new Error(`founding-state.json carries no draft.placement.where.${service} — the bench never placed it`);
  }
  return id;
}
  • Step 4: Run, expect PASS.

  • Step 5: The wizard helpers — in wizard.ts after servicesToAccess:

/**
 * The Services layer with picks: wait for the catalogue to have LOADED (the front
 * door is seeded CHOSEN the moment onMounted resolves, #1474), pick each slug,
 * then Continue → Access. A pick the catalogue does not offer reds by name.
 */
export async function pickServices(live: LaunchedApp, slugs: string[]) {
  await test.step(`Services → pick ${slugs.join(', ')} → Access`, async () => {
    await expect(live.page.locator('[data-status="service-catalogue"]')).toBeVisible({ timeout: 30_000 });
    await expect(live.page.locator('[data-service="front-door"][data-status="chosen"]')).toBeVisible({
      timeout: 30_000,
    });
    for (const svc of slugs) {
      const card = live.page.locator(`[data-field="catalogue-card"][data-service="${svc}"]`);
      await expect(card, `the catalogue offers no ${svc} card`).toBeVisible({ timeout: 30_000 });
      await card.locator('[data-action="pick-service"]').click();
      await expect(card.locator('[data-action="unpick-service"]')).toBeVisible();
    }
    await live.page.click('[data-status="service-catalogue"] [data-action="continue"]');
    await expect(live.page.locator('[data-status="access"]')).toBeVisible();
  });
}

/**
 * On the bench, place one service on the GATEWAY card (the first device card) —
 * explicitly, because ADR 0243 builds nothing left on the bench and a pill tapped
 * "to the next machine with room" is an assumption, not a placement. Returns the
 * gateway's bench id so the caller can read the placement back off the seam.
 */
export async function placeOnGateway(live: LaunchedApp, slug: string): Promise<string> {
  const { placeServiceOnMachine } = await import('./foundingFleet');
  let gatewayId = '';
  await test.step(`the bench: place ${slug} on the gateway`, async () => {
    await expect(live.page.locator('[data-status="device-placement"]')).toBeVisible({ timeout: 30_000 });
    gatewayId =
      (await live.page
        .locator('[data-status="device-placement"] [data-field="device-card"]')
        .first()
        .getAttribute('data-device')) ?? '';
    expect(gatewayId, 'the bench has no gateway card').not.toBe('');
    await placeServiceOnMachine(live.page, slug, gatewayId);
  });
  return gatewayId;
}

(Use a static import { placeServiceOnMachine } from './foundingFleet'; if it creates no import cycle — foundingFleet.ts imports from wizard.ts today; check with pnpm --filter app build. If it cycles, keep the dynamic import.)

  • Step 6: Re-point journey.v2-fleet.spec.ts — leg v2-walk (:264-287): replace the inline catalogue block (from await expect(live.page.locator('[data-status="service-catalogue"]'))… to the access expect) with await pickServices(live, ['files', 'docs-editing']);. Leg place-across-machines (:328-340): replace the gatewayId read + placeServiceOnMachine(live.page, 'files', gatewayId) with await placeOnGateway(live, 'files'); keeping placeServiceOnMachine(live.page, 'docs-editing', deviceId). Same selectors, same assertions.

  • Step 7: Verify — pnpm --filter app build (vue-tsc covers tests/), pnpm exec vitest run tests/e2e/fixtures/ from app/, then pnpm lint at the root.

  • Step 8: Commit — e2e: phase 9 — foundingServiceRows / foundingPlacementOf read the seam's S11 services rows and the bench placement; pickServices + placeOnGateway lift the v2-fleet catalogue walk into fixtures/wizard.ts.


Phase 9 (provision on founding) task 2 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 2: Founding-state services reader + catalogue pick + gateway placement fixtures **Files:** - Modify: `app/tests/e2e/fixtures/selfhosted.ts` (`foundingServiceRows`, `foundingPlacementOf`) - Test: `app/tests/e2e/fixtures/selfhosted.test.ts` - Modify: `app/tests/e2e/fixtures/wizard.ts` (`pickServices`, `placeOnGateway`) - Modify: `app/tests/e2e/journey.v2-fleet.spec.ts:264-287, 328-340` (call the shared helpers — same selectors, same assertions) **Interfaces:** - Produces: - `export interface FoundingServiceRow { service: string; name: string; short?: string; address?: string; status: 'done' | 'todo' | 'failed'; detail?: string }` - `export function foundingServiceRows(stateJson: string): FoundingServiceRow[]` — reads `standup.deploy.services`; throws naming the path when absent. - `export function foundingPlacementOf(stateJson: string, service: string): string` — reads `draft.placement.where[service]`; throws when absent. - `export async function pickServices(live: LaunchedApp, slugs: string[]): Promise<void>` — on the catalogue section: waits for the front door CHOSEN (#1474), picks each slug, asserts `unpick-service`, Continue → Access. - `export async function placeOnGateway(live: LaunchedApp, slug: string): Promise<string>` — on the bench: reads the first `device-card`'s `data-device` (the gateway), drags the pill via `placeServiceOnMachine`, returns the gateway id. Does NOT press Continue. - Consumes: `placeServiceOnMachine(page, slug, deviceId)` from `fixtures/foundingFleet.ts:289`. - [ ] **Step 1: Failing fixture test** — append to `selfhosted.test.ts`: ```ts import { foundingPlacementOf, foundingServiceRows } from './selfhosted'; describe('foundingServiceRows / foundingPlacementOf — the phase-9 seam reads', () => { const state = JSON.stringify({ draft: { placement: { where: { 'front-door': 'gw', files: 'gw' } } }, standup: { deploy: { services: [ { service: 'files', name: 'Files & documents', short: 'files', address: 'https://files.x.idss.nz', status: 'done' }, { service: 'chat', name: 'Chat', status: 'todo', detail: 'not ready to set up here yet — you can add Chat from the control panel' }, ], }, }, }); it('returns every services row with its status and address', () => { const rows = foundingServiceRows(state); expect(rows.map((r) => `${r.service}:${r.status}`)).toEqual(['files:done', 'chat:todo']); expect(rows[0].address).toBe('https://files.x.idss.nz'); }); it('throws naming the path when the deploy carries no services (never an empty pass)', () => { expect(() => foundingServiceRows(JSON.stringify({ standup: { deploy: {} } }))).toThrow( /standup\.deploy\.services/, ); }); it('reads where a service was placed, and throws when it was not', () => { expect(foundingPlacementOf(state, 'files')).toBe('gw'); expect(() => foundingPlacementOf(state, 'chat')).toThrow(/draft\.placement\.where\.chat/); }); }); ``` - [ ] **Step 2: Run, expect FAIL** — `cd app && pnpm exec vitest run tests/e2e/fixtures/selfhosted.test.ts`. - [ ] **Step 3: Implement** in `selfhosted.ts` (extend `FoundingStateDoc`): ```ts export interface FoundingServiceRow { service: string; name: string; short?: string; address?: string; status: 'done' | 'todo' | 'failed'; detail?: string; } interface FoundingStateDoc { draft?: { address?: { host?: string; secret?: string }; access?: { ip?: string }; placement?: { where?: Record<string, string> }; }; standup?: { deploy?: { services?: FoundingServiceRow[] } }; } /** * The S11 services rows the founding's own deploy wrote (#1392, `DeployStatus.Services`) * — the ONE record of whether a founding-time service stood up: a founding never fails * over a service, so the hand-off is green either way. Read BEFORE sign-in: the state * file is scrubbed when the hand-off completes. */ export function foundingServiceRows(stateJson: string): FoundingServiceRow[] { const rows = parseFoundingState(stateJson)?.standup?.deploy?.services; if (!rows || rows.length === 0) { throw new Error( 'founding-state.json carries no standup.deploy.services — the S11 deploy recorded no service rows ' + '(nothing was placed on the gateway, or the deploy never reached the services stage)', ); } return rows; } /** Where the bench placed a service (`draft.placement.where[<slug>]`); throws when unplaced (ADR 0243: unplaced = not built). */ export function foundingPlacementOf(stateJson: string, service: string): string { const id = parseFoundingState(stateJson)?.draft?.placement?.where?.[service] ?? ''; if (id === '') { throw new Error(`founding-state.json carries no draft.placement.where.${service} — the bench never placed it`); } return id; } ``` - [ ] **Step 4: Run, expect PASS.** - [ ] **Step 5: The wizard helpers** — in `wizard.ts` after `servicesToAccess`: ```ts /** * The Services layer with picks: wait for the catalogue to have LOADED (the front * door is seeded CHOSEN the moment onMounted resolves, #1474), pick each slug, * then Continue → Access. A pick the catalogue does not offer reds by name. */ export async function pickServices(live: LaunchedApp, slugs: string[]) { await test.step(`Services → pick ${slugs.join(', ')} → Access`, async () => { await expect(live.page.locator('[data-status="service-catalogue"]')).toBeVisible({ timeout: 30_000 }); await expect(live.page.locator('[data-service="front-door"][data-status="chosen"]')).toBeVisible({ timeout: 30_000, }); for (const svc of slugs) { const card = live.page.locator(`[data-field="catalogue-card"][data-service="${svc}"]`); await expect(card, `the catalogue offers no ${svc} card`).toBeVisible({ timeout: 30_000 }); await card.locator('[data-action="pick-service"]').click(); await expect(card.locator('[data-action="unpick-service"]')).toBeVisible(); } await live.page.click('[data-status="service-catalogue"] [data-action="continue"]'); await expect(live.page.locator('[data-status="access"]')).toBeVisible(); }); } /** * On the bench, place one service on the GATEWAY card (the first device card) — * explicitly, because ADR 0243 builds nothing left on the bench and a pill tapped * "to the next machine with room" is an assumption, not a placement. Returns the * gateway's bench id so the caller can read the placement back off the seam. */ export async function placeOnGateway(live: LaunchedApp, slug: string): Promise<string> { const { placeServiceOnMachine } = await import('./foundingFleet'); let gatewayId = ''; await test.step(`the bench: place ${slug} on the gateway`, async () => { await expect(live.page.locator('[data-status="device-placement"]')).toBeVisible({ timeout: 30_000 }); gatewayId = (await live.page .locator('[data-status="device-placement"] [data-field="device-card"]') .first() .getAttribute('data-device')) ?? ''; expect(gatewayId, 'the bench has no gateway card').not.toBe(''); await placeServiceOnMachine(live.page, slug, gatewayId); }); return gatewayId; } ``` (Use a static `import { placeServiceOnMachine } from './foundingFleet';` if it creates no import cycle — `foundingFleet.ts` imports from `wizard.ts` today; check with `pnpm --filter app build`. If it cycles, keep the dynamic import.) - [ ] **Step 6: Re-point `journey.v2-fleet.spec.ts`** — leg `v2-walk` (`:264-287`): replace the inline catalogue block (from `await expect(live.page.locator('[data-status="service-catalogue"]'))…` to the `access` expect) with `await pickServices(live, ['files', 'docs-editing']);`. Leg `place-across-machines` (`:328-340`): replace the gatewayId read + `placeServiceOnMachine(live.page, 'files', gatewayId)` with `await placeOnGateway(live, 'files');` keeping `placeServiceOnMachine(live.page, 'docs-editing', deviceId)`. Same selectors, same assertions. - [ ] **Step 7: Verify** — `pnpm --filter app build` (vue-tsc covers `tests/`), `pnpm exec vitest run tests/e2e/fixtures/` from `app/`, then `pnpm lint` at the root. - [ ] **Step 8: Commit** — `e2e: phase 9 — foundingServiceRows / foundingPlacementOf read the seam's S11 services rows and the bench placement; pickServices + placeOnGateway lift the v2-fleet catalogue walk into fixtures/wizard.ts`. ---

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 #1486 — status success

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

envelope
{
  "issue": 1486,
  "status": "success",
  "commits": [
    "c298f2e2c1d83a933fac87be425cf4c4898c367a"
  ],
  "changed_files": [
    "app/tests/e2e/fixtures/selfhosted.ts",
    "app/tests/e2e/fixtures/selfhosted.test.ts",
    "app/tests/e2e/fixtures/wizard.ts",
    "app/tests/e2e/journey.v2-fleet.spec.ts"
  ],
  "tests": [
    {
      "command": "CI=true pnpm --filter app build",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm exec vitest run tests/e2e/fixtures/ (app cwd)",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm lint",
      "exit_code": 0
    }
  ],
  "criteria": {
    "foundingServiceRows reads standup.deploy.services and throws naming the path when absent": "selfhosted.ts foundingServiceRows + selfhosted.test.ts 'phase-9 seam reads' (20 passed)",
    "foundingPlacementOf reads draft.placement.where[service] and throws when unplaced": "selfhosted.ts foundingPlacementOf + selfhosted.test.ts",
    "pickServices waits for the front door CHOSEN, picks each slug, Continue → Access": "wizard.ts pickServices",
    "placeOnGateway reads the first device-card's data-device, drags the pill via placeServiceOnMachine, returns the gateway id": "wizard.ts placeOnGateway (static import of placeServiceOnMachine, no cycle per vue-tsc)",
    "journey.v2-fleet legs v2-walk and place-across-machines call the shared helpers with same selectors/assertions": "journey.v2-fleet.spec.ts diff",
    "build (vue-tsc over tests) + fixtures vitest + lint green": "tests array all exit_code 0"
  },
  "summary": "Phase-9 task 2: founding-state services/placement readers plus pickServices/placeOnGateway fixtures, with the v2-fleet catalogue walk re-pointed to them.",
  "blockers": []
}
**close-report** for #1486 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1486, "status": "success", "commits": [ "c298f2e2c1d83a933fac87be425cf4c4898c367a" ], "changed_files": [ "app/tests/e2e/fixtures/selfhosted.ts", "app/tests/e2e/fixtures/selfhosted.test.ts", "app/tests/e2e/fixtures/wizard.ts", "app/tests/e2e/journey.v2-fleet.spec.ts" ], "tests": [ { "command": "CI=true pnpm --filter app build", "exit_code": 0 }, { "command": "CI=true pnpm exec vitest run tests/e2e/fixtures/ (app cwd)", "exit_code": 0 }, { "command": "CI=true pnpm lint", "exit_code": 0 } ], "criteria": { "foundingServiceRows reads standup.deploy.services and throws naming the path when absent": "selfhosted.ts foundingServiceRows + selfhosted.test.ts 'phase-9 seam reads' (20 passed)", "foundingPlacementOf reads draft.placement.where[service] and throws when unplaced": "selfhosted.ts foundingPlacementOf + selfhosted.test.ts", "pickServices waits for the front door CHOSEN, picks each slug, Continue → Access": "wizard.ts pickServices", "placeOnGateway reads the first device-card's data-device, drags the pill via placeServiceOnMachine, returns the gateway id": "wizard.ts placeOnGateway (static import of placeServiceOnMachine, no cycle per vue-tsc)", "journey.v2-fleet legs v2-walk and place-across-machines call the shared helpers with same selectors/assertions": "journey.v2-fleet.spec.ts diff", "build (vue-tsc over tests) + fixtures vitest + lint green": "tests array all exit_code 0" }, "summary": "Phase-9 task 2: founding-state services/placement readers plus pickServices/placeOnGateway fixtures, with the v2-fleet catalogue walk re-pointed to them.", "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#1486
No description provided.