fix(update): report failure when systemctl will not start the update timer - #282
Merged
ralyodio merged 1 commit intoAug 4, 2026
Conversation
…timer
`moshcode update --timer --install` writes the systemd units, runs
`systemctl daemon-reload` and `systemctl enable --now`, then always
prints "checking on a schedule now" and exits 0 — even when the enable
fails. On a host without systemd (a container, WSL, macOS) or without
root, the timer never starts, so the tool promises an auto-update that
will never fire.
Two layers were dropping the failure:
- bin/moshcode.mjs wired `runner` to swallow execFile's error and always
resolve { ok: true }, so selfUpdateCommand could never see a failure.
- selfUpdateCommand ignored the runner results entirely.
Surface execFile's error as { ok: !err }, and when daemon-reload or
enable reports ok:false, tell the user the timer is not scheduled yet
and exit 1 instead of claiming success. The existing tests already
inject runner: () => ({ ok: true }), so the { ok } contract is honored.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merged
ralyodio
added a commit
that referenced
this pull request
Aug 4, 2026
A Moshpit name now survives the TLS handshake without a per-name detour. `dns trust <name>` installs the leaf a name serves, but only when its key matches a pin the registry already published, and `dns start --trust-all` does that as names resolve (#279, #281). Minor, not patch: two new ways to invoke the tool. Also carries two commands that used to report success they had not earned -- `update --timer --install` when systemctl refused (#282), and `site --proxy` with a port outside 1-65535 (#280). Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
moshcode update --timer --installwrites the systemd units, runssystemctl daemon-reloadandsystemctl enable --now moshcode-update.timer, then always printschecking on a schedule nowand exits0— even when the enable fails.On a host without systemd (a container, WSL, macOS) or without root, the timer never starts. The user is told their machine is auto-updating on a schedule when it is not. Silent, and exactly the kind of promise you only discover was empty when the update you were counting on never happened.
Two layers were dropping the failure:
bin/moshcode.mjswiredrunnerasexecFile(cmd, args, () => res({ ok: true }))— the callback ignores execFile's error and always resolves{ ok: true }, soselfUpdateCommandcould never see a failure.src/selfupdate.mjsignored the runner results entirely and printed success unconditionally.Fix
(err) => res({ ok: !err }).selfUpdateCommand, whendaemon-reloadorenablereportsok:false, tell the user the timer is not scheduled yet and return1instead of claiming success.The existing tests already inject
runner: () => ({ ok: true }), so the{ ok }contract is the intended one — this change just honors the failing side of it.Evidence (real
selfUpdateCommand, systemctl enable failing)Before:
After:
Tests
New regression test in
test/selfupdate.test.mjs: withsystemctl enablereturningok:false, asserts exit1, units still written, no "checking on a schedule now", and the failure message. Fails before this change, passes after.Controls unchanged: the
ok:trueinstall path still printschecking on a scheduleand returns0.Full suite green: 1215 tests, 1002 pass, 0 fail, 213 skipped. Two source files + one test file; generated package-lock.json removed before commit.