@feigi/fleet-ctl 3.41.0 → 3.41.1
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 +42 -11
- package/skills/run-team/SKILL.md +10 -4
package/package.json
CHANGED
|
@@ -66,8 +66,10 @@
|
|
|
66
66
|
// unknown — some read failed: git, a hash, HEAD, `origin/main`, or a baseline
|
|
67
67
|
// that EXISTS but cannot be read (unreadable file, unsearchable
|
|
68
68
|
// `.fleet/`, dangling symlink, not written by --record) — or is a
|
|
69
|
-
// v1 baseline, which says nothing of HEAD: re-record it
|
|
70
|
-
//
|
|
69
|
+
// v1 baseline, which says nothing of HEAD: re-record it — or names
|
|
70
|
+
// a commit absent from the repository: examine HEAD, then
|
|
71
|
+
// re-record it. "A failure is an unknown answer, never a 'no'" —
|
|
72
|
+
// never `clean`.
|
|
71
73
|
// absent — no baseline at all: the run never recorded one. A refusal
|
|
72
74
|
// ("record at run start"), never `clean`.
|
|
73
75
|
//
|
|
@@ -78,7 +80,20 @@
|
|
|
78
80
|
// so it refuses on every unknown cause it can see: a baseline that exists but
|
|
79
81
|
// cannot be read, and any failed git or hash read (no snapshot, nothing to
|
|
80
82
|
// write). A detached HEAD has no symbolic ref to record, so it refuses that
|
|
81
|
-
// too. A v1 baseline
|
|
83
|
+
// too. A v1 baseline, and one whose commit is gone (it never reads the
|
|
84
|
+
// recorded commit), it overwrites without a word.
|
|
85
|
+
//
|
|
86
|
+
// A BASELINE COMMIT GONE FROM THE REPOSITORY is its own unknown. An amend or
|
|
87
|
+
// reset leaves the baseline's commit unreachable, and once reflog expiry and
|
|
88
|
+
// gc prune it the ancestry read fails where it would have answered `dirty`.
|
|
89
|
+
// What failed is the baseline, not the environment, so "fix the failure and
|
|
90
|
+
// never re-baseline" would forbid the one remedy: the advice is to examine
|
|
91
|
+
// HEAD against `origin/main` FIRST — the move off that commit is unexamined —
|
|
92
|
+
// and only then re-record. The check returns before it compares paths, so the
|
|
93
|
+
// advice also says to resolve any stray paths. On the baseline's own branch it
|
|
94
|
+
// is still `unknown`, never `dirty` or `clean`: the read that would have
|
|
95
|
+
// judged the move could not be made. A different branch reads `dirty` before
|
|
96
|
+
// any ancestry read.
|
|
82
97
|
//
|
|
83
98
|
// ROOT. The main checkout is the parent of `git rev-parse --git-common-dir`
|
|
84
99
|
// (git-env.mjs's `workspaceDirFromGitCommonDir`, as fleet-tick.mjs resolves
|
|
@@ -272,13 +287,18 @@ function originMain(root, env) {
|
|
|
272
287
|
|
|
273
288
|
/**
|
|
274
289
|
* Did HEAD move off the baseline's? `{ok, change}`: `change` is null, or the
|
|
275
|
-
* `HEAD <was> → <now>` entry; `{ok: false, why}` when a read failed
|
|
290
|
+
* `HEAD <was> → <now>` entry; `{ok: false, why}` when a read failed, with
|
|
291
|
+
* `missing: true` when the failure is the baseline's commit being absent.
|
|
276
292
|
* Clean is all of: the same symbolic ref; the baseline's commit an ancestor of
|
|
277
293
|
* HEAD or equal to it; no commit in `B..HEAD` that `origin/main` lacks. So a
|
|
278
294
|
* fast-forward to `origin/main` and a commit already unpushed at the baseline
|
|
279
295
|
* read clean, while a stray commit, a reset or an amend do not. `origin/main`
|
|
280
296
|
* is read even when HEAD equals the baseline: a checkout that cannot name it
|
|
281
297
|
* is one this cannot vouch for.
|
|
298
|
+
* A failed ancestry read is followed by `git cat-file -e B`, which exits 1
|
|
299
|
+
* for an absent object and 0 for a present one, even a corrupt one;
|
|
300
|
+
* `-e B^{commit}` exits 128 for both, so it cannot tell them apart. Only
|
|
301
|
+
* exit 1 is the missing answer; anything else keeps the ancestry failure.
|
|
282
302
|
*/
|
|
283
303
|
function headMove(root, env, was, now) {
|
|
284
304
|
const origin = originMain(root, env);
|
|
@@ -287,7 +307,12 @@ function headMove(root, env, was, now) {
|
|
|
287
307
|
if (now.ref !== was.ref) return moved;
|
|
288
308
|
if (now.oid === was.oid) return { ok: true, change: null };
|
|
289
309
|
const ancestor = git("git merge-base --is-ancestor", ["merge-base", "--is-ancestor", was.oid, now.oid], root, env);
|
|
290
|
-
if (!ancestor.ok)
|
|
310
|
+
if (!ancestor.ok) {
|
|
311
|
+
if (ancestor.status === 1) return moved;
|
|
312
|
+
const present = git("git cat-file -e", ["cat-file", "-e", was.oid], root, env);
|
|
313
|
+
if (present.ok || present.status !== 1) return ancestor;
|
|
314
|
+
return { ok: false, missing: true, why: `baseline commit ${was.oid.slice(0, 7)} is missing from this repository; HEAD is ${headLabel(now)}` };
|
|
315
|
+
}
|
|
291
316
|
const stray = git("git rev-list", ["rev-list", "--max-count=1", `${was.oid}..${now.oid}`, "^refs/remotes/origin/main"], root, env);
|
|
292
317
|
if (!stray.ok) return stray;
|
|
293
318
|
return stray.stdout.trim() === "" ? { ok: true, change: null } : moved;
|
|
@@ -345,9 +370,10 @@ export function changedPaths(baseline, current) {
|
|
|
345
370
|
|
|
346
371
|
/**
|
|
347
372
|
* The tick's question: `{state, root?, baseline?, changed?, headMove?, why?, cause?}`.
|
|
348
|
-
* `cause` tells the
|
|
373
|
+
* `cause` tells the four unknowns apart — `"baseline"` (it exists but cannot
|
|
349
374
|
* be read), `"outdated"` (a v1 baseline: it says nothing of HEAD, so it can
|
|
350
|
-
* answer nothing)
|
|
375
|
+
* answer nothing), `"missing"` (the baseline's commit is absent from the
|
|
376
|
+
* repository) and `"read"` (git or a hash failed) — since each has its own
|
|
351
377
|
* message. The baseline is read before the tree, because without one there
|
|
352
378
|
* is nothing to compare against and no reason to look.
|
|
353
379
|
* A HEAD move is the first entry of `changed`, also named in `headMove`.
|
|
@@ -359,13 +385,13 @@ export function checkMainCheckout({ cwd = process.cwd(), env = process.env } = {
|
|
|
359
385
|
const path = baselinePath(root);
|
|
360
386
|
const base = readBaseline(path);
|
|
361
387
|
if (base.status === "absent") return { state: "absent", root, baseline: path };
|
|
362
|
-
|
|
363
|
-
if (base.status === "
|
|
364
|
-
|
|
388
|
+
const unknown = (why, cause = "read") => ({ state: "unknown", cause, root, baseline: path, why });
|
|
389
|
+
if (base.status === "unreadable") return unknown(base.why, "baseline");
|
|
390
|
+
if (base.status === "outdated") return unknown(base.why, "outdated");
|
|
365
391
|
const now = readState(root, env);
|
|
366
392
|
if (!now.ok) return unknown(now.why);
|
|
367
393
|
const move = headMove(root, env, base.head, now.head);
|
|
368
|
-
if (!move.ok) return unknown(move.why);
|
|
394
|
+
if (!move.ok) return unknown(move.why, move.missing ? "missing" : "read");
|
|
369
395
|
const changed = changedPaths(base.entries, now.entries);
|
|
370
396
|
if (move.change !== null) changed.unshift(move.change);
|
|
371
397
|
if (!changed.length) return { state: "clean", root, baseline: path };
|
|
@@ -400,6 +426,11 @@ export function describe(check, live = null) {
|
|
|
400
426
|
return `MAIN-CHECKOUT-UNKNOWN ${check.why}${members}`
|
|
401
427
|
+ ` — dispatch held: resolve any stray paths FIRST, then re-record with ${RECORD_COMMAND} (it overwrites, it does not compare)`;
|
|
402
428
|
}
|
|
429
|
+
if (check.cause === "missing") {
|
|
430
|
+
return `MAIN-CHECKOUT-UNKNOWN ${check.why}${members}`
|
|
431
|
+
+ " — dispatch held: examine HEAD against origin/main FIRST, since a missing baseline commit means HEAD moved off it by an amend or reset nobody has looked at, and resolve any stray paths;"
|
|
432
|
+
+ ` then re-record with ${RECORD_COMMAND} (it overwrites, it does not compare)`;
|
|
433
|
+
}
|
|
403
434
|
return check.cause === "baseline"
|
|
404
435
|
? `MAIN-CHECKOUT-UNKNOWN baseline unreadable: ${check.why}${members}`
|
|
405
436
|
+ " — dispatch held: fix the baseline so it can be read; NEVER re-baseline over it, --record overwrites rather than compares"
|
package/skills/run-team/SKILL.md
CHANGED
|
@@ -309,7 +309,9 @@ phase, or in any later one, asks the maintainer which tickets to take.
|
|
|
309
309
|
certifies them. **Never re-record over `MAIN-CHECKOUT-UNKNOWN`**: that
|
|
310
310
|
walks the run from "could not look" to "certified clean" in one step, so
|
|
311
311
|
`--record` itself refuses over a baseline it cannot read and on any git
|
|
312
|
-
read that fails.
|
|
312
|
+
read that fails. The exceptions are a v1 baseline and a baseline whose
|
|
313
|
+
commit is missing from the repository; Phase 3's tick lines say how each
|
|
314
|
+
is cleared. `main-checkout.mjs --check` prints the same answer
|
|
313
315
|
without a tick.
|
|
314
316
|
|
|
315
317
|
**Run the pre-flight, once the pin and the baseline are recorded.**
|
|
@@ -1942,9 +1944,13 @@ depth** guard table applied in code. Act on each line as it reads:
|
|
|
1942
1944
|
could not look: a git or hash read failed (`could not look:`), or the
|
|
1943
1945
|
baseline exists but cannot be read (`baseline unreadable:`). Never clean,
|
|
1944
1946
|
and **never re-baseline over it** — `--record` overwrites, so that certifies
|
|
1945
|
-
a tree nobody read. Fix what the line names and tick again. The
|
|
1946
|
-
|
|
1947
|
-
of HEAD
|
|
1947
|
+
a tree nobody read. Fix what the line names and tick again. The exceptions
|
|
1948
|
+
are the two whose remedy is `--record`: `baseline v1 — re-record`, an
|
|
1949
|
+
old-format baseline that says nothing of HEAD; and `baseline commit <oid> is
|
|
1950
|
+
missing from this repository`, which an amend or reset followed by gc
|
|
1951
|
+
leaves — examine HEAD against `origin/main` FIRST, since HEAD moved off
|
|
1952
|
+
that commit and nobody has looked at the move, and resolve any stray paths,
|
|
1953
|
+
which the line does not name; only then re-record.
|
|
1948
1954
|
- `MAIN-CHECKOUT-NO-BASELINE …` with `HOLD (main checkout no baseline)` — no
|
|
1949
1955
|
baseline was recorded. Yours to fix: run Phase 0's `--record`. A baseline
|
|
1950
1956
|
that vanished mid-run is not a fresh run — report it to the maintainer
|