rehearsal-3: journey.selfhosted.spec.ts — thirteen teeth over the manual path, fault-injection honesty legs included #521

Closed
opened 2026-08-14 06:20:47 +00:00 by ben · 2 comments
Owner

Part of rehearsal phase 3 — gateway from home (spec docs/superpowers/specs/2026-08-14-183-phase-3-home-gateway-rehearsal-design.md, plan docs/superpowers/plans/2026-08-14-183-phase-3-home-gateway-rehearsal.md).
The plan section below is the work, verbatim; its Interfaces block names what neighbouring tasks consume — keep those names exact.

Global constraints (apply to every step)

  • Use the domain glossary's vocabulary (CONTEXT.md) in ALL copy, comments,
    commit messages: founding, gateway, agent, install command,
    enrollment code — never installer/daemon/token/join-key.
  • Fail loud, never fabricate (ADR 0100): a missing artifact/secret/seam is an
    error with the real reason, never a silent skip or a made-up value.
  • x86_64 only at v1; full install is the consented mode (ADR 0024); the
    install command is a doorway, not a kept tool (ADR 0028).
  • Never write closes #NNN (or any close keyword) in commits or issue bodies
    for the standing drive issue family — say "advances #NNN". Even DESCRIBING a
    close can auto-close (2026-08-10 lesson, twice).
  • Commits that change project state update STATUS.md in the same commit
    (CLAUDE.md rule); the drive-issue minting commit (Task 9) carries the
    STATUS + runbook update for the whole arc.
  • TDD: each step's test is written and seen red before its implementation.
  • Secrets never enter .sandcastle/.env (it forwards into worker containers);
    host-only secrets live in the executor's rehearsal-env.sh (2026-07-11
    lesson).

Task 7: The journey spec — journey.selfhosted.spec.ts (blocked by Tasks 4, 5, 6)

Files:

  • Create: app/tests/e2e/journey.selfhosted.spec.ts
  • Test: it IS the test; pure sequencing logic (fault-injection ordering,
    heartbeat trigger) unit-tested beside the fixtures it lives with.

Interfaces:

  • Consumes: runRecordedLeg/driveLegs (fixtures/legs.ts), runFoundingPrefix
    (foundingPrefix.ts — S1–S3 shared bodies), Task 6's three fixtures, Task 4's
    walkthrough selectors, sshDroplet, the evidence fixtures, the droplet env
    the machinery exports (REHEARSAL_DROPLET_IP — confirm the exact name in
    scripts/lib/rehearsal-droplet.sh and reuse it).
  • Produces: the 13 legs of the spec's table, in order, writing legs.json
    under test-results/drive-selfhosted/<stamp>/; teardown offboards the slug
    and relies on the machinery's droplet destroy.

Leg implementation notes (each is a runRecordedLeg with the spec's ceiling):

  • wizard-precheck → claim (slug rehearsal-home) → create →
    install-command (via Task 6 fixtures; the command string must contain
    get.idss.nz and the code — assert it, the fixture returns it).
  • agent-install: sshDroplet(ip, command, 300_000) with the EXACT
    string the app rendered (never rebuilt); assert exit 0 and
    systemctl is-active ourcloud-agent reports active.
  • consent: sshDropletInteractive re-attaches the terminal join (per
    Task 1's script contract the join runs foreground; drive it with the
    expect/send pairs for full install — read the agent's actual prompts from
    internal/join/cli.go at implementation time and pin them in the answers
    array); save the transcript to the run dir as consent-transcript.txt.
  • pair: app-side — wait for the S9 spec gate to render its pass.
  • ports-honest: BEFORE the walkthrough's first probe:
    sshDroplet(ip, "iptables -I INPUT -p tcp --dport 443 -j DROP", …); assert
    [data-port="443"][data-status="dropped"] and the firewall-lane guidance
    render; red the leg if S10 shows reachable while the rule stands (the
    under-report detector); then iptables -D INPUT -p tcp --dport 443 -j DROP,
    click [data-action="recheck-ports"], assert reachable.
  • point → deploy-takeover → activation → founded: mirror the
    phase-1 journey's leg bodies (journey.droplet.spec.ts) — same events, same
    honest-red plumbing; the takeover here is triggered by the first deploy on
    the paired device, not the carrier.
  • heartbeat-repoint: read Address.Host + Address.Secret from the
    drive's founding state (the same state file the evidence fixtures snapshot);
    POST the broker's /point with ip: "203.0.113.250" (TEST-NET — never a
    real host) + the secret; then poll dig +short <host> until it answers the
    droplet IP again within the ceiling — the gateway's heartbeat must have
    re-pointed. Assert the app/dashboard shows no standing fault after.
  • Ceilings exactly as the spec table; budgets are ceilings, not
    expectations.
  • tsc + unit suites green; commit — rehearsal phase 3: the drive founds from home — thirteen teeth over the manual path (spec 2026-08-14).
Part of rehearsal **phase 3 — gateway from home** (spec `docs/superpowers/specs/2026-08-14-183-phase-3-home-gateway-rehearsal-design.md`, plan `docs/superpowers/plans/2026-08-14-183-phase-3-home-gateway-rehearsal.md`). The plan section below is the work, verbatim; its **Interfaces** block names what neighbouring tasks consume — keep those names exact. ## Global constraints (apply to every step) - Use the domain glossary's vocabulary (`CONTEXT.md`) in ALL copy, comments, commit messages: *founding*, *gateway*, *agent*, *install command*, *enrollment code* — never installer/daemon/token/join-key. - Fail loud, never fabricate (ADR 0100): a missing artifact/secret/seam is an error with the real reason, never a silent skip or a made-up value. - x86_64 only at v1; full install is the consented mode (ADR 0024); the install command is a doorway, not a kept tool (ADR 0028). - Never write `closes #NNN` (or any close keyword) in commits or issue bodies for the standing drive issue family — say "advances #NNN". Even DESCRIBING a close can auto-close (2026-08-10 lesson, twice). - Commits that change project state update `STATUS.md` in the same commit (CLAUDE.md rule); the drive-issue minting commit (Task 9) carries the STATUS + runbook update for the whole arc. - TDD: each step's test is written and seen red before its implementation. - Secrets never enter `.sandcastle/.env` (it forwards into worker containers); host-only secrets live in the executor's `rehearsal-env.sh` (2026-07-11 lesson). --- ### Task 7: The journey spec — `journey.selfhosted.spec.ts` (blocked by Tasks 4, 5, 6) **Files:** - Create: `app/tests/e2e/journey.selfhosted.spec.ts` - Test: it IS the test; pure sequencing logic (fault-injection ordering, heartbeat trigger) unit-tested beside the fixtures it lives with. **Interfaces:** - Consumes: `runRecordedLeg`/`driveLegs` (fixtures/legs.ts), `runFoundingPrefix` (foundingPrefix.ts — S1–S3 shared bodies), Task 6's three fixtures, Task 4's walkthrough selectors, `sshDroplet`, the evidence fixtures, the droplet env the machinery exports (`REHEARSAL_DROPLET_IP` — confirm the exact name in `scripts/lib/rehearsal-droplet.sh` and reuse it). - Produces: the 13 legs of the spec's table, in order, writing `legs.json` under `test-results/drive-selfhosted/<stamp>/`; teardown offboards the slug and relies on the machinery's droplet destroy. Leg implementation notes (each is a `runRecordedLeg` with the spec's ceiling): - [ ] `wizard-precheck` → `claim` (slug `rehearsal-home`) → `create` → `install-command` (via Task 6 fixtures; the command string must contain `get.idss.nz` and the code — assert it, the fixture returns it). - [ ] `agent-install`: `sshDroplet(ip, command, 300_000)` with the EXACT string the app rendered (never rebuilt); assert exit 0 and `systemctl is-active ourcloud-agent` reports active. - [ ] `consent`: `sshDropletInteractive` re-attaches the terminal join (per Task 1's script contract the join runs foreground; drive it with the expect/send pairs for full install — read the agent's actual prompts from `internal/join/cli.go` at implementation time and pin them in the answers array); save the transcript to the run dir as `consent-transcript.txt`. - [ ] `pair`: app-side — wait for the S9 spec gate to render its pass. - [ ] `ports-honest`: BEFORE the walkthrough's first probe: `sshDroplet(ip, "iptables -I INPUT -p tcp --dport 443 -j DROP", …)`; assert `[data-port="443"][data-status="dropped"]` and the firewall-lane guidance render; **red the leg if S10 shows reachable while the rule stands** (the under-report detector); then `iptables -D INPUT -p tcp --dport 443 -j DROP`, click `[data-action="recheck-ports"]`, assert reachable. - [ ] `point` → `deploy-takeover` → `activation` → `founded`: mirror the phase-1 journey's leg bodies (journey.droplet.spec.ts) — same events, same honest-red plumbing; the takeover here is triggered by the first deploy on the paired device, not the carrier. - [ ] `heartbeat-repoint`: read `Address.Host` + `Address.Secret` from the drive's founding state (the same state file the evidence fixtures snapshot); POST the broker's `/point` with `ip: "203.0.113.250"` (TEST-NET — never a real host) + the secret; then poll `dig +short <host>` until it answers the droplet IP again within the ceiling — the gateway's heartbeat must have re-pointed. Assert the app/dashboard shows no standing fault after. - [ ] Ceilings exactly as the spec table; budgets are ceilings, not expectations. - [ ] `tsc` + unit suites green; commit — `rehearsal phase 3: the drive founds from home — thirteen teeth over the manual path (spec 2026-08-14)`.
Author
Owner

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

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

close-report for #521 — status success

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

envelope
{
  "issue": 521,
  "status": "success",
  "commits": [
    "7c621178a5b771af1bda38b674c9fab6aab2a7e2"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/selfhosted.test.ts",
    "app/tests/e2e/fixtures/selfhosted.ts",
    "app/tests/e2e/journey.selfhosted.spec.ts"
  ],
  "tests": [
    {
      "command": "node_modules/.bin/vue-tsc -p tsconfig.json",
      "exit_code": 0
    },
    {
      "command": "node_modules/.bin/vitest run tests/e2e/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "wizard-precheck -> claim (rehearsal-home) -> create -> install-command legs, command carries get.idss.nz + the code (asserted)": "journey.selfhosted.spec.ts legs 1-4; enrollmentCodeFrom() asserts get.idss.nz + a non-empty code (fixtures/selfhosted.ts), proven in selfhosted.test.ts",
    "agent-install: sshDroplet(ip, command, 300000) with the EXACT rendered string, assert exit 0 and systemctl is-active ourcloud-agent active": "journey.selfhosted.spec.ts agent-install leg — pastes installCommand verbatim, asserts r.code===0 and systemctl is-active == active",
    "consent: sshDropletInteractive re-attaches the terminal join with the full-install expect/send pairs; transcript saved as consent-transcript.txt": "consent leg runs `ourcloud-agent enroll <code>` with fullInstallConsentAnswers() (menu->1, WIPE, read off internal/join/cli.go) and writes artifacts/consent-transcript.txt",
    "pair: wait for the S9 spec gate to render its pass": "pair leg waits for [data-status=spec-gate-pass]",
    "ports-honest: drop 443 before first probe, assert [data-port=443][data-status=dropped] + firewall-lane guidance, RED if reachable while rule stands, then remove + recheck-ports + assert reachable": "ports-honest leg via portsHonest() + portFaultPlan(); under-report detector asserts [data-status=reachable] count 0 while dropped, then click [data-action=recheck-ports] and assert reachable",
    "point -> deploy-takeover -> activation -> founded: mirror phase-1 honest-red plumbing; takeover triggered by first deploy on the paired device": "legs 9-12 race deploy-live/hand-off/deploy-failed and finish-fault via throwOnDeployFailure()+readFault(); founded asserts [data-status=hand-off] + https portal-address + no fault",
    "heartbeat-repoint: read Address.Host+Secret from founding state, POST broker /point ip=203.0.113.250 + secret, poll dig +short until it answers the droplet IP within ceiling, assert no standing fault": "heartbeatRepoint() reads foundingAddress(founding-state.json), POSTs {host,ip:203.0.113.250} with Bearer secret to OURCLOUD_BROKER_URL/v1/subdomains/point, polls digShort until digAnswers(droplet ip), then asserts readFault undefined",
    "Ceilings exactly as the spec table; budgets are ceilings": "CEILING map in journey.selfhosted.spec.ts matches the spec's 13-leg table minute-for-minute",
    "13 legs in order, writing legs.json under test-results/drive-selfhosted/<stamp>/; teardown offboards the slug and relies on machinery destroy": "the 13 runRecordedLeg legs write legs.json to live.runDir/artifacts; afterAll offboards reservedHost via /v1/subdomains/offboard best-effort and closes the app, relying on the machinery droplet destroy",
    "tsc + unit suites green": "vue-tsc exit 0; vitest run tests/e2e/ 70/70 green including the 17 new selfhosted.test.ts cases",
    "pure sequencing logic unit-tested beside the fixtures": "fixtures/selfhosted.ts (consent answers, doorway parse, fault-injection ordering, mis-point body, dig predicate, state read) with 17 unit tests in fixtures/selfhosted.test.ts"
  },
  "summary": "Landed journey.selfhosted.spec.ts — the phase-3 self-hosted drive's thirteen legs over the manual install path, with the ports-honest and heartbeat-repoint false-green detectors, backed by pure sequencing logic in fixtures/selfhosted.ts proven offline.",
  "reason": "",
  "blockers": []
}
**close-report** for #521 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 521, "status": "success", "commits": [ "7c621178a5b771af1bda38b674c9fab6aab2a7e2" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/selfhosted.test.ts", "app/tests/e2e/fixtures/selfhosted.ts", "app/tests/e2e/journey.selfhosted.spec.ts" ], "tests": [ { "command": "node_modules/.bin/vue-tsc -p tsconfig.json", "exit_code": 0 }, { "command": "node_modules/.bin/vitest run tests/e2e/", "exit_code": 0 } ], "criteria": { "wizard-precheck -> claim (rehearsal-home) -> create -> install-command legs, command carries get.idss.nz + the code (asserted)": "journey.selfhosted.spec.ts legs 1-4; enrollmentCodeFrom() asserts get.idss.nz + a non-empty code (fixtures/selfhosted.ts), proven in selfhosted.test.ts", "agent-install: sshDroplet(ip, command, 300000) with the EXACT rendered string, assert exit 0 and systemctl is-active ourcloud-agent active": "journey.selfhosted.spec.ts agent-install leg — pastes installCommand verbatim, asserts r.code===0 and systemctl is-active == active", "consent: sshDropletInteractive re-attaches the terminal join with the full-install expect/send pairs; transcript saved as consent-transcript.txt": "consent leg runs `ourcloud-agent enroll <code>` with fullInstallConsentAnswers() (menu->1, WIPE, read off internal/join/cli.go) and writes artifacts/consent-transcript.txt", "pair: wait for the S9 spec gate to render its pass": "pair leg waits for [data-status=spec-gate-pass]", "ports-honest: drop 443 before first probe, assert [data-port=443][data-status=dropped] + firewall-lane guidance, RED if reachable while rule stands, then remove + recheck-ports + assert reachable": "ports-honest leg via portsHonest() + portFaultPlan(); under-report detector asserts [data-status=reachable] count 0 while dropped, then click [data-action=recheck-ports] and assert reachable", "point -> deploy-takeover -> activation -> founded: mirror phase-1 honest-red plumbing; takeover triggered by first deploy on the paired device": "legs 9-12 race deploy-live/hand-off/deploy-failed and finish-fault via throwOnDeployFailure()+readFault(); founded asserts [data-status=hand-off] + https portal-address + no fault", "heartbeat-repoint: read Address.Host+Secret from founding state, POST broker /point ip=203.0.113.250 + secret, poll dig +short until it answers the droplet IP within ceiling, assert no standing fault": "heartbeatRepoint() reads foundingAddress(founding-state.json), POSTs {host,ip:203.0.113.250} with Bearer secret to OURCLOUD_BROKER_URL/v1/subdomains/point, polls digShort until digAnswers(droplet ip), then asserts readFault undefined", "Ceilings exactly as the spec table; budgets are ceilings": "CEILING map in journey.selfhosted.spec.ts matches the spec's 13-leg table minute-for-minute", "13 legs in order, writing legs.json under test-results/drive-selfhosted/<stamp>/; teardown offboards the slug and relies on machinery destroy": "the 13 runRecordedLeg legs write legs.json to live.runDir/artifacts; afterAll offboards reservedHost via /v1/subdomains/offboard best-effort and closes the app, relying on the machinery droplet destroy", "tsc + unit suites green": "vue-tsc exit 0; vitest run tests/e2e/ 70/70 green including the 17 new selfhosted.test.ts cases", "pure sequencing logic unit-tested beside the fixtures": "fixtures/selfhosted.ts (consent answers, doorway parse, fault-injection ordering, mis-point body, dig predicate, state read) with 17 unit tests in fixtures/selfhosted.test.ts" }, "summary": "Landed journey.selfhosted.spec.ts — the phase-3 self-hosted drive's thirteen legs over the manual install path, with the ports-honest and heartbeat-repoint false-green detectors, backed by pure sequencing logic in fixtures/selfhosted.ts proven offline.", "reason": "", "blockers": [] } ``` </details>
ben closed this issue 2026-08-14 18:32:08 +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#521
No description provided.