Skip to content

fix(desktop,cli): stop rendering the unknown update count as "1 change included" - #83381

Closed
Dolverin wants to merge 2 commits into
NousResearch:mainfrom
Dolverin:fix/desktop-update-count-unknown
Closed

fix(desktop,cli): stop rendering the unknown update count as "1 change included"#83381
Dolverin wants to merge 2 commits into
NousResearch:mainfrom
Dolverin:fix/desktop-update-count-unknown

Conversation

@Dolverin

Copy link
Copy Markdown
Contributor

Problem

Windows installer checkouts are shallow (clone --depth 1), and passive update checks against the official SSH origin deliberately use presence-only HTTPS ls-remote so a FIDO2/passkey key is never touched (#51922 documented the fallout of trusting rev-list there). In that state the exact behind-count is unknowable — but the sentinel value for "unknown" was a literal 1, and every surface rendered it as a real number:

  • Desktop About page: "A new update is ready (1 change included)." — observed while 90+ commits were actually pending
  • CLI banner / hermes version: "1 commit behind"

The code comments already stated the intent ("show a generic update available"), but nothing downstream distinguished the sentinel from a real count.

Fix

Pass "unknown" through honestly instead of faking precision:

  • update-count.ts returns null for the unknowable case; the main process sets updateAvailable explicitly and still serves the (capped) commit log, so "See what's new" keeps working
  • Desktop About page and update toast key off updateAvailable and render new count-free strings (updateReadyUnknown / updateReadyMessageUnknown, all 5 locales) when no exact count exists
  • CLI: the official-SSH branch of _check_via_local_git now returns UPDATE_AVAILABLE_NO_COUNT (-1) unchanged — consistent with the existing shallow path — and hermes version prints a generic "Update available" line instead of "1 commit behind"
  • No behavior change when the count is knowable (full clones, dev images): exact numbers are still computed and shown

Tests

New FAIL-BEFORE coverage: desktop sentinel returns null (was 1), store toast fires with count-free copy for unknown counts (was swallowed by the <= 0 guard), CLI SSH path keeps -1 (was 1), hermes version shows the generic line.

  • vitest --project electron: 10/10
  • vitest --project ui: 44/44
  • pytest tests/hermes_cli/test_update_check.py: 5/5
  • tsc typecheck clean (3 configs); eslint clean on all touched files

…ded' on shallow clones

On an installer checkout (clone --depth 1) with no merge-base against the
freshly fetched origin tip, resolveBehindCount returned the sentinel 1 and
every surface rendered it as a literal count: 'A new update is ready (1
change included).' — even when the true distance was far larger (observed:
90 commits). The sentinel was meant to mean 'update available, exact count
unknown', but nothing downstream distinguished it from a real one.

- update-count.ts: return null (unknown) instead of the numeric sentinel
- main.ts: flag updateAvailable explicitly and still serve the (capped)
  commit log so 'See what's new' stays useful in the unknown case
- updates.ts: toast fires for behind:null + updateAvailable, with
  count-free copy instead of being swallowed by the <= 0 guard
- about-settings.tsx: status line and action buttons key off
  updateAvailable; unknown size renders the new count-free string
- i18n: updateReadyUnknown / updateReadyMessageUnknown in all 5 locales

Refs NousResearch#51922 (the shallow-clone special case this UI now renders honestly).

Tests: vitest electron 10/10, ui 44/44 (3 FAIL-BEFORE reds turned green),
tsc typecheck clean, eslint clean on all touched files.
The official-SSH branch of _check_via_local_git collapsed
UPDATE_AVAILABLE_NO_COUNT (-1) to a literal 1, so the startup banner and
'hermes version' printed "1 commit behind" for shallow installer clones —
the desktop UI's "1 change included" lie, second source. Pass the sentinel
through and teach cmd_version the generic 'Update available' line. The
REST payload (-1) already maps to update_available=True, which the fixed
desktop now renders count-free.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #86257 — your commit was cherry-picked onto current main with your authorship preserved in git log (bf10349). Thanks! Your null-sentinel + updateAvailable plumbing (store, toast, About settings, all locales, CLI renderer) is the honesty backbone of the class fix. We combined it with #64469's shallow-always-skip/ancestor-proof design and added exact-count recovery via the GitHub compare API on top.

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