build: communities registry + the one-shot move of the existing seat into communities/<id> — copy, verify, set aside (ADR 0298 d.1, d.2, d.4) — #2094 #2095

Closed
opened 2026-10-30 02:52:55 +00:00 by ben · 4 comments
Owner

Parent

  • Spec: #2094
  • ADR 0298 · DDR 0299 · wireframe docs/ux/wireframes/shell/shell-hb-health-board.html · flow docs/ux/flows/shell.mermaid node HB · build plan docs/superpowers/plans/2026-10-29-many-communities-one-app.md (exact names, signatures, file homes and tests per task). All land with design PR #2093.

What to build

Electron main gains the communities registry (communities.json at the app root) and, on first launch of this build, moves a pre-0298 seat (the d.1 list at the top level of the app root) into communities/<uuid>/. It copies into a staging folder, verifies every file by sha256, commits by writing the registry, then renames the originals into pre-0298-backup/. Only the d.1 list moves. Chromium files, updates/, window-state.json, clan-config.pre-flip/ and demo-seed-* stay put. A vm/ folder refuses the move. Any failure leaves the old layout in force. The outcome is exposed on boot-info as moveOutcome. Plan Tasks 1 + 2.

Anti-goal (Ben): never disturb Whakatōhea Demo's existing seat (~/.config/IDSS on Ben's laptop). Nothing in this ticket may sync, push, deploy or open SSH to a gateway except where the ticket says so.

Acceptance criteria

  • Registry: absent reads empty; add mints a uuid folder (0700) and persists atomically; remove drops the entry and keeps the folder; an unknown version is refused and never rewritten.
  • Move: only the seat entries move; every moved file's sha256 equals its backup's; key/keychain modes stay 0600; Chromium files, updates/, clan-config.pre-flip/ and demo-seed-* stay at the root.
  • vm/ present → refused-vm, root byte-identical. Injected copy corruption → failed, no registry, no communities/, originals in place.
  • A leftover .staging-* from a killed move is cleaned and the move completes; an empty root is not a legacy seat; a second run is a no-op.
  • The app still boots on failed/refused-vm (the renderer's legacy-single fallback is the board ticket's).
  • Unit tests per the plan's Task 1 + 2 names pass; vue-tsc clean.

Blocked by

  • #2093 (the design PR lands on main first)

Task manifest

task: communities-registry-and-move
implements_flow: shell
implements_edge: launch→HB (precondition)
wireframe: docs/ux/wireframes/shell/shell-hb-health-board.html
interface: |
  readRegistry(root) / addCommunity(root) / removeCommunity(root, id) / communityFolder(root, e)
  migrateLegacySeat(root, deps?): MoveOutcome  ('none'|'moved'|'refused-vm'|'failed')
binds:
  - symbol: migrateLegacySeat
    defined_in: app/src-electron/communitiesMigrate.ts
  - symbol: readRegistry
    defined_in: app/src-electron/communities.ts
seam: app/tests/unit/communitiesRegistry.test.ts + communitiesMigrate.test.ts (temp roots seeded like ~/.config/IDSS)
unproven_by_seam: the move against Ben's REAL seat — the copy-proof ticket exercises it
acceptance:
  - given: a root seeded like ~/.config/IDSS today
    when: migrateLegacySeat runs
    then: the seat entries are in communities/<id>, byte-identical, originals in pre-0298-backup, nothing else moved
  - given: a copy that corrupts one file
    when: migrateLegacySeat runs
    then: it returns failed and the old layout is untouched
depends_on: []
out_of_scope: [health-board-ui, community-sessions, undo-script]
needs_human_decision: []
## Parent - Spec: #2094 - ADR 0298 · DDR 0299 · wireframe `docs/ux/wireframes/shell/shell-hb-health-board.html` · flow `docs/ux/flows/shell.mermaid` node HB · build plan `docs/superpowers/plans/2026-10-29-many-communities-one-app.md` (exact names, signatures, file homes and tests per task). All land with design PR #2093. ## What to build Electron main gains the **communities registry** (`communities.json` at the app root) and, on first launch of this build, **moves a pre-0298 seat** (the d.1 list at the top level of the app root) into `communities/<uuid>/`. It copies into a staging folder, verifies every file by sha256, commits by writing the registry, then renames the originals into `pre-0298-backup/`. Only the d.1 list moves. Chromium files, `updates/`, `window-state.json`, `clan-config.pre-flip/` and `demo-seed-*` stay put. A `vm/` folder refuses the move. Any failure leaves the old layout in force. The outcome is exposed on boot-info as `moveOutcome`. Plan Tasks 1 + 2. **Anti-goal (Ben):** never disturb Whakatōhea Demo's existing seat (`~/.config/IDSS` on Ben's laptop). Nothing in this ticket may sync, push, deploy or open SSH to a gateway except where the ticket says so. ## Acceptance criteria - [ ] Registry: absent reads empty; add mints a uuid folder (0700) and persists atomically; remove drops the entry and keeps the folder; an unknown `version` is refused and never rewritten. - [ ] Move: only the seat entries move; every moved file's sha256 equals its backup's; key/keychain modes stay 0600; Chromium files, `updates/`, `clan-config.pre-flip/` and `demo-seed-*` stay at the root. - [ ] `vm/` present → `refused-vm`, root byte-identical. Injected copy corruption → `failed`, no registry, no `communities/`, originals in place. - [ ] A leftover `.staging-*` from a killed move is cleaned and the move completes; an empty root is not a legacy seat; a second run is a no-op. - [ ] The app still boots on `failed`/`refused-vm` (the renderer's legacy-single fallback is the board ticket's). - [ ] Unit tests per the plan's Task 1 + 2 names pass; `vue-tsc` clean. ## Blocked by - #2093 (the design PR lands on `main` first) ## Task manifest ```yaml task: communities-registry-and-move implements_flow: shell implements_edge: launch→HB (precondition) wireframe: docs/ux/wireframes/shell/shell-hb-health-board.html interface: | readRegistry(root) / addCommunity(root) / removeCommunity(root, id) / communityFolder(root, e) migrateLegacySeat(root, deps?): MoveOutcome ('none'|'moved'|'refused-vm'|'failed') binds: - symbol: migrateLegacySeat defined_in: app/src-electron/communitiesMigrate.ts - symbol: readRegistry defined_in: app/src-electron/communities.ts seam: app/tests/unit/communitiesRegistry.test.ts + communitiesMigrate.test.ts (temp roots seeded like ~/.config/IDSS) unproven_by_seam: the move against Ben's REAL seat — the copy-proof ticket exercises it acceptance: - given: a root seeded like ~/.config/IDSS today when: migrateLegacySeat runs then: the seat entries are in communities/<id>, byte-identical, originals in pre-0298-backup, nothing else moved - given: a copy that corrupts one file when: migrateLegacySeat runs then: it returns failed and the old layout is untouched depends_on: [] out_of_scope: [health-board-ui, community-sessions, undo-script] needs_human_decision: [] ```

swarm-claim host=bens-mac-04 run=57220
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=57220 (automated multi-host claim — lowest live claim id works this ticket)

⏩ independent reviewer for #2095 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #2095 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>

close-report for #2095 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261030-004111-99d153 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 2095,
  "status": "success",
  "commits": [
    "b769ec18e8b634d7a9cb954311d014cbc5aed0f2"
  ],
  "changed_files": [
    "STATUS.md",
    "app/src-electron/communities.ts",
    "app/src-electron/communitiesMigrate.ts",
    "app/src-electron/electron-main.ts",
    "app/tests/unit/communitiesMigrate.test.ts",
    "app/tests/unit/communitiesRegistry.test.ts"
  ],
  "tests": [
    {
      "command": "cd app && npx vitest run tests/unit/communitiesRegistry.test.ts tests/unit/communitiesMigrate.test.ts",
      "exit_code": 0
    },
    {
      "command": "cd app && npx vue-tsc --noEmit",
      "exit_code": 0
    },
    {
      "command": "node_modules/.bin/eslint .",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Registry: absent reads empty; add mints a uuid folder (0700) and persists atomically; remove drops the entry and keeps the folder; an unknown version is refused and never rewritten": "communities.ts readRegistry/addCommunity/removeCommunity (atomic .tmp rename, 0700 mkdir, unknown-version throws); proven by communitiesRegistry.test.ts (5 tests, all pass)",
    "Move: only the seat entries move; every moved file's sha256 equals its backup's; key/keychain modes stay 0600; Chromium files, updates/, clan-config.pre-flip/ and demo-seed-* stay at the root": "communitiesMigrate.ts migrateLegacySeat copies only SEAT_ENTRIES, chmod preserves 0600, sha256 verify; proven by communitiesMigrate.test.ts 'moves only the seat entries', 'byte-for-byte', 'keeps 0600'",
    "vm/ present -> refused-vm, root byte-identical. Injected copy corruption -> failed, no registry, no communities/, originals in place": "migrateLegacySeat returns refused-vm before touching anything; failure path rmSync's staging + removeIfEmpty(communities); proven by communitiesMigrate.test.ts 'refuses the move when vm/ is present' and 'fails and leaves the old layout when a copy is corrupted'",
    "A leftover .staging-* from a killed move is cleaned and the move completes; an empty root is not a legacy seat; a second run is a no-op": "cleanStaging() runs before fresh staging; empty root and present-registry both return none; proven by communitiesMigrate.test.ts 'resumes cleanly after a partial copy', 'treats an empty root as not a legacy seat', 'is a no-op on a second run'",
    "The app still boots on failed/refused-vm (the renderer's legacy-single fallback is the board ticket's)": "electron-main.ts runs migrateLegacySeat in a try/catch before createWindow and always proceeds to createWindow; the renderer legacy-single fallback is out_of_scope (health-board-ui, sibling ticket)",
    "Unit tests per the plan's Task 1 + 2 names pass; vue-tsc clean": "vitest run of both files exits 0 (14 tests); vue-tsc --noEmit exits 0"
  },
  "binds": [
    {
      "symbol": "readRegistry",
      "defined_in": "app/src-electron/communities.ts"
    },
    {
      "symbol": "migrateLegacySeat",
      "defined_in": "app/src-electron/communitiesMigrate.ts"
    }
  ],
  "summary": "Electron main gains the communities registry and the one-shot copy-verify-set-aside move of the pre-0298 seat into communities/<id> (ADR 0298 d.1/d.2/d.4).",
  "blockers": []
}
**close-report** for #2095 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261030-004111-99d153` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 2095, "status": "success", "commits": [ "b769ec18e8b634d7a9cb954311d014cbc5aed0f2" ], "changed_files": [ "STATUS.md", "app/src-electron/communities.ts", "app/src-electron/communitiesMigrate.ts", "app/src-electron/electron-main.ts", "app/tests/unit/communitiesMigrate.test.ts", "app/tests/unit/communitiesRegistry.test.ts" ], "tests": [ { "command": "cd app && npx vitest run tests/unit/communitiesRegistry.test.ts tests/unit/communitiesMigrate.test.ts", "exit_code": 0 }, { "command": "cd app && npx vue-tsc --noEmit", "exit_code": 0 }, { "command": "node_modules/.bin/eslint .", "exit_code": 0 } ], "criteria": { "Registry: absent reads empty; add mints a uuid folder (0700) and persists atomically; remove drops the entry and keeps the folder; an unknown version is refused and never rewritten": "communities.ts readRegistry/addCommunity/removeCommunity (atomic .tmp rename, 0700 mkdir, unknown-version throws); proven by communitiesRegistry.test.ts (5 tests, all pass)", "Move: only the seat entries move; every moved file's sha256 equals its backup's; key/keychain modes stay 0600; Chromium files, updates/, clan-config.pre-flip/ and demo-seed-* stay at the root": "communitiesMigrate.ts migrateLegacySeat copies only SEAT_ENTRIES, chmod preserves 0600, sha256 verify; proven by communitiesMigrate.test.ts 'moves only the seat entries', 'byte-for-byte', 'keeps 0600'", "vm/ present -> refused-vm, root byte-identical. Injected copy corruption -> failed, no registry, no communities/, originals in place": "migrateLegacySeat returns refused-vm before touching anything; failure path rmSync's staging + removeIfEmpty(communities); proven by communitiesMigrate.test.ts 'refuses the move when vm/ is present' and 'fails and leaves the old layout when a copy is corrupted'", "A leftover .staging-* from a killed move is cleaned and the move completes; an empty root is not a legacy seat; a second run is a no-op": "cleanStaging() runs before fresh staging; empty root and present-registry both return none; proven by communitiesMigrate.test.ts 'resumes cleanly after a partial copy', 'treats an empty root as not a legacy seat', 'is a no-op on a second run'", "The app still boots on failed/refused-vm (the renderer's legacy-single fallback is the board ticket's)": "electron-main.ts runs migrateLegacySeat in a try/catch before createWindow and always proceeds to createWindow; the renderer legacy-single fallback is out_of_scope (health-board-ui, sibling ticket)", "Unit tests per the plan's Task 1 + 2 names pass; vue-tsc clean": "vitest run of both files exits 0 (14 tests); vue-tsc --noEmit exits 0" }, "binds": [ { "symbol": "readRegistry", "defined_in": "app/src-electron/communities.ts" }, { "symbol": "migrateLegacySeat", "defined_in": "app/src-electron/communitiesMigrate.ts" } ], "summary": "Electron main gains the communities registry and the one-shot copy-verify-set-aside move of the pre-0298 seat into communities/<id> (ADR 0298 d.1/d.2/d.4).", "blockers": [] } ``` </details>

unproven_by_seam (carried from the manifest): the seam drives migrateLegacySeat against freshly-seeded temp roots only. What it never exercises is the move against Ben's REAL ~/.config/IDSS seat — that live leg is #2103 (the copy-proof ticket, ready-for-human).

Note on test evidence: the full app unit suite has 2 pre-existing failures in this sandbox (boot.test.ts and updatesFeed.test.ts: spawnSync go ENOENT) because the Go toolchain is not on PATH in this shell; both are unrelated to this slice and run under nix develop. The targeted vitest run for this slice (14 tests), vue-tsc, and eslint . are all green.

unproven_by_seam (carried from the manifest): the seam drives migrateLegacySeat against freshly-seeded temp roots only. What it never exercises is the move against Ben's REAL ~/.config/IDSS seat — that live leg is #2103 (the copy-proof ticket, ready-for-human). Note on test evidence: the full app unit suite has 2 pre-existing failures in this sandbox (boot.test.ts and updatesFeed.test.ts: spawnSync go ENOENT) because the Go toolchain is not on PATH in this shell; both are unrelated to this slice and run under `nix develop`. The targeted vitest run for this slice (14 tests), vue-tsc, and `eslint .` are all green.
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#2095
No description provided.