@mark1russell7/service 0.6.1 → 0.6.3

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 (49) hide show
  1. package/README.md +114 -5
  2. package/build/{builder-BNAkpeTT.d.ts → builder-bXJqMe2p.d.ts} +3 -2
  3. package/build/{core-CWsGgr9J.d.ts → core-B1zbS4WY.d.ts} +4 -3
  4. package/build/{dial-JEJavY0U.d.ts → dial-CSGKVlZe.d.ts} +2 -2
  5. package/build/grpc.d.ts +3 -3
  6. package/build/grpc.js +1 -1
  7. package/build/host.d.ts +556 -0
  8. package/build/host.js +1738 -0
  9. package/build/host.js.map +1 -0
  10. package/build/http-client.d.ts +3 -3
  11. package/build/http-client.js +1 -1
  12. package/build/http.d.ts +17 -3
  13. package/build/http.js +53 -10
  14. package/build/http.js.map +1 -1
  15. package/build/index.d.ts +44 -6
  16. package/build/index.js +78 -158
  17. package/build/index.js.map +1 -1
  18. package/build/lifecycle-Ks9Yd5CM.d.ts +387 -0
  19. package/build/{limiter-B0849Vhp.d.ts → limiter-BoZkXIxk.d.ts} +2 -2
  20. package/build/{limiter-pkBZUp-t.js → limiter-CmC4vCjk.js} +21 -13
  21. package/build/limiter-CmC4vCjk.js.map +1 -0
  22. package/build/limiter.d.ts +3 -3
  23. package/build/limiter.js +1 -1
  24. package/build/{lifecycle-CCDLvXLF.d.ts → logger-DhFgh48y.d.ts} +25 -367
  25. package/build/{machine-DZMb_QEU.js → machine-DKWLZOqu.js} +7 -19
  26. package/build/machine-DKWLZOqu.js.map +1 -0
  27. package/build/mongodb.d.ts +3 -3
  28. package/build/mongodb.js +1 -1
  29. package/build/pg.d.ts +2 -2
  30. package/build/pg.js +1 -1
  31. package/build/ports-CZLzYK5d.d.ts +125 -0
  32. package/build/process-DG_im2zc.js +171 -0
  33. package/build/process-DG_im2zc.js.map +1 -0
  34. package/build/{queue-eLs5IruM.d.ts → queue-BjiGodqh.d.ts} +3 -2
  35. package/build/rabbitmq.d.ts +4 -4
  36. package/build/rabbitmq.js +1 -1
  37. package/build/redis.d.ts +3 -3
  38. package/build/redis.js +1 -1
  39. package/build/retrier-Bzkme_yM.js +51 -0
  40. package/build/retrier-Bzkme_yM.js.map +1 -0
  41. package/build/{store-D5HLgBnW.d.ts → store-Cwuepb-z.d.ts} +14 -3
  42. package/build/testing.d.ts +86 -3
  43. package/build/testing.js +238 -2
  44. package/build/testing.js.map +1 -1
  45. package/build/websocket.d.ts +3 -3
  46. package/build/websocket.js +1 -1
  47. package/package.json +6 -2
  48. package/build/limiter-pkBZUp-t.js.map +0 -1
  49. package/build/machine-DZMb_QEU.js.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A service that you declare as data before it starts. You compose it with plain calls: its dependencies, its checks, its policies and its shutdown. `describe()` gives the whole graph as data, and it starts nothing. `lint()` then applies the timer-ordering law to that graph. `start()` gives the graph to the health runtime, and `run()` starts the whole lifecycle.
4
4
 
5
- This release has the declaration, its export, the law, the health runtime, the lifecycle and the edge of a service in Node (`@mark1russell7/service/http`). The wrappers of the clients come in a later release.
5
+ This release has the declaration, its export, the law, the health runtime, the lifecycle and the edge of a service in Node (`@mark1russell7/service/http`). It also has the host of a program in Node (`@mark1russell7/service/host`). The wrappers of the clients come in a later release.
6
6
 
7
7
  ## What the package does
8
8
 
@@ -78,6 +78,10 @@ The format of a description is `mark1russell7.service/1`.
78
78
  - **The answers that did not go.** The event of that cap (`phase.cap`) gives the cause and the count, for example `answers not flushed: 2`. The close of the transports then destroys those sockets.
79
79
  - **Work that did not end.** A call whose end did not come, a transport that did not end its drain, or a step of an owner still fails the phase. The exit code is then 1, as before.
80
80
  - **Only the work of the drain.** The drain waits only for the streams that `life.request` of its lifecycle made, because only its cut ends them. A stream of another lifecycle, or of none, does not hold the drain. The record of the drain gives their count, for example `streams outside the lifecycle: 1`. Thus each exit code is the exit code of 0.5.4.
81
+ - **Uncaught errors.** `run({ uncaught: { exitCode, ignore } })` adds a handler for `uncaughtException` and `unhandledRejection` from the start to the exit. Without the option, the runtime adds no handler, as before.
82
+ - **An uncaught error starts the shutdown.** The error is an error of the lifecycle, and the logger gets it at `error`, with its stack. Then the staged shutdown starts with `exitCode`, as a signal does. The default code is 1.
83
+ - **Skipped errors.** `ignore(error, origin)` tells if the runtime skips an error, for example an `ECONNRESET` or an `EPIPE` of a peer socket. The logger gets a skipped error at `warn`, and the service continues.
84
+ - **The port of the errors.** The runtime adds the handler through `ProcessPort.onUncaught`, an optional method. `embeddedProcess()` does not have it, because the owner of the process keeps its errors.
81
85
  - **Exit codes.** `life.shutdown(cause, { code })` gives the exit code of the work, a whole number from 0 to 255. The first request with a code sets it. `svc.exitCode(trigger, code)` gives the code of a shutdown that a trigger starts, for example 130 for SIGINT. A code that is not 0 stays after an error. A code of 0, or no code, becomes 1 after an error.
82
86
  - **The output.** The stage `flush the output` comes last. The owners of the phase write their last output first, for example a log or a trace exporter. Then the `ProcessPort` writes the buffered output of stdout and stderr, in the cap of the stage. Without this phase, the process exits without a wait, as in 0.4.
83
87
  - **The hold.** The lifecycle holds its process from its start to its exit, through `ProcessPort.hold`, as a listening socket does. The hold is one timer of the event loop, and the exit releases it. The other timers of the runtime still do not keep the process alive (A14).
@@ -86,6 +90,7 @@ The format of a description is `mark1russell7.service/1`.
86
90
  - **The logger.** `run({ logger })` and `start({ logger })` give each transition of the machines to a logger, as an entry with a level and fields. The logger is one sink of the same stream as `record` (`logEvents`).
87
91
  - **The levels.** Each step of the startup, each phase with its cap, its outcome and its duration, and the exit code are `info`. A phase at its cap is `warn`, and an error of the lifecycle is `error`. The polls are `debug`.
88
92
  - **The logger port.** A `Logger` has one method, `log(level, message, fields)`, thus an adapter to another logger is a few lines. `consoleLogger({ level })` writes to the console at `info` and above by default.
93
+ - **Lines of JSON.** `consoleLogger({ level, format: "json" })` writes one line of JSON for each entry, with `level`, `message` and each field. An error field gives its name, its message and its stack. The default format is `text`, as before.
89
94
  - **No logger.** Without a logger, the runtime writes no log, as before. `testLogger()` of `@mark1russell7/service/testing` keeps each entry, thus a test can examine the log.
90
95
 
91
96
  ## The machines
@@ -320,9 +325,13 @@ The clock, the heartbeat and the backoff have their own entries. Each entry impo
320
325
  - **The backoff.** `backoffDelay(policy, attempt, random)` gives the delay before a try: `base × factor^(attempt − 1)`, at most `cap`, with a jitter. The first try is 1.
321
326
  - **The jitter.** The jitter `subtract` takes a random part of the delay away, and a fraction of 1 is the full jitter. The jitter `add` adds a random time up to an amount.
322
327
  - **The band.** `backoffBand(policy, attempt)` gives the least and the most delay of one try. Without a try, it covers each try. The law reads the most delay from it. `backoffProblems(policy)` names each value that the delays cannot use.
328
+ - **The retrier.** `retrier({ base, factor, cap, jitter, clock, signal })` starts a function again after the backoff of each try. The root of the package gives it, and the entry `./backoff` does not.
329
+ - **The calls of a retrier.** `schedule(run)` counts one more try, and starts `run` after the delay of that try, on the clock. It gives the delay, and `attempts` gives the count. A second `schedule` stops the retry that waits.
330
+ - **The end of a retrier.** `reset()` sets the count to 0, for example after a start that succeeded. `cancel()` stops the retry that waits. The abort of `signal` cancels the retrier, for example the `signal` of the lifecycle in the drain.
323
331
  - **Milliseconds.** These functions take times in milliseconds, as the clock does. The declaration and the law keep their amounts (`Quantity`).
324
332
 
325
333
  ```ts
334
+ import { retrier } from "@mark1russell7/service";
326
335
  import { backoffDelay } from "@mark1russell7/service/backoff";
327
336
  import { heartbeat } from "@mark1russell7/service/heartbeat";
328
337
 
@@ -339,6 +348,15 @@ socket.addEventListener("message", (event) => {
339
348
 
340
349
  // full jitter: a random time from 0 to the backoff
341
350
  const delay = backoffDelay({ base: 1000, factor: 1.5, cap: 30_000, jitter: { kind: "subtract", fraction: 1 } }, attempt);
351
+
352
+ // a watch that starts again after each failure, until the drain of the service
353
+ const rewatch = retrier({ base: 1000, factor: 2, cap: 30_000, jitter: { kind: "subtract", fraction: 1 }, signal: life.signal });
354
+ const watch = (): void => {
355
+ start().then(
356
+ () => rewatch.reset(),
357
+ () => rewatch.schedule(watch),
358
+ );
359
+ };
342
360
  ```
343
361
 
344
362
  ## The keyed limiter
@@ -348,7 +366,7 @@ A keyed limiter gives each key its own limit, for example each tenant or each pr
348
366
  | Export | Function |
349
367
  | --- | --- |
350
368
  | `svc.limiter(name, spec)` | The declaration of a limiter, as data. `describe()` shows it in `limiters`. |
351
- | `keyedLimiter(name, spec, store)` | The runtime of a limiter: `take(key)` gives a `Decision` |
369
+ | `keyedLimiter(name, spec, store)` | The runtime of a limiter: `take(key)` gives a `Decision`, and `tryTakeSync(key)` gives it at once on a memory store |
352
370
  | `memoryStore(clock)` | The store of one replica, on the injected monotonic clock |
353
371
  | `decide(rule, state, now)`, `limitRule(policy)`, `freeAt(rule, state)` | The arithmetic of each store, for a store of your own |
354
372
  | `idleSpan(policy)`, `longestRetryAfter(policy)`, `retryAfterSeconds(retryAfter)` | The times of a policy, and `Retry-After` in whole seconds |
@@ -362,6 +380,8 @@ A keyed limiter gives each key its own limit, for example each tenant or each pr
362
380
  - **A token bucket.** `{ type: "token-bucket", rate, burst }` gives a key `burst` takes at once, and then `rate` takes in each unit of time. The rate is a count for each unit of time, for example `count/s` or `count/min`.
363
381
  - **A sliding window.** `{ type: "sliding-window", limit, window }` gives a key at most `limit` takes in each window. Each take counts for one window from its time. Graph limits its writes with this policy.
364
382
  - **The decision.** `take(key)` gives `{ allowed: true, remaining }` or `{ allowed: false, retryAfter, cause }`. `retryAfter` is a `Quantity` above zero: the time until the limiter lets the same take in. The cause is `limit`, `cap` or `store`.
383
+ - **A take with no promise.** `tryTakeSync(key)` gives the same `Decision` at once. `keyedLimiter` on a `memoryStore` gives a `LocalLimiter`, whose type has it. On `KeyedLimiter`, it is optional.
384
+ - **Only a local store.** `tryTakeSync` throws for a shared store, before the take. It also throws for a local store whose take gives a promise. That take still counts, thus use `take()` with such a store.
365
385
  - **The clock.** `memoryStore(clock)` reads time only through its clock. Thus a step of the wall clock moves no count, and a fake clock gives exact decisions in a test.
366
386
  - **The store.** A `LimiterStore` decides each take in one atomic step, on its own clock. A store in another process does the arithmetic of `decide` in one step of its own. `redisLimiterStore` of `@mark1russell7/service/redis` is one script of Redis that reads `TIME`.
367
387
  - **No shared store.** With `{ kind: "local" }`, each replica keeps its own counts. For a limit L over N replicas, declare L / N on each replica.
@@ -414,8 +434,8 @@ if (!decision.allowed) return limitedResponse(decision); // 429, with Retry-Afte
414
434
  | Export | Function |
415
435
  | --- | --- |
416
436
  | `httpTransport(server, knobs, options)` | A server of `node:http` as a transport of the lifecycle, with a list of mounts |
417
- | `probeServer({ port, host, server_retry_after, kinds })` | A health server on a port of its own |
418
- | `probeHandler(health, { prefix, kinds })` | The probes as a request handler on the port of the application |
437
+ | `probeServer({ port, host, server_retry_after, kinds, paths })` | A health server on a port of its own |
438
+ | `probeHandler(health, { prefix, kinds, paths })` | The probes as a request handler on the port of the application |
419
439
  | `PROBE_KINDS` | The four probe kinds, the default of the option `kinds` |
420
440
  | `handle(controller, route, work, options)` | A request handler that does each request of a route through `life.request` |
421
441
  | `writeOutcome(res, stream, options)` | The stream of a request as a response of `node:http`, unary or a stream |
@@ -457,6 +477,9 @@ if (!decision.allowed) return limitedResponse(decision); // 429, with Retry-Afte
457
477
  - **The probe kinds.** The option `kinds` names the probes that answer, for example `["startup", "readiness", "liveness"]`. The default is all four of `PROBE_KINDS`.
458
478
  - **A kind that the list does not name.** Its path is not a probe. `probeHandler` gives it to the next handler, and `probeServer` answers it with 404. Thus a probe server can keep the report off its port.
459
479
  - **A bad list of kinds.** `probeHandler` and `probeServer` refuse an empty list, an unknown kind and a kind two times. The error names the bad part.
480
+ - **More probe paths.** The option `paths` gives more paths to a probe kind, for example `{ liveness: ["/livez", "/healthz"], readiness: ["/readyz"] }`. Each probe path of a kind still answers.
481
+ - **A more path is exact.** It is a whole path, and the prefix does not go before it. A more path of readiness has no controller after it. Without `paths`, the paths are the same as before.
482
+ - **A bad option `paths`.** The two functions refuse an unknown kind, a kind that `kinds` does not name and a path two times. They also refuse a path that is not a whole path, and a probe path of a kind.
460
483
  - **A route through the request tracking.** `handle(controller, route, work, options)` gives a request handler. Each request that it takes goes through `life.request`, thus the service admits it, counts it and can cut it.
461
484
  - **The route of a handler.** A route name takes a request whose method and path are that name, for example `POST /orders`. A function gives the name of a route or of a pattern (`controller.pattern`), or null for a request of another handler. `options.detail` gives the detail of a request for the function of a pattern.
462
485
  - **The work.** The work gets the request and a signal. The signal aborts when the shutdown cuts the request, at the cooperative abort, or when the client goes away.
@@ -515,6 +538,89 @@ app.controller("orders").requires("db").route("POST /orders", { idempotent: fals
515
538
  const life = await app.run(); // the process exits after SIGTERM, with 0 or 1
516
539
  ```
517
540
 
541
+ ## The host
542
+
543
+ `@mark1russell7/service/host` keeps programs alive on one computer, without a container platform. It installs a Windows scheduled task or a systemd user unit. A group supervisor then starts each program in sequence and starts it again after it stops. Of the modules of Node, the entry imports only `node:child_process`, `node:fs/promises`, `node:net`, `node:os` and `node:path`. The root of the package does not import it.
544
+
545
+ Each effect goes through a port (`HostPorts`): the commands, the files, the processes, the network and the clock. `nodeHostPorts()` gives the ports of Node. A test gives `fakeHost()` from the testing subpath, thus it starts no process and installs no task.
546
+
547
+ | Export | Function |
548
+ | --- | --- |
549
+ | `installService(spec, ports, { start })` | Writes the task or the unit, and registers it with `schtasks` or `systemctl --user` |
550
+ | `uninstallService`, `startService`, `stopService` | Remove, start and stop the task or the unit |
551
+ | `serviceStatus(spec, ports, { discovery })` | The state of the task or the unit, and the record of its instance |
552
+ | `renderTaskXml`, `renderSystemdUnit`, `renderSystemdTimer` | The task and the units as text, with no effect |
553
+ | `superviseGroup(spec, ports, options)` | The supervisor of a group of programs |
554
+ | `startOrder`, `groupProblems` | The start sequence of a group, and the problems of its spec |
555
+ | `acquireInstanceLock`, `inspectInstanceLock` | The lock of one instance: a file with the process ID and its start time |
556
+ | `writeDiscovery`, `readDiscovery`, `removeDiscovery` | The discovery file: the process ID, the port, the address and the start time |
557
+ | `stopTree(pid, ports)` | The stop of a process tree by its process ID |
558
+ | `probeOnce`, `parseEnvFile`, `rotatingLog` | A ready probe, an env file and a log file with rotation |
559
+
560
+ - **The task.** On Windows, `installService` writes the XML of a scheduled task and gives it to `schtasks /Create`. The task starts at logon or each day, as the user, without a window. It starts the program again after a failure.
561
+ - **The unit.** On Linux, `installService` writes a systemd user unit in `$XDG_CONFIG_HOME/systemd/user` and enables it. A daily start also gets a timer. Other platforms get `unsupported`, and nothing changes.
562
+ - **The outcomes.** Each operation gives data, not a throw: `done`, `failed` with each command and its output, `refused` with the problems of the spec, or `unsupported`.
563
+ - **The lock.** The lock file has the process ID and its start time. Thus a new process with the same ID does not hold the lock. A lock whose process stopped is stale, and the next take removes it.
564
+ - **The discovery file.** A client reads the port and the address of a running instance from it. `readDiscovery` tells `running`, `absent`, `stale` or `malformed`, and it does not throw.
565
+ - **The sequence of a group.** A program starts when each program of its `after` is ready. A ready probe is an HTTP status, a TCP connection or a command that gives 0. The times of a probe are quantities.
566
+ - **A program that stops.** It starts again after the backoff of its `retrier`. The count of tries goes back to 0 after the program is ready for `resetAfter`. A program also waits until its `after` programs are ready again.
567
+ - **A program that is not ready in its time.** The supervisor stops it after `within`, and starts it again after the backoff. The state of the program tells the reason.
568
+ - **One instance of each program.** Each program has its own lock. The supervisor holds the lock for its child, thus a second supervisor of the same group gets `held` and starts nothing.
569
+ - **The files of a program.** Its output goes to `<stateDir>/logs/<name>.log`, which rotates at its size. Its environment is the host, then its env file, then its `env`. It also gets its own `cwd`.
570
+ - **The staged stop.** The supervisor stops the programs in the reverse sequence. A program with an IPC channel gets the message `"shutdown"`, which `svc.trigger("ipc-message", …)` matches. Else Linux sends SIGTERM, and Windows starts `taskkill /T /PID` without `/F`.
571
+ - **The stop of the tree.** After the grace, Windows starts `taskkill /T /F /PID <pid>`. Linux sends SIGKILL to the process group of the child. The host does not stop a process by its name or its command line at any time.
572
+
573
+ ```ts
574
+ // group.js: the logon task starts this supervisor as the user
575
+ import { daemon, service } from "@mark1russell7/service";
576
+ import { nodeHostPorts, superviseGroup } from "@mark1russell7/service/host";
577
+
578
+ const s = (value: number) => ({ value, unit: "s" });
579
+ const ms = (value: number) => ({ value, unit: "ms" });
580
+ const group = superviseGroup(
581
+ {
582
+ name: "stack",
583
+ stateDir: "/var/lib/stack",
584
+ programs: [
585
+ { name: "db", program: "/usr/bin/db", ready: { probe: { kind: "tcp", port: 5432 }, interval: ms(500), timeout: ms(250), within: s(30) } },
586
+ {
587
+ name: "api",
588
+ program: process.execPath,
589
+ args: ["api.js"],
590
+ cwd: "/srv/api",
591
+ envFile: "/var/lib/stack/api.env",
592
+ after: ["db"],
593
+ ipc: true,
594
+ ready: { probe: { kind: "http", url: "http://127.0.0.1:8080/health" }, interval: ms(500), timeout: ms(250), within: s(30) },
595
+ listen: { port: 8080, url: "http://127.0.0.1:8080/" },
596
+ },
597
+ ],
598
+ },
599
+ nodeHostPorts(),
600
+ );
601
+
602
+ const host = service("stack")
603
+ .profile(daemon)
604
+ .dependency("group", { system: null, knobs: {}, operations: {} }, { connect: () => group.start(), close: () => group.stop() })
605
+ .readiness({ type: "debounce", interval: s(5), failAfter: 3, recoverAfter: 1 })
606
+ .liveness({ type: "window", failAfter: s(45) })
607
+ .startup(s(60));
608
+ await host.run();
609
+ ```
610
+
611
+ ```ts
612
+ // install.js: the owner of the computer starts this one time
613
+ import { installService, nodeHostPorts } from "@mark1russell7/service/host";
614
+
615
+ const outcome = await installService(
616
+ { name: "stack", description: "The stack", program: process.execPath, args: ["group.js"], start: "logon", restart: { after: { value: 1, unit: "min" } }, stateDir: "/var/lib/stack" },
617
+ nodeHostPorts(),
618
+ );
619
+ console.log(outcome.kind);
620
+ ```
621
+
622
+ - **The stop of the group.** The phase `tear down dependencies` caps `group.stop()`. Give that phase a cap above the sum of the graces of the programs.
623
+
518
624
  ## The testing subpath
519
625
 
520
626
  `@mark1russell7/service/testing` has the seams that a test of a service needs:
@@ -525,6 +631,7 @@ const life = await app.run(); // the process exits after SIGTERM, with 0 or 1
525
631
  - `scriptedCheck(behavior)` gives a check whose behavior a test sets: `"ok"`, `"error"`, `"indeterminate"`, `"throw"`, `"timeout"` or `"hang"`.
526
632
  - `quietServer()` starts a TCP echo server that can go quiet. Its connections stay open while it is quiet, as with a frozen peer.
527
633
  - `detachedLifecycle()` gives a lifecycle with no service, for the start of a transport in a test.
634
+ - `fakeHost(options)` gives the ports of the host entry on a fake clock, a fake file system and fake processes. It records each command and each signal. A test ends a child with `exit(code)`, and `polite` makes each child obey a staged stop.
528
635
  - `transportConformance(make, options)` generates the conformance test of a transport. `make` gives a subject: the transport, a way to offer new work and a way to hold work in flight. The cases check that `stopIntake` refuses new work, and that the count is correct and comes from events. They also check that `drain` holds to its deadline and gives the cooperative abort, and that `close` is idempotent and bounded. The fake clock makes the cases fast, and the real clock measures them.
529
636
  - `contractCases(declare)` generates the contract test of a declaration. The cases are the service at rest, each dependency unavailable, each dependency degraded by 100 ms, each recovery, and a negative control. A dependency that no check exercises is a finding, and so is a check whose timeout a latency of 100 ms fails.
530
637
 
@@ -776,7 +883,7 @@ for await (const event of stream) {
776
883
  - **The gRPC client.** These tests use a fake channel and a fake clock. They cover the declaration, the outcome of each status code, the methods that the client sends again or not, the keepalive and the IDLE channel. They also cover a GOAWAY, the close, the checks and the manifestations. Seven scenarios replay against the document of the client. One test sends calls through grpc-js to a server of the loopback.
777
884
  - **F6 for Redis.** The fault matrix crosses each manifestation (a refusal, a frozen process, a black hole, a death without a close, and an app stall), each gating posture, two timings and two jitters. That is 60 cases on the fake. Each case holds the trip and the release of its policy to `failSpan` and `recoverSpan`. Five more cases shut the service down during each manifestation, and each one exits 0.
778
885
  - **The timers.** These tests use a fake clock, and they cover the hooks of the heartbeat and its two kinds of ping. A property test holds the death of a silent peer to `detectionTime` in 300 seeded cases. Another one compares the heartbeat with a WebSocket heartbeat that sends one ping at a time, on 300 schedules of pongs. The backoff gives the delays of three earlier backoffs, number for number, and each delay is in its band.
779
- - **The entries.** The timer entries reach no other package, no `node:` module and no zod. No entry of the service reaches zod, also through `quantity` and the replay of the algebra. The root reaches no `node:` module. The HTTP edge reaches only `node:http`, `node:net` and `quantity`. The worker loop and the queue drain reach only `quantity`.
886
+ - **The entries.** The timer entries reach no other package, no `node:` module and no zod. No entry of the service reaches zod, also through `quantity` and the replay of the algebra. The root reaches no `node:` module. The HTTP edge reaches only `node:http`, `node:net` and `quantity`. The worker loop and the queue drain reach only `quantity`. The host reaches only `quantity` and five `node:` modules, and it loads none of its fakes.
780
887
  - **The requests.** A unary work is a stream of one item, and a stream gives each item when its reader asks. The drain waits for an open stream. The cooperative abort ends a stream through `return()`, and a cut or a failure after the first item ends in-band. A reader that stops early stops the work. The function of a route pattern decides the answer of each cut request.
781
888
  - **The options of the runner.** These tests cover the requests of a transport while the startup runs, the policy of a repeat signal, the profiles and the process triggers. They also cover the exit codes, a first Ctrl-C that aborts at once, and the flush of the output.
782
889
  - **The composition.** Two components, each with a transport, a dependency and a check, share one service and one `run()`. The parts start and stop in their sequence, and the process exits one time.
@@ -790,6 +897,8 @@ for await (const event of stream) {
790
897
  - **The worker loop.** These tests use the fake clock. They cover the sleep, `"more"`, the backoff and its jitter, `wake()`, the stop of the intake and the drain with its cooperative abort. They also cover the bound of an iteration, the lanes, the setup, the teardown, the close bound and the law (O20).
791
898
  - **The queue drain.** These tests cover the slots, the poll, the policy of A11 and the count of deliveries. They also cover a job that goes back at the stop, an async iterable and a failed take. A cut job of each kind of route, the close bound and the refusals of the service have tests too.
792
899
  - **The conformance of the helpers.** The worker loop passes each case of the kit with three lanes, and the queue drain with three slots. Each one passes with the request tracking and without it. With one lane, the loop passes each case that holds one work.
900
+ - **The host.** These tests use `fakeHost()`, thus they start no process and install no task. They cover the text of the task and the units, each command of each operation, and the lock with its stale recovery. They also cover the discovery file, the probes, the env file and the rotation of the log.
901
+ - **The group supervisor.** These tests cover the start sequence with its probes, the environment, the logs, and the lock of each program. They also cover the backoff and its reset, a restart that waits for its programs, and the deadline of a probe. Each stage of the stop has tests on Linux and on Windows.
793
902
  - **The IPC message.** A message that matches a declared shape starts the staged shutdown on the fake process, with the exit code of its signal. A second message obeys the policy of a repeat signal.
794
903
  - **On real sockets.** `HTTP_IT=1` starts the tests of the HTTP edge on the loopback. They cover the conformance on the fake clock and on the real clock, keep-alive and the stop of the intake. They also cover the upgrades, the probe server and a service after SIGTERM. They measure time, thus only CI starts them (`http.yml`), on Node 22.19, 24 and 26. CI keeps the raw records of each job as an artifact.
795
904
  - **On the real clock.** `WORKERS_IT=1` starts the kit of the worker loop and of the queue drain on the real clock, in the jobs of `http.yml`.
@@ -1,6 +1,7 @@
1
1
  import { n as Clock } from "./clock-mVqhXD0b.js";
2
2
  import { c as LimiterSpec } from "./policy-G4QJ1ZZq.js";
3
- import { $ as Coupling, E as CheckFn, Et as ExitTrigger, K as Trace, Mt as ProcessTrigger, Q as CooperativeFloor, T as StartOptions, Vt as Operation, W as Outcome, X as Check, at as Phase, bt as OperationOf, ct as ServiceDescription, d as TransportImpl, et as Dependency, ft as Poll, it as MessageTrigger, mt as Timing, n as HealthServer, o as PhaseWork, r as Lifecycle, rt as Gate, s as RunOptions, st as RepeatSignal, t as DependencyHandle, tt as ExitCodes, x as Health } from "./lifecycle-CCDLvXLF.js";
3
+ import { C as MessageTrigger, D as ServiceDescription, E as RepeatSignal, G as ExitTrigger, N as Timing, S as Gate, Z as ProcessTrigger, _ as CooperativeFloor, b as ExitCodes, ct as Operation, h as Check, j as Poll, v as Coupling, w as Phase, y as Dependency, z as OperationOf } from "./logger-DhFgh48y.js";
4
+ import { D as CheckFn, E as StartOptions, F as Outcome, L as Trace, S as Health, d as TransportImpl, n as HealthServer, o as PhaseWork, r as Lifecycle, s as RunOptions, t as DependencyHandle } from "./lifecycle-Ks9Yd5CM.js";
4
5
  import { Extent, Quantity } from "@mark1russell7/quantity";
5
6
  //#region src/profiles.d.ts
6
7
  /**
@@ -208,4 +209,4 @@ interface ServiceBuilder {
208
209
  declare const service: (name: string) => ServiceBuilder;
209
210
  //#endregion
210
211
  export { WatchdogSpec as a, Profile as c, kubernetes as d, localDev as f, Watchdog as i, daemon as l, ServiceBuilder as n, watchdog as o, service as r, PodTiming as s, ControllerBuilder as t, ephemeral as u };
211
- //# sourceMappingURL=builder-BNAkpeTT.d.ts.map
212
+ //# sourceMappingURL=builder-bXJqMe2p.d.ts.map
@@ -1,7 +1,8 @@
1
1
  import { t as Backoff } from "./backoff-B-jGWVDm.js";
2
2
  import { n as Clock } from "./clock-mVqhXD0b.js";
3
- import { E as CheckFn, Vt as Operation, X as Check, Y as Recorder, ct as ServiceDescription, et as Dependency, ft as Poll, lt as Step, rt as Gate, t as DependencyHandle } from "./lifecycle-CCDLvXLF.js";
4
- import { n as ServiceBuilder } from "./builder-BNAkpeTT.js";
3
+ import { D as ServiceDescription, O as Step, S as Gate, ct as Operation, h as Check, j as Poll, m as Recorder, y as Dependency } from "./logger-DhFgh48y.js";
4
+ import { D as CheckFn, t as DependencyHandle } from "./lifecycle-Ks9Yd5CM.js";
5
+ import { n as ServiceBuilder } from "./builder-bXJqMe2p.js";
5
6
  import { Extent, Quantity } from "@mark1russell7/quantity";
6
7
  //#region src/client/meets.d.ts
7
8
  /** A situation is what the connection did when the failure started: a command in flight, or idle. */
@@ -230,4 +231,4 @@ declare const retryProblems: (name: string, knobs: RetryKnobs) => string[];
230
231
  declare const STARTING_POLL: Poll;
231
232
  //#endregion
232
233
  export { MANIFESTATIONS as C, firstDetector as D, Situation as E, unwatched as O, Detector as S, Meeting as T, Sent as _, ClientKnobs as a, retryProblems as b, ClientSpec as c, Factory as d, ReadyWait as f, SendOptions as g, STARTING_POLL as h, ClientJoin as i, ClientStep as l, RetrySchedule as m, CheckOptions as n, ClientOptions as o, RetryKnobs as p, Client as r, ClientSocket as s, Attempt as t, DialFn as u, readyWait as v, Manifestation as w, retrySchedule as x, retryBackoff as y };
233
- //# sourceMappingURL=core-CWsGgr9J.d.ts.map
234
+ //# sourceMappingURL=core-B1zbS4WY.d.ts.map
@@ -1,4 +1,4 @@
1
- import "./core-CWsGgr9J.js";
1
+ import "./core-B1zbS4WY.js";
2
2
  //#region src/client/dial.d.ts
3
3
  /**
4
4
  * A judge reads the bytes that the server sent so far. It gives null for a good answer, an error for
@@ -13,4 +13,4 @@ type Judge = (received: Buffer) => Error | null | "more";
13
13
  declare const statusLineJudge: (accept: (status: number, line: string) => Error | null) => Judge;
14
14
  //#endregion
15
15
  export { statusLineJudge as n, Judge as t };
16
- //# sourceMappingURL=dial-JEJavY0U.d.ts.map
16
+ //# sourceMappingURL=dial-CSGKVlZe.d.ts.map
package/build/grpc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Vt as Operation, ft as Poll } from "./lifecycle-CCDLvXLF.js";
2
- import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, b as retryProblems, c as ClientSpec, d as Factory, f as ReadyWait, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, p as RetryKnobs, r as Client, s as ClientSocket, t as Attempt, u as DialFn, v as readyWait, w as Manifestation } from "./core-CWsGgr9J.js";
3
- import { t as Judge } from "./dial-JEJavY0U.js";
1
+ import { ct as Operation, j as Poll } from "./logger-DhFgh48y.js";
2
+ import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, b as retryProblems, c as ClientSpec, d as Factory, f as ReadyWait, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, p as RetryKnobs, r as Client, s as ClientSocket, t as Attempt, u as DialFn, v as readyWait, w as Manifestation } from "./core-B1zbS4WY.js";
3
+ import { t as Judge } from "./dial-CSGKVlZe.js";
4
4
  import { Extent, Quantity } from "@mark1russell7/quantity";
5
5
  import { Machine } from "@mark1russell7/algebra";
6
6
  //#region src/grpc/connection.d.ts
package/build/grpc.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { realClock } from "./clock.js";
2
2
  import { i as heartbeatDetection } from "./timing-DGRi3XCI.js";
3
- import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-DZMb_QEU.js";
3
+ import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-DKWLZOqu.js";
4
4
  //#region src/grpc/connection.ts
5
5
  /** These states are in the sequence of the enum of grpc-js: the index of a state is its value. */
6
6
  const GRPC_STATES = [