@descryy/runtime-controller 0.2.0 → 0.3.0

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.
Files changed (61) hide show
  1. package/LICENSE +6 -0
  2. package/dist/capability-registry.d.ts +0 -15
  3. package/dist/capability-registry.d.ts.map +1 -1
  4. package/dist/capability-registry.js +9 -19
  5. package/dist/capability-registry.js.map +1 -1
  6. package/dist/collector-version.d.ts +1 -8
  7. package/dist/collector-version.d.ts.map +1 -1
  8. package/dist/collector-version.js +1 -8
  9. package/dist/collector-version.js.map +1 -1
  10. package/dist/container-sandbox.d.ts +66 -150
  11. package/dist/container-sandbox.d.ts.map +1 -1
  12. package/dist/container-sandbox.js +62 -143
  13. package/dist/container-sandbox.js.map +1 -1
  14. package/dist/controller.d.ts +54 -87
  15. package/dist/controller.d.ts.map +1 -1
  16. package/dist/controller.js +77 -104
  17. package/dist/controller.js.map +1 -1
  18. package/dist/dependency-version-check.d.ts +19 -73
  19. package/dist/dependency-version-check.d.ts.map +1 -1
  20. package/dist/dependency-version-check.js +18 -67
  21. package/dist/dependency-version-check.js.map +1 -1
  22. package/dist/env.d.ts +4 -10
  23. package/dist/env.d.ts.map +1 -1
  24. package/dist/env.js +4 -10
  25. package/dist/env.js.map +1 -1
  26. package/dist/environment-metadata.d.ts +9 -17
  27. package/dist/environment-metadata.d.ts.map +1 -1
  28. package/dist/environment-metadata.js +12 -29
  29. package/dist/environment-metadata.js.map +1 -1
  30. package/dist/environment-version-check.d.ts +22 -65
  31. package/dist/environment-version-check.d.ts.map +1 -1
  32. package/dist/environment-version-check.js +24 -66
  33. package/dist/environment-version-check.js.map +1 -1
  34. package/dist/execution-safety.d.ts +54 -112
  35. package/dist/execution-safety.d.ts.map +1 -1
  36. package/dist/execution-safety.js +48 -102
  37. package/dist/execution-safety.js.map +1 -1
  38. package/dist/index.d.ts +0 -10
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/orchestration.d.ts +24 -39
  42. package/dist/orchestration.d.ts.map +1 -1
  43. package/dist/orchestration.js +39 -75
  44. package/dist/orchestration.js.map +1 -1
  45. package/dist/process-collector.d.ts +8 -22
  46. package/dist/process-collector.d.ts.map +1 -1
  47. package/dist/process-collector.js +23 -55
  48. package/dist/process-collector.js.map +1 -1
  49. package/dist/process-manager.d.ts +45 -80
  50. package/dist/process-manager.d.ts.map +1 -1
  51. package/dist/process-manager.js +51 -101
  52. package/dist/process-manager.js.map +1 -1
  53. package/dist/readiness.d.ts +28 -70
  54. package/dist/readiness.d.ts.map +1 -1
  55. package/dist/readiness.js +73 -95
  56. package/dist/readiness.js.map +1 -1
  57. package/dist/sandbox.d.ts +60 -105
  58. package/dist/sandbox.d.ts.map +1 -1
  59. package/dist/sandbox.js +78 -121
  60. package/dist/sandbox.js.map +1 -1
  61. package/package.json +7 -2
@@ -1,13 +1,10 @@
1
1
  /**
2
- * Process manager (plan §5): command execution, working directory,
3
- * environment variables, process-group tracking, stdout/stderr capture,
4
- * exit-code capture, cleanup with a shutdown grace period, and orphan-
5
- * process prevention.
2
+ * Process manager (§5): command execution, cwd, env, process-group tracking,
3
+ * stdout/stderr capture, exit-code capture, graceful shutdown, orphan prevention.
6
4
  *
7
- * Orphan prevention and group-kill use POSIX process groups
8
- * (`detached: true` + `process.kill(-pid, signal)`), matching this
9
- * project's Linux development and CI targets. Not portable to Windows as
10
- * written — out of scope for the V1 fixture-app slice (plan §34).
5
+ * Orphan prevention and group-kill use POSIX process groups (`detached: true` +
6
+ * `process.kill(-pid, signal)`) -- not portable to Windows, out of scope for the V1
7
+ * fixture-app slice (§34).
11
8
  */
12
9
  import { execFile, spawn } from "node:child_process";
13
10
  import { readFileSync } from "node:fs";
@@ -17,25 +14,17 @@ import { applyResourceLimits } from "./execution-safety.js";
17
14
  import { applySandbox } from "./sandbox.js";
18
15
  import { applyContainerSandbox } from "./container-sandbox.js";
19
16
  /**
20
- * Binds port 0 (OS picks a free one), reads it, releases it immediately.
21
- * A real gap remains between "free when checked" and "still free when the
22
- * real service binds it" (RT-024's own class of gap, one layer down) --
23
- * unavoidable without binding the real service directly to the probe
24
- * socket, which `spawnProcess`'s child-process model doesn't support, and
25
- * which no ordinary application would cooperate with anyway.
17
+ * Binds port 0, reads it, releases immediately. A real gap remains between "free
18
+ * when checked" and "still free when the child binds it" (RT-024's gap, one layer
19
+ * down) -- unavoidable without binding the real service directly to the probe
20
+ * socket, which the child-process model doesn't support.
26
21
  *
27
- * **Examined for a fix and deliberately not "fixed".** Holding the probe
28
- * socket open for longer does not narrow the window, it widens it: the
29
- * child cannot bind while we hold the port, and the dominant term is the
30
- * child's own startup, not our release. Retrying on the child's bind error
31
- * would mean parsing that error out of process output, which is
32
- * per-language text and has no place in a language-neutral controller.
33
- * What was done instead is to make the one symptom legible: `awaitReadiness`
34
- * now names the endpoint it probed, so a collision reads as "nothing
35
- * answered on this port" rather than as an unexplained application failure.
36
- * In practice the window is a handful of milliseconds and readiness always
37
- * runs afterwards, so a genuine collision fails loudly -- it is just no
38
- * longer misattributed.
22
+ * **Examined and deliberately not "fixed".** Holding the probe socket longer widens
23
+ * the window rather than narrowing it (the child can't bind while we hold it).
24
+ * Instead, `awaitReadiness` names the endpoint it probed, so a collision reads as
25
+ * "nothing answered on this port" rather than an unexplained failure. Window is a
26
+ * handful of ms in practice; a genuine collision still fails loudly, just correctly
27
+ * attributed.
39
28
  */
40
29
  export function allocateEphemeralPort() {
41
30
  return new Promise((resolve, reject) => {
@@ -63,16 +52,13 @@ export function spawnProcess(options) {
63
52
  let killStarted = false;
64
53
  let child;
65
54
  let settled = false;
66
- // Set only for the container backend (applyContainerSandbox's own
67
- // returned name) -- see kill()'s own comment for why the container
68
- // needs a real, separate stop mechanism from the bwrap path's group-kill.
55
+ // Set only for the container backend -- see kill() for why it needs a separate
56
+ // stop mechanism from bwrap's group-kill.
69
57
  let containerName = null;
70
58
  let resolveExit;
71
59
  let exitPromise;
72
- // Everything a (re)spawn needs to reset, in one place -- `restart()` calls
73
- // this again after the previous child has fully exited, and the two call
74
- // sites (initial construction, restart) must not drift into resetting
75
- // different subsets of this state.
60
+ // Everything a (re)spawn needs to reset, in one place -- construction and
61
+ // restart() must not drift into resetting different subsets of this state.
76
62
  function spawnChild() {
77
63
  startedAt = new Date().toISOString();
78
64
  exitedAt = null;
@@ -85,9 +71,7 @@ export function spawnProcess(options) {
85
71
  resolveExit = resolve;
86
72
  });
87
73
  // "container" skips applyResourceLimits entirely (see SpawnProcessOptions.
88
- // sandboxBackend's own comment on why prlimit composition isn't attempted
89
- // for this backend yet) -- every other case (the default, "bwrap")
90
- // behaves exactly as before this field existed.
74
+ // sandboxBackend) -- "bwrap" (default) is unchanged.
91
75
  const wrapped = options.sandboxBackend === "container"
92
76
  ? applyContainerSandbox({
93
77
  interpreterCommand: options.command,
@@ -118,15 +102,10 @@ export function spawnProcess(options) {
118
102
  child.stderr?.on("data", (chunk) => {
119
103
  outputBuffer += chunk.toString("utf8");
120
104
  });
121
- // Node does not call `spawn()`'s error path synchronously -- a bad
122
- // command (ENOENT) surfaces later as an `'error'` event, never a thrown
123
- // exception here, and per Node's own docs `'exit'` may never fire after
124
- // an `'error'`. An EventEmitter's unhandled `'error'` event crashes the
125
- // process, and with no `'exit'` guaranteed either, `exitPromise` would
126
- // otherwise hang forever -- both `'exit'` and `'error'` settle the same
127
- // promise exactly once, so a failed-to-spawn process reads as an
128
- // ordinary never-became-ready process (no pid, no output, no readiness
129
- // success) rather than crashing the caller or hanging its cleanup.
105
+ // A bad command (ENOENT) surfaces as an `'error'` event, not a thrown exception,
106
+ // and per Node's docs `'exit'` may never fire after `'error'`. Both events settle
107
+ // the same promise exactly once, so a failed spawn reads as an ordinary
108
+ // never-became-ready process rather than crashing the caller or hanging cleanup.
130
109
  function settle(info) {
131
110
  if (settled)
132
111
  return;
@@ -164,22 +143,16 @@ export function spawnProcess(options) {
164
143
  return;
165
144
  }
166
145
  if (containerName !== null) {
167
- // Real finding from this backend's own escape tests, not assumed up
168
- // front: the local `docker` CLI process is not the container -- it
169
- // runs under `dockerd`, a separate process tree entirely. Signaling
170
- // the CLI's process group (the mechanism below, correct for bwrap,
171
- // which execs the sandboxed process directly) left a real orphaned
172
- // container running in testing. `docker stop` targets the actual
173
- // container by name and is the real stop mechanism for this backend;
174
- // `--rm` (set by applyContainerSandbox) then removes it once stopped.
175
- // Still falls through to the group-kill below afterward, as a
176
- // backstop for the local CLI process itself.
146
+ // Found via escape testing: the local `docker` CLI process is not the
147
+ // container -- it runs under `dockerd`, a separate process tree.
148
+ // Signaling the CLI's process group left a real orphaned container running.
149
+ // `docker stop` (by name) is the real stop mechanism here; `--rm` then
150
+ // removes it. Still falls through to group-kill below as a CLI backstop.
177
151
  try {
178
152
  await execFileAsync("docker", ["stop", "--time", String(Math.max(1, Math.round(gracePeriodMs / 1000))), containerName]);
179
153
  }
180
154
  catch {
181
- // Already stopped/removed (e.g. the process exited on its own
182
- // first) -- not an error worth surfacing to the caller.
155
+ // Already stopped/removed -- not worth surfacing.
183
156
  }
184
157
  }
185
158
  signalGroup(pid, "SIGTERM");
@@ -190,11 +163,9 @@ export function spawnProcess(options) {
190
163
  }
191
164
  }
192
165
  async function restart(gracePeriodMs = DEFAULT_GRACE_PERIOD_MS) {
193
- // Safe whether the process is still alive, already exited on its own,
194
- // or already mid-kill -- `kill()` is idempotent in all three cases and
195
- // this always waits for the OLD child to be fully gone before
196
- // `spawnChild()` reassigns `child`/`exitPromise`/etc., so no event from
197
- // the outgoing process can land on the incoming one's state.
166
+ // Safe regardless of the old process's state -- kill() is idempotent, and this
167
+ // waits for it to be fully gone before spawnChild() reassigns state, so no
168
+ // outgoing event can land on the incoming process.
198
169
  await kill(gracePeriodMs);
199
170
  spawnChild();
200
171
  }
@@ -207,17 +178,12 @@ export function spawnProcess(options) {
207
178
  };
208
179
  }
209
180
  /**
210
- * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether
211
- * delivery would be possible. `ESRCH` means no such pid; `EPERM` means a
212
- * pid we don't own but that unambiguously exists, still alive for this
213
- * purpose. Any other error is treated as "exists" rather than guessed away.
181
+ * `process.kill(pid, 0)` sends no signal, only asks the kernel if delivery is
182
+ * possible. `ESRCH` = no such pid; `EPERM` = a pid we don't own but that exists.
214
183
  *
215
- * A second, deliberate copy of `packages/orchestrator/src/attach-to-running-process.ts`'s
216
- * function of the same name, not an import of it: `orchestrator` depends on
217
- * `controller` (see `orchestrator/package.json`), so the reverse import
218
- * would be circular. Tiny and pure, the same "duplicated because both
219
- * copies are easy to notice drift" precedent `attach-to-running-jvm-process.ts`'s
220
- * own `reconstructJvmSourcePath` already sets for exactly this reason.
184
+ * Deliberate second copy of `orchestrator/src/attach-to-running-process.ts`'s
185
+ * same-named function, not an import -- `orchestrator` depends on `controller`, so
186
+ * the reverse import would be circular. Tiny and pure enough to duplicate safely.
221
187
  */
222
188
  export function isProcessAlive(pid) {
223
189
  try {
@@ -230,25 +196,15 @@ export function isProcessAlive(pid) {
230
196
  }
231
197
  const DEFAULT_ATTACH_POLL_INTERVAL_MS = 50;
232
198
  /**
233
- * `ManagedProcess` for a service `ExecutionController.run()` attaches to
234
- * instead of spawning (`ServiceConfiguration.attach`). Reads
235
- * `attach.logFilePath` fresh on every `readOutput()` call — the same
236
- * growing-whole-buffer contract a spawned process's in-memory pipe buffer
237
- * already has (`spawnProcess`'s own `outputBuffer`), so `createPollingProcessOutputSource`
238
- * (`@descryy/runtime-orchestrator`) needs no attach-specific branch to
239
- * consume either one.
199
+ * `ManagedProcess` for a service attached to rather than spawned. Reads
200
+ * `attach.logFilePath` fresh on every `readOutput()` -- same growing-whole-buffer
201
+ * contract as a spawned process's in-memory pipe buffer.
240
202
  *
241
- * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this
242
- * process and `ATTACH_MODE_SCOPE_DISCLOSURE` (`@descryy/runtime-contracts`)
243
- * is unconditional: attach mode "never executes code in it or applies
244
- * changes to it." `ExecutionController`'s cleanup path kills every managed
245
- * process on failure/timeout/stop — for an attached service that would mean
246
- * terminating a process this runtime does not own, silently, the exact
247
- * thing the disclosure promises never happens. Ending observation (no
248
- * further polling) is the honest equivalent of "stop" here; the target
249
- * keeps running, as it was before Descry ever attached. `restart()` throws
250
- * for the same reason: there is no command this runtime could relaunch it
251
- * with.
203
+ * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this process,
204
+ * and `ATTACH_MODE_SCOPE_DISCLOSURE` is unconditional: attach mode never executes
205
+ * code in or applies changes to what it observes. Ending observation is the honest
206
+ * equivalent of "stop" -- the target keeps running. `restart()` throws for the same
207
+ * reason: no command exists to relaunch it with.
252
208
  */
253
209
  export function attachManagedProcess(options) {
254
210
  const { pid, logFilePath } = options.attach;
@@ -265,16 +221,12 @@ export function attachManagedProcess(options) {
265
221
  }
266
222
  return {
267
223
  processId: options.processId,
268
- // No command to report — this runtime never launched this process,
269
- // so there is nothing here that isn't a guess. Disclosed rather than
270
- // fabricated.
224
+ // No real command to report -- disclosed rather than guessed.
271
225
  command: `<attached: pid ${String(pid)}, ${logFilePath}>`,
272
226
  pid,
273
227
  startedAt,
274
228
  exitedAt,
275
- // Neither is observable for a process we did not spawn and do not
276
- // reap — see this function's own module doc on why `kill()` never
277
- // signals it, which is exactly what would let us learn either.
229
+ // Not observable for a process we don't spawn or reap.
278
230
  exitCode: null,
279
231
  signal: null,
280
232
  serviceName: options.serviceName ?? null,
@@ -306,7 +258,7 @@ export function attachManagedProcess(options) {
306
258
  return exitPromise;
307
259
  }
308
260
  function kill() {
309
- // Deliberate no-op — see this function's own module doc.
261
+ // Deliberate no-op -- see module doc above.
310
262
  return Promise.resolve();
311
263
  }
312
264
  function restart() {
@@ -318,13 +270,11 @@ export function attachManagedProcess(options) {
318
270
  const execFileAsync = promisify(execFile);
319
271
  function signalGroup(pid, signal) {
320
272
  try {
321
- // Negative pid targets the whole process group (the child is its
322
- // leader, per `detached: true`), not just the immediate process --
323
- // this is the orphan-prevention mechanism.
273
+ // Negative pid targets the whole process group (orphan-prevention mechanism).
324
274
  process.kill(-pid, signal);
325
275
  }
326
276
  catch {
327
- // Group already gone -- nothing to signal, not an error.
277
+ // Group already gone -- not an error.
328
278
  }
329
279
  }
330
280
  function sleep(ms) {
@@ -1 +1 @@
1
- {"version":3,"file":"process-manager.js","sourceRoot":"","sources":["../src/process-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE;YACnB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACpD,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;gBAC3D,OAAO;YACT,CAAC;YACD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;YACzB,KAAK,CAAC,KAAK,CAAC,GAAG,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;QACH,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,SAAS,IAAI;QACX,4CAA4C;QAC5C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,SAAS,OAAO;QACd,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,iEAAiE,MAAM,CAAC,GAAG,CAAC,2BAA2B;YACrG,4CAA4C,CAC/C,CACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC5D,CAAC;AAED,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,SAAS,WAAW,CAAC,GAAW,EAAE,MAAsB;IACtD,IAAI,CAAC;QACH,8EAA8E;QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -1,65 +1,30 @@
1
1
  /**
2
- * Readiness (plan §6): "Readiness must not equal 'process exists.'" —
3
- * supported strategies are HTTP health check, TCP/port check, a known log
4
- * pattern, a real subprocess command, or a caller-supplied hook (which
5
- * covers the plan's "framework readiness hook" and "user-defined readiness"
6
- * — two names for the same shape, a caller-provided async predicate,
7
- * consolidated into one mechanism rather than two near-identical ones).
2
+ * Readiness (§6): "readiness must not equal 'process exists.'" Mechanisms: HTTP
3
+ * check, TCP/port check, log pattern, subprocess command, or a caller hook
4
+ * (consolidates the plan's "framework readiness hook" and "user-defined readiness"
5
+ * into one predicate shape).
8
6
  *
9
- * **`command` is not `custom-hook` (RT-193).** An earlier version of this
10
- * comment folded the plan's "command check" into `custom-hook` too, on the
11
- * reasoning that both are "a caller-provided check." That collapsed a real
12
- * distinction: `custom-hook` runs a caller's own in-process predicate,
13
- * while `command` runs an actual subprocess and reads its actual exit
14
- * code — the same "declared, not inferred" shape `ServiceConfiguration`'s
15
- * own `command` field already uses, one layer over. A caller with a real
16
- * CLI health check (`pg_isready`, a framework's own readiness script) had
17
- * no way to express that without either wrapping it in a hand-written
18
- * `custom-hook` predicate that shells out itself, or reimplementing the
19
- * subprocess plumbing per caller — `command` is that plumbing, built once.
7
+ * **`command` is not `custom-hook` (RT-193).** `custom-hook` runs a caller's
8
+ * in-process predicate; `command` runs a real subprocess and reads its exit code --
9
+ * built once so a caller with a real CLI health check (`pg_isready`) doesn't have to
10
+ * shell out from inside a hand-written hook.
20
11
  *
21
- * The plan requires recording which mechanism succeeded — `ReadinessResult`
22
- * makes that a field, not something inferred after the fact.
12
+ * **What `ready: true` does not claim (RT-024).** All mechanisms answer "is
13
+ * something listening/responding," none confirm it's the process *this* spawn
14
+ * produced -- a stale listener from an already-dead run satisfies `http`/`tcp-port`
15
+ * identically. `log-pattern` only carries the stronger this-run guarantee if `read`
16
+ * is wired to this execution's own `readOutput()` (caller discipline, not enforced
17
+ * by the type). An ephemeral port closes this gap by construction; a fixed,
18
+ * guessable port doesn't. Found via a real 30s collector timeout that looked like a
19
+ * Playwright bug and was actually a wait on an orphaned process from a dead session
20
+ * (RT-024).
23
21
  *
24
- * **What `ready: true` does and does not claim (RT-024).** All four
25
- * mechanisms answer one question — is something listening / responding
26
- * where expected — and none answer whether it is the process *this*
27
- * `spawnProcess` call produced. A stale listener from an unrelated, already-
28
- * dead run satisfies `http`/`tcp-port` identically to a correct one; nothing
29
- * here can tell them apart. `log-pattern` only carries the stronger,
30
- * this-run-specific guarantee when its `read` is wired to *this* execution's
31
- * own `ManagedProcess.readOutput()` — the type does not enforce that wiring,
32
- * it is a caller discipline. `custom-hook` inherits whatever the caller's
33
- * predicate actually checks.
34
- *
35
- * Callers that bind a fixed, guessable host:port are exposed to this gap;
36
- * an ephemeral port closes it by construction (nothing else can already be
37
- * bound there) rather than by detection, and is the default recommendation
38
- * over a startup-nonce scheme, which only earns its extra machinery when a
39
- * fixed port is genuinely unavoidable (a contract with an external tool).
40
- * See `descry-runtime`'s `DECISIONS.md` RT-024 for how this was found —
41
- * a real 30-second collector timeout that looked like a Playwright/DOM bug
42
- * and was actually a correct wait against an orphaned process from a
43
- * different, already-dead session.
44
- *
45
- * **A single probe attempt cannot outlive `timeoutMs` (RT-030).** `http`
46
- * and `tcp-port` each bind their I/O to the *remaining* time until
47
- * `deadline`, not a fresh per-attempt budget — a target that accepts a
48
- * connection and never responds no longer lets one probe attempt run past
49
- * the caller's own deadline. Measured, not theoretical: an unbound `fetch`
50
- * here let `awaitReadiness` run past its own `timeoutMs` (>8s observed
51
- * against a 3s budget). `command` honors the same discipline, the same
52
- * way: `execFile`'s own `timeout` option is set to the remaining time until
53
- * `deadline`, so a command that hangs instead of exiting is killed rather
54
- * than left to run past the caller's own budget — it owns a real OS
55
- * resource (a child process) exactly like the http/tcp-port sockets do, so
56
- * it gets the same treatment. `custom-hook` is not wrapped the same way — a
57
- * caller-supplied predicate owns its own timeout behavior, same as every
58
- * other `Collector`-shaped callback contract in this repo (`collector.ts`'s
59
- * own docs put "must resolve, not hang" on the implementer); imposing a
60
- * surprise external cancellation on arbitrary caller code would be a
61
- * different, larger decision than fixing the mechanisms that own a real OS
62
- * resource this module can actually clean up.
22
+ * **A single probe attempt cannot outlive `timeoutMs` (RT-030).** `http`/`tcp-port`
23
+ * bind I/O to the remaining time until `deadline`, not a fresh per-attempt budget --
24
+ * measured: an unbound `fetch` here let `awaitReadiness` run 8s+ past a 3s budget.
25
+ * `command` gets the same treatment via `execFile`'s `timeout`. `custom-hook` is not
26
+ * wrapped this way -- a caller predicate owns its own timeout, same as every other
27
+ * `Collector` callback contract here.
63
28
  */
64
29
  export declare const READINESS_MECHANISMS: readonly ["http", "tcp-port", "log-pattern", "command", "custom-hook"];
65
30
  export type ReadinessMechanism = (typeof READINESS_MECHANISMS)[number];
@@ -76,18 +41,11 @@ export interface TcpPortReadinessCheck {
76
41
  export interface LogPatternReadinessCheck {
77
42
  readonly kind: "log-pattern";
78
43
  /**
79
- * Tested against `read()`'s full return value on every poll (RT-032's
80
- * `awaitReadiness` loop). `read` is documented to wire to
81
- * `ManagedProcess.readOutput()`, which returns the entire accumulated
82
- * stdout+stderr buffer with **no size cap** — a caller-supplied pattern
83
- * with an unbounded quantifier immediately before a literal that can be
84
- * absent (the exact shape RT-069 found and fixed in
85
- * `evidence-store/redaction.ts`'s `EMAIL_PATTERN`, and RT-070 also found
86
- * and fixed in this package's own `PORT_PLACEHOLDER`) would run that
87
- * catastrophic-backtracking cost against a growing buffer on every single
88
- * poll. Nothing in this repo currently supplies such a pattern here, so
89
- * this is a disclosed risk at the call site rather than a fixed one — the
90
- * regex is the caller's, not this module's, to bound.
44
+ * Tested against `read()`'s full return value on every poll. `read` wires to
45
+ * `readOutput()`, an unbounded, growing stdout+stderr buffer -- an unbounded
46
+ * quantifier before an absent-able literal (the ReDoS shape RT-069/RT-070 already
47
+ * fixed elsewhere) would backtrack catastrophically here on every poll. Disclosed
48
+ * risk, not fixed: the regex is the caller's to bound, not this module's.
91
49
  */
92
50
  readonly pattern: RegExp;
93
51
  /** Pulls currently-buffered output — wire this to a ManagedProcess's `readOutput`. */
@@ -1 +1 @@
1
- {"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../src/readiness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAKH,eAAO,MAAM,oBAAoB,wEAAyE,CAAC;AAC3G,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC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