fix(desktop): make shallow update status presence-only - #64469
fix(desktop): make shallow update status presence-only#64469metamindedu wants to merge 1 commit into
Conversation
f373481 to
bbe14a4
Compare
bbe14a4 to
686f306
Compare
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Fix for desktop shallow update status to be presence-only. Well-scoped (119 additions, 65 deletions). No security concerns.
Reviewed by Hermes Agent
|
Thanks for the focused follow-up. The premise is verified against current Automated hermes-sweeper review. |
|
Merged via PR #86257 — your commit was cherry-picked onto current main with your authorship preserved in git log (bf10349). Thanks! Your design carried three key pieces of the class fix: shallow checkouts always skip |
What does this PR do?
This is a focused follow-up to #51922 / #52201. The existing Desktop guard treats a shallow checkout as unsafe only when
merge-baseis absent, and explicitly assumes that a shallow checkout with a visible merge-base has a reliablerev-listcount.That assumption does not always hold. A clean Windows installer checkout briefly reported 6,588 commits behind while the complete object graph between the same tips contained 49 commits. In a shallow graph, HEAD can hide ancestry that a remote merge path exposes, so
merge-basecan still succeed whilegit rev-list HEAD..origin/main --countincludes old commits.This change treats exact counts as trustworthy only in full clones. Shallow installs report
0when the tips are equal or when Git positively proves that the remote tip is an ancestor of local HEAD; every other SHA mismatch remains the presence-only1sentinel. The changelog shows only the fetched remote tip instead of walking the contaminated ancestry range.Related Issue
Follow-up to #51922 and the merged fix #52201.
Related but intentionally non-overlapping: #53479 / #53494 cover the CLI updater path; this PR only fixes the Desktop
checkUpdates()path.Type of Change
Changes Made
apps/desktop/electron/update-count.tsorigin/<branch>tip metadata for shallow changelogs while preserving the existing 40-commit range for full clones.apps/desktop/electron/main.tsmerge-base --is-ancestorproof for shallow local-ahead checkouts;apps/desktop/electron/update-count.test.tsrev-listovercounts;origin/mainremains up to date;How to Test
cd apps/desktop && npm run test:desktop:platforms -- electron/update-count.test.ts electron/update-remote.test.tsmerge-basestill succeeds, and proves the visible shallow count is inflated before asserting the presence-only result.behindat 0.cd apps/desktop && npm run typecheckcd apps/desktop && npx eslint electron/update-count.ts electron/update-count.test.tscd apps/desktop && npx prettier --check electron/update-count.ts electron/update-count.test.tscd apps/desktop && npm run buildassert-dist-built.npm run test:desktop:platformswas also exercised on Windows. The changedupdate-count.test.tspassed under the full parallel suite (including the Git regression); the run retained unrelated existing Windows/POSIX baseline failures inwindows-hermes-path.test.ts,update-relaunch.test.ts,git-worktree-ops.test.ts, and two.mjstest-loading suites.Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
finallyScreenshots / Logs
Observed real installer state before the fix:
After the shallow boundary was refreshed, the same checkout switched to the existing presence-only
1display without moving HEAD. The regression test captures the underlying graph condition directly so the fix does not depend on a screenshot or a particular upstream commit count.