✔ shared copy: npm ci, pushed reachability, readonly/existing copy, webui delegation (336.653648ms)
✔ wrapper preserves Q81 lease and marker, rejects foreign/symlink; check uses effective roots (365.371435ms)
✖ bus unit copy/pm pins, install refuses all busy states and failed reads, drop-in refusal (312.087042ms)
✔ missing package manifest refuses before npm; npm failure removes the unpublished temp copy (226.977148ms)
✔ real pinned install loads bus and Console; same-copy mosaic talk passes proof, other trees refuse (2894.896352ms)
✔ bus status reads effective copy/pm/drop-ins without writes; check refuses an overridden ExecStart (424.632444ms)
✔ drop-ins in either override field and malformed metadata refuse; uninstall also checks --no-reload (142.77561ms)
ℹ tests 7
ℹ suites 0
ℹ pass 6
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 4754.827272

✖ failing tests:

test at packages/cli/tests/stack-copy.test.mjs:57:1
✖ bus unit copy/pm pins, install refuses all busy states and failed reads, drop-in refusal (312.087042ms)
  AssertionError [ERR_ASSERTION]: The input did not match the regular expression /bus start %i --pm/. Input:
  
  '# Mosaic bus host, one instance per business: mosaic-bus@<business>.\n' +
    '# Rendered by scripts/bus-service.sh from packages/cli/systemd/; /mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730,\n' +
    '# /usr/local/bin:/usr/bin:/bin and the claude line below are filled in at install time. Edit the template and reinstall; do\n' +
    '# not edit the installed copy. The bus store allows one broker per data\n' +
    '# root, so run one instance per data root (packages/cli/README.md).\n' +
    '[Unit]\n' +
    'Description=Mosaic bus host (%i)\n' +
    'Documentation=file:///mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730/packages/cli/README.md\n' +
    'StartLimitIntervalSec=600\n' +
    'StartLimitBurst=5\n' +
    '\n' +
    '[Service]\n' +
    'Type=simple\n' +
    'WorkingDirectory=/mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730\n' +
    'Environment=PATH=/usr/local/bin:/usr/bin:/bin\n' +
    "# The Claude Code binary that managed sessions and the manifest's\n" +
    '# claudeVersion run, pinned at install (`--claude PATH`, default\n' +
    '# `command -v claude`). Without it they run `claude` from PATH above.\n' +
    'Environment=MOSAIC_CLAUDE_BIN=/usr/bin/claude\n' +
    '# Claude Code sessions log in with what this 0600 file sets, which the\n' +
    "# operator writes: CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY, or a proxy's\n" +
    '# ANTHROPIC_AUTH_TOKEN with ANTHROPIC_BASE_URL. The `-` lets the unit start\n' +
    '# without it, and a Claude Code launch then refuses.\n' +
    'EnvironmentFile=-%h/.config/mosaic-dev/secrets/claude-session.env\n' +
    '# The host reads the system config and the business file, boots the broker\n' +
    '# (packages/bus/src/process.mjs) and starts the notifier. Config problems and\n' +
    '# refusals exit 3, usage 4, invalid input 2: none of those is retried. A\n' +
    '# child that dies takes the host down with exit 1, and the unit restarts\n' +
    '# the pair.\n' +
    'ExecStart=/mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730/scripts/mosaic bus start %i\n' +
    'Restart=on-failure\n' +
    'RestartSec=15\n' +
    'RestartPreventExitStatus=2 3 4\n' +
    '# `systemctl --user stop` sends SIGTERM to the host, which stops the\n' +
    '# notifier after its poll in flight, then closes the broker.\n' +
    'KillSignal=SIGTERM\n' +
    'KillMode=mixed\n' +
    'TimeoutStopSec=60\n' +
    'NoNewPrivileges=yes\n' +
    '\n' +
    '[Install]\n' +
    'WantedBy=default.target\n'
  
      at TestContext.<anonymous> (file:///mnt/storage/src/mosaic-stack-rocko-85/packages/cli/tests/stack-copy.test.mjs:60:188)
      at Test.runInAsyncScope (node:async_hooks:226:14)
      at Test.run (node:internal/test_runner/test:1402:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
      at Test.postRun (node:internal/test_runner/test:1542:19)
      at Test.run (node:internal/test_runner/test:1467:12)
      at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: "# Mosaic bus host, one instance per business: mosaic-bus@<business>.\n# Rendered by scripts/bus-service.sh from packages/cli/systemd/; /mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730,\n# /usr/local/bin:/usr/bin:/bin and the claude line below are filled in at install time. Edit the template and reinstall; do\n# not edit the installed copy. The bus store allows one broker per data\n# root, so run one instance per data root (packages/cli/README.md).\n[Unit]\nDescription=Mosaic bus host (%i)\nDocumentation=file:///mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730/packages/cli/README.md\nStartLimitIntervalSec=600\nStartLimitBurst=5\n\n[Service]\nType=simple\nWorkingDirectory=/mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730\nEnvironment=PATH=/usr/local/bin:/usr/bin:/bin\n# The Claude Code binary that managed sessions and the manifest's\n# claudeVersion run, pinned at install (`--claude PATH`, default\n# `command -v claude`). Without it they run `claude` from PATH above.\nEnvironment=MOSAIC_CLAUDE_BIN=/usr/bin/claude\n# Claude Code sessions log in with what this 0600 file sets, which the\n# operator writes: CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY, or a proxy's\n# ANTHROPIC_AUTH_TOKEN with ANTHROPIC_BASE_URL. The `-` lets the unit start\n# without it, and a Claude Code launch then refuses.\nEnvironmentFile=-%h/.config/mosaic-dev/secrets/claude-session.env\n# The host reads the system config and the business file, boots the broker\n# (packages/bus/src/process.mjs) and starts the notifier. Config problems and\n# refusals exit 3, usage 4, invalid input 2: none of those is retried. A\n# child that dies takes the host down with exit 1, and the unit restarts\n# the pair.\nExecStart=/mnt/storage/scratch/tmp/stack-copy-JmuIVd/copies/0b22f48de4fdb2fc1ced09a85d4382d2a9021730/scripts/mosaic bus start %i\nRestart=on-failure\nRestartSec=15\nRestartPreventExitStatus=2 3 4\n# `systemctl --user stop` sends SIGTERM to the host, which stops the\n# notifier after its poll in flight, then closes the broker.\nKillSignal=SIGTERM\nKillMode=mixed\nTimeoutStopSec=60\nNoNewPrivileges=yes\n\n[Install]\nWantedBy=default.target\n",
    expected: /bus start %i --pm/,
    operator: 'match',
    diff: 'simple'
  }
