mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 11:22:02 +03:00
df9ffa977d
A Windows ZIP update drops workspace node_modules. If the reinstall then failed, the renderer and its receipt stayed current, so `hermes desktop --source` skipped the build and could not launch. Treat a missing apps/desktop/node_modules/electron as a needed build.
33 lines
1.5 KiB
Python
33 lines
1.5 KiB
Python
"""A current renderer must not hide a source build whose linked Electron is gone.
|
|
|
|
A Windows ZIP update drops workspace node_modules (pnpm's links do not survive the
|
|
copy). If the reinstall then fails, apps/desktop/dist and its freshness receipt are
|
|
still current, and `hermes desktop --source` would skip the build and fail to launch
|
|
the missing runtime instead of relinking it.
|
|
"""
|
|
from hermes_cli import main_desktop, source_build
|
|
|
|
|
|
def _source_tree(tmp_path, monkeypatch, *, electron: bool):
|
|
desktop = tmp_path / "apps/desktop"
|
|
(desktop / "dist").mkdir(parents=True)
|
|
(desktop / "dist/index.html").write_text("<html></html>", encoding="utf-8")
|
|
if electron:
|
|
(desktop / "node_modules/electron").mkdir(parents=True)
|
|
(desktop / "node_modules/electron/package.json").write_text("{}", encoding="utf-8")
|
|
# The compiler owns receipts; hold that check current to isolate the runtime boundary.
|
|
monkeypatch.setattr(source_build, "source_product_current", lambda *_: True)
|
|
return tmp_path, desktop
|
|
|
|
|
|
def test_missing_linked_electron_needs_a_source_build(tmp_path, monkeypatch):
|
|
root, desktop = _source_tree(tmp_path, monkeypatch, electron=False)
|
|
|
|
assert main_desktop._desktop_build_needed(desktop, root, source_mode=True)
|
|
|
|
|
|
def test_current_source_build_with_its_electron_is_reused(tmp_path, monkeypatch):
|
|
root, desktop = _source_tree(tmp_path, monkeypatch, electron=True)
|
|
|
|
assert not main_desktop._desktop_build_needed(desktop, root, source_mode=True)
|