fix(pty,subprocess,lsp): address review round on cancellation, lookup, and contracts

- pty-local: a pre-write inspection rejection no longer releases a canceled
  send while its foreground SIGINT is in flight; the interrupt path retains
  the slot and its post-signal tail resumes polling. Regression pins the
  failure-shaped cancellation and a close-during-write release.
- pty-local: SEND_ACTIVE names which provider operation is draining; README
  states the never-settling-provider outcome (slot retained, close recovers).
- subprocess-local: resolveExecutable rejects relative paths containing
  separators instead of expanding them per PATH entry with a misleading
  not-found error; seam JSDoc pins the rule for every provider.
- subprocess-local: LocalTerminalHandle documents why the seam's
  in-flight-join promise holds without operation tracking.
- lsp-local: the oversized-source diagnostic reports the observed byte lower
  bound; README documents that processId: null trades away server-side
  orphan cleanup after a hard-killed harness.
- pty/subprocess seams: cross-reference the twin five-member signal unions.
- pty-local: TODO markers for send-state consolidation and initialize-race
  relocation.
This commit is contained in:
Tianyi Cui
2026-08-02 14:11:57 +08:00
parent a662af94df
commit e385c11e8e
21 changed files with 155 additions and 33 deletions

View File

@@ -32,6 +32,10 @@ describe('LocalSubprocessService', () => {
PATH: relative(process.cwd(), dirname(process.execPath)) || '.',
})).toBe(process.execPath)
await expect(ctx.subprocess.resolveExecutable('')).rejects.toThrow('must be non-empty')
await expect(ctx.subprocess.resolveExecutable('./bin/tsserver'))
.rejects.toThrow('is a relative path')
await expect(ctx.subprocess.resolveExecutable('node_modules/.bin/server'))
.rejects.toThrow('is a relative path')
await expect(ctx.subprocess.resolveExecutable('dsh-command-that-does-not-exist', { PATH: '' }))
.rejects.toThrow('was not found on PATH')
await expect(ctx.subprocess.resolveExecutable('/dsh-absolute-command-that-does-not-exist'))
@@ -61,6 +65,8 @@ describe('LocalSubprocessService', () => {
.toEqual(['/explicit/tool.EXE'])
expect(candidates('tool.exe', {})).toEqual([resolve(process.cwd(), 'tool.exe')])
expect(candidates('tool', { PATH: '/bin' })).toHaveLength(4)
await expect(ctx.subprocess.resolveExecutable(String.raw`bin\server.exe`))
.rejects.toThrow('is a relative path')
} finally {
platform.mockRestore()
await fiber.dispose()