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 +1 -1
- package/src/cli.js +12 -2
- package/test/owner-replacement.test.js +20 -0
package/package.json
CHANGED
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
|
-
|
|
103
|
-
|
|
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)
|