From 4e5cea136ab0cf8c6d1ce309c42e742f0e5da2ee Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Tue, 29 Sep 2026 14:20:22 +0530 Subject: [PATCH] test(update): a same-named script outside the checkout still repairs it Pins the path half of the tail identity: only this checkout's own hermes_cli/ scripts are exempt from the launch-time repair. --- .../test_update_launch_completion.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/hermes_cli/test_update_launch_completion.py b/tests/hermes_cli/test_update_launch_completion.py index 233c2b26a0..47dbd519fc 100644 --- a/tests/hermes_cli/test_update_launch_completion.py +++ b/tests/hermes_cli/test_update_launch_completion.py @@ -122,6 +122,25 @@ def test_prepared_completion_import_does_not_start_another_tail(tmp_path, monkey assert venv_sync.completion_pending_path(root).is_file() +def test_same_named_script_outside_the_checkout_still_repairs(tmp_path, monkeypatch, completion_tail): + """Only this checkout's own tail is exempt: another tree's worker still owes this one's repair.""" + import pm + from hermes_cli import _launchers + + root = _self_checkout(tmp_path, monkeypatch) + foreign = tmp_path / "other" / "hermes_cli" / "source_completion.py" + foreign.parent.mkdir(parents=True) + foreign.touch() + venv_sync.arm_completion(root) + monkeypatch.setattr(pm, "venv_is_current", lambda **kw: True) + monkeypatch.setattr(_launchers, "resolve_store_python", lambda _: Path(sys.executable)) + monkeypatch.setattr(sys, "argv", [str(foreign), "--prepared"]) + + assert venv_sync.prepare_launch(root, sys.argv[1:]) is None + assert len(completion_tail) == 1 + assert not venv_sync.completion_pending_path(root).is_file() + + def test_completion_tail_output_stays_off_stdout(tmp_path, monkeypatch, completion_tail): """The automatic tail runs in front of the user's command, which may be piping JSON.""" import pm