Skip to content

fix: skip bogus shallow update counts - #53512

Closed
supplefrog wants to merge 1 commit into
NousResearch:mainfrom
supplefrog:fix/53479-cli-shallow-update-count
Closed

supplefrog wants to merge 1 commit into
NousResearch:mainfrom
supplefrog:fix/53479-cli-shallow-update-count

Conversation

@supplefrog

Copy link
Copy Markdown
Contributor

Summary

  • make hermes update skip git rev-list --count when a shallow install has no visible merge-base with origin/<branch>
  • compare tip SHAs in that case and print a generic update-available message instead of a bogus full-history count
  • add regression coverage for the shallow/no-merge-base update path

Fixes #53479

Test Plan

  • python -m pytest tests/hermes_cli/test_cmd_update.py::TestCmdUpdateBranchFallback::test_update_shallow_without_merge_base_does_not_count_history -q — passed
  • python -m py_compile hermes_cli/main.py tests/hermes_cli/test_cmd_update.py — passed
  • node --test apps/desktop/electron/update-count.test.cjs — passed

Notes

  • python -m pytest tests/hermes_cli/test_cmd_update.py -q currently has Windows-local baseline failures unrelated to this change: one expectation assumes bare ['git'] while production uses ['git', '-c', 'windows.appendAtomically=false'], and one npm-call assertion does not observe npm calls in this Windows mocked run. The new regression test passes independently.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 27, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.
Duplicate of #53494 (earliest open PR for #53479, created 08:20) — same mechanism: detect a shallow checkout with no merge-base via rev-parse --is-shallow-repository, skip git rev-list --count, and print a generic update-available message instead of a bogus count. #53498 is the sibling already linked to #53494. Marking duplicate so the maintainer can consolidate on the canonical PR.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Comment

Fixes bogus shallow commit counts in cmd_update by detecting shallow repos and comparing tip SHAs instead of using rev-list --count. Includes a dedicated test.

Note: Competing fix pair detected — PRs #53498 and #53494 address the same issue. PR #53498 also adds --depth 1 for shallow fetches; PR #53494 extracts a shared _get_remote_update_commit_count() helper. All three implementations are independently sound. The maintainer should reconcile which approach to merge.


Reviewed by Hermes Agent

@supplefrog

Copy link
Copy Markdown
Contributor Author

Closing as duplicate. #53498 already implements the same fix for #53479 with broader targeted coverage and CI signal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI updater still trusts rev-list counts for shallow/diverged installs

3 participants