@feigi/fleet-ctl 3.23.30 → 3.23.31

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.23.30",
3
+ "version": "3.23.31",
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": {
@@ -163,15 +163,20 @@ function parseArgs(argv) {
163
163
  // its own refusal. But it has no exit status and mostly no stderr, so `err`
164
164
  // names the kill, after whatever git did write — a caller quoting `err` would
165
165
  // otherwise quote an empty reason.
166
+ //
167
+ // A git that ignores the buffer kill can still exit 0, with no signal, after
168
+ // its output was cut off: any `error` on a git that ran fails it, whatever its
169
+ // exit status, and `err` names that error without claiming a kill.
166
170
  function git(args, cwd) {
167
171
  const r = spawnSync("git", args, { cwd, env: ENV, encoding: "utf8" });
168
172
  if (r.error && !r.pid) throw cannot(`could not start git: ${r.error.message}`);
169
173
  const err = (r.stderr ?? "").trim();
170
- const killed = r.signal && `git was killed by ${r.signal}${killCause(r.error)}`;
171
- return { ok: r.status === 0, out: (r.stdout ?? "").replace(/\n$/, ""), err: [err, killed].filter(Boolean).join("; ") };
174
+ const failed = r.signal ? `git was killed by ${r.signal}` : r.error && `git exited ${r.status} after an error`;
175
+ const note = failed && `${failed}${errorCause(r.error)}`;
176
+ return { ok: r.status === 0 && !r.error, out: (r.stdout ?? "").replace(/\n$/, ""), err: [err, note].filter(Boolean).join("; ") };
172
177
  }
173
178
 
174
- function killCause(error) {
179
+ function errorCause(error) {
175
180
  if (!error) return "";
176
181
  if (error.code === "ENOBUFS") return " (ENOBUFS: its output outgrew the spawn buffer)";
177
182
  return ` (${error.code ?? error.message})`;
@@ -595,6 +595,32 @@ test("a git that exits non-zero is refused with exactly its stderr, naming no si
595
595
  assert.doesNotMatch(r.err, /killed/);
596
596
  });
597
597
 
598
+ // A `status` stub that ignores SIGTERM — and so does every command it starts —
599
+ // writes `?? ` and then `bytes` x's, and exits 0.
600
+ const trapTermStatus = (bytes) => `trap '' TERM; printf '?? '; head -c ${bytes} /dev/zero | tr '\\0' x; exit 0`;
601
+
602
+ // Past spawnSync's default 1 MiB buffer the kill that ENOBUFS sends is
603
+ // ignored: git exits 0 with no signal, but its output was cut off. That is a
604
+ // failed git, refused with a reason naming the overrun — read as ok, the
605
+ // truncated status would pass for a dirty tree.
606
+ test("a git that exits 0 after outgrowing the spawn buffer is refused, naming the overrun", () => {
607
+ const { dir } = repo(MAVEN_FILES);
608
+ const r = prove(dir, COUNT_PROOF, { env: { PATH: fakeGit("status*", trapTermStatus(2_000_000)) } });
609
+ assert.equal(r.status, 1, r.err);
610
+ assert.match(r.err, /NOT PROVEN — could not read the tree state in the throwaway worktree: git exited 0 after an error \(ENOBUFS: its output outgrew the spawn buffer\); install output: /);
611
+ assert.doesNotMatch(r.err, /killed|could not start git/);
612
+ });
613
+
614
+ // The control: the same stub writing 1000 bytes is a git that succeeded, its
615
+ // output read whole — here, one untracked path the Install step left.
616
+ test("the same SIGTERM-trapping git with small output is ok, its output intact", () => {
617
+ const { dir } = repo(MAVEN_FILES);
618
+ const r = prove(dir, COUNT_PROOF, { env: { PATH: fakeGit("status*", trapTermStatus(997)) } });
619
+ assert.equal(r.status, 1, r.err);
620
+ assert.match(r.err, /NOT PROVEN — the Install step changed the tree \(first: \?\? x{997}\); /);
621
+ assert.doesNotMatch(r.err, /ENOBUFS|could not read the tree state/);
622
+ });
623
+
598
624
  // A killed `worktree remove` is a failed one: cleanup falls back to the plain
599
625
  // delete, and the proof's own NOT PROVEN — which keeps its log directory,
600
626
  // the throwaway worktree's parent — stands.