From 87fddc7e4cb4a3076412eaad3e61e25d521300e6 Mon Sep 17 00:00:00 2001 From: LiangshouX Date: Tue, 3 Nov 2026 13:05:18 +0800 Subject: [PATCH] docs(dsh): state what the leftover record actually gets The docs case claimed the package does not ship the docs; it does (the package manifest lists "docs" in "files", there is no .npmignore and the directory is not git-ignored), so the check runs in the packed install and the comment was the opposite of the fact. The service lifetime also promised that Start replaces a leftover, but a healthy one is only observed: Start reports it as already running and replaces nothing. The wording now says so, and a case pins it. --- integrations/dsh/docs/environment.md | 6 +++--- integrations/dsh/docs/environment_ZH.md | 4 ++-- integrations/dsh/tests/docs-render.test.mjs | 7 ++++--- integrations/dsh/tests/env-manager.test.mjs | 11 +++++++++++ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/integrations/dsh/docs/environment.md b/integrations/dsh/docs/environment.md index a4a46137..d395131d 100644 --- a/integrations/dsh/docs/environment.md +++ b/integrations/dsh/docs/environment.md @@ -166,9 +166,9 @@ processes it manages when the Host exits. The plugin owns a small service adapte - A record left by an older version under a path prefix of the same origin (for example `127.0.0.1:2333/reme`) describes the **same** local service, because the launch configures only host and port. When it can be proven to be this plugin's service, such a record is re-keyed to the endpoint on - screen and then managed like any other launch: **Stop** is offered, and **Start** replaces it. It is then - not reported as a foreign process the tab cannot act on, which would leave the user with a process to - kill by hand. + screen and then managed like any other launch: **Stop** is offered, and **Start** replaces it while it is + not healthy. It is then not reported as a foreign process the tab cannot act on, which would leave the + user with a process to kill by hand. - **Stop** tree-kills the recorded process (process group on POSIX, `taskkill /T /F` on Windows), waits for it to exit, escalates (POSIX: `SIGTERM` then `SIGKILL`; Windows: force `taskkill` again), and clears the record only after the pid is gone. A service started elsewhere stays untouched and is only observed. diff --git a/integrations/dsh/docs/environment_ZH.md b/integrations/dsh/docs/environment_ZH.md index 230f7529..b4f50d7c 100644 --- a/integrations/dsh/docs/environment_ZH.md +++ b/integrations/dsh/docs/environment_ZH.md @@ -132,8 +132,8 @@ ReMe 在服务启动时读取 workspace 目录下的 `.env`;标签页从不把 - 服务占用端口但健康检查失败时显示为“端口被占用”;若能证明是本插件启动的,标签页仍给出**停止**按钮。 - 旧版本遗留在同一源(origin)某个路径前缀下(例如 `127.0.0.1:2333/reme`)的记录,描述的是**同一个**本地服务—— 启动只配置 host 与端口。只要能证明它是本插件启动的,这种记录就会被重新登记到当前显示的地址,随后与其他启动 - 一样被管理:给出**停止**按钮,**启动**也会替换它。它不会再被当成标签页无从处理的外部进程,否则用户只能自己去 - 杀进程。 + 一样被管理:给出**停止**按钮,**启动**在它尚未健康时替换它。它不会再被当成标签页无从处理的外部进程,否则用户 + 只能自己去杀进程。 - **停止**会树杀记录的进程(POSIX 上按进程组、Windows 上为 `taskkill /T /F`),等待其退出,必要时升级(POSIX: `SIGTERM` 后 `SIGKILL`;Windows:再次强制 `taskkill`),并**在 pid 真正消失之后**才清除记录。别处启动的服务不受影响, 只会被观察。 diff --git a/integrations/dsh/tests/docs-render.test.mjs b/integrations/dsh/tests/docs-render.test.mjs index 59bbffaa..e81aed5b 100644 --- a/integrations/dsh/tests/docs-render.test.mjs +++ b/integrations/dsh/tests/docs-render.test.mjs @@ -40,10 +40,11 @@ function codeSpans(text) { test("the user docs hold no code span the GUI turns into a link", (t) => { for (const file of ["environment.md", "environment_ZH.md"]) { const path = join(docs, file); - // The packed plugin does not ship the docs; there is nothing to check - // there. + // The docs are part of the package (`files` includes `docs`), so the check + // runs in the packed install too. This branch only guards a checkout that + // does not have them. if (!existsSync(path)) { - t.skip(`${file} is not part of the package`); + t.skip(`${file} is not part of this checkout`); continue; } const offenders = codeSpans(readFileSync(path, "utf8")).filter( diff --git a/integrations/dsh/tests/env-manager.test.mjs b/integrations/dsh/tests/env-manager.test.mjs index 60505baf..53f26d5f 100644 --- a/integrations/dsh/tests/env-manager.test.mjs +++ b/integrations/dsh/tests/env-manager.test.mjs @@ -474,6 +474,17 @@ test("adopts a leftover record under a same-origin path prefix", async (t) => { ); // The adopted record is stoppable: the endpoint on screen can act on it. + // A healthy service is only observed, though: Start reports it as already + // running and replaces nothing. + const started = await manager.serviceStart( + "http://127.0.0.1:2334", + "D:\\env\\python.exe", + join(directory, "workspace"), + ); + assert.equal(started.started, false); + assert.equal(started.alreadyRunning, true); + assert.equal(calls.spawn.length, 0, "a healthy service is not replaced"); + const stopped = await manager.serviceStop("http://127.0.0.1:2334"); assert.equal(stopped.stopped, true); assert.deepEqual(calls.killTree, [6000]);