Conversation
bb91b24 to
b0ccb85
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused cache-invalidation fix. The on-disk stale-cache premise remains valid on current main: hermes_cli/banner.py:339-344 returns a fresh cache before local HEAD is examined.
Problems
- The PR's
cache_rev is not Nonecondition (hermes_cli/banner.py:274on the PR head) disables cache hits for non-git/PyPI installs. Current main retains those hits and keys them byVERSION(hermes_cli/banner.py:330-364, commit689ef5e233980f5d5a32080e959f44c8991dd03a). - The PR predates that VERSION-keyed contract and removes
ver; salvage should preserve it while adding the git-HEAD discriminator. tests/hermes_cli/test_update_check.py:89covers legacyrev: null, but not a freshgit:oldheadentry whose current HEAD becomesnewhead.- Current
_check_via_local_git()now probesremote get-url originand shallow status (hermes_cli/banner.py:196,212), so the PR's narrower subprocess mocks need updating.
Suggested changes
- Retain
ver == VERSIONfor all installs and require matching HEAD only for local git checkouts. - Add the fresh old-HEAD/new-HEAD regression case and current git preflight mock responses.
Automated hermes-sweeper review.
| if ( | ||
| now - cached.get("ts", 0) < _UPDATE_CHECK_CACHE_SECONDS | ||
| and cached.get("rev") == embedded_rev | ||
| cache_rev is not None |
There was a problem hiding this comment.
When neither HERMES_REVISION nor a local .git checkout exists, cache_rev stays None, so this rejects every otherwise-valid PyPI cache entry. Preserve current main's ver == VERSION cache path (689ef5e) and apply HEAD matching only to git installs.
| fake_banner.parent.mkdir(parents=True, exist_ok=True) | ||
| fake_banner.touch() | ||
| cache_file = tmp_path / ".update_check" | ||
| cache_file.write_text(json.dumps({"ts": time.time(), "behind": 83, "rev": None})) |
There was a problem hiding this comment.
This verifies migration from the legacy rev: null schema, not the steady-state bug. Add a fresh rev: "git:oldhead" case with git rev-parse HEAD returning newhead, and assert it rechecks and rewrites the cache.
| cache_file.write_text(json.dumps({"ts": 0, "behind": 1, "rev": "git:old"})) | ||
|
|
||
| mock_result = MagicMock(returncode=0, stdout="5\n") | ||
| def fake_run(cmd, **kwargs): |
There was a problem hiding this comment.
When salvaging onto current main, this mock must also handle git remote get-url origin and git rev-parse --is-shallow-repository; current _check_via_local_git() runs both before fetch/rev-list.
Summary
Test Plan
tests/hermes_cli/test_update_check.pyUploaded from LangLang production local patch after rebasing on the latest
origin/main.