rollbridge 0.1.84 → 0.1.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollbridge",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "description": "Zero-downtime process supervisor and local traffic switcher for deploy-managed apps.",
5
5
  "keywords": [
6
6
  "deploy",
package/src/cli.js CHANGED
@@ -99,8 +99,18 @@ export async function runCli(argv) {
99
99
 
100
100
  if (options.replaceOwner) {
101
101
  if (bootstrap || options.takeoverOwner) throw new Error("Daemon --replace-owner cannot be combined with bootstrap takeover options.")
102
- startupPromise = daemon.replaceIncompatibleOwner()
103
- await startupPromise
102
+ try {
103
+ startupPromise = daemon.replaceIncompatibleOwner()
104
+ await startupPromise
105
+ } catch (error) {
106
+ daemon.logger("owner replacement failed without terminating the daemon supervisor", {
107
+ error: error instanceof Error ? error.message : String(error),
108
+ status: "error"
109
+ })
110
+ await daemon.abandonOwnerRecoveryAttempt()
111
+ process.exitCode = 1
112
+ return
113
+ }
104
114
  }
105
115
 
106
116
  if (!options.takeoverOwner && !options.replaceOwner && !options.resetRetiredOwner) {
@@ -886,6 +886,26 @@ test("ensure-daemon owns and reports the exact candidate exit before readiness",
886
886
  }
887
887
  })
888
888
 
889
+ test("replace-owner failure is logged and cleaned up without an uncaught daemon exception", async () => {
890
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), "rollbridge-owner-replacement-nonfatal-"))
891
+ const configPath = path.join(root, "rollbridge.cjs")
892
+ const statePath = path.join(root, "missing-state.json")
893
+
894
+ try {
895
+ await writeConfig(configPath, config({controlPath: path.join(root, "rollbridge.sock"), extraCompanion: false, statePath}))
896
+ const result = await run(process.execPath, [
897
+ binPath, "daemon", "--config", configPath, "--replace-owner"
898
+ ])
899
+
900
+ expect(result.code).toBe(1)
901
+ expect(result.stdout).toMatch(/owner replacement failed without terminating the daemon supervisor/)
902
+ expect(result.stdout).toMatch(/No committed durable owner transaction was found/)
903
+ expect(result.stderr).not.toMatch(/triggerUncaughtException/)
904
+ } finally {
905
+ await fs.rm(root, {force: true, recursive: true})
906
+ }
907
+ })
908
+
889
909
  test("legacy disruptive bridge rejects non-protocol guardian failures exactly", () => {
890
910
  expect(isLegacyGuardianPrepareDiagnostic("Guardian prepare-owner-replacement requires a process key")).toBe(true)
891
911
  expect(isLegacyGuardianPrepareDiagnostic("Unknown guardian command: prepare-owner-replacement")).toBe(true)