@feigi/fleet-ctl 3.73.0 → 3.73.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.73.0",
3
+ "version": "3.73.2",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -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 last = String(r.stderr ?? "").trim().split("\n").at(-1);
148
- return { ok: false, why: `${what} ${r.signal ? `killed by ${r.signal}` : `exited ${r.status}`}${last ? `: ${last}` : ""}`, status: r.status };
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 cat-file -e B`, which exits 1
305
- * for an absent object and 0 for a present one, even a corrupt one;
306
- * `-e B^{commit}` exits 128 for both, so it cannot tell them apart. Only
307
- * exit 1 is the missing answer; anything else keeps the ancestry failure.
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 present = git("git cat-file -e", ["cat-file", "-e", was.oid], root, env);
319
- if (present.ok || present.status !== 1) return ancestor;
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);