- A dev checkout linked at plugins/<name> with a root plugin.js: Electron's publish copied the link itself (fs.cp keeps a top-level link), so the "copy" was the checkout, the marker was written into it, and the prune (which skipped linked folders) left a ghost after the link went. Copy from the resolved folder; never keep or stamp a link at <root>/<name>; the prune follows links and drops only the link. The host twin gets the same link-target and prune handling (its copytree already copied the files). - The install dialog decided desktop success from the reconcile's touched list, which also names folders the pass deleted: a force reinstall whose new tree dropped its desktop entry read as installed. Read the folder (Electron fs bridge, or the host's /api/desktop-plugins) instead. - Re-pin consent: the desktop half is a presence surface, so moving it between plugin.js and desktop/plugin.js widens nothing.
37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
"""A re-pin that adds a desktop half is a widened surface whichever layout the half uses.
|
|
|
|
The installers accept ``plugin.js`` at the package root as well as under ``desktop/``; the re-pin
|
|
consent check reads the same rule, so a root-layout half added by a new commit is not waved through.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from hermes_cli.plugins_cmd_catalog import plugin_surface, surface_delta
|
|
|
|
|
|
@pytest.mark.parametrize("entry", ["plugin.js", "desktop/plugin.js"])
|
|
def test_new_desktop_half_widens_the_surface_in_either_layout(tmp_path: Path, entry: str):
|
|
old, new = tmp_path / "old", tmp_path / "new"
|
|
for tree in (old, new):
|
|
tree.mkdir()
|
|
(tree / "plugin.yaml").write_text("name: demo\n")
|
|
(new / entry).parent.mkdir(parents=True, exist_ok=True)
|
|
(new / entry).write_text("export default {}\n")
|
|
|
|
delta = surface_delta(plugin_surface({"name": "demo"}, old), plugin_surface({"name": "demo"}, new))
|
|
|
|
assert delta.get("desktop") == [entry]
|
|
|
|
|
|
@pytest.mark.parametrize(("before", "after"), [("plugin.js", "desktop/plugin.js"), ("desktop/plugin.js", "plugin.js")])
|
|
def test_moving_an_existing_desktop_half_between_layouts_widens_nothing(tmp_path: Path, before: str, after: str):
|
|
old, new = tmp_path / "old", tmp_path / "new"
|
|
for tree, entry in ((old, before), (new, after)):
|
|
(tree / entry).parent.mkdir(parents=True, exist_ok=True)
|
|
(tree / "plugin.yaml").write_text("name: demo\n")
|
|
(tree / entry).write_text("export default {}\n")
|
|
|
|
assert surface_delta(plugin_surface({"name": "demo"}, old), plugin_surface({"name": "demo"}, new)) == {}
|