Repository navigation
fix(updates): run the installed release under a launcher from before the rename - #1723
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merge-pass review (head 492f1da), by a gate reviewer running a different model than the author's. This changes the update path that every installed user goes through. I'm not merging it until rollback is safe. What the review found fine:
Please fix before merge:
Also: the PR description's validation names two test files that don't exist ( Once the fix is in and the checks are green, this goes back in the merge queue. It's a |
…e old names under an old launcher
|
Thanks. Both points are addressed in 0131fbb. 1. Rollback after the second update can leave the app down: fixed.
2. PR description: the body named only This commit changes behaviour in |
|
Merge pass: reviewed in place of a CodeRabbit review, which was rate-limited. This is the update path every installed user goes through.
|
Problem
Updating in the app from 0.4.13 to the next release breaks the handover to the new release's
supervisor. An update never replaces
the running launcher (
server/managed.ts), so after the install the 0.4.13 launcher starts the newrelease's supervisor. That launcher names the checkout
HERDR_WEB_SOURCE_ROOTand looks for theactive release only under
~/.config/herdr-web-ui/updates/<hash>/.The new supervisor first moves
~/.config/herdr-web-uito~/.config/ovis(#1648), then accepts asaved release only under the new path. The
current.jsonthe 0.4.13 supervisor wrote names~/.config/herdr-web-ui/.../release-*, so the new supervisor ignores it and starts the bridge fromthe source checkout, which is still 0.4.13. That bridge reads
HERDR_WEB_BOOT_ID, notOVIS_BOOT_ID, so it fails the supervisor's startup health check. The new supervisor exits beforeit is ready, and the launcher falls back to the 0.4.13 supervisor, which shows "The updated
supervisor failed to start". By then the state dir has already moved out from under the launcher.
The same failure repeats on every later update. A new supervisor that did get to install would not
help either: the new supervisor
records the release under
~/.config/ovis/..., the 0.4.13 launcher rejects that path and startsits own supervisor, and that one rejects it too.
Change
server/legacy-env.ts:legacyLauncherStateDir(env)tells whether a launcher from before therename started this supervisor (
HERDR_WEB_SOURCE_ROOTset,OVIS_LAUNCHERunset). If one did,it returns that launcher's state dir (
HERDR_WEB_STATE_DIR, else$XDG_CONFIG_HOME/herdr-web-ui). The helper sits in this file because it is already inCARRY_OVER, the conventions test's list of files allowed to use the old names.server/supervisor.ts: under such a launcher, the supervisor does not move the state dir. Ituses the old dir for app state and update state, and hands that dir to its bridge as
OVIS_STATE_DIR, so the bridge does not move it either. The move waits for a launcher of thisversion, which runs once the app starts from an updated source checkout or plugin.
server/supervisor.ts,server/legacy-env.ts(withLegacyNames): under such a launcher, thesupervisor also hands its bridge the old names of what it sets (
HERDR_WEB_MANAGED,HERDR_WEB_BOOT_ID,HERDR_WEB_STATE_DIR,HERDR_WEB_REVISION). When a saved release fails tostart, the supervisor falls back to the source checkout, and under an old launcher that checkout
is 0.4.13, whose bridge reads only the old names. Without them it could not answer the health
check. After a second update, the old launcher's own fallback is the previous release's
supervisor, which does the same thing, so the app stayed down. Even a bridge that did come up
would not be managed, so it could not update again.
server/managed.ts: the launcher setsOVIS_LAUNCHER=1, so the supervisors it starts keep movingthe state dir as before.
The candidate fix put the same logic in
supervisor.ts, but that file is not inCARRY_OVER, sothe "names from before Ovis" conventions test fails on it. Moving the logic into
legacy-env.tskeeps the conventions test passing without editing it.
Test
server/legacy-env.test.tsgets three supervisor tests and a mapping test. Each supervisor test runs the realrunSupervisorand the realUpdateragainst a git fixture shaped like a 0.4.13 install that has just installed a release. Thebridge's start is recorded and its health check is answered.
state stays in
herdr-web-ui. Before this fix, the bridge started from the source checkout:Expected: …/config/herdr-web-ui/updates/<hash>/release-next,Received: …/checkout.source checkout and hands that bridge
HERDR_WEB_BOOT_ID,HERDR_WEB_MANAGED,HERDR_WEB_STATE_DIRandHERDR_WEB_REVISION. In the stand-in, the source checkout's bridgereads only the old names, as 0.4.13's does. On 492f1da this test fails: the bridge in
…/checkoutcannot answer the boot id it was given.ovisandleaves a link at the old path.
bun run check fastpasses.Manual check with the real 0.4.13 launcher: a clone checked out at tag
v0.4.13ranbun server/managed.tsagainst an installed release under a tempXDG_CONFIG_HOMEand theisolated
ovis-testherdr session.startup health check." The launcher then falls back to the 0.4.13 supervisor, and the state dir
has already been moved and replaced by a link.
/tmp/ovis-qa-two-updates.ts). The real0.4.13 launcher installs two releases through
/api/updates. The second release's bridgepasses its install check but exits at its next start, under its own supervisor.
health check. The launcher then falls back to release 1's supervisor, which fails the same way,
and the launcher exits 1. The app is down.
/api/updatesreportsit as managed with no error, so the user can update again, and the launcher stays up.
/api/healthserved the release's revision fromthe release's own supervisor, with no fallback.
~/.config/herdr-web-uistayed a real directory,and
current.jsonwas kept.