rehearsal phase 2 T2: provision fixtures take the door, not a forwarded port — occ runner injected #487

Closed
opened 2026-08-12 18:28:54 +00:00 by ben · 1 comment
Owner

Phase 2 of the #183 rehearsal ratchet (spec docs/superpowers/specs/2026-08-12-183-phase-2-nextcloud-rehearsal-design.md, plan docs/superpowers/plans/2026-08-12-183-phase-2-nextcloud-rehearsal.md): the droplet drive grows past founding to a complete Nextcloud deployment at the real public door. This ticket is Task 2 of the plan, carried verbatim below — the plan file at HEAD is the authoritative copy if this body and it ever diverge.

Verification gate (what YOU run): cd app && pnpm test && pnpm build. The tail's LIVE behavior is unprovable in the sandbox (#377) — do NOT attempt to run a drive; the ratchet verifies it after Ben arms phase 2.

Global Constraints

  • Selectors are the wireframes' data-* contract (ADR 0132); label-matching (clickAny) is sanctioned ONLY for kanidm's and Nextcloud's external screens.
  • DDR 0165: every Nextcloud address resolves against the door the app exposes (readFilesDoor's return + doorPath) — never a rebuilt URL.
  • Budgets are CEILINGS, not expectations (phase-1 ruling); each tail leg's ceiling is the spec's table (sign-in 10 min, co-host 5, deploy-files 40, files-healthy 2, door 2, branded-login 3, oidc-admin 5, branded-chrome 5).
  • Every tail step is a runRecordedLeg — legs.json current on disk before any rethrow.
  • NO changes to .sandcastle/ (protected path, and the machinery is generic by design), scripts/rehearsal-cycle.sh, or .forgejo/workflows/.
  • The private-path specs (provision-nextcloud.live.spec.ts, private-path.live.spec.ts, foundingPrefix.ts) must keep compiling and keep their exact behavior — call sites pass the portful door they already read.
  • REHEARSAL_DRIVE_ISSUE in .sandcastle/.env is NOT flipped by this plan — arming is Ben's step after his #425 hand sign-off.
  • The tail's live behavior is unprovable off-droplet (#377): the pre-land gate is pnpm test + pnpm build (vue-tsc) in app/; the ratchet is the real test.
  • Brand expectations are the wizard fixtures' own values: name E2E Drive, accent #619793, background #f5f5f0, logo LOGO_FIXTURE_PNG, greeting E2E_GREETING (both exported by app/tests/e2e/fixtures/wizard.ts).

Task 2: provision.ts — door-origin generalization + injected occ runner

Every Nextcloud-facing helper takes the DOOR (the S5 [Open] target) instead of a forwarded webPort, and the occ proof takes its runner as a parameter. The private path keeps its exact behavior: its door carries the forwarded port, so doorPath(door, …) resolves to the same URLs filesUrl(webPort, …) built.

Files:

  • Modify: app/tests/e2e/fixtures/provision.ts
  • Modify: app/tests/e2e/provision-nextcloud.live.spec.ts (call sites)
  • Test: app/tests/e2e/fixtures/provision.test.ts

Interfaces:

  • Consumes: doorPath(door, path) (already exists), guestExec(live, remote) from ./fixtures/evidence (private-path occ runner).

  • Produces (changed signatures Task 3 relies on):

    • doorHost(door: string): string — the door's hostname.
    • readFilesDoor(page: Page, apex?: string): Promise<string> — apex defaults to the private lab's APEX.
    • oidcSignInAsOperator(page: Page, door: string, runDir: string): Promise<void> (was (c: CeremonyBrowser, webPort, runDir)).
    • assertOperatorIsAdmin(page: Page, door: string): Promise<void> (was (page, webPort)).
    • assertBrandedChrome(page: Page, occ: (remote: string) => Promise<string>, door: string, expect_: ChromeBrandExpectation, shotPath: string): Promise<void> (was (live, page, webPort, expect_, shotPath)).
    • filesUrl/idpUrl stay exported (the lab's port-splice shape, still pinned by pure tests).
  • Step 1: Write the failing test for doorHost

Append to the describe('provision fixture pure logic', …) block in provision.test.ts:

  it('reads the host off the door — portful lab door and portless public door alike', () => {
    expect(doorHost(`https://files.${APEX}:36743`)).toBe(`files.${APEX}`);
    expect(doorHost('https://files.rehearsal.idss.nz')).toBe('files.rehearsal.idss.nz');
  });

Add doorHost to the imports from ./provision.

  • Step 2: Run the test to verify it fails

Run: cd app && pnpm test tests/e2e/fixtures/provision.test.ts
Expected: FAIL — doorHost is not exported.

  • Step 3: Implement doorHost and generalize the four helpers

In provision.ts, after doorPath:

/**
 * The door's own hostname — what the OIDC walk must land back on. Portful lab
 * door and portless public door alike (DDR 0165: the door is the single source;
 * nothing rebuilds a host from an apex it guessed).
 */
export function doorHost(door: string): string {
  return new URL(door).hostname;
}

readFilesDoor — take the apex (default keeps the private path verbatim):

export async function readFilesDoor(page: Page, apex: string = APEX): Promise<string> {

and replace every files.${APEX} inside its body (the shownText comparison, both error messages, and the target.includes check) with files.${apex}.

oidcSignInAsOperator — new signature and door-derived landing host:

export async function oidcSignInAsOperator(
  page: Page,
  door: string,
  runDir: string,
): Promise<void> {

Delete the const { page } = c; line, drop the CeremonyBrowser import if now unused, and replace the landing wait:

  await page.waitForURL(`**${doorHost(door)}**`, { timeout: 60_000 });

assertOperatorIsAdmin — new signature and door-resolved target:

export async function assertOperatorIsAdmin(page: Page, door: string): Promise<void> {
  const target = doorPath(door, '/settings/admin');

assertBrandedChrome — occ runner injected, logo probe door-resolved:

export async function assertBrandedChrome(
  page: Page,
  occ: (remote: string) => Promise<string>,
  door: string,
  expect_: ChromeBrandExpectation,
  shotPath: string,
): Promise<void> {
  // 1. The STORED theming, asked of the box's own occ (--output=json so the
  //    values parse, never a scrape) — the runner is the caller's: guestExec on
  //    the private path's qemu guest, ssh root@droplet on the public path.
  const raw = await occ('nextcloud-occ config:list theming --output=json');

and the served-logo probe:

  const logoResp = await page.request.get(doorPath(door, '/index.php/apps/theming/image/logo'));

Remove the now-unused live: LaunchedApp parameter, its guestExec/LaunchedApp imports from provision.ts if nothing else uses them, and the filesUrl calls these two functions held (the helpers themselves stay exported).

  • Step 4: Update the private-path call sites

In provision-nextcloud.live.spec.ts: add guestExec to the existing import from ./fixtures/evidence, then:

    await test.step('OIDC sign-in as operator', () =>
      oidcSignInAsOperator(dash, door, live.runDir));
    await test.step('operator is admin', () => assertOperatorIsAdmin(dash, door));

and (comment block above it unchanged):

    await test.step('signed-in chrome wears the whole kit', () =>
      assertBrandedChrome(dash, (remote) => guestExec(live, remote), door,
        { name: 'E2E Drive', accent: '#619793', background: '#f5f5f0', logo: LOGO_FIXTURE_PNG },
        `${live.runDir}/artifacts/nextcloud/branded-chrome.png`));

(dash IS prefix!.ceremony.page — the same page the old c: CeremonyBrowser argument carried, so behavior is unchanged.)

  • Step 5: Run the tests + typecheck

Run: cd app && pnpm test && pnpm build
Expected: both green; provision.test.ts's new doorHost case passes, existing cases untouched.

  • Step 6: Commit
git add app/tests/e2e/fixtures/provision.ts app/tests/e2e/fixtures/provision.test.ts app/tests/e2e/provision-nextcloud.live.spec.ts
git commit -m "rehearsal phase 2: provision fixtures take the door, not a forwarded port (spec 2026-08-12)"
Phase 2 of the #183 rehearsal ratchet (spec `docs/superpowers/specs/2026-08-12-183-phase-2-nextcloud-rehearsal-design.md`, plan `docs/superpowers/plans/2026-08-12-183-phase-2-nextcloud-rehearsal.md`): the droplet drive grows past founding to a complete Nextcloud deployment at the real public door. This ticket is **Task 2** of the plan, carried verbatim below — the plan file at HEAD is the authoritative copy if this body and it ever diverge. **Verification gate (what YOU run):** `cd app && pnpm test && pnpm build`. The tail's LIVE behavior is unprovable in the sandbox (#377) — do NOT attempt to run a drive; the ratchet verifies it after Ben arms phase 2. ## Global Constraints - Selectors are the wireframes' `data-*` contract (ADR 0132); label-matching (`clickAny`) is sanctioned ONLY for kanidm's and Nextcloud's external screens. - DDR 0165: every Nextcloud address resolves against the door the app exposes (`readFilesDoor`'s return + `doorPath`) — never a rebuilt URL. - Budgets are CEILINGS, not expectations (phase-1 ruling); each tail leg's ceiling is the spec's table (`sign-in` 10 min, `co-host` 5, `deploy-files` 40, `files-healthy` 2, `door` 2, `branded-login` 3, `oidc-admin` 5, `branded-chrome` 5). - Every tail step is a `runRecordedLeg` — `legs.json` current on disk before any rethrow. - NO changes to `.sandcastle/` (protected path, and the machinery is generic by design), `scripts/rehearsal-cycle.sh`, or `.forgejo/workflows/`. - The private-path specs (`provision-nextcloud.live.spec.ts`, `private-path.live.spec.ts`, `foundingPrefix.ts`) must keep compiling and keep their exact behavior — call sites pass the portful door they already read. - `REHEARSAL_DRIVE_ISSUE` in `.sandcastle/.env` is NOT flipped by this plan — arming is Ben's step after his #425 hand sign-off. - The tail's live behavior is unprovable off-droplet (#377): the pre-land gate is `pnpm test` + `pnpm build` (vue-tsc) in `app/`; the ratchet is the real test. - Brand expectations are the wizard fixtures' own values: name `E2E Drive`, accent `#619793`, background `#f5f5f0`, logo `LOGO_FIXTURE_PNG`, greeting `E2E_GREETING` (both exported by `app/tests/e2e/fixtures/wizard.ts`). ### Task 2: provision.ts — door-origin generalization + injected occ runner Every Nextcloud-facing helper takes the DOOR (the S5 `[Open]` target) instead of a forwarded `webPort`, and the occ proof takes its runner as a parameter. The private path keeps its exact behavior: its door carries the forwarded port, so `doorPath(door, …)` resolves to the same URLs `filesUrl(webPort, …)` built. **Files:** - Modify: `app/tests/e2e/fixtures/provision.ts` - Modify: `app/tests/e2e/provision-nextcloud.live.spec.ts` (call sites) - Test: `app/tests/e2e/fixtures/provision.test.ts` **Interfaces:** - Consumes: `doorPath(door, path)` (already exists), `guestExec(live, remote)` from `./fixtures/evidence` (private-path occ runner). - Produces (changed signatures Task 3 relies on): - `doorHost(door: string): string` — the door's hostname. - `readFilesDoor(page: Page, apex?: string): Promise<string>` — `apex` defaults to the private lab's `APEX`. - `oidcSignInAsOperator(page: Page, door: string, runDir: string): Promise<void>` (was `(c: CeremonyBrowser, webPort, runDir)`). - `assertOperatorIsAdmin(page: Page, door: string): Promise<void>` (was `(page, webPort)`). - `assertBrandedChrome(page: Page, occ: (remote: string) => Promise<string>, door: string, expect_: ChromeBrandExpectation, shotPath: string): Promise<void>` (was `(live, page, webPort, expect_, shotPath)`). - `filesUrl`/`idpUrl` stay exported (the lab's port-splice shape, still pinned by pure tests). - [ ] **Step 1: Write the failing test for `doorHost`** Append to the `describe('provision fixture pure logic', …)` block in `provision.test.ts`: ```ts it('reads the host off the door — portful lab door and portless public door alike', () => { expect(doorHost(`https://files.${APEX}:36743`)).toBe(`files.${APEX}`); expect(doorHost('https://files.rehearsal.idss.nz')).toBe('files.rehearsal.idss.nz'); }); ``` Add `doorHost` to the imports from `./provision`. - [ ] **Step 2: Run the test to verify it fails** Run: `cd app && pnpm test tests/e2e/fixtures/provision.test.ts` Expected: FAIL — `doorHost` is not exported. - [ ] **Step 3: Implement `doorHost` and generalize the four helpers** In `provision.ts`, after `doorPath`: ```ts /** * The door's own hostname — what the OIDC walk must land back on. Portful lab * door and portless public door alike (DDR 0165: the door is the single source; * nothing rebuilds a host from an apex it guessed). */ export function doorHost(door: string): string { return new URL(door).hostname; } ``` `readFilesDoor` — take the apex (default keeps the private path verbatim): ```ts export async function readFilesDoor(page: Page, apex: string = APEX): Promise<string> { ``` and replace every `files.${APEX}` inside its body (the `shownText` comparison, both error messages, and the `target.includes` check) with `files.${apex}`. `oidcSignInAsOperator` — new signature and door-derived landing host: ```ts export async function oidcSignInAsOperator( page: Page, door: string, runDir: string, ): Promise<void> { ``` Delete the `const { page } = c;` line, drop the `CeremonyBrowser` import if now unused, and replace the landing wait: ```ts await page.waitForURL(`**${doorHost(door)}**`, { timeout: 60_000 }); ``` `assertOperatorIsAdmin` — new signature and door-resolved target: ```ts export async function assertOperatorIsAdmin(page: Page, door: string): Promise<void> { const target = doorPath(door, '/settings/admin'); ``` `assertBrandedChrome` — occ runner injected, logo probe door-resolved: ```ts export async function assertBrandedChrome( page: Page, occ: (remote: string) => Promise<string>, door: string, expect_: ChromeBrandExpectation, shotPath: string, ): Promise<void> { // 1. The STORED theming, asked of the box's own occ (--output=json so the // values parse, never a scrape) — the runner is the caller's: guestExec on // the private path's qemu guest, ssh root@droplet on the public path. const raw = await occ('nextcloud-occ config:list theming --output=json'); ``` and the served-logo probe: ```ts const logoResp = await page.request.get(doorPath(door, '/index.php/apps/theming/image/logo')); ``` Remove the now-unused `live: LaunchedApp` parameter, its `guestExec`/`LaunchedApp` imports from provision.ts if nothing else uses them, and the `filesUrl` calls these two functions held (the helpers themselves stay exported). - [ ] **Step 4: Update the private-path call sites** In `provision-nextcloud.live.spec.ts`: add `guestExec` to the existing import from `./fixtures/evidence`, then: ```ts await test.step('OIDC sign-in as operator', () => oidcSignInAsOperator(dash, door, live.runDir)); await test.step('operator is admin', () => assertOperatorIsAdmin(dash, door)); ``` and (comment block above it unchanged): ```ts await test.step('signed-in chrome wears the whole kit', () => assertBrandedChrome(dash, (remote) => guestExec(live, remote), door, { name: 'E2E Drive', accent: '#619793', background: '#f5f5f0', logo: LOGO_FIXTURE_PNG }, `${live.runDir}/artifacts/nextcloud/branded-chrome.png`)); ``` (`dash` IS `prefix!.ceremony.page` — the same page the old `c: CeremonyBrowser` argument carried, so behavior is unchanged.) - [ ] **Step 5: Run the tests + typecheck** Run: `cd app && pnpm test && pnpm build` Expected: both green; `provision.test.ts`'s new `doorHost` case passes, existing cases untouched. - [ ] **Step 6: Commit** ```bash git add app/tests/e2e/fixtures/provision.ts app/tests/e2e/fixtures/provision.test.ts app/tests/e2e/provision-nextcloud.live.spec.ts git commit -m "rehearsal phase 2: provision fixtures take the door, not a forwarded port (spec 2026-08-12)" ```
Author
Owner

close-report for #487 — status success

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

envelope
{
  "issue": 487,
  "status": "success",
  "commits": [
    "60db5d8"
  ],
  "changed_files": [
    "app/tests/e2e/fixtures/provision.ts",
    "app/tests/e2e/fixtures/provision.test.ts",
    "app/tests/e2e/provision-nextcloud.live.spec.ts"
  ],
  "tests": [
    {
      "command": "nix develop .#go-ci -c pnpm test (in app/)",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci -c pnpm build (in app/)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "doorHost reads host off portful lab door and portless public door": "provision.ts:52 doorHost via new URL().hostname; pinned by provision.test.ts:30-33 (both cases), test suite 862 passed",
    "readFilesDoor takes apex (default APEX keeps private path verbatim)": "provision.ts:407 readFilesDoor(page, apex=APEX); files.${apex} used in shownText/errors/target check",
    "oidcSignInAsOperator(page, door, runDir) landing host door-derived": "provision.ts:540 new signature; waitForURL uses doorHost(door); CeremonyBrowser import dropped",
    "assertOperatorIsAdmin(page, door) target via doorPath": "provision.ts:611 target = doorPath(door, '/settings/admin')",
    "assertBrandedChrome(page, occ, door, ...) occ runner injected + logo probe door-resolved": "provision.ts:694 new signature; raw = await occ(...); logoResp via doorPath(door, ...)",
    "private-path call sites pass portful door + guestExec wrapper, behavior unchanged": "provision-nextcloud.live.spec.ts:107-118 dash+door+guestExec; guestExec added to evidence import; pnpm build (vue-tsc) exit 0",
    "verification gate pnpm test && pnpm build green": "862 tests passed, build exit 0 under nix develop .#go-ci"
  },
  "summary": "Phase-2 Task 2: provision Nextcloud helpers resolve against the S5 door (DDR 0165) and take an injected occ runner instead of a forwarded webPort; new doorHost pure helper pinned; private path behavior unchanged.",
  "blockers": []
}
**close-report** for #487 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 487, "status": "success", "commits": [ "60db5d8" ], "changed_files": [ "app/tests/e2e/fixtures/provision.ts", "app/tests/e2e/fixtures/provision.test.ts", "app/tests/e2e/provision-nextcloud.live.spec.ts" ], "tests": [ { "command": "nix develop .#go-ci -c pnpm test (in app/)", "exit_code": 0 }, { "command": "nix develop .#go-ci -c pnpm build (in app/)", "exit_code": 0 } ], "criteria": { "doorHost reads host off portful lab door and portless public door": "provision.ts:52 doorHost via new URL().hostname; pinned by provision.test.ts:30-33 (both cases), test suite 862 passed", "readFilesDoor takes apex (default APEX keeps private path verbatim)": "provision.ts:407 readFilesDoor(page, apex=APEX); files.${apex} used in shownText/errors/target check", "oidcSignInAsOperator(page, door, runDir) landing host door-derived": "provision.ts:540 new signature; waitForURL uses doorHost(door); CeremonyBrowser import dropped", "assertOperatorIsAdmin(page, door) target via doorPath": "provision.ts:611 target = doorPath(door, '/settings/admin')", "assertBrandedChrome(page, occ, door, ...) occ runner injected + logo probe door-resolved": "provision.ts:694 new signature; raw = await occ(...); logoResp via doorPath(door, ...)", "private-path call sites pass portful door + guestExec wrapper, behavior unchanged": "provision-nextcloud.live.spec.ts:107-118 dash+door+guestExec; guestExec added to evidence import; pnpm build (vue-tsc) exit 0", "verification gate pnpm test && pnpm build green": "862 tests passed, build exit 0 under nix develop .#go-ci" }, "summary": "Phase-2 Task 2: provision Nextcloud helpers resolve against the S5 door (DDR 0165) and take an injected occ runner instead of a forwarded webPort; new doorHost pure helper pinned; private path behavior unchanged.", "blockers": [] } ``` </details>
ben closed this issue 2026-08-12 20:20:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#487
No description provided.