@hmharness/lsp 0.23.29 → 0.23.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/lsp",
3
- "version": "0.23.29",
3
+ "version": "0.23.31",
4
4
  "description": "hmharness LSP Client/Manager — drives external language servers (LSP 3.18 over stdio) for agent code intelligence. Client only: we never implement language servers.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "build": "tsc -p tsconfig.build.json"
16
16
  },
17
17
  "dependencies": {
18
- "@hmharness/kernel": "0.23.29"
18
+ "@hmharness/kernel": "0.23.31"
19
19
  },
20
20
  "engines": {
21
21
  "node": ">=22"
@@ -107,12 +107,24 @@ test('client: unknown method surfaces the server error honestly', async () => {
107
107
  test('process-manager: restart budget refuses flapping servers', async () => {
108
108
  const ws = await mkdtemp(join(tmpdir(), 'lsp-ws-'));
109
109
  const manager = new ProcessManager({ id: 'crasher', command: process.execPath, args: ['-e', 'process.exit(3)'], source: 'explicit' }, ws, { maxRestarts: 2 });
110
+ // restarts consume ONLY on explicit start() while the child is dead; a
111
+ // fixed 300ms sleep can race a slow spawn (start() sees it alive and
112
+ // returns WITHOUT counting) - so WAIT for death before each restart
113
+ // (await-the-boundary; this exact test flaked twice on CI)
114
+ const waitDead = async (): Promise<boolean> => {
115
+ const deadline = Date.now() + 10_000;
116
+ while (manager.running) {
117
+ if (Date.now() > deadline) return false;
118
+ await new Promise((r) => setTimeout(r, 25));
119
+ }
120
+ return true;
121
+ };
110
122
  manager.start();
111
- await new Promise((r) => setTimeout(r, 300));
123
+ assert.ok(await waitDead(), 'first crash should exit');
112
124
  manager.start(); // restart 1
113
- await new Promise((r) => setTimeout(r, 300));
125
+ assert.ok(await waitDead(), 'restart 1 should crash');
114
126
  manager.start(); // restart 2
115
- await new Promise((r) => setTimeout(r, 300));
127
+ assert.ok(await waitDead(), 'restart 2 should crash');
116
128
  assert.throws(() => manager.start(), /restart budget/);
117
129
  await manager.stop();
118
130
  await rm(ws, { recursive: true, force: true });