Repository navigation
fix(daemon): skip a scheduled update run when every source is unreachable - #472
Merged
Merged
Conversation
…able UpdateFeatures wraps the new updex.ErrSourcesUnreachable when at least one transfer failed, every own transfer error is a DNS, dial or pre-response timeout failure, no HTTP request of the run got a response, the run context is live and no refresh failed. A per-run tracker in the context, read by a transport wrapper NewClient installs on a copy of its HTTP client, records whether a source answered. Under systemd, features update prints its normal output, logs one line and exits 0, so updex-update.service does not stay failed while a host is offline. Partial failures, error statuses, verification failures and an interactive run still fail. ADR-0018 amends the exit rule of ADR-0016. Fixes #471
…d CancelRequest Cross-review findings on #472: - a dial that fails for a local reason (EMFILE, EACCES, ENOBUFS) no longer counts as unreachable; ETIMEDOUT does - the transport wrapper forwards CancelRequest to a base that is not an *http.Transport, so a client timeout still cancels a legacy transport - ADR-0018 and the docs say the skip adds one line after the run's usual warnings, which stay live in the journal; the CLI test reads both stderr routes with the reporter on Coverage rose to 90.1%: bump the baseline.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
bketelsen
approved these changes
Oct 26, 2026
This was referenced Oct 26, 2026
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.
Summary
Fixes #471 (Brian's decision T256b, 2026-10-26: option 2).
A scheduled
updex features updaterun whose sources are all unreachable is now a skip: it logs one line and exits 0, soupdex-update.servicedoes not stayfailed(and the systemdegraded) for up to 6 h on an offline laptop. Any other failure still fails the unit.Definition (
updex/unreachable.go,UpdateFeatures): the error wraps the newupdex.ErrSourcesUnreachableonly whensourceTrackerin the context;NewClientinstallssourceTrackerTransporton a shallow copy of its HTTP client —Timeout,CheckRedirect,Jarkept, caller's client untouched,CloseIdleConnectionsforwarded);not linked: another transfer … failedis unreachable:*net.DNSError, a*net.OpErrorwithOp == "dial",ECONNREFUSED/EHOSTUNREACH/ENETUNREACH/ENETDOWN, or anet.Errortimeout (no response, per rule 2);CLI: only under systemd (
INVOCATION_ID, as the existingErrBusyskip): the normal output (table or--jsonarray) is printed, thenupdex: no update source is reachable; skipping this runon stderr, exit 0. An interactive run still exits non-zero. The units do not change (DaemonUnits(),units_hook_contract_test.gountouched).ADR: new ADR-0018 amends ADR-0016's exit rule ("exits non-zero when any enabled feature failed"); ADR-0016 is Accepted and immutable, so its text is not edited.
Checks
make fmtmake ci— tidy, vet, gofmt, golangci-lint 0 issues, unit/E2E/race tests, coverage 90.0% (baseline 90.0, floor 89.5), linux amd64/arm64 buildsgo test ./cmd/updex ./tests/e2e/...isUnreachabletable; SDK: all unreachable (DNS fake transport, refused loopback port) → wrapped; 1 reachable + 1 unreachable, a 404/500 source, a hash/signature failure, a cancelled run, a refresh failure, a replaced transport → not wrapped; no errors → nil. CLI: all unreachable under systemd → exit 0 + 1 line; partial → error; verification failure → error; interactive → error;--jsonunder systemd → 1 array, exit 0.Risk classification
Rationale:
features updatein a shell andfeatures checkstill fail.Docs housekeeping
README.md,docs/design/overview.md,docs/specs/sdk-api.md,AGENTS.mdTEMPLATE.md, indexed indocs/README.mdVerification
node scripts/check-docs.mjsgreen