@feigi/fleet-ctl 3.73.1 → 3.73.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.
- package/package.json +1 -1
- package/scripts/main-checkout.mjs +18 -8
- package/scripts/suite-slot.mjs +12 -5
package/package.json
CHANGED
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
// switch and a switch back between two ticks; a stray commit pushed to `main`
|
|
34
34
|
// in a repository with no protecting ruleset. This is a backstop for
|
|
35
35
|
// accidents, not for adversaries.
|
|
36
|
+
// If the pack holding the baseline commit is unreadable, git reports exactly
|
|
37
|
+
// what it reports for a pruned commit, so the result is `missing`; an
|
|
38
|
+
// unopenable loose object or a broken alternate is `unknown` with a read
|
|
39
|
+
// cause instead (see `headMove`).
|
|
36
40
|
//
|
|
37
41
|
// THE PROTECTED SET is the non-ignored paths of the main checkout — what the
|
|
38
42
|
// member-write-guard protects — and its HEAD. `.fleet/`, `.worktrees/` and
|
|
@@ -144,8 +148,9 @@ function git(what, args, cwd, env) {
|
|
|
144
148
|
});
|
|
145
149
|
if (!r.error && r.status === 0) return { ok: true, stdout: r.stdout };
|
|
146
150
|
if (r.error) return { ok: false, why: `${what} did not run: ${r.error.code ?? r.error.message}`, status: null };
|
|
147
|
-
const
|
|
148
|
-
|
|
151
|
+
const stderr = String(r.stderr ?? "").trim();
|
|
152
|
+
const last = stderr.split("\n").at(-1);
|
|
153
|
+
return { ok: false, why: `${what} ${r.signal ? `killed by ${r.signal}` : `exited ${r.status}`}${last ? `: ${last}` : ""}`, status: r.status, stderr };
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
/** The main checkout `cwd` belongs to: `{ok, root}` or `{ok: false, why}`. */
|
|
@@ -301,10 +306,14 @@ function originMain(root, env) {
|
|
|
301
306
|
* read clean, while a stray commit, a reset or an amend do not. `origin/main`
|
|
302
307
|
* is read even when HEAD equals the baseline: a checkout that cannot name it
|
|
303
308
|
* is one this cannot vouch for.
|
|
304
|
-
* A failed ancestry read is followed by `git
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
309
|
+
* A failed ancestry read is followed by `git rev-parse -q --verify B^{commit}`.
|
|
310
|
+
* Only exit 1 with nothing on stderr is the missing answer: that is what an
|
|
311
|
+
* absent commit gives. Exit 1 with anything on stderr means git could not
|
|
312
|
+
* settle absence — an unopenable loose object, a broken alternate, an object
|
|
313
|
+
* that is not a commit, or output unrelated to the object such as GIT_TRACE's
|
|
314
|
+
* — and that read's own failure is returned, so `why` carries what git
|
|
315
|
+
* printed. Anything else, a corrupt object's exit 128 included, keeps the
|
|
316
|
+
* ancestry failure.
|
|
308
317
|
*/
|
|
309
318
|
function headMove(root, env, was, now) {
|
|
310
319
|
const origin = originMain(root, env);
|
|
@@ -315,8 +324,9 @@ function headMove(root, env, was, now) {
|
|
|
315
324
|
const ancestor = git("git merge-base --is-ancestor", ["merge-base", "--is-ancestor", was.oid, now.oid], root, env);
|
|
316
325
|
if (!ancestor.ok) {
|
|
317
326
|
if (ancestor.status === 1) return moved;
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
327
|
+
const probe = git("git rev-parse --verify", ["rev-parse", "-q", "--verify", `${was.oid}^{commit}`], root, env);
|
|
328
|
+
if (probe.ok || probe.status !== 1) return ancestor;
|
|
329
|
+
if (probe.stderr !== "") return probe;
|
|
320
330
|
return { ok: false, missing: true, why: `baseline commit ${was.oid.slice(0, 7)} is missing from this repository; HEAD is ${headLabel(now)}` };
|
|
321
331
|
}
|
|
322
332
|
const stray = git("git rev-list", ["rev-list", "--max-count=1", `${was.oid}..${now.oid}`, "^refs/remotes/origin/main"], root, env);
|
package/scripts/suite-slot.mjs
CHANGED
|
@@ -25,11 +25,18 @@
|
|
|
25
25
|
// the home directory rather than a workspace's `.fleet/` because the bound is
|
|
26
26
|
// host-wide and a review's snapshot is no repository. The holder stamps its own
|
|
27
27
|
// pid and releases on exit; a holder killed without releasing is taken over by
|
|
28
|
-
// the next waiter, so a SIGKILLed wrapper never wedges a slot.
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// running.
|
|
28
|
+
// the next waiter, so a SIGKILLed wrapper never wedges a slot. The takeover
|
|
29
|
+
// does not stop the dead holder's test run, so a wrapper killed with SIGKILL
|
|
30
|
+
// alone leaves its run going uncounted and the host over its bound until that
|
|
31
|
+
// run ends; stop a wrapper with SIGTERM, which it forwards to the `sh -c`
|
|
32
|
+
// running its entrypoint, releasing its slot once that shell exits. The run
|
|
33
|
+
// stops with it only if that shell execs the run, as `exec node --test` does;
|
|
34
|
+
// a compound entrypoint (`cd sub && make test`), or a script that neither
|
|
35
|
+
// execs nor relays the signal, can leave the run going past the release,
|
|
36
|
+
// uncounted as after a SIGKILL. What the takeover cannot clear — an empty or
|
|
37
|
+
// partial lock whose writer died before stamping its pid, and a leftover
|
|
38
|
+
// `<i>.lock.reap` — is named on the way out of an expired wait, for the
|
|
39
|
+
// operator to remove by hand once nothing is running.
|
|
33
40
|
//
|
|
34
41
|
// Environment:
|
|
35
42
|
// FLEET_SUITE_SLOTS number of slots N, a positive integer. Default 2.
|