# SCRATCH ROOT, NOT LIVE. Window B rehearsal (repin-ca15d73e9.md P3, mos-0838 D2, sage-1004/1006/1008),
# run by darkwing from 2026-10-19T18:02:54Z.
# Tool: /home/jwoltje/darkwing-scratch/r1004/repo, a git clone --shared of the canonical checkout at 6e7c23d7d91499c0bbeef474d6f52d055304d21f;
# scripts/stack-release.sh blob 4b16e848a6b9905b6a568668367bad6df5f65c7b (row 166 has not landed).
# Root: /home/jwoltje/darkwing-scratch/r1004/rootB. Config /home/jwoltje/darkwing-scratch/r1004/rootB/cfg/config.json, data root /home/jwoltje/darkwing-scratch/r1004/rootB/data, units in /home/jwoltje/darkwing-scratch/r1004/rootB/xcfg/systemd/user.
# Business file: scratch-business-B.json (sha256 a3104f0ecda189a6704dbd301ddb36c4ed9ee3ff86973ad90d5a5490d9b62dec):
#   the committed example with Window A's plug-ins, usage-source transcript and channel cli,webui.
# Seeded by seed.sh at 5fa9cc8f2c66b52408b652b59c3070f7210b44d0 and 3h: the copy's real bus host started on stand-in units, then adopt.
# Stand-ins (/home/jwoltje/darkwing-scratch/r1004/b): systemctl runs the copy's real 'scripts/mosaic bus start mosaic-stack' WITHOUT --pm.
#   The PM launch is EMULATED: no claude runs. A waiting runner process, one sessions.json entry and one
#   'launched chief' journal line stand in for it. The Console is a /healthz stand-in on 127.0.0.1:47391.
#   journalctl and systemd-analyze are the stack-release test's. claude is a fixture that prints a version.
# Credential files are fake placeholders; both base URLs in the file are 127.0.0.1:9.
# Before: pointer {"copy":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","business":"mosaic-stack","pm":true,"claude":"/home/jwoltje/darkwing-scratch/r1004/b/claude","console":["--port","47391","--business","mosaic-stack"],"schema":"3h","activation":"20261019T180158Z-5fa9cc8f2c66","at":"2026-10-19T18:01:58Z"}
# Before: store schema 3h

## 1. activate --plan
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> scripts/stack-release.sh activate ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00 mosaic-stack --plan --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin)
plan: activate for mosaic-stack
from: 5fa9cc8f2c66b52408b652b59c3070f7210b44d0
to: ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
store schema: 3h (read from the store the running bus holds)
target schema: 3i
migration: 3h to 3i, after a backup of the stopped store
migration steps: 3h to 3i
needs: --migrate (not given; the run would roll back with migration-needs-flag)
needs: Jason present for this run (decision 96 condition 2)
commits: the run adds 8 (newest first, at most 200):
  ca15d73e9 limits: a daily token quota for the account the stack uses, and bus schema 3h to 3i (row 126, #1620)
  54319f552 sessions: Filbert row 126 r2 review, approve
  4c385db45 sessions: Dewey row 126 round 4 build and review rounds 1-2
  2124cfa76 queue: row 126 Filbert r1 approve, brief re-pin for 3h to 3i, row 7 week note, round 2 in-review (sage)
  e264db51b plans: row 126 brief names the 3h to 3i step and the account guard (#1620)
  1df04f52f sessions: Filbert row 126 r1 review, approve
  9e2b26866 queue: row 167 Filbert approve and done, row 126 round 1 in-review (sage)
  640a1ee97 sessions: Sage row 167 landing and row 126 3i ruling
bus: scripts/bus-service.sh install --copy ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00 --copies /home/jwoltje/darkwing-scratch/r1004/copies --pm --claude /home/jwoltje/darkwing-scratch/r1004/b/claude
Console: scripts/webui-service.sh install --copy ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00 --copies /home/jwoltje/darkwing-scratch/r1004/copies --port 47391 --business mosaic-stack
CLI: scripts/stack-copy.sh wrapper ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00 --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin
# exit 0

## 2. activate --pm --migrate
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> scripts/stack-release.sh activate ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00 mosaic-stack --pm --migrate --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin)
stack-release: captured the rollback set: /home/jwoltje/darkwing-scratch/r1004/rootB/data/state/stack-rollback/20261019T180254Z-ca15d73e9fdc
stack-release: stopped both units
stack-release: stopped store schema: 3h
stack-release: backup: /home/jwoltje/darkwing-scratch/r1004/rootB/data/backups/stack/20261019T180254Z-ca15d73e9fdc
stack-release: migrated the store to 3i
stack-release: installed ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
stack-release: gate passed on ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
stack-release: activate ok: ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00 is live for mosaic-stack
# exit 0
# activation log, last line: {"at":"2026-10-19T18:02:55Z","op":"activate","from":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","to":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","backup":"20261019T180254Z-ca15d73e9fdc","activation":"20261019T180254Z-ca15d73e9fdc","result":"ok"}
# activation id: 20261019T180254Z-ca15d73e9fdc; backup: 20261019T180254Z-ca15d73e9fdc
# no backup STAMP found

## 3. status after activate
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> scripts/stack-release.sh status mosaic-stack --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin)
pointer: /home/jwoltje/darkwing-scratch/r1004/rootB/data/state/stack-active.json
  {"copy":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","business":"mosaic-stack","pm":true,"claude":"/home/jwoltje/darkwing-scratch/r1004/b/claude","console":["--port","47391","--business","mosaic-stack"],"schema":"3i","activation":"20261019T180254Z-ca15d73e9fdc","at":"2026-10-19T18:02:55Z"}
log (last five lines):
  {"at":"2026-10-19T18:01:58Z","op":"adopt","from":null,"to":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","backup":null,"activation":"20261019T180158Z-5fa9cc8f2c66","result":"ok"}
  {"at":"2026-10-19T18:02:54Z","op":"activate","from":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","to":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","backup":null,"activation":"20261019T180254Z-ca15d73e9fdc","result":"started"}
  {"at":"2026-10-19T18:02:55Z","op":"activate","from":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","to":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","backup":"20261019T180254Z-ca15d73e9fdc","activation":"20261019T180254Z-ca15d73e9fdc","result":"ok"}
check:
  bus: /home/jwoltje/darkwing-scratch/r1004/copies/ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
  Console: /home/jwoltje/darkwing-scratch/r1004/copies/ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
  CLI: /home/jwoltje/darkwing-scratch/r1004/copies/ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
  result: pass
bus status:
  host: mosaic-stack, pid 1402280, running, since 2026-10-19T18:02:55.131Z, notifier off
  socket: present
  writer.lock: pid 1402297
  boot: organization file loaded at 2026-10-19T18:02:55.130Z
unit flags: match the pointer
drift: 39 commit(s) on refactor since the pointer's copy
# exit 0
# store schema after activate (read-only, held by the bus): 3i

## 4. launches list after activate (the NEW copy's CLI)
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> /home/jwoltje/darkwing-scratch/r1004/copies/ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00/scripts/mosaic launches list --json)
[
  {
    "run": "remul1402306",
    "business": "mosaic-stack",
    "instance": "chief",
    "harness": "claude-code",
    "model": "emulated",
    "launchedBy": "standin-pm-emulation",
    "runnerPid": 1402306,
    "runnerStartTime": "53416545",
    "startedAt": "2026-10-19T18:02:55.233Z",
    "live": true
  }
]
# exit 0
# mos-0838 D3 counts, read-only from the scratch store the bus holds, rows with at > the backup STAMP:
#   events after : 0 (total 0)
#   usage_records after : 0 (total 0)
#   instance_names after : 0 (total 0)

## 5. rollback --restore --plan
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> scripts/stack-release.sh rollback mosaic-stack --restore 20261019T180254Z-ca15d73e9fdc --plan --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin)
plan: rollback for mosaic-stack
from: ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00
to: 5fa9cc8f2c66b52408b652b59c3070f7210b44d0
store schema: 3i (read from the store the running bus holds)
target schema: 3h
restore: the store must go back to 3h; needs --restore 20261019T180254Z-ca15d73e9fdc
commits: the run takes away 8 (newest first, at most 200):
  ca15d73e9 limits: a daily token quota for the account the stack uses, and bus schema 3h to 3i (row 126, #1620)
  54319f552 sessions: Filbert row 126 r2 review, approve
  4c385db45 sessions: Dewey row 126 round 4 build and review rounds 1-2
  2124cfa76 queue: row 126 Filbert r1 approve, brief re-pin for 3h to 3i, row 7 week note, round 2 in-review (sage)
  e264db51b plans: row 126 brief names the 3h to 3i step and the account guard (#1620)
  1df04f52f sessions: Filbert row 126 r1 review, approve
  9e2b26866 queue: row 167 Filbert approve and done, row 126 round 1 in-review (sage)
  640a1ee97 sessions: Sage row 167 landing and row 126 3i ruling
bus: scripts/bus-service.sh install --copy 5fa9cc8f2c66b52408b652b59c3070f7210b44d0 --copies /home/jwoltje/darkwing-scratch/r1004/copies --pm --claude /home/jwoltje/darkwing-scratch/r1004/b/claude
Console: scripts/webui-service.sh install --copy 5fa9cc8f2c66b52408b652b59c3070f7210b44d0 --copies /home/jwoltje/darkwing-scratch/r1004/copies --port 47391 --business mosaic-stack
CLI: scripts/stack-copy.sh wrapper 5fa9cc8f2c66b52408b652b59c3070f7210b44d0 --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin
# exit 0

## 6. rollback --restore
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> scripts/stack-release.sh rollback mosaic-stack --restore 20261019T180254Z-ca15d73e9fdc --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin)
restore: /home/jwoltje/darkwing-scratch/r1004/rootB/data/backups/stack/20261019T180254Z-ca15d73e9fdc; the store now in place moves to /home/jwoltje/darkwing-scratch/r1004/rootB/data/bus.post-attempt-20261019T180256Z and is kept; 0 event(s) were written after the backup
stack-release: captured the rollback set: /home/jwoltje/darkwing-scratch/r1004/rootB/data/state/stack-rollback/20261019T180256Z-5fa9cc8f2c66
stack-release: stopped both units
stack-release: stopped store schema: 3i
stack-release: restored /home/jwoltje/darkwing-scratch/r1004/rootB/data/backups/stack/20261019T180254Z-ca15d73e9fdc; the store from before the restore is at /home/jwoltje/darkwing-scratch/r1004/rootB/data/bus.post-attempt-20261019T180256Z
stack-release: installed 5fa9cc8f2c66b52408b652b59c3070f7210b44d0
stack-release: gate passed on 5fa9cc8f2c66b52408b652b59c3070f7210b44d0
stack-release: rollback ok: 5fa9cc8f2c66b52408b652b59c3070f7210b44d0 is live for mosaic-stack
# exit 0
# activation log, last line: {"at":"2026-10-19T18:02:57Z","op":"rollback","from":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","to":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","backup":"20261019T180254Z-ca15d73e9fdc","activation":"20261019T180256Z-5fa9cc8f2c66","result":"ok"}

## 7. status after rollback
# command: (cd /home/jwoltje/darkwing-scratch/r1004/repo && <scratch env> scripts/stack-release.sh status mosaic-stack --copies /home/jwoltje/darkwing-scratch/r1004/copies --bin /home/jwoltje/darkwing-scratch/r1004/rootB/bin)
pointer: /home/jwoltje/darkwing-scratch/r1004/rootB/data/state/stack-active.json
  {"copy":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","business":"mosaic-stack","pm":true,"claude":"/home/jwoltje/darkwing-scratch/r1004/b/claude","console":["--port","47391","--business","mosaic-stack"],"schema":"3h","activation":"20261019T180256Z-5fa9cc8f2c66","at":"2026-10-19T18:02:57Z"}
log (last five lines):
  {"at":"2026-10-19T18:01:58Z","op":"adopt","from":null,"to":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","backup":null,"activation":"20261019T180158Z-5fa9cc8f2c66","result":"ok"}
  {"at":"2026-10-19T18:02:54Z","op":"activate","from":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","to":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","backup":null,"activation":"20261019T180254Z-ca15d73e9fdc","result":"started"}
  {"at":"2026-10-19T18:02:55Z","op":"activate","from":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","to":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","backup":"20261019T180254Z-ca15d73e9fdc","activation":"20261019T180254Z-ca15d73e9fdc","result":"ok"}
  {"at":"2026-10-19T18:02:56Z","op":"rollback","from":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","to":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","backup":"20261019T180254Z-ca15d73e9fdc","activation":"20261019T180256Z-5fa9cc8f2c66","result":"started"}
  {"at":"2026-10-19T18:02:57Z","op":"rollback","from":"ca15d73e9fdcdcf66a10f86cdedeb2d6a08f2b00","to":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","backup":"20261019T180254Z-ca15d73e9fdc","activation":"20261019T180256Z-5fa9cc8f2c66","result":"ok"}
check:
  bus: /home/jwoltje/darkwing-scratch/r1004/copies/5fa9cc8f2c66b52408b652b59c3070f7210b44d0
  Console: /home/jwoltje/darkwing-scratch/r1004/copies/5fa9cc8f2c66b52408b652b59c3070f7210b44d0
  CLI: /home/jwoltje/darkwing-scratch/r1004/copies/5fa9cc8f2c66b52408b652b59c3070f7210b44d0
  result: pass
bus status:
  host: mosaic-stack, pid 1403169, running, since 2026-10-19T18:02:57.371Z, notifier off
  socket: present
  writer.lock: pid 1403198
  boot: organization file loaded at 2026-10-19T18:02:57.370Z
unit flags: match the pointer
drift: 47 commit(s) on refactor since the pointer's copy
# exit 0
# store schema after rollback: 3h
# pointer: {"copy":"5fa9cc8f2c66b52408b652b59c3070f7210b44d0","business":"mosaic-stack","pm":true,"claude":"/home/jwoltje/darkwing-scratch/r1004/b/claude","console":["--port","47391","--business","mosaic-stack"],"schema":"3h","activation":"20261019T180256Z-5fa9cc8f2c66","at":"2026-10-19T18:02:57Z"}
# data root bus dirs: backups/stack/20261019T180254Z-ca15d73e9fdc bus bus-host bus.post-attempt-20261019T180256Z 

## Addendum, 2026-10-19T18:03:13Z: correction to the D3 counts above
# run.sh took the log's backup field as a path; it is the id, so the STAMP lookup missed and the counts
# above ran with an empty stamp (at > ''). Every table total was 0, so the 0s stand. Read again here:
# backup dir: /home/jwoltje/darkwing-scratch/r1004/rootB/data/backups/stack/20261019T180254Z-ca15d73e9fdc
# files: ./bus/bus.sqlite ./DATA_ROOT ./LISTING.txt ./MODES.txt ./ROLLBACK_SET ./SCHEMA ./SHA256SUMS ./SOURCE.sha256 ./STAMP 
# STAMP: 2026-10-19T18:02:54.726Z; SCHEMA: 3h; DATA_ROOT: /home/jwoltje/darkwing-scratch/r1004/rootB/data
# command: (cd /home/jwoltje/darkwing-scratch/r1004/rootB/data/backups/stack/20261019T180254Z-ca15d73e9fdc && sha256sum -c SHA256SUMS)
  sha256sum: bus.sqlite: No such file or directory
  bus.sqlite: FAILED open or read
  sha256sum: WARNING: 1 listed file could not be read
# exit 1
# The kept post-attempt store (the 3i store the restore moved aside), read immutable and read-only, rows with at > STAMP:
#   schema 3i
#   events after 2026-10-19T18:02:54.726Z: 0 (total 0)
#   usage_records after 2026-10-19T18:02:54.726Z: 0 (total 0)
#   instance_names after 2026-10-19T18:02:54.726Z: 0 (total 0)
# post-attempt dir: bus.sqlite 
# Not exercised: the store held no events, so the restore never refused post-backup-events and no --events N run was
# needed. No usage_records or instance_names rows existed, so the D3 drop case was not exercised either.

## Addendum 2, 2026-10-19T18:04:45Z: correction to the sha256sum line in addendum 1
# Addendum 1 ran sha256sum -c from the backup dir. SHA256SUMS names bus.sqlite relative to bus/, the way
# stack-release.sh:285 checks it, so exit 1 there was my wrong cwd, not a bad backup. Rerun as the tool runs it:
# command: (cd /home/jwoltje/darkwing-scratch/r1004/rootB/data/backups/stack/20261019T180254Z-ca15d73e9fdc/bus && sha256sum -c ../SHA256SUMS)
  bus.sqlite: OK
# exit 0
# SOURCE.sha256 matches SHA256SUMS: yes
