fix(update): verify core deps after lazy refresh failures - #58246
fix(update): verify core deps after lazy refresh failures#58246tianma-if wants to merge 1 commit into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment
Summary
Adds verification of core dependencies after a failed lazy refresh during the update process. This prevents partially-failed optional backend installs from corrupting the base venv.
Looks Good
- Well-scoped: 2 files (main.py + test), 114 additions
- Clear docstring explaining the regression scenario
- Proper fallback path: runs core dep verifier on both exception and partial-failure paths
- Tests added covering the verification trigger
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting the post-refresh recovery path. Current main still reports failed lazy refreshes without re-running the existing core-dependency repair (hermes_cli/main.py:7614-7622), while the verifier already repairs missing declared packages (hermes_cli/main.py:7837-8017).
Problems
- The new keyword-argument call at
hermes_cli/main.py:9933-9937breaks the shared update mock attests/hermes_cli/test_update_autostash.py:396, which islambda: None. Update tests using_setup_update_mocks()will raiseTypeErrorwhen the update reaches the refresh step.
Suggested changes
- Update that mock to accept
*args, **kwargs, preferably capturing the arguments and asserting the update path forwards the selected install target. - Add coverage through
_cmd_update_impl, not only the helper, for forwarding the uv/pip target into_refresh_active_lazy_features.
Automated hermes-sweeper review.
| @@ -9904,7 +9930,11 @@ def _cmd_update_impl(args, gateway_mode: bool): | |||
| # UI, desktop rebuild) are non-core and can't brick the venv. | |||
| _clear_update_incomplete_marker() | |||
|
|
|||
| _refresh_active_lazy_features() | |||
| _refresh_active_lazy_features( | |||
There was a problem hiding this comment.
This new keyword-argument call breaks the shared update-test stub at tests/hermes_cli/test_update_autostash.py:396 (lambda: None). Update that mock to accept *args, **kwargs or capture and assert these arguments; otherwise tests using _setup_update_mocks() raise TypeError here.
d820f7c to
81d3364
Compare
|
Closing as superseded by PR #69867 (#69867), which fixes #57828 via import-based probes rather than metadata verification. The reported failure state leaves distribution metadata intact while import files are wiped, so |
Summary
Why
A failed optional lazy backend refresh can partially touch the venv and leave core packages corrupted. This reuses the existing verifier/repair path immediately after the risky step, before the update continues into Node/UI work.
Addresses #57828.
Tests
.venv/bin/python -m pytest tests/hermes_cli/test_verify_core_dependencies.py -q.venv/bin/python -m pytest tests/hermes_cli/test_update_venv_health.py tests/hermes_cli/test_verify_core_dependencies.py -q.venv/bin/python -m py_compile hermes_cli/main.py tests/hermes_cli/test_verify_core_dependencies.py.venv/bin/python -m ruff check hermes_cli/main.py tests/hermes_cli/test_verify_core_dependencies.pygit diff --check