Skip to content

emrg: auto update-check prompt (rant 2026-08-10T07:12:12) - #602

Merged
argszero merged 1 commit into
masterfrom
feature/auto-update-check-prompt
Aug 9, 2026
Merged

emrg: auto update-check prompt (rant 2026-08-10T07:12:12)#602
argszero merged 1 commit into
masterfrom
feature/auto-update-check-prompt

Conversation

@argszero

@argszero argszero commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Host rant 2026-08-10T07:12:12: auto check for new versions + prompt — NO auto download/install (host-specified boundary). Packaged emrg update only prints a manual-download message and nothing ever checks GitHub automatically, so the host only learns about releases by word of mouth.

Changes

  • emrg/update_check.py (new): version compare (semver tuple, prerelease-safe — a prerelease tag can never compare newer), TTL gate (should_check), idempotent prompt state (~/.emrg/.last_update_check.json), silent github.com/ghapi check (never raises on network/HTTP failure — next TTL retries).
  • config: [update] check = true|false (default true) + ttl_hours = 24.
  • daemon: _update_check_loop background task (startup + every TTL; exits immediately when disabled); update_check command (cached latest + has_update + prompted_version + enabled); update_check_prompted command (idempotency — same version never re-prompted).
  • TUI: one-time non-blocking startup banner (New version vX available — https://github.com/argszero/emrg/releases), marks prompted.
  • GUI: settings about-area line with a Releases link (one-time, no modal).
  • Docs: test counts synced 652 → 670 (18 new tests: version comparison 0.2.17<0.2.18, TTL not-expired no-check, prompt idempotency, silent network failure, config disable).

Verification

  • uv run pytest tests/ -q: 670 passed
  • cd emrg/gui && npm test: 107 passed
  • node --check main/preload/dialogs/i18n: OK
  • import check + python -m emrg --help: OK
  • doc-count guard: OK

No auto download, no auto install, no installer flow — display-only per host instruction.

Display-only new-version check — never auto-downloads/installs.
- emrg/update_check.py: version compare (semver tuple, prerelease-safe),
  TTL gate, idempotent prompt state (~/.emrg/.last_update_check.json),
  silent github.com/ghapi check (no raise on failure)
- config: [update] check=true|false + ttl_hours=24 (default true)
- daemon: _update_check_loop at startup + TTL; update_check /
  update_check_prompted commands
- TUI: one-time non-blocking startup banner; marks prompted (idempotent)
- GUI: settings about-area line with Releases link (one-time)
- +18 tests (version/TTL/idempotency/silent-failure/disable), 652->670

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260810-072029. Reviewed the full diff: version compare is prerelease-safe (parse terminates at first non-digit piece — 'v0.2.18-beta1' can never beat 'v0.2.17', verified positive+negative locally); TTL gate handles missing/fresh/stale/custom states; silent network/HTTP failure returns None and retries next TTL (tested both error paths); prompt idempotency via state file; daemon loop exits cleanly when disabled and cancels on shutdown; config default check=true/ttl_hours=24; 18 new tests 652→670 with doc-count guard synced. CI test workflow green. Solid, matches the host-specified no-auto-download/no-auto-install boundary.

@pm25coder

pm25coder commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

I tested this PR locally and it verifies clean:

  • uv run pytest tests/ → 615 passed + 55 skipped (670 total) — matches the doc count updates in Agent.md/README.md/README.cn.md, and the doc-count guard (test_doc_counts) passes.
  • tests/test_update_check.py → 18/18 pass, covering the acceptance items: version comparison, TTL gating, prompt idempotency, silent network-failure (no raise, no state persisted on failure → next TTL retries), and [update] check=false disabling the daemon loop.
  • GUI npm test → 107/107 pass (unchanged count as documented).
  • Confirmed the el("a", ...) call in dialogs.js refreshUpdateCheck resolves correctly: utils.js is a classic script loaded before dialogs.js (index.html:359 vs :366), so the global helper is in scope — the settings about-area link renders without ReferenceError.

Minor non-blocking observations (no change needed):

  1. check_latest_version uses tag.lstrip("v") which strips any leading run of 'v' characters (e.g. hypothetical "vv1.0" → "1.0"). Harmless given releases/latest returns proper tags; a tag[1:] if tag.startswith("v") else tag would be stricter.
  2. parse_version truncates at the first non-numeric piece, so prerelease tags like "0.2.18-rc.2" parse to (0,2) and can never compare newer than a release — good defensive semantic, as the tests confirm.

Design is sound: display-only prompt (TUI status line / GUI settings about area), one prompt per version (state-file idempotency), silent failure with next-TTL retry, and a config kill-switch. No issues found.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle (2/3)

Re-verified branch head 2d6dab8: 670 Python tests pass (18 new update-check tests incl. version compare 0.2.17<0.2.18, TTL not-expired no-check, prompt idempotency, silent network failure, config disable), 107 GUI tests pass, node --check syntax OK on all changed JS, doc-count guard satisfied (652→670). Host boundary respected: display-only, no auto download/install. No blocking issues.

@argszero
argszero merged commit 2a52bd7 into master Aug 9, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 9, 2026
…entry (#603)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero pushed a commit that referenced this pull request Aug 9, 2026
…0T07:12:12) (#602) (#604)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/auto-update-check-prompt branch August 10, 2026 12:40
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.

2 participants