Skip to content

feat(update): allow disabling the update check (LAN-235)#137

Merged
lance0 merged 3 commits into
masterfrom
lancey3/lan-235-feature-allow-disabling-update-check
Jul 7, 2026
Merged

feat(update): allow disabling the update check (LAN-235)#137
lance0 merged 3 commits into
masterfrom
lancey3/lan-235-feature-allow-disabling-update-check

Conversation

@lance0

@lance0 lance0 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Adds a full opt-out for the background "newer release available" check (update-informer → GitHub API, TUI mode only). Requested by a ttl user (lance0/ttl#110) as a standard package-manager/CI courtesy. Closes LAN-235.

How to turn it off

Precedence (first that applies wins): compiled-out → env → CLI → config.toml → saved pref.

Surface How
env DO_NOT_TRACK=1 (cross-tool standard) or XFR_NO_UPDATE_CHECK=1
config.toml no_update_check = true under [client]
TUI toggle Settings → Display → Update check: on/off; persisted to prefs.toml (disable_update_check), sticks across runs
CLI --no-update-check
compile-out update-check cargo feature (default-on); --no-default-features drops update-informer from the tree entirely — no phone-home code shipped

Notes for review

  • The check only ever ran in TUI mode (single spawn in run_tui_loop); the gate sits there.
  • The TUI toggle only persists on an explicit user change (update_check_touched), so untouched users don't get a spurious prefs.toml write.
  • env_opt_out treats an env var as "on" unless empty/0/false.
  • Not handled: toggling off mid-run doesn't hide an already-displayed banner (it applies to the next run). Easy to add if wanted.

Validation

  • Builds with and without default features; cargo tree --no-default-features -i update-informer → absent.
  • clippy -D warnings clean on --all-features and --no-default-features; fmt clean.
  • 270 lib tests pass (added env_flag_truthiness + update_check_toggle_flips_and_marks_touched).
  • --no-update-check appears in --help.

Files: update.rs, config.rs, prefs.rs, tui/settings.rs, tui/ui.rs, main.rs, Cargo.toml, CHANGELOG.md, examples/config.toml.

lance0 added 2 commits July 7, 2026 09:33
The background "newer release available" check (update-informer against the
GitHub API, run in TUI mode) had no opt-out, which is unwanted when xfr is
installed from a package repository or run in locked-down environments.

Add opt-outs at every layer:
- --no-update-check CLI flag
- DO_NOT_TRACK (cross-tool standard) / XFR_NO_UPDATE_CHECK env vars
- [client] no_update_check in config.toml
- an "Update check" toggle in the TUI Settings (Display tab), persisted to
  prefs.toml (disable_update_check) so it sticks across runs
- an update-check cargo feature (default-on): --no-default-features drops the
  update-informer dependency entirely, so package builds ship no phone-home code

Resolution precedence: compiled-out > env > CLI > config > saved pref.
The resolution OR-chain flattened the config/pref tristate with
unwrap_or(false), so Some(false) ("explicitly enabled") and None ("unset")
were indistinguishable: an explicit no_update_check = false in config.toml
could not re-enable the check over a stale disable_update_check = true in
prefs.toml.

Extract the resolution into update::check_disabled, where an explicit config
value wins over the saved pref (matching the existing theme CLI>config>saved
precedence). Add a unit test covering the precedence, including the
compiled-out path.
- examples/config.toml shipped an active `no_update_check = false`. Because an
  explicit config value wins over the saved pref (by design), that would defeat
  a user's persisted TUI "Update check: off" toggle for anyone who copied the
  example. Comment it out so an unset config lets the TUI toggle govern.
- Document the control everywhere it's user-visible: --no-update-check in the
  README CLI table and man page CLIENT OPTIONS; DO_NOT_TRACK /
  XFR_NO_UPDATE_CHECK in the man page ENVIRONMENT section; and a "Disabling the
  update check" section in docs/FEATURES.md with the full precedence.
@lance0
lance0 merged commit 6350eb5 into master Jul 7, 2026
17 checks passed
@lance0
lance0 deleted the lancey3/lan-235-feature-allow-disabling-update-check branch July 7, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant