rollbridge 0.1.67 → 0.1.69
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/README.md +8 -0
- package/changelog.d/20261116-config-json-canonical-shape.md +11 -0
- package/changelog.d/20261116-drain-specs-gate-the-retirement-record.md +29 -0
- package/changelog.d/20261116-guardian-version-handoff.md +37 -0
- package/changelog.d/20261116-reclaim-dead-owner-mutation.md +7 -0
- package/changelog.d/20261117-activation-path-drain-deadline.md +35 -0
- package/changelog.d/20261117-stop-companion-after-retired-dependency.md +7 -0
- package/docs/cli.md +14 -7
- package/docs/config.md +8 -4
- package/docs/troubleshooting.md +27 -0
- package/docs/workers.md +1 -0
- package/examples/tensorbuzz.com.js +2 -1
- package/package.json +1 -1
- package/src/config.js +28 -2
- package/src/daemon.js +144 -35
- package/src/doctor.js +7 -0
- package/src/drain-policy.js +18 -4
- package/src/guardian-client.js +54 -6
- package/src/managed-process.js +14 -5
- package/src/process-guardian.js +75 -4
- package/src/release-group.js +30 -2
- package/tensorbuzz.yml +3 -1
- package/test/compose-config.test.js +4 -2
- package/test/config-validation.test.js +21 -1
- package/test/drain-policy.test.js +28 -0
- package/test/guardian-client.test.js +48 -4
- package/test/managed-process.test.js +11 -2
- package/test/owner-recovery.test.js +43 -4
- package/test/owner-replacement.test.js +150 -9
- package/test/release-group.test.js +57 -0
- package/test/rollbridge.test.js +109 -9
- package/test/shutdown-completion.test.js +52 -0
- package/test/support/process.js +3 -1
package/README.md
CHANGED
|
@@ -255,6 +255,14 @@ supervisor. The upgrade fails before handoff and requires one explicit clean
|
|
|
255
255
|
remain atomic. A genuinely pre-replacement guardian still uses the separately
|
|
256
256
|
documented one-time disruptive compatibility bridge below.
|
|
257
257
|
|
|
258
|
+
A retained guardian that reports a different rollbridge version from the daemon
|
|
259
|
+
runtime is handed to a current-version coordinator through that same bridge, so
|
|
260
|
+
a package upgrade does not need a supervisor restart: the coordinator owns the
|
|
261
|
+
daemon and every process it starts, the retained guardian keeps the processes it
|
|
262
|
+
already owns, and nothing waits for those to drain. `status.ownerTransition`
|
|
263
|
+
reports `mode: "guardian-version-handoff"`. The refusal is the last resort and
|
|
264
|
+
names both versions plus the exact `shutdown`/`ensure-daemon` commands.
|
|
265
|
+
|
|
258
266
|
There is one explicit compatibility boundary: the first upgrade from a genuine
|
|
259
267
|
pre-owner-replacement Rollbridge guardian and daemon cannot share its listeners
|
|
260
268
|
on supported Node 20. The same boundary applies to a retained transition guardian
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Fixed
|
|
2
|
+
|
|
3
|
+
- Make a normalized config identical to its own JSON form, so a release config
|
|
4
|
+
that crossed the guardian's owner-replacement transfer is still equal to the
|
|
5
|
+
config file it came from. Owner replacement publishes release configs over the
|
|
6
|
+
guardian's JSON socket, which drops undefined-valued properties; the candidate
|
|
7
|
+
daemon then held a config that no longer matched its own file, and the next
|
|
8
|
+
deploy aborted with "Config changes to control cannot be applied live" even
|
|
9
|
+
though the file was byte-identical and hashed to the same owner-config digest
|
|
10
|
+
(measured on tensorbuzz/production, 2026-11-16). The only remedy the tool
|
|
11
|
+
offered was a manual daemon restart.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
### Fixed
|
|
2
|
+
|
|
3
|
+
- Four drain/retirement specs read the daemon's process record before the daemon had observed the
|
|
4
|
+
event they describe, and failed intermittently on a busy runner while passing locally. Measured
|
|
5
|
+
here in a `node:26` container against `origin/master` `c390da9` (2026-11-16): running the three
|
|
6
|
+
`test/rollbridge.test.js` specs on their own gave `an explicit stop returns within its retirement
|
|
7
|
+
budget…` 0/6 passing, `rollback refuses to restore a drained generation…` 2/6 and `a restore
|
|
8
|
+
deploy naming a drained generation…` 2/6, and `test/managed-process.test.js` "a retirement budget
|
|
9
|
+
caps a finite graceful window…" 0/4. The same invocations inside the whole file passed, which is
|
|
10
|
+
what made them look green locally and red in CI: every recent `rollbridge` master commit carries
|
|
11
|
+
a failed `TensorBuzz: build_1` naming one of these specs.
|
|
12
|
+
- `test/rollbridge.test.js` now gates on the settled record. A bounded retirement stop returns the
|
|
13
|
+
moment its budget expires — that is the point of the bound — while the shell wrapper it signalled
|
|
14
|
+
is still on its way out, so the record briefly reports the wrapper pid and `state: "quiesced"`,
|
|
15
|
+
and `ManagedProcess.currentHeldProcessGroup()` deliberately reports nothing until the tracked
|
|
16
|
+
process is `stopped`. Measured: `stopRelease` returned after 106 ms with
|
|
17
|
+
`{pid: 13640, retirementTimedOut: true, state: "quiesced"}` and the record settled to
|
|
18
|
+
`{heldProcessGroup: {liveMemberCount: 1, pgid: 13640}, state: "stopped"}` within the next 50 ms.
|
|
19
|
+
The new `retirementRecordSettled` helper waits for that observation before the assertions, so the
|
|
20
|
+
specs still prove the group outlived its tracked process instead of assuming it.
|
|
21
|
+
- `test/managed-process.test.js` "a retirement budget caps a finite graceful window instead of being
|
|
22
|
+
outvoted by it" signalled its fixture before the fixture had installed its `SIGTERM` disposition,
|
|
23
|
+
so the default disposition applied, the group exited, `waitForProcessGroupExit` returned true, and
|
|
24
|
+
`retirementTimedOut` stayed false — the same boot race the neighbouring specs already gate on. It
|
|
25
|
+
now announces readiness the same way (`require("node:fs").writeFileSync(readyPath, "ready")` after
|
|
26
|
+
the handler is installed) and waits for that marker before the stop.
|
|
27
|
+
- No product behaviour changed and no wait was lengthened: the gates are on durable observations
|
|
28
|
+
(a process record reaching `stopped`, a marker file the fixture writes), so a daemon that never
|
|
29
|
+
records the residue still fails.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
### Fixed
|
|
2
|
+
|
|
3
|
+
- A rollbridge version bump now hands the retained guardian to a current-version coordinator
|
|
4
|
+
automatically instead of refusing until a human restarts a daemon or a supervisor. Measured on
|
|
5
|
+
TensorBuzz production (STOE-2040): the live guardian was pid 2423469, 19 days up, running
|
|
6
|
+
`…/releases/20261028121152/backend/node_modules/rollbridge/src/process-guardian.js` (rollbridge
|
|
7
|
+
0.1.55) while the daemon runtime was 0.1.61, and 45 deploys were refused with
|
|
8
|
+
`Another owner mutation is already in progress`. Nothing replaced the guardian: every daemon
|
|
9
|
+
start reuses `recovery.guardian` from the state file, so the version mismatch had no path out
|
|
10
|
+
at all.
|
|
11
|
+
- The retained guardian's version is read from its own executable (`guardianVersionFromProcess`)
|
|
12
|
+
before any replacement transaction is prepared, so the version probe does not move the
|
|
13
|
+
`capabilities` command ahead of `prepare-owner-replacement` where a capability-gated guardian
|
|
14
|
+
expects it. `test/owner-replacement.test.js` "replacement-capable guardian without daemon
|
|
15
|
+
recovery aborts before handoff and resumes incumbent drains" is the control for that ordering.
|
|
16
|
+
- A drifted guardian takes the authenticated upgrade bridge that already reconciles the one-time
|
|
17
|
+
legacy owner: the candidate starts a coordinator of its own version
|
|
18
|
+
(`<statePath>.guardian-<version>.sock`), the retained guardian keeps supervising every process
|
|
19
|
+
it already owns, and `status.ownerTransition` reports `mode: "guardian-version-handoff"` with
|
|
20
|
+
`disruptive: true`. Nothing waits for the retained generation to drain — the retained guardian
|
|
21
|
+
retires when its own processes exit. `test/owner-replacement.test.js`
|
|
22
|
+
"version-drifted retained guardian is handed to a current-version coordinator automatically"
|
|
23
|
+
asserts the retained worker pids stay live and reported by the retained guardian afterwards.
|
|
24
|
+
- Consequence of that design: every rollbridge version bump crosses the disruptive boundary once.
|
|
25
|
+
The incumbent daemon is `SIGKILL`ed, the supervised application processes keep their exact PIDs
|
|
26
|
+
under guardian supervision, and existing proxy/control connections may close. Replacements at
|
|
27
|
+
matching versions remain candidate-first and atomic.
|
|
28
|
+
- The refusal is now the last resort and names both versions plus the exact commands:
|
|
29
|
+
`The persistent Rollbridge guardian is version <guardian> while this daemon runs rollbridge
|
|
30
|
+
<daemon>; … Run "rollbridge shutdown --config <path>" and then "rollbridge ensure-daemon
|
|
31
|
+
--config <path>" to replace the supervisor with this Rollbridge installation.` It fires only
|
|
32
|
+
when no handoff can be authorised: no incumbent daemon to hand guardian ownership from, no
|
|
33
|
+
incumbent PID reported by `ensure-daemon`, an unattestable guardian version, an incumbent PID
|
|
34
|
+
that is not the attested owner, or a config change in the same invocation (the bridge keeps the
|
|
35
|
+
incumbent config identity unchanged). `test/owner-recovery.test.js`
|
|
36
|
+
"startup against a version-drifted guardian without an incumbent refuses and names both versions
|
|
37
|
+
and the repair command" asserts the refusal text and that the live generation is untouched.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## Reclaim owner-mutation leases held by dead daemons
|
|
2
|
+
|
|
3
|
+
The guardian now verifies the recorded mutation holder PID before refusing a new
|
|
4
|
+
owner mutation. Dead holders are reclaimed and reported as an
|
|
5
|
+
`owner-mutation-reclaimed` event, so a daemon death cannot leave the deploy fence
|
|
6
|
+
wedged until an operator kills the guardian. `rollbridge status` and `doctor` now
|
|
7
|
+
show the guardian version and active mutation lease diagnostics.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
### Fixed
|
|
2
|
+
|
|
3
|
+
- A draining generation that still owns live connections is no longer reported `progressing`
|
|
4
|
+
without bound. The connection branch of `classifyDrainProgress` had no deadline, so a release
|
|
5
|
+
whose `proxy.drainTimeoutMs` wait had already expired kept claiming progress for as long as one
|
|
6
|
+
websocket stayed open. It now reports the new `timedOut` status, naming the budget and how far
|
|
7
|
+
past it the drain is: `drain budget 60000ms exceeded by 1000ms with 1 live connection still
|
|
8
|
+
owned by the generation`. Measured on TensorBuzz production 2026-11-17 (`shared/log/rollbridge.log`,
|
|
9
|
+
`tensorbuzz-production-web-1`): the incumbent retired by the failed deploy of `20261117063703`
|
|
10
|
+
began draining at `drainStartedAt 06:40:21.244Z` and was still read `draining` with
|
|
11
|
+
`drain.status: progressing`, `sampleWindowMs: 0` and one held websocket at 07:00Z and again at
|
|
12
|
+
07:30Z, 25+ min past `proxy.drainTimeoutMs: 60000`. `timedOut` is a report, never an escalation:
|
|
13
|
+
`decideWedgedEscalation` still acts only on a `wedged` classification, and
|
|
14
|
+
`test/drain-policy.test.js` "the drain deadline names the deadline and never escalates" holds
|
|
15
|
+
that boundary. No signal path and no scheduled sampler is added.
|
|
16
|
+
- A candidate retired by a failed pre-commit activation is now drained by the compensation that
|
|
17
|
+
retired it. `compensatePreCommitActivationFailure` started the candidate's `drainAndPrune` only
|
|
18
|
+
on its success path, after the checkpoint clear, so when incumbent restoration threw the retired
|
|
19
|
+
candidate was left `draining` with its processes alive: candidate `20261117063703` still held
|
|
20
|
+
`web` pid 3201928 when read at 07:30Z, 47 min after its compensation threw at 06:42:31.115Z, and
|
|
21
|
+
reached `release drained` only when a later compensation reached its success path at
|
|
22
|
+
08:47:00.159Z. A retained generation that still holds live processes is the state that refuses
|
|
23
|
+
every later deploy, and a failed candidate is never a restoration target. The drain now starts
|
|
24
|
+
where the candidate is recorded retired and stays in the background — the compensation does not
|
|
25
|
+
wait for it, so this cannot turn a failed activation into a blocking stop.
|
|
26
|
+
- New coverage for both halves: `test/release-group.test.js` "a draining generation that still owns
|
|
27
|
+
a connection past its drain budget is named timedOut, not left claiming progress" reads the
|
|
28
|
+
classification out of `status()` for a release whose `drainStartedAt` is 90 s old with one
|
|
29
|
+
connection still owned, and back to `progressing` for the same release inside budget.
|
|
30
|
+
`test/rollbridge.test.js` "a candidate retired by a failed activation is drained to stopped
|
|
31
|
+
instead of left holding live processes" fails activation, rejects the incumbent restoration, and
|
|
32
|
+
asserts the retired candidate reaches `stopped` with a `release drained` event — on the base tree
|
|
33
|
+
that wait times out because the drain was unreachable. "unresolved generation transition fences
|
|
34
|
+
stop, restart, and rollback mutations" additionally checks that the candidate its deploy retired
|
|
35
|
+
is stopped by its own compensation drain while the fence refuses every mutation.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Stop companions after a retired dependency
|
|
2
|
+
|
|
3
|
+
Release companions that declare a same-generation service dependency now stop
|
|
4
|
+
after an unexpected exit when that dependency has been retired. They no longer
|
|
5
|
+
restart forever against the retired service's port. The TensorBuzz worker
|
|
6
|
+
example declares its jobs-main dependency and relies on the worker's lifecycle
|
|
7
|
+
handshake instead of a permanent port wait.
|
package/docs/cli.md
CHANGED
|
@@ -116,12 +116,14 @@ the candidate binds and validates its listeners, and an authenticated fenced
|
|
|
116
116
|
transaction commits guardian authority and the final control socket. A lost
|
|
117
117
|
control response is accepted only when the guardian confirms the exact committed
|
|
118
118
|
transaction id. The first authenticated upgrade from a genuine pre-replacement
|
|
119
|
-
guardian/daemon,
|
|
120
|
-
the retired-owner commit capability,
|
|
119
|
+
guardian/daemon, from a retained prepare/stage guardian that explicitly lacks
|
|
120
|
+
the retired-owner commit capability, or from a retained guardian whose rollbridge
|
|
121
|
+
version differs from the candidate runtime, is the exception: `ensure-daemon` preserves its exact
|
|
121
122
|
guardian-owned processes but deliberately retires the old listeners before the
|
|
122
123
|
Node 20 candidate binds, so existing proxy/control connections may close.
|
|
123
124
|
Successful status JSON records this as `ownerTransition.disruptive: true` and
|
|
124
|
-
`ownerTransition.mode: "legacy-first-upgrade"
|
|
125
|
+
`ownerTransition.mode: "legacy-first-upgrade"` for a protocol gap or
|
|
126
|
+
`"guardian-version-handoff"` for a version drift. This bridge requires
|
|
125
127
|
the incumbent config identity unchanged; make config/socket changes in a second,
|
|
126
128
|
atomic invocation. Auth, transport, malformed-response, arbitrary unknown-command,
|
|
127
129
|
and authority failures do not qualify and fail before any deploy is sent.
|
|
@@ -168,7 +170,7 @@ handoff would push the number of concurrently draining release groups past
|
|
|
168
170
|
[`releaseRetention.maxConcurrentDrainingReleaseGroups`](config.md#releaseretention) —
|
|
169
171
|
the incumbent the handoff is about to retire counts too. The incumbent keeps serving,
|
|
170
172
|
nothing of the candidate is started, and the error names every draining group with its
|
|
171
|
-
`progressing`/`wedged` classification and the bound it exceeded.
|
|
173
|
+
`progressing`/`timedOut`/`wedged` classification and the bound it exceeded.
|
|
172
174
|
|
|
173
175
|
The same pre-activation refusal applies when `--release-id` names a release Rollbridge
|
|
174
176
|
still **retains** while that generation holds live work: draining with processes alive, or
|
|
@@ -367,9 +369,14 @@ re-checked at most once every 5 seconds, and clears itself when its members leav
|
|
|
367
369
|
Each **draining** release reports a `drain` classification — `status`, the `reason`
|
|
368
370
|
behind it, the `sampleWindowMs` it rests on, and `cpuDeltaMs`:
|
|
369
371
|
|
|
370
|
-
- `progressing` — the generation still owns live connections
|
|
371
|
-
inside its retirement budget, or its
|
|
372
|
-
sample window. A legitimate multi-hour drain reports this.
|
|
372
|
+
- `progressing` — the generation still owns live connections inside
|
|
373
|
+
`proxy.drainTimeoutMs`, a process is still inside its retirement budget, or its
|
|
374
|
+
process-group CPU advanced across the sample window. A legitimate multi-hour drain reports this.
|
|
375
|
+
- `timedOut` — the generation still owns live connections, but the configured drain budget has
|
|
376
|
+
already expired: `drain budget 60000ms exceeded by 900000ms with 1 live connection still owned
|
|
377
|
+
by the generation`. The connection wait was given up at `proxy.drainTimeoutMs`; the record says
|
|
378
|
+
so instead of claiming progress for as long as one socket stays open. It is a report only —
|
|
379
|
+
`timedOut` never authorises a signal, and escalation still requires `wedged`.
|
|
373
380
|
- `wedged` — the drain can no longer progress: no live connection, every
|
|
374
381
|
retirement budget expired, and either no runner child remains or the group's CPU
|
|
375
382
|
is flat across a window of at least 20 seconds.
|
package/docs/config.md
CHANGED
|
@@ -78,7 +78,7 @@ to let a deploy group talk to the daemon.
|
|
|
78
78
|
| `proxy.upstreamHost` | string | `proxy.host`, or `"127.0.0.1"` when `proxy.host` is `0.0.0.0`/`::` | Host Rollbridge uses for release health checks and proxy targets. |
|
|
79
79
|
| `proxy.healthPath` | string | `"/ping"` | Default health-check path for proxied processes. |
|
|
80
80
|
| `proxy.healthTimeoutMs` | number | `120000` | Default boot budget for proxied processes: how long a release may take to answer its health path for the first time. Measured on TensorBuzz production (server3, 2026-11-06): the web app was still initialising when a `30000` deadline expired, so two deploys were killed mid-boot; `120000` is the budget the same release publishes on today. Waiting for a `dependsOn` service is not charged to it. |
|
|
81
|
-
| `proxy.drainTimeoutMs` | number | `60000` | How long to drain HTTP/WebSocket connections before stopping the retired proxied process. Expiry never stops an independently draining jobs generation. |
|
|
81
|
+
| `proxy.drainTimeoutMs` | number | `60000` | How long to drain HTTP/WebSocket connections before stopping the retired proxied process. Expiry never stops an independently draining jobs generation. It is also the budget a `drain` classification measures elapsed drain against: a generation that still owns connections past it reports `timedOut` rather than `progressing` (see [`status` in the CLI guide](cli.md#status)). |
|
|
82
82
|
| `proxy.nonBlockingDrainTimeoutMs` | number | `60000` | How long release retirement waits for an independently draining process before recording it as still draining and completing the release; `stop` and `rollback` hand the same bound to the processes they must not kill, so neither command can hold the owner-mutation fence for the whole drain. Expiry never sends `SIGKILL`; the process keeps its live work. |
|
|
83
83
|
| `proxy.forceStopTimeoutMs` | number | `10000` | Default per-process graceful-stop timeout (`SIGTERM`, then `SIGKILL`). |
|
|
84
84
|
|
|
@@ -114,7 +114,7 @@ bound of 12.
|
|
|
114
114
|
|
|
115
115
|
The refusal is a deploy failure like any other: the incumbent keeps serving, nothing of the
|
|
116
116
|
candidate is started, and the named reason says which groups are still holding the fleet and
|
|
117
|
-
whether each is `progressing` or `wedged` (see [`status` in the CLI
|
|
117
|
+
whether each is `progressing`, `timedOut`, or `wedged` (see [`status` in the CLI
|
|
118
118
|
guide](cli.md#status)). A refused deploy is retried once a drain finishes; the bound is a
|
|
119
119
|
policy, not a queue.
|
|
120
120
|
|
|
@@ -242,12 +242,16 @@ The first upgrade from an authenticated pre-replacement Rollbridge guardian and
|
|
|
242
242
|
daemon uses an explicitly disruptive compatibility bridge because that legacy
|
|
243
243
|
owner cannot transfer listeners on Node 20. A retained guardian that supports
|
|
244
244
|
replacement prepare/stage but lacks the retired-owner commit command is explicitly
|
|
245
|
-
classified and uses the same bridge
|
|
245
|
+
classified and uses the same bridge, and so is a retained guardian whose rollbridge
|
|
246
|
+
version differs from the daemon runtime: the candidate starts a coordinator of its
|
|
247
|
+
own version, the retained guardian keeps the processes it already owns, and nothing
|
|
248
|
+
waits for those to drain. Rollbridge attests the exact guardian and
|
|
246
249
|
daemon processes, sockets, runtime/config authority, and durable process
|
|
247
250
|
registrations before retiring the legacy listeners. Managed process PIDs and
|
|
248
251
|
release state remain supervised, but live proxy/control connections may close.
|
|
249
252
|
The resulting status includes `ownerTransition: {disruptive: true, mode:
|
|
250
|
-
"legacy-first-upgrade", ...}
|
|
253
|
+
"legacy-first-upgrade", ...}` for a protocol gap or `{disruptive: true, mode:
|
|
254
|
+
"guardian-version-handoff", ...}` for a version drift. The bridge only accepts the incumbent config
|
|
251
255
|
identity; retry config or socket changes after the protocol upgrade, when the
|
|
252
256
|
normal atomic handoff applies. Other guardian/auth/transport/identity failures
|
|
253
257
|
remain fail-closed.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -27,6 +27,33 @@ preparation itself fails, check permissions for
|
|
|
27
27
|
`/tmp/rollbridge-<user-id>-<application-hash>-runtime`) before retrying. The directory
|
|
28
28
|
must be private to the invoking user.
|
|
29
29
|
|
|
30
|
+
## Retained guardian on an older rollbridge version
|
|
31
|
+
|
|
32
|
+
**Symptom.** `ensure-daemon` reports `The persistent Rollbridge guardian is version <x> while
|
|
33
|
+
this daemon runs rollbridge <y>` and confirms that the deploy was not sent.
|
|
34
|
+
|
|
35
|
+
**Cause.** The daemon reuses `recovery.guardian` from the state file on every start, so a
|
|
36
|
+
supervisor left running from an earlier release outlives the package it came from. A version
|
|
37
|
+
mismatch is normally reconciled without an operator: `ensure-daemon` starts a coordinator of its
|
|
38
|
+
own version over the retained guardian, the retained guardian keeps supervising the processes it
|
|
39
|
+
already owns, and nothing waits for them to drain. `status.ownerTransition` then reports
|
|
40
|
+
`mode: "guardian-version-handoff"` with `disruptive: true`; the incumbent daemon is retired while
|
|
41
|
+
its supervised application processes keep their exact PIDs.
|
|
42
|
+
|
|
43
|
+
**Fix.** The refusal is the last resort and names both versions plus the exact commands. Run them
|
|
44
|
+
in that order:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
rollbridge shutdown --config /etc/rollbridge/app.cjs
|
|
48
|
+
rollbridge ensure-daemon --config /etc/rollbridge/app.cjs
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
It fires only when no handoff can be authorised: no incumbent daemon to hand guardian ownership
|
|
52
|
+
from, no incumbent PID reported by `ensure-daemon`, a guardian version that cannot be attested, an
|
|
53
|
+
incumbent PID that is not the attested owner, or a config change in the same invocation — the
|
|
54
|
+
bridge keeps the incumbent config identity unchanged, so apply a config or socket change in a
|
|
55
|
+
second invocation once the supervisor is current.
|
|
56
|
+
|
|
30
57
|
If startup instead reports `Rollbridge daemon candidate <pid> exited before
|
|
31
58
|
readiness`, the ensuring CLI observed that exact child exit before it could
|
|
32
59
|
attest status. The diagnostic includes the exit code or signal and spawned
|
package/docs/workers.md
CHANGED
|
@@ -26,6 +26,7 @@ fixed port such as `7330`.
|
|
|
26
26
|
{
|
|
27
27
|
id: "background-jobs-worker",
|
|
28
28
|
policy: "companion",
|
|
29
|
+
dependsOn: ["background-jobs-main"],
|
|
29
30
|
env: {VELOCIOUS_BACKGROUND_JOBS_PORT: "{{ports.background-jobs-main}}"},
|
|
30
31
|
command: "npx velocious background-jobs-worker",
|
|
31
32
|
replicas: 4,
|
|
@@ -60,6 +60,7 @@ export default {
|
|
|
60
60
|
{
|
|
61
61
|
id: "background-jobs-worker",
|
|
62
62
|
policy: "companion",
|
|
63
|
+
dependsOn: ["background-jobs-main"],
|
|
63
64
|
cwd: "{{releasePath}}/backend",
|
|
64
65
|
env: {
|
|
65
66
|
NODE_ENV: "production",
|
|
@@ -67,7 +68,7 @@ export default {
|
|
|
67
68
|
VELOCIOUS_BEACON_PORT: "{{ports.beacon}}",
|
|
68
69
|
VELOCIOUS_BACKGROUND_JOBS_PORT: "{{ports.background-jobs-main}}"
|
|
69
70
|
},
|
|
70
|
-
command: "wait-for-it 127.0.0.1:{{ports.beacon}} --strict --
|
|
71
|
+
command: "wait-for-it 127.0.0.1:{{ports.beacon}} --strict -- npx velocious background-jobs-worker",
|
|
71
72
|
lifecycle: {
|
|
72
73
|
quietCommand: "appctl jobs-worker-retire --pid $ROLLBRIDGE_PID",
|
|
73
74
|
reactivateCommand: "appctl jobs-worker-reactivate --pid $ROLLBRIDGE_PID"
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -160,6 +160,32 @@ export function normalizeConfig(rawConfig, configPath = process.cwd()) {
|
|
|
160
160
|
return config
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Drops every undefined-valued property so a normalized config is identical to its own JSON form.
|
|
165
|
+
*
|
|
166
|
+
* Owner replacement hands the candidate daemon its release configs through the guardian's JSON
|
|
167
|
+
* socket, and JSON serialization drops undefined-valued keys. The inherited config then compares
|
|
168
|
+
* unequal to a freshly loaded one under `isDeepStrictEqual` even when the config file never
|
|
169
|
+
* changed, and the live-reload fence aborts the next deploy. Measured in production on 2026-11-16
|
|
170
|
+
* (tensorbuzz/production): after a failed activation was compensated inside a replacement daemon,
|
|
171
|
+
* the following deploy failed with "Config changes to control cannot be applied live" while both
|
|
172
|
+
* config files were byte-identical and hashed to the same `ownerConfigDigest` — that digest is
|
|
173
|
+
* JSON-based, so the daemon held two contradictory notions of the same config and only the
|
|
174
|
+
* JSON-shaped one survived the handoff.
|
|
175
|
+
* @param {JsonValue} value - Normalized config value.
|
|
176
|
+
* @returns {JsonValue} The same value with every undefined-valued property removed.
|
|
177
|
+
*/
|
|
178
|
+
function withoutUndefinedProperties(value) {
|
|
179
|
+
if (Array.isArray(value)) return value.map(withoutUndefinedProperties)
|
|
180
|
+
if (isPlainObject(value)) {
|
|
181
|
+
return Object.fromEntries(Object.entries(value)
|
|
182
|
+
.filter(([, entryValue]) => entryValue !== undefined)
|
|
183
|
+
.map(([key, entryValue]) => [key, withoutUndefinedProperties(entryValue)]))
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return value
|
|
187
|
+
}
|
|
188
|
+
|
|
163
189
|
/**
|
|
164
190
|
* Validates a raw config object and collects every issue instead of throwing on the first one.
|
|
165
191
|
* @param {JsonValue} rawConfig - Parsed config.
|
|
@@ -205,7 +231,7 @@ export function validateConfig(rawConfig, configPath = process.cwd()) {
|
|
|
205
231
|
validateComposeUnits(compose, processes, issues)
|
|
206
232
|
|
|
207
233
|
return {
|
|
208
|
-
config: {
|
|
234
|
+
config: /** @type {RollbridgeConfig} */ (withoutUndefinedProperties(/** @type {JsonValue} */ ({
|
|
209
235
|
application,
|
|
210
236
|
...(compose.length > 0 ? {compose} : {}),
|
|
211
237
|
...(composeStatePath ? {composeStatePath} : {}),
|
|
@@ -216,7 +242,7 @@ export function validateConfig(rawConfig, configPath = process.cwd()) {
|
|
|
216
242
|
proxy,
|
|
217
243
|
releaseRetention,
|
|
218
244
|
statePath
|
|
219
|
-
},
|
|
245
|
+
}))),
|
|
220
246
|
issues
|
|
221
247
|
}
|
|
222
248
|
}
|