@srobroek/pi-design 0.14.3 → 0.14.4
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/CHANGELOG.md +6 -0
- package/extensions/design.js +29 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## design [0.14.4](https://github.com/srobroek/harness-plugins/compare/design--v0.14.3...design--v0.14.4) (2026-12-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **lib:** settle a subprocess whose pipe a descendant holds, and verify cut-off mutations ([#342](https://github.com/srobroek/harness-plugins/issues/342)) ([8fd6bd8](https://github.com/srobroek/harness-plugins/commit/8fd6bd8df1c19fab2618a0965c620093aa1444c6))
|
|
6
|
+
|
|
1
7
|
## design [0.14.3](https://github.com/srobroek/harness-plugins/compare/design--v0.14.2...design--v0.14.3) (2026-12-05)
|
|
2
8
|
|
|
3
9
|
## design [0.14.2](https://github.com/srobroek/harness-plugins/compare/design--v0.14.1...design--v0.14.2) (2026-12-05)
|
package/extensions/design.js
CHANGED
|
@@ -13,6 +13,8 @@ import { isAbsolute, resolve } from "path";
|
|
|
13
13
|
import { constants } from "os";
|
|
14
14
|
var EXIT_GRACE_MS = 2000;
|
|
15
15
|
var EXIT_POLL_MS = 100;
|
|
16
|
+
var PIPE_DRAIN_MS = 2000;
|
|
17
|
+
var DRAIN_EXTRA_TURNS = 2;
|
|
16
18
|
function goneWatch(graceMs, pollMs) {
|
|
17
19
|
const polls = Math.max(1, Math.ceil(graceMs / Math.max(1, pollMs)));
|
|
18
20
|
let since = null;
|
|
@@ -79,6 +81,7 @@ function capture(stream) {
|
|
|
79
81
|
}
|
|
80
82
|
function supervise(child, options = {}) {
|
|
81
83
|
const grace = Math.max(0, options.graceMs ?? EXIT_GRACE_MS);
|
|
84
|
+
const drainMs = Math.max(0, options.drainMs ?? PIPE_DRAIN_MS);
|
|
82
85
|
const pollMs = Math.max(1, options.pollMs ?? EXIT_POLL_MS);
|
|
83
86
|
const alive = options.alive ?? processAlive;
|
|
84
87
|
const group = options.group ?? false;
|
|
@@ -92,6 +95,7 @@ function supervise(child, options = {}) {
|
|
|
92
95
|
const gone = goneWatch(grace, pollMs);
|
|
93
96
|
let deadline;
|
|
94
97
|
let graceTimer;
|
|
98
|
+
let drainTimer;
|
|
95
99
|
const settle = (run) => {
|
|
96
100
|
if (settled)
|
|
97
101
|
return;
|
|
@@ -99,6 +103,7 @@ function supervise(child, options = {}) {
|
|
|
99
103
|
clearTimeout(deadline);
|
|
100
104
|
clearTimeout(graceTimer);
|
|
101
105
|
clearInterval(poller);
|
|
106
|
+
clearTimeout(drainTimer);
|
|
102
107
|
signal?.removeEventListener("abort", onAbort);
|
|
103
108
|
resolve(run);
|
|
104
109
|
};
|
|
@@ -122,7 +127,8 @@ function supervise(child, options = {}) {
|
|
|
122
127
|
end("lost");
|
|
123
128
|
}, pollMs);
|
|
124
129
|
unref(poller);
|
|
125
|
-
|
|
130
|
+
const bounded = timeoutMs !== undefined && timeoutMs > 0 && Number.isFinite(timeoutMs);
|
|
131
|
+
if (bounded) {
|
|
126
132
|
deadline = setTimeout(() => end("timeout"), timeoutMs);
|
|
127
133
|
if (options.unref)
|
|
128
134
|
unref(deadline);
|
|
@@ -130,8 +136,28 @@ function supervise(child, options = {}) {
|
|
|
130
136
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
131
137
|
if (signal?.aborted)
|
|
132
138
|
onAbort();
|
|
133
|
-
child.exited.then(() => {
|
|
139
|
+
child.exited.then((exitCode) => {
|
|
134
140
|
exitSeen = true;
|
|
141
|
+
if (bounded || ended !== null || settled)
|
|
142
|
+
return;
|
|
143
|
+
let turns = 0;
|
|
144
|
+
const drain = () => {
|
|
145
|
+
if (ended !== null || settled)
|
|
146
|
+
return;
|
|
147
|
+
if (turns++ < DRAIN_EXTRA_TURNS) {
|
|
148
|
+
drainTimer = setTimeout(drain, 0);
|
|
149
|
+
if (options.unref)
|
|
150
|
+
unref(drainTimer);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
out.cancel();
|
|
154
|
+
err.cancel();
|
|
155
|
+
const signalCode = signalName(child.signalCode);
|
|
156
|
+
settle({ kind: "incomplete", exitCode, signalCode, stdout: out.snapshot(), stderr: err.snapshot() });
|
|
157
|
+
};
|
|
158
|
+
drainTimer = setTimeout(drain, drainMs);
|
|
159
|
+
if (options.unref)
|
|
160
|
+
unref(drainTimer);
|
|
135
161
|
}, () => {
|
|
136
162
|
return;
|
|
137
163
|
});
|
|
@@ -253,7 +279,7 @@ function clip(text) {
|
|
|
253
279
|
function interpretScan(run, timeoutSeconds) {
|
|
254
280
|
const stderr = run.stderr.trim();
|
|
255
281
|
if (run.kind !== "exited") {
|
|
256
|
-
const why = run.kind === "timeout" ? `impeccable detect did not finish within ${timeoutSeconds}s and was killed` : run.kind === "aborted" ? "impeccable detect was cancelled" : "impeccable detect ended without an exit status";
|
|
282
|
+
const why = run.kind === "timeout" ? `impeccable detect did not finish within ${timeoutSeconds}s and was killed` : run.kind === "aborted" ? "impeccable detect was cancelled" : run.kind === "incomplete" ? `impeccable detect exited ${run.exitCode}, but a process it started kept its output open; the output is incomplete` : "impeccable detect ended without an exit status";
|
|
257
283
|
return { ok: false, status: run.kind, findings: null, text: [why, stderr].filter(Boolean).join(`
|
|
258
284
|
`) };
|
|
259
285
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srobroek/pi-design",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "UI and UX design skills: design-system audit, DESIGN.md, rendered-surface review, accessibility audit, motion, microcopy, prototypes, and wireframes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|