Skip to content

Commit 7947573

Browse files
ashraffoudaclaude
andcommitted
fix(upgrade): keep dev on its original upgrade behaviour
The canary rollout change (#121) also affected dev nodes: with the network `latest` symlink no longer assumed to equal the chain version, a dev node outside test_farms during a canary would update to the symlink instead of waiting, unlike before. Restore dev's original behaviour: dev always follows the network `latest` symlink (the update worker doesn't gate dev networks) and skips the version-match check, while still honoring the safe_to_upgrade / test_farms gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0516cc1 commit 7947573

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

pkg/upgrade/upgrade.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,28 @@ func (u *Upgrader) update(ctx context.Context) error {
294294
targetVer = chainVer.VersionLight
295295
}
296296

297+
isDev := env.RunningMode == environment.RunningDev
298+
297299
// During a canary rollout (safe_to_upgrade == false) the update worker holds the
298300
// network `latest` taglink back at the last GA version, so a freshly bootstrapped
299301
// node comes up on GA and non-canary nodes stay put. Only nodes whose farm is in
300-
// test_farms take part, and they must target the chain (canary) version directly
302+
// test_farms take part, and they must target the chain (canary) version tag directly
301303
// because `latest` no longer points at it.
302-
if !chainVer.SafeToUpgrade && slices.Contains(testFarms, uint32(env.FarmID)) {
304+
//
305+
// dev keeps the original behaviour: it always follows the network `latest` symlink
306+
// (the worker doesn't gate dev) and skips the version-match check below, while still
307+
// honoring the safe_to_upgrade / test_farms gate.
308+
if !isDev && !chainVer.SafeToUpgrade && slices.Contains(testFarms, uint32(env.FarmID)) {
303309
// retarget the taglink at the chain version, keeping the repo/tags prefix
304310
prefix := remote.Target[:strings.LastIndex(remote.Target, "/")+1]
305311
remote.Target = prefix + targetVer
306312
}
307313

314+
if isDev && !chainVer.SafeToUpgrade && !slices.Contains(testFarms, uint32(env.FarmID)) {
315+
// dev node that is not part of the canary; wait for safe_to_upgrade (original behaviour)
316+
return nil
317+
}
318+
308319
// obviously a remote tag needs to differ from the current tag.
309320
// if the remote is different, we actually run the update and exit.
310321
if remote.Target == current.Target {
@@ -314,8 +325,9 @@ func (u *Upgrader) update(ctx context.Context) error {
314325

315326
// the resolved hub version must match the version the chain wants us to run; for a
316327
// non-canary node during a canary this keeps it from moving ahead of the GA `latest`.
328+
// dev skips this check to preserve its original always-follow-`latest` behaviour.
317329
remoteVer := remote.Target[strings.LastIndex(remote.Target, "/")+1:]
318-
if env.RunningMode != environment.RunningDev && remoteVer != targetVer {
330+
if !isDev && remoteVer != targetVer {
319331
// nothing to do! `latest` hasn't caught up to the chain version yet
320332
return nil
321333
}

0 commit comments

Comments
 (0)