@feigi/fleet-ctl 3.148.2 → 3.150.0
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/commands/run-merge-bot.md +4 -4
- package/package.json +1 -1
- package/scripts/board-gather.mjs +91 -76
- package/scripts/board.html +46 -44
- package/scripts/compute-board.mjs +6 -5
- package/scripts/compute-cell-evidence.mjs +222 -316
- package/scripts/fleet-event.mjs +173 -15
- package/scripts/fleet-tick.mjs +5 -4
- package/scripts/ledger.mjs +31 -22
- package/scripts/ticket-router.mjs +1 -1
- package/skills/run-team/SKILL.md +5 -5
- package/skills/run-team/references/finisher.md +9 -4
- package/skills/run-team/references/ledger.md +1 -1
- package/skills/run-team/references/member-lifecycle.md +1 -1
|
@@ -45,11 +45,11 @@ Nothing else names that head. A commit's dates are when it was made, not when it
|
|
|
45
45
|
|
|
46
46
|
**Route `current` — the recorded head is the current head — is the normal case, and it proceeds untouched** — label applied, head unchanged, merge goes ahead exactly as it did before this gate existed.
|
|
47
47
|
|
|
48
|
-
**Route `gate` — the recorded head is not the current head — is not refused on sight: it may be a rebase-carry, and the merge gate decides.** The label binds to the change the finisher audited, not to one SHA: a rewrite that leaves the PR's net change byte-identical — a conflict-free rebase onto a newer `main` — keeps it, and anything a push adds, drops or edits does not, whenever it was pushed and however its commits are dated. So, in the main checkout after a plain `git fetch origin`, run step 3's gate now, before step 1, with `--pre <record>` and no `--post`. **`rebaseCarry` null → refuse:** report `head-moved-after-label-#<pr>` and stop on that PR. Leave the label where it is — you audited nothing and removing another member's verdict is not yours to do. What clears it is a **fresh** finisher against the new head; the first audit does not transfer, because it verified a different tree. Non-null → the current head carries the labelled head's change: `--pre` stays the labelled head on every later gate run, step 1's `pre` must read `rebaseCarry.accepted` (any other head is a push since the proof — refuse with `head-moved-after-label-#<pr>`), and your report names the carry as `rebase-carry-#<pr>` with both SHAs.
|
|
48
|
+
**Route `gate` — the recorded head is not the current head — is not refused on sight: it may be a rebase-carry, and the merge gate decides.** The label binds to the change the finisher audited, not to one SHA: a rewrite that leaves the PR's net change byte-identical — a conflict-free rebase onto a newer `main` — keeps it, and anything a push adds, drops or edits does not, whenever it was pushed and however its commits are dated. So, in the main checkout after a plain `git fetch origin`, run step 3's gate now, before step 1, with `--pre <record>` and no `--post`. **`rebaseCarry` null → refuse:** report `head-moved-after-label-#<pr>` and stop on that PR. Leave the label where it is — you audited nothing and removing another member's verdict is not yours to do; your report's settle takes it off before the fresh finisher. What clears it is a **fresh** finisher against the new head; the first audit does not transfer, because it verified a different tree. Non-null → the current head carries the labelled head's change: `--pre` stays the labelled head on every later gate run, step 1's `pre` must read `rebaseCarry.accepted` (any other head is a push since the proof — refuse with `head-moved-after-label-#<pr>`), and your report names the carry as `rebase-carry-#<pr>` with both SHAs.
|
|
49
49
|
|
|
50
50
|
**Route `timeline` — no record, a hand-added label or one applied before its labeller recorded a head — falls back to the timeline, which can refuse a moved head but never name the labelled one.** The command has already read it, `gh api repos/{owner}/{repo}/issues/<pr>/timeline?per_page=100 --paginate`, and printed the verdict as `timeline: {label, verdict, after}`, `label` the Label map's string for `ready-to-merge`. Run the command before `gh pr update-branch`, on this route too: your own rebase lands commits after the label by construction, so once you have rebased this read can no longer tell your commits from someone else's.
|
|
51
51
|
|
|
52
|
-
`verdict` is `moved` when a `committed` or `head_ref_force_pushed` event follows the last `labeled` event for that string, `after` listing those events as `<event> <sha>`; otherwise `clean`. **`moved` with no record → refuse:** report `head-moved-after-label-#<pr>` and stop on that PR, the label left where it is — nothing names a head the label was applied to, so no carry can be proven. **`clean` is the normal case, and it proceeds untouched.** A timeline with no `labeled` event for that string has no verdict: the label is on the PR, so a read that never saw it applied came back empty or wrong, and the command exits 2 with `step` `read-timeline`.
|
|
52
|
+
`verdict` is `moved` when a `committed` or `head_ref_force_pushed` event follows the last `labeled` event for that string, `after` listing those events as `<event> <sha>`; otherwise `clean`. **`moved` with no record → refuse:** report `head-moved-after-label-#<pr>` and stop on that PR, the label left where it is for your report's settle to take off — nothing names a head the label was applied to, so no carry can be proven. **`clean` is the normal case, and it proceeds untouched.** A timeline with no `labeled` event for that string has no verdict: the label is on the PR, so a read that never saw it applied came back empty or wrong, and the command exits 2 with `step` `read-timeline`.
|
|
53
53
|
|
|
54
54
|
Record the head before you rebase — the `head` the command printed, read before anything moved it — because step 3 hands it to the merge gate as `--pre` and nothing later can reconstruct it. Where step 1 runs, that is its `pre`; on an already-current PR it is simply the head you merge. After a carry, `--pre` is the labelled head instead.
|
|
55
55
|
|
|
@@ -142,7 +142,7 @@ For each labeled PR, lowest first:
|
|
|
142
142
|
|
|
143
143
|
**Why the ref and not `headRefOid`: during the PR object's lag both operands go stale in the SAME direction, so that compare fails OPEN as readily as it fails closed.** The false STOP is the visible half — the worktree holds the rebased head, the PR object still holds the pre-rebase sha, and a correct tree comes back `worktree-diverged-#<pr>`, costing a pass. The silent half is the one that ships: a worktree that has not fetched since the rebase sits on that same pre-rebase sha, so BOTH sides read it, the check reads **Equal**, and this fallback verifies a tree the remote no longer has while step 4 merges the head it does — a green measured against a tree no merge will take, which is the exact failure the STOP arm below exists to prevent, reached through the arm that passes. Measured at the sibling site (`run-team/SKILL.md` phase 1) in a scratch repo: a clone unfetched since the rebase resolved `origin/<branch>` to the pre-rebase commit with its subject unchanged, while `git ls-remote origin refs/heads/<branch>` read the true tip from that same clone. **Re-reading `headRefOid` on a settle window does not reach that half at all** — it fires only where the two disagree — which is why the operand changes here rather than the verdict gaining a window.
|
|
144
144
|
|
|
145
|
-
**Unequal → `git fetch origin` and read the ref once more, then decide on that second reading. Bounded at one re-read, never a third.** Neither operand is a cached value, so a stable second reading cannot flip the verdict; what the re-read is for is the ref MOVING while you verify, which is live here because one way into this fallback is a step-1 poll whose cap ran out with the ref unmoved, and that call is async — it can land a moment after you gave up on it. The two readings differ → the head is not settled and the audit behind the label verified a tree that is already gone, so **refuse: report `head-moved-after-label-#<pr>` and stop**, label
|
|
145
|
+
**Unequal → `git fetch origin` and read the ref once more, then decide on that second reading. Bounded at one re-read, never a third.** Neither operand is a cached value, so a stable second reading cannot flip the verdict; what the re-read is for is the ref MOVING while you verify, which is live here because one way into this fallback is a step-1 poll whose cap ran out with the ref unmoved, and that call is async — it can land a moment after you gave up on it. The two readings differ → the head is not settled and the audit behind the label verified a tree that is already gone, so **refuse: report `head-moved-after-label-#<pr>` and stop**, the label left for your report's settle to take off, the same verdict and the same remedy — a fresh finisher against the new head — the gate above reaches for a head that moved after the audit. Do not read a third time; that is the unbounded wait step 1 had to be written out of. The two readings agree → the mismatch is real and belongs to one of the two arms below. **`Equal` is not among the outcomes a surviving mismatch can reach**: a worktree that is not on the branch ref never passes this check, whatever the PR object says.
|
|
146
146
|
|
|
147
147
|
**Ahead or behind is the `unique` verdict of `~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run unique-in-upstream.mjs --worktree <worktree> --upstream origin/<branch>`, run after that fetch — not the sha compare.** A rebase orphans the pre-rebase head, so the ref does not carry the worktree's commits BY SHA even where it carries every patch in them; read the mismatch as "commits the ref lacks" and a worktree holding no work of its own answers yes and takes the STOP. Patch equivalence is the question, and the verdict is not a raw `git cherry` line: a patch id ignores position and whitespace, so an unpushed commit that repeats a change the branch carries elsewhere in the file, or differs from it by whitespace alone, reads `-` there and the STOP would not fire. The script reads `unique` true when `git cherry` shows a `+`, `origin/<branch>..HEAD` holds a merge commit, or merging HEAD into `origin/<branch>` conflicts or makes a tree other than the branch's own: `"unique": true` → ahead; `"unique": false` → behind, a worktree the rebase superseded included — unless its branch carried a merge commit the rebase dropped. The worktree still holds that merge, so it reads `"unique": true` with `merges` above 0, `content.paths` empty and every `listing` line `-`, and takes the STOP as ahead though it holds no work of its own; say in the report that the merge is all it holds. Exit 2 is no verdict — the read failed and the error is named — and is not behind: take the STOP, report `worktree-diverged-#<pr>` and quote the error.
|
|
148
148
|
|
|
@@ -209,7 +209,7 @@ For each labeled PR, lowest first:
|
|
|
209
209
|
|
|
210
210
|
Each `reason` is a fact the gate now enforces, not a step you run:
|
|
211
211
|
|
|
212
|
-
- **`head-moved-after-label`** — the PR head is neither `pre` nor `post`, nor a head whose net change the gate proved identical to `pre`'s (`rebaseCarry`, which names both). **Any third SHA is a push that landed while you waited on CI, and no CI check can see it**: `ci-state.mjs` selects the run whose `headSha` equals the *current* PR head (`scripts/ci-state.mjs`, the `r.headSha === prHead` filter), so a member's push plus its own green run satisfies every CI check while the audit behind the label belongs to a tree that is gone. A carry is proven only for the head `gh pr view` read; a different head at `ci-state`'s own read is still this row. The remedy is a fresh finisher against the new head
|
|
212
|
+
- **`head-moved-after-label`** — the PR head is neither `pre` nor `post`, nor a head whose net change the gate proved identical to `pre`'s (`rebaseCarry`, which names both). **Any third SHA is a push that landed while you waited on CI, and no CI check can see it**: `ci-state.mjs` selects the run whose `headSha` equals the *current* PR head (`scripts/ci-state.mjs`, the `r.headSha === prHead` filter), so a member's push plus its own green run satisfies every CI check while the audit behind the label belongs to a tree that is gone. A carry is proven only for the head `gh pr view` read; a different head at `ci-state`'s own read is still this row. The remedy is a fresh finisher against the new head: the bot leaves the label, and its report's settle takes it off before that finisher.
|
|
213
213
|
- **`main-gain-removed:<path>`** — merging this head would remove lines `main` gained after the PR's work began: lines a later merge landed, deleted by a branch commit that every rebase since has replayed without a conflict, so no conflict preview and no `origin/main...HEAD` read is sure to show them. `mainGain.hits[]` names each file, the landing key (`#<n>` for a merged PR, else the landing commit's 12-character SHA), the removed lines, each hunk that held any of them (`hunks[]`: the line numbers, the `added` lines the removed tokens were compared against, and the `missing` tokens with counts, a blank line's token written `"\n"`), and the `ack` line to copy. Skip the PR, leave the label alone, and report `main-gain-removed:<path>-#<pr>` with the hit list and the keys. Never restore the lines yourself — the removal may be deliberate. It clears when the PR stops removing them or its body carries `main-gain-removal: <path> <key> - <why>` for every hit; the gate reads the body each run, so editing it is enough. An acknowledged removal is listed in `mainGain.acknowledged[]` and the gate passes it — name each one, with its reason, in your report. Your report's `refused[]` entry for the PR carries the gate's `reason` as it printed it, `main-gain-removed:<path>`, and the gate's `--out` file above stays where the gate wrote it: the controller parks the PR off that entry, at the `head` and `bodyDigest` that file records the gate refused, and no merge bot is dispatched on the PR's account until its head or its body changes — though a bot dispatched for another queued PR may still evaluate it again.
|
|
214
214
|
|
|
215
215
|
Each hit line carries a `kind`: `modified` when the hunk that removed it also adds lines, none of which claimed it as an in-place edit, or `deleted` when the hunk only removes lines. The gate clears a gained line, lists it in `mainGain.edited[]` with the `rule` that cleared it, and passes it, by three rules. `line`: a removed line edited in place that keeps every token of its text, one entry per line. `hunk`: every removed line of a hunk that adds lines — gained and older lines alike, a blank line counting as one blank token — has its tokens among the hunk's added lines, as a re-wrap does, so the gained lines no `line` entry covers clear together. `retracted #N`: the hunk rule fails only because the PR deleted a forward reference to a ticket it closes (`once #N lands`, `until #N ships` and the like), so the reference's tokens are dropped from the removed side and the one token after it may differ from an added token in case alone; `N` lists every closing issue its removed phrases named, and a PR that only refers to the ticket (`Refs #N`) gets no such clearing. A `hunk` or `retracted #N` entry is one per cleared hunk: `line` is its first cleared gained line, `text` the cleared lines joined with a newline and `replacement` the added lines compared. Tokens never cross hunks, and a hunk that only removes lines is never cleared, so a `deleted` line is always a hit. The gate reads which issues the PR closes from the references `--closing-refs` carries, echoed as `closes`, `null` when they could not be read, which turns the retraction rule off.
|
package/package.json
CHANGED
package/scripts/board-gather.mjs
CHANGED
|
@@ -36,7 +36,6 @@ import { RECEIPT, RECEIPT_HELD, CLOSEOUT_RECEIPT, OBJECTIVES, isOmpSessionDirNam
|
|
|
36
36
|
import { lastSegment } from "./pull-attribution.mjs";
|
|
37
37
|
import { NAME, warnOnce, execRead } from "./board-common.mjs";
|
|
38
38
|
import { mergedReadPrs, issuesOfPrs } from "./compute-board.mjs";
|
|
39
|
-
import { repoIdentity } from "./compute-cell-evidence.mjs";
|
|
40
39
|
import { readCostGuard } from "./fleet-tick.mjs";
|
|
41
40
|
import { parseFrontmatter } from "./tier-roles.mjs";
|
|
42
41
|
import { isImplementer } from "./member-outcomes.mjs";
|
|
@@ -841,30 +840,15 @@ export function readCloseoutPr(stateDir) {
|
|
|
841
840
|
return { number: Number(number), at: typeof at === "string" ? at : null };
|
|
842
841
|
}
|
|
843
842
|
|
|
844
|
-
// The checkout's own router table, `plugin/scripts/router-table.json` under the
|
|
845
|
-
// workspace (the directory `stateDir` is in), as the installed one is read:
|
|
846
|
-
// `{ status: "ok", table }`, `{ status: "missing" }` (no such file: a consumer's
|
|
847
|
-
// checkout) or `{ status: "unreadable", why }`. Never warns: the installed
|
|
848
|
-
// table's read does, and a consumer is not at fault for lacking this file.
|
|
849
|
-
export function readCheckoutTable(stateDir) {
|
|
850
|
-
let text;
|
|
851
|
-
try {
|
|
852
|
-
text = readFileSync(join(dirname(stateDir), "plugin", "scripts", "router-table.json"), "utf8");
|
|
853
|
-
} catch (e) {
|
|
854
|
-
return e.code === "ENOENT" ? { status: "missing" } : { status: "unreadable", why: e.code ?? e.message };
|
|
855
|
-
}
|
|
856
|
-
let table;
|
|
857
|
-
try { table = validateTable(JSON.parse(text)); } catch { return { status: "unreadable", why: "not JSON" }; }
|
|
858
|
-
return table instanceof Error ? { status: "unreadable", why: table.message } : { status: "ok", table };
|
|
859
|
-
}
|
|
860
|
-
|
|
861
843
|
// The Fit metrics-refresh.mjs writes beside the guard,
|
|
862
844
|
// `.fleet/router-fit.json`: `{ status: "ok", fit }`, `{ status: "missing" }`
|
|
863
|
-
// or `{ status: "unreadable", why }`.
|
|
864
|
-
//
|
|
865
|
-
//
|
|
866
|
-
//
|
|
867
|
-
//
|
|
845
|
+
// or `{ status: "unreadable", why }`. It is read as `route` reads it
|
|
846
|
+
// (ticket-router.mjs's readFitBeside): the Fit is read whenever its `table`
|
|
847
|
+
// passes `validateTable`, so the tab never says the starting table routes while
|
|
848
|
+
// `route` routes by the Fit. The fields only the tab reads decide nothing:
|
|
849
|
+
// `computed_at` and `guard_computed_at` are null where they are no string and
|
|
850
|
+
// `tsv_blobs` null where it is no object, and the tab says each is not checked,
|
|
851
|
+
// as it says of an `n_rows` that is no count.
|
|
868
852
|
export function readFitFile(stateDir) {
|
|
869
853
|
let text;
|
|
870
854
|
try {
|
|
@@ -875,16 +859,10 @@ export function readFitFile(stateDir) {
|
|
|
875
859
|
let p;
|
|
876
860
|
try { p = JSON.parse(text); } catch { return { status: "unreadable", why: "not JSON" }; }
|
|
877
861
|
if (!isJsonObject(p)) return { status: "unreadable", why: "not a JSON object" };
|
|
878
|
-
for (const key of ["computed_at", "guard_computed_at"]) {
|
|
879
|
-
if (typeof p[key] !== "string") return { status: "unreadable", why: `\`${key}\` is not a string` };
|
|
880
|
-
}
|
|
881
|
-
for (const key of ["tsv_blobs", "prior"]) {
|
|
882
|
-
if (!isJsonObject(p[key])) return { status: "unreadable", why: `\`${key}\` is not an object` };
|
|
883
|
-
}
|
|
884
862
|
const table = validateTable(p.table);
|
|
885
863
|
if (table instanceof Error) return { status: "unreadable", why: table.message };
|
|
886
|
-
|
|
887
|
-
return { status: "ok", fit: { computed_at: p.computed_at, guard_computed_at: p.guard_computed_at, tsv_blobs: p.tsv_blobs
|
|
864
|
+
const stringOrNull = (v) => (typeof v === "string" ? v : null);
|
|
865
|
+
return { status: "ok", fit: { computed_at: stringOrNull(p.computed_at), guard_computed_at: stringOrNull(p.guard_computed_at), tsv_blobs: isJsonObject(p.tsv_blobs) ? p.tsv_blobs : null, table } };
|
|
888
866
|
}
|
|
889
867
|
|
|
890
868
|
// A receipt's `metrics` step, `{ status, at, output }`, or null: no receipt, one
|
|
@@ -923,29 +901,6 @@ export function readAgents(scriptDir) {
|
|
|
923
901
|
return { list, error: null };
|
|
924
902
|
}
|
|
925
903
|
|
|
926
|
-
// The install's own `package.json`, `../package.json` from the script's
|
|
927
|
-
// directory: `{ name, version, repository, error }`, `repository` the url its
|
|
928
|
-
// field names (the field is a string or `{ url }`), null where it names none.
|
|
929
|
-
// A file that cannot be read or parsed is `error`, with the rest null: the tab
|
|
930
|
-
// words an install it cannot name, never a guess.
|
|
931
|
-
export function readInstall(scriptDir) {
|
|
932
|
-
const file = join(scriptDir, "..", "package.json");
|
|
933
|
-
let pkg;
|
|
934
|
-
try {
|
|
935
|
-
pkg = JSON.parse(readFileSync(file, "utf8"));
|
|
936
|
-
} catch (e) {
|
|
937
|
-
return { name: null, version: null, repository: null, error: `${file}: ${e instanceof SyntaxError ? "not JSON" : (e.code ?? e.message)}` };
|
|
938
|
-
}
|
|
939
|
-
if (!isJsonObject(pkg)) return { name: null, version: null, repository: null, error: `${file}: not a JSON object` };
|
|
940
|
-
const repo = isJsonObject(pkg.repository) ? pkg.repository.url : pkg.repository;
|
|
941
|
-
return {
|
|
942
|
-
name: typeof pkg.name === "string" ? pkg.name : null,
|
|
943
|
-
version: typeof pkg.version === "string" ? pkg.version : null,
|
|
944
|
-
repository: typeof repo === "string" ? repo : null,
|
|
945
|
-
error: null,
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
|
|
949
904
|
// The live run's Objective, off the phase-0 receipt in the workspace's `.fleet`
|
|
950
905
|
// (the file readReceipt owns), or null: no receipt, as between runs, one that
|
|
951
906
|
// will not read, or one that records none.
|
|
@@ -999,19 +954,27 @@ export const MODEL_ROLES_EVERY_MS = 60_000;
|
|
|
999
954
|
// `omp` would otherwise hold every tick after it, not just this tab's.
|
|
1000
955
|
export const MODEL_ROLES_TIMEOUT_MS = 10_000;
|
|
1001
956
|
|
|
1002
|
-
// `omp
|
|
1003
|
-
//
|
|
1004
|
-
// `{ ok: false, why }`.
|
|
1005
|
-
|
|
1006
|
-
const
|
|
957
|
+
// One `omp <argv>` whose stdout is JSON, in the cockpit's own environment:
|
|
958
|
+
// `{ ok: true, cmd, json }` with the command in words and what it printed, or
|
|
959
|
+
// `{ ok: false, why }`. Each reader adds only its own shape check.
|
|
960
|
+
async function readOmpJson(argv, timeout) {
|
|
961
|
+
const cmd = `omp ${argv.join(" ")}`;
|
|
1007
962
|
const r = await execRead("omp", argv, { timeout });
|
|
1008
963
|
if (r.error) {
|
|
1009
964
|
const how = r.code ?? (r.signal ? `killed by ${r.signal}` : `exit ${r.status}`);
|
|
1010
|
-
return { ok: false, why:
|
|
965
|
+
return { ok: false, why: `${cmd} failed (${how})` };
|
|
1011
966
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
967
|
+
try { return { ok: true, cmd, json: JSON.parse(r.stdout) }; } catch { return { ok: false, why: `${cmd} printed non-JSON` }; }
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// `omp config get modelRoles --json`, in the cockpit's own environment, which can
|
|
971
|
+
// differ from the controller's. `{ ok: true, value }` with the record, or
|
|
972
|
+
// `{ ok: false, why }`.
|
|
973
|
+
export async function readModelRoles(timeout = MODEL_ROLES_TIMEOUT_MS) {
|
|
974
|
+
const r = await readOmpJson(["config", "get", "modelRoles", "--json"], timeout);
|
|
975
|
+
if (!r.ok) return r;
|
|
976
|
+
const value = r.json?.value;
|
|
977
|
+
if (!isJsonObject(value)) return { ok: false, why: `${r.cmd} printed no modelRoles record` };
|
|
1015
978
|
return { ok: true, value };
|
|
1016
979
|
}
|
|
1017
980
|
|
|
@@ -1046,6 +1009,59 @@ export async function carryModelRoles(carried, now, read = readModelRoles) {
|
|
|
1046
1009
|
return carry(heldRead(carried) ?? NO_READ, now, read, MODEL_ROLES_EVERY_MS);
|
|
1047
1010
|
}
|
|
1048
1011
|
|
|
1012
|
+
// `omp models --json`, omp's model catalog, in the cockpit's own environment:
|
|
1013
|
+
// `{ ok: true, value }` with `{ models: [{ selector, thinking }] }` — every
|
|
1014
|
+
// listed model that has a selector, in the catalog's order, so a role's model
|
|
1015
|
+
// matches the entry route's own catalog read matches it to; `thinking` the
|
|
1016
|
+
// efforts it runs at, what a role's ladder is read off for the exploration
|
|
1017
|
+
// Cells, or null where it names none, and nothing else, so the carried read
|
|
1018
|
+
// stays small — or `{ ok: false, why }`, also for a list in which no model names
|
|
1019
|
+
// its efforts: a catalog with no ladder in it is a read that failed, never an
|
|
1020
|
+
// install whose exploration Cells are all tripped.
|
|
1021
|
+
export async function readCatalog(timeout = MODEL_ROLES_TIMEOUT_MS) {
|
|
1022
|
+
const r = await readOmpJson(["models", "--json"], timeout);
|
|
1023
|
+
if (!r.ok) return r;
|
|
1024
|
+
if (!isJsonObject(r.json) || !Array.isArray(r.json.models)) return { ok: false, why: `${r.cmd} printed no model list` };
|
|
1025
|
+
const models = r.json.models
|
|
1026
|
+
.filter((m) => isJsonObject(m) && typeof m.selector === "string")
|
|
1027
|
+
.map((m) => ({ selector: m.selector, thinking: Array.isArray(m.thinking) ? m.thinking.filter((t) => typeof t === "string") : null }));
|
|
1028
|
+
if (r.json.models.length > 0 && !models.some((m) => m.thinking !== null)) return { ok: false, why: `${r.cmd} printed no model with a thinking list` };
|
|
1029
|
+
return { ok: true, value: { models } };
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// The carried model catalog read, the same way as `modelRoles`.
|
|
1033
|
+
export async function carryCatalog(carried, now, read = readCatalog) {
|
|
1034
|
+
return carry(heldRead(carried) ?? NO_READ, now, read, MODEL_ROLES_EVERY_MS);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// A repository's host and `owner/name` off its url — `gh repo view`'s, or any
|
|
1038
|
+
// shape a `package.json` `repository` takes: an npm shorthand, a scp-style
|
|
1039
|
+
// address or a URL — or null when it names none. A `#ref` pin and a `www.` host
|
|
1040
|
+
// name the same repository; a segment of dots only names none.
|
|
1041
|
+
export function repoIdentity(url) {
|
|
1042
|
+
if (typeof url !== "string") return null;
|
|
1043
|
+
const s = url.trim().replace(/^git\+/, "").replace(/#.*$/, "");
|
|
1044
|
+
let host;
|
|
1045
|
+
let path;
|
|
1046
|
+
const short = /^(github|gitlab|bitbucket):([^/\s]+\/[^/\s]+)$/.exec(s);
|
|
1047
|
+
const scp = /^[^@/\s]+@([^:/\s]+):(.+)$/.exec(s);
|
|
1048
|
+
if (short) {
|
|
1049
|
+
host = `${short[1]}.${short[1] === "bitbucket" ? "org" : "com"}`;
|
|
1050
|
+
path = short[2];
|
|
1051
|
+
} else if (scp) {
|
|
1052
|
+
[, host, path] = scp;
|
|
1053
|
+
} else if (/^[\w.-]+\/[\w.-]+$/.test(s)) {
|
|
1054
|
+
host = "github.com";
|
|
1055
|
+
path = s;
|
|
1056
|
+
} else {
|
|
1057
|
+
try { ({ hostname: host, pathname: path } = new URL(s)); } catch { return null; }
|
|
1058
|
+
}
|
|
1059
|
+
const [owner, rest] = path.split("/").filter(Boolean);
|
|
1060
|
+
const name = rest?.replace(/\.git$/, "");
|
|
1061
|
+
if (!host || !owner || !name || /^\.+$/.test(owner) || /^\.+$/.test(name)) return null;
|
|
1062
|
+
return { host: host.toLowerCase().replace(/^www\./, ""), name: `${owner}/${name}` };
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1049
1065
|
// The carried `docs/metrics` contents call, the same way: `value` is `{ blobs }`,
|
|
1050
1066
|
// `blobs` null for a 404 and otherwise main's blob id by path. A workspace whose
|
|
1051
1067
|
// repository the cockpit cannot name has nothing to ask `gh api` about, and says
|
|
@@ -1089,7 +1105,7 @@ export async function carryMainMetrics(carried, now, repoUrl, read = readMainMet
|
|
|
1089
1105
|
// `stateDir` is the workspace's `.fleet` directory, where the cost guard and the
|
|
1090
1106
|
// receipts the Cell evidence tab reads live. Null, as with `stateFile`, says no
|
|
1091
1107
|
// caller named one: that tab is then built from no guard and no receipt, and the
|
|
1092
|
-
// cockpit's `omp` is not asked for `modelRoles
|
|
1108
|
+
// cockpit's `omp` is not asked for `modelRoles` or its model catalog.
|
|
1093
1109
|
//
|
|
1094
1110
|
// `cwd` is the checkout whose Label map is read, once per gather, through
|
|
1095
1111
|
// label-map.mjs's reader; it defaults to this process's cwd, where every `gh`
|
|
@@ -1335,29 +1351,28 @@ export async function gather({ ledgerFile, prevFile, stateFile = null, stateDir
|
|
|
1335
1351
|
const now = Date.now();
|
|
1336
1352
|
const stallOwnerOf = isStalled(assessBeat({ beat, ticked, acted, controller, now })) ? stallOwner(controller, NAME) : null;
|
|
1337
1353
|
// The Cell evidence tab's inputs. Every file again on every tick, nothing
|
|
1338
|
-
// cached, the rule of every read here; the
|
|
1339
|
-
// child spawn, carried from the previous board and read
|
|
1340
|
-
// minute. `stateDir` is the workspace's `.fleet`: a caller
|
|
1341
|
-
// no workspace, so it reads none of the workspace's
|
|
1342
|
-
// either (a guard that reads as missing, no
|
|
1354
|
+
// cached, the rule of every read here; the exceptions are `modelRoles` and the
|
|
1355
|
+
// model catalog, one child spawn each, carried from the previous board and read
|
|
1356
|
+
// again at most once a minute. `stateDir` is the workspace's `.fleet`: a caller
|
|
1357
|
+
// that names none names no workspace, so it reads none of the workspace's
|
|
1358
|
+
// records and spawns no `omp` either (a guard that reads as missing, no
|
|
1359
|
+
// receipts, the reads carried as they were).
|
|
1343
1360
|
const guard = stateDir === null ? { status: "missing" } : readGuardFile(stateDir);
|
|
1344
1361
|
const guardJson = stateDir === null ? null : readGuardJson(stateDir);
|
|
1345
1362
|
const fit = stateDir === null ? { status: "missing" } : readFitFile(stateDir);
|
|
1346
1363
|
const closeoutPr = stateDir === null ? null : readCloseoutPr(stateDir);
|
|
1347
|
-
const checkoutTable = stateDir === null ? { status: "missing" } : readCheckoutTable(stateDir);
|
|
1348
1364
|
const receipts = stateDir === null
|
|
1349
1365
|
? { phase0: null, closeout: null }
|
|
1350
1366
|
: { phase0: readMetricsStep(join(stateDir, RECEIPT)), closeout: readMetricsStep(join(stateDir, CLOSEOUT_RECEIPT)) };
|
|
1351
1367
|
const agents = readAgents(scriptDir);
|
|
1352
|
-
const install = readInstall(scriptDir);
|
|
1353
1368
|
const objective = stateDir === null ? null : readObjective(stateDir);
|
|
1354
1369
|
// Read side by side: each has its own 10 s timeout, and one after the other a
|
|
1355
|
-
// tick on which
|
|
1356
|
-
const [modelRoles, mainMetrics] = stateDir === null
|
|
1357
|
-
? [heldRead(prev?.modelRoles), null]
|
|
1358
|
-
: await Promise.all([carryModelRoles(prev?.modelRoles, now), carryMainMetrics(prev?.mainMetrics, now, repoUrl)]);
|
|
1370
|
+
// tick on which every one hangs would stall once for each.
|
|
1371
|
+
const [modelRoles, catalog, mainMetrics] = stateDir === null
|
|
1372
|
+
? [heldRead(prev?.modelRoles), heldRead(prev?.catalog), null]
|
|
1373
|
+
: await Promise.all([carryModelRoles(prev?.modelRoles, now), carryCatalog(prev?.catalog, now), carryMainMetrics(prev?.mainMetrics, now, repoUrl)]);
|
|
1359
1374
|
return { ledger, issues, prs, merged, closed, closedIssues, ci, prev, repo, repoUrl, workspace, port, spend, beat, ticked, acted, controller, stallOwner: stallOwnerOf, poolOk,
|
|
1360
1375
|
roles, labelMapError,
|
|
1361
|
-
poolCapped, prsOk, prsCapped, guard, guardJson, fit, receipts, closeoutPr, agents, modelRoles,
|
|
1376
|
+
poolCapped, prsOk, prsCapped, guard, guardJson, fit, receipts, closeoutPr, agents, modelRoles, catalog, mainMetrics, objective, implementers: [...implementers.values()], routerTable,
|
|
1362
1377
|
now, interval };
|
|
1363
1378
|
}
|
package/scripts/board.html
CHANGED
|
@@ -106,9 +106,7 @@
|
|
|
106
106
|
.ce-foot { margin-top:8px; }
|
|
107
107
|
#cells-declared summary { cursor:pointer; color:var(--dim); }
|
|
108
108
|
.ce-member { display:flex; gap:10px; flex-wrap:wrap; font-size:12px; margin:2px 0 0 18px; }
|
|
109
|
-
.ce-
|
|
110
|
-
.ce-side { flex:1 1 20em; }
|
|
111
|
-
.ce-row { display:grid; gap:12px; border-top:1px solid var(--line); padding:6px 0; font-size:12px; }
|
|
109
|
+
.ce-row { display:grid; grid-template-columns:10em minmax(0, 1fr); gap:12px; border-top:1px solid var(--line); padding:6px 0; font-size:12px; }
|
|
112
110
|
.ce-row a { color:var(--blue); text-decoration:none; }
|
|
113
111
|
.ce-cand { color:var(--dim); margin-left:10px; }
|
|
114
112
|
.ce-stratum { font-weight:600; overflow-wrap:anywhere; }
|
|
@@ -461,70 +459,74 @@ function ceEntry(e) {
|
|
|
461
459
|
return box;
|
|
462
460
|
}
|
|
463
461
|
|
|
464
|
-
//
|
|
465
|
-
// could not make,
|
|
466
|
-
//
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
box
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
|
|
462
|
+
// The heading of the view of the Fit: its failed-Fit flag first, then its
|
|
463
|
+
// source line, the check it could not make, how a Pull is dispatched, its
|
|
464
|
+
// labels and model-change notices, burn-in progress, the tripped Cells and the
|
|
465
|
+
// model-name line, where each is set.
|
|
466
|
+
function ceFitHeading(p) {
|
|
467
|
+
const box = el("div");
|
|
468
|
+
if (p.flag) { const flag = el("div", "ce-alert"); flag.append(el("div", "ce-verdict", p.flag)); box.append(flag); }
|
|
469
|
+
box.append(el("div", "ce-source", p.source.text));
|
|
470
|
+
if (p.source.check) box.append(el("div", "ce-note", p.source.check));
|
|
471
|
+
if (p.heading) box.append(el("div", "ce-note", p.heading));
|
|
472
|
+
for (const label of p.labels || []) box.append(el("div", "ce-note ce-amber", label));
|
|
473
|
+
for (const notice of p.notices || []) box.append(el("div", "ce-note ce-amber", notice));
|
|
474
|
+
if (p.burnIn) {
|
|
475
|
+
box.append(el("div", "ce-note", p.burnIn.heading));
|
|
476
|
+
for (const c of p.burnIn.cells) box.append(el("div", "ce-cand", `${c.cell} · ${c.n} of ${c.of} merged PRs`));
|
|
477
|
+
}
|
|
478
|
+
if (p.tripped) box.append(el("div", "ce-note", p.tripped));
|
|
479
|
+
if (p.modelLine) box.append(el("div", "ce-note ce-amber", p.modelLine));
|
|
475
480
|
return box;
|
|
476
481
|
}
|
|
477
482
|
|
|
478
|
-
// One
|
|
479
|
-
//
|
|
480
|
-
//
|
|
481
|
-
function
|
|
483
|
+
// One group's row: the Cell it routes to and why, its own Cell where the guard
|
|
484
|
+
// holds it back, each candidate's n, verdict and interval, and the Cells the
|
|
485
|
+
// group draws over.
|
|
486
|
+
function ceFitEntry(line) {
|
|
482
487
|
const box = el("div", "ce-polcell");
|
|
483
|
-
if (
|
|
484
|
-
|
|
488
|
+
if (line.unread) { box.append(el("span", "ce-dim", line.unread)); return box; }
|
|
489
|
+
const e = line.entry;
|
|
485
490
|
const hd = el("div", "ce-hd");
|
|
486
|
-
hd.append(el("span", "ce-cell",
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
reason.href = href;
|
|
491
|
+
hd.append(el("span", "ce-cell", e.cell));
|
|
492
|
+
const reason = el("a", "ce-dim", e.reason);
|
|
493
|
+
reason.href = line.href;
|
|
490
494
|
hd.append(reason);
|
|
491
|
-
if (
|
|
495
|
+
if (e.held) hd.append(el("span", "ce-amber", e.held));
|
|
492
496
|
box.append(hd);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
box.append(line);
|
|
497
|
+
for (const c of e.candidates) {
|
|
498
|
+
const row = el("div", "ce-cand", `${c.cell} · n ${c.n ?? "not checked"}${c.nMark || ""} · ${c.verdict} · ${c.interval}`);
|
|
499
|
+
if (c.model && c.model.text) row.append(el("span", "ce-amber", " · " + c.model.text));
|
|
500
|
+
box.append(row);
|
|
498
501
|
}
|
|
502
|
+
if (line.exploring) box.append(el("div", "ce-note", line.exploring));
|
|
499
503
|
return box;
|
|
500
504
|
}
|
|
501
505
|
|
|
502
|
-
// One
|
|
506
|
+
// One group of the tree, its rule indented by its depth. It is a place
|
|
503
507
|
// `#cells/row/<objective>/<stratum>` lands on.
|
|
504
|
-
function
|
|
508
|
+
function ceFitLine(line) {
|
|
505
509
|
const box = ceBox("div", "ce-row", line.anchor);
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
510
|
+
const rule = el("span", "ce-stratum", line.rule);
|
|
511
|
+
rule.style.paddingLeft = `${line.depth}em`;
|
|
512
|
+
rule.title = line.stratum;
|
|
513
|
+
box.append(rule, ceFitEntry(line));
|
|
509
514
|
return box;
|
|
510
515
|
}
|
|
511
516
|
|
|
512
|
-
// The
|
|
513
|
-
//
|
|
517
|
+
// The view of the Fit that routes this run: its heading, then each Objective's
|
|
518
|
+
// tree of groups, with the live run's Objective marked.
|
|
514
519
|
function cePolicy(p) {
|
|
515
520
|
const sec = ceBox("section", "ce-sec", "cells-rows");
|
|
516
|
-
sec.append(el("h2", null,
|
|
517
|
-
const sides = el("div", "ce-sides");
|
|
518
|
-
for (const s of p.sides) sides.append(cePolicySide(s));
|
|
519
|
-
sec.append(sides);
|
|
521
|
+
sec.append(el("h2", null, p.title), ceFitHeading(p));
|
|
520
522
|
for (const o of p.objectives) {
|
|
521
523
|
const hd = el("div", "ce-hd ce-obj");
|
|
522
524
|
hd.append(el("span", "ce-cell", o.objective));
|
|
523
525
|
if (o.live) hd.append(el("span", "badge", "this run's Objective"));
|
|
524
526
|
sec.append(hd);
|
|
525
|
-
for (const line of o.lines) sec.append(
|
|
527
|
+
for (const line of o.lines) sec.append(ceFitLine(line));
|
|
526
528
|
}
|
|
527
|
-
for (const
|
|
529
|
+
for (const f of p.footnotes) sec.append(el("div", "ce-foot", `${f.mark} ${f.text}`));
|
|
528
530
|
return sec;
|
|
529
531
|
}
|
|
530
532
|
|
|
@@ -554,7 +556,7 @@ function renderCells(ce) {
|
|
|
554
556
|
const g = ce.guard;
|
|
555
557
|
|
|
556
558
|
const links = el("div", "ce-links");
|
|
557
|
-
for (const [href, text] of [["#cells/rows", "
|
|
559
|
+
for (const [href, text] of [["#cells/rows", "the Fit"], ["#cells/guard", "the guard"], ["#cells/declared", "declared, not measured"]]) {
|
|
558
560
|
if (!ce.policy && href === "#cells/rows") continue;
|
|
559
561
|
if (links.children.length) links.append(document.createTextNode(" · "));
|
|
560
562
|
const a = el("a", null, text);
|
|
@@ -858,8 +858,8 @@ export function computeBoard(inputs) {
|
|
|
858
858
|
// The Cell evidence tab's model (compute-cell-evidence.mjs), built from the
|
|
859
859
|
// guard (through the tick's reader, and as parsed, for the readers alert),
|
|
860
860
|
// the receipts' metrics steps and the close-out's PR beside the open PRs, the
|
|
861
|
-
// definitions, the
|
|
862
|
-
//
|
|
861
|
+
// definitions, the Fit, the starting router table, the live run's Objective
|
|
862
|
+
// and the carried `modelRoles`, model catalog and `docs/metrics` reads
|
|
863
863
|
// gather() answered, and this run's Pulls: each card's
|
|
864
864
|
// Cell line, booked As-routed to its Cell. A caller that read none of them
|
|
865
865
|
// (every hand-built input in this suite) gets the tab's no-guard state:
|
|
@@ -876,17 +876,18 @@ export function computeBoard(inputs) {
|
|
|
876
876
|
openPrs: inputs.prsOk === false ? null : { numbers: (inputs.prs ?? []).map((p) => p.number), capped: inputs.prsCapped === true },
|
|
877
877
|
agents: inputs.agents,
|
|
878
878
|
modelRoles: inputs.modelRoles,
|
|
879
|
+
catalog: inputs.catalog,
|
|
879
880
|
mainMetrics: inputs.mainMetrics,
|
|
880
881
|
table: inputs.routerTable,
|
|
881
|
-
checkoutTable: inputs.checkoutTable,
|
|
882
|
-
install: inputs.install,
|
|
883
|
-
repoUrl: inputs.repoUrl,
|
|
884
882
|
objective: inputs.objective,
|
|
885
883
|
pulls: tickets.filter((t) => t.cellLine).map((t) => ({ issue: t.issue, cell: t.cellLine.cell, mark: t.cellLine.mark, targets: t.cellLine.targets })),
|
|
886
884
|
}),
|
|
887
885
|
// The `omp config get modelRoles` read, carried tick to tick the way `ci`
|
|
888
886
|
// and `repo` are: `{ value, readAt, error }`, read at most once a minute.
|
|
889
887
|
modelRoles: inputs.modelRoles ?? null,
|
|
888
|
+
// The `omp models` catalog read, carried the same way: `{ value: { models },
|
|
889
|
+
// readAt, error }`, read at most once a minute.
|
|
890
|
+
catalog: inputs.catalog ?? null,
|
|
890
891
|
// The `docs/metrics` contents call, carried the same way: `{ value: { blobs },
|
|
891
892
|
// readAt, error }`, main's blob id by path, read at most once a minute.
|
|
892
893
|
mainMetrics: inputs.mainMetrics ?? null,
|