@mark1russell7/conventions 0.44.0 → 0.45.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/README.md +14 -1
- package/build/cli.js +1 -1
- package/build/index.d.ts +36 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -2
- package/build/index.js.map +1 -1
- package/build/owners.d.ts +37 -0
- package/build/owners.d.ts.map +1 -0
- package/build/owners.js +42 -0
- package/build/owners.js.map +1 -0
- package/build/{run-DII4tn_0.js → run-BezUWj3N.js} +456 -43
- package/build/run-BezUWj3N.js.map +1 -0
- package/package.json +8 -3
- package/build/run-DII4tn_0.js.map +0 -1
|
@@ -1221,6 +1221,47 @@ const WORKFLOW$1 = /^\.github\/workflows\/[^/]+\.ya?ml$/;
|
|
|
1221
1221
|
const indentOf$1 = (line) => line.length - line.trimStart().length;
|
|
1222
1222
|
/** This function gives the lines of a workflow, with each line of a comment made empty. */
|
|
1223
1223
|
const workflowLines = (text) => text.split(/\r?\n/).map((line) => line.trimStart().startsWith("#") ? "" : line);
|
|
1224
|
+
/**
|
|
1225
|
+
* This function gives a line of a shell script with each quoted text as `""` and with no comment. A word in a quote or a
|
|
1226
|
+
* comment is thus not a command. A double quote can hold `\"`. A quote that does not close stays as it is.
|
|
1227
|
+
*
|
|
1228
|
+
* The function reads the line one time. The regular expression `"(?:[^"\\]|\\.)*"` starts a new search at each `"`.
|
|
1229
|
+
* On a line of many `\"` with no closing quote, its time is the square of the length (CodeQL `js/polynomial-redos`).
|
|
1230
|
+
* Here, a failed search for the closing `"` reads the line to its end. Each later `"` then has no closing quote too.
|
|
1231
|
+
* Thus each kind of quote fails at most one time.
|
|
1232
|
+
*/
|
|
1233
|
+
function shellCode(line) {
|
|
1234
|
+
let out = "";
|
|
1235
|
+
let open = {
|
|
1236
|
+
double: true,
|
|
1237
|
+
single: true
|
|
1238
|
+
};
|
|
1239
|
+
let i = 0;
|
|
1240
|
+
while (i < line.length) {
|
|
1241
|
+
const char = line.charAt(i);
|
|
1242
|
+
const double = char === "\"" && open.double;
|
|
1243
|
+
if (double || char === "'" && open.single) {
|
|
1244
|
+
let end = i + 1;
|
|
1245
|
+
while (end < line.length && line.charAt(end) !== char) end += double && line.charAt(end) === "\\" ? 2 : 1;
|
|
1246
|
+
if (end < line.length) {
|
|
1247
|
+
out += "\"\"";
|
|
1248
|
+
i = end + 1;
|
|
1249
|
+
continue;
|
|
1250
|
+
}
|
|
1251
|
+
open = double ? {
|
|
1252
|
+
...open,
|
|
1253
|
+
double: false
|
|
1254
|
+
} : {
|
|
1255
|
+
...open,
|
|
1256
|
+
single: false
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
out += char;
|
|
1260
|
+
i += 1;
|
|
1261
|
+
}
|
|
1262
|
+
const comment = out.search(/(?:^|\s)#/);
|
|
1263
|
+
return comment >= 0 ? out.slice(0, comment) : out;
|
|
1264
|
+
}
|
|
1224
1265
|
/** This function removes a comment at the end of a value, and the quotes around it. */
|
|
1225
1266
|
function valueOf$1(raw) {
|
|
1226
1267
|
const comment = raw.search(/\s#/);
|
|
@@ -1263,6 +1304,29 @@ function childKeys(lines, index) {
|
|
|
1263
1304
|
for (let i = index + 1; i < blockEnd(lines, index); i++) if ((lines[i] ?? "").trim() !== "" && indentOf$1(lines[i] ?? "") === indent) keys.push(i);
|
|
1264
1305
|
return keys;
|
|
1265
1306
|
}
|
|
1307
|
+
/** This function gives the end of the list under the key at the line `key`, for example `steps`. A list can have the same indent as its key. */
|
|
1308
|
+
function listEnd(lines, key) {
|
|
1309
|
+
const indent = indentOf$1(lines[key] ?? "");
|
|
1310
|
+
for (let at = key + 1; at < lines.length; at++) {
|
|
1311
|
+
const line = lines[at] ?? "";
|
|
1312
|
+
if (line.trim() === "") continue;
|
|
1313
|
+
if (indentOf$1(line) < indent || indentOf$1(line) === indent && !line.trimStart().startsWith("- ")) return at;
|
|
1314
|
+
}
|
|
1315
|
+
return lines.length;
|
|
1316
|
+
}
|
|
1317
|
+
/** This function gives the lines of the items (`- `) of the list under the key at the line `key`. */
|
|
1318
|
+
function listItems$1(lines, key) {
|
|
1319
|
+
const end = listEnd(lines, key);
|
|
1320
|
+
let indent;
|
|
1321
|
+
const starts = [];
|
|
1322
|
+
for (let at = key + 1; at < end; at++) {
|
|
1323
|
+
const line = lines[at] ?? "";
|
|
1324
|
+
if (line.trim() === "") continue;
|
|
1325
|
+
indent ??= indentOf$1(line);
|
|
1326
|
+
if (indentOf$1(line) === indent && line.trimStart().startsWith("- ")) starts.push(at);
|
|
1327
|
+
}
|
|
1328
|
+
return starts;
|
|
1329
|
+
}
|
|
1266
1330
|
/**
|
|
1267
1331
|
* This function applies changes to the lines of `text`, and keeps its line ends. The changes go from the end to the
|
|
1268
1332
|
* start, so each index stays correct. At one index, a splice that removes lines goes first, so it removes only the old
|
|
@@ -2151,9 +2215,9 @@ const securityOneJob = {
|
|
|
2151
2215
|
* GitHub fails at times with a 504, and a bare `curl` then fails the job.
|
|
2152
2216
|
*/
|
|
2153
2217
|
/** The files of a composite action. */
|
|
2154
|
-
const ACTION$
|
|
2218
|
+
const ACTION$2 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
2155
2219
|
/** The action of the template itself. It is the one place with the download. */
|
|
2156
|
-
const SHARED_ACTION = ".github/actions/setup-cue/action.yml";
|
|
2220
|
+
const SHARED_ACTION$1 = ".github/actions/setup-cue/action.yml";
|
|
2157
2221
|
/** A hand-written install of the cue CLI: a download of a release asset, or a build with `go install`. */
|
|
2158
2222
|
const DOWNLOAD = /github\.com\/cue-lang\/cue\/releases\/download\/(v[0-9][^/\s"']*)\/|cuelang\.org\/go\/cmd\/cue@(v?[0-9][^\s"']*|latest)/;
|
|
2159
2223
|
/** This function gives each line of a file that installs the cue CLI with its own command. It does not read a comment line. */
|
|
@@ -2198,7 +2262,7 @@ const setupCue = {
|
|
|
2198
2262
|
const files = context.gitFiles();
|
|
2199
2263
|
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
2200
2264
|
const breaks = [];
|
|
2201
|
-
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$
|
|
2265
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION$2.test(path)) && path !== SHARED_ACTION$1).sort(byCode)) {
|
|
2202
2266
|
let text;
|
|
2203
2267
|
try {
|
|
2204
2268
|
text = readFileSync(join(context.root, file), "utf8");
|
|
@@ -2263,7 +2327,7 @@ const SHARED_ACTIONS = [
|
|
|
2263
2327
|
/** The `uses` value of a job that calls the shared CI, with no pin. */
|
|
2264
2328
|
const SHARED_CI = "mark1russell7/template/.github/workflows/reusable-ci.yml";
|
|
2265
2329
|
/** The action folder of a path: `.github/actions/<name>/action.yml` gives `<name>`. */
|
|
2266
|
-
const ACTION = /^\.github\/actions\/([^/]+)\//;
|
|
2330
|
+
const ACTION$1 = /^\.github\/actions\/([^/]+)\//;
|
|
2267
2331
|
/** The file name of a path. */
|
|
2268
2332
|
const baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
2269
2333
|
/** This function tells if a job of a workflow text uses the shared CI of the template. */
|
|
@@ -2327,7 +2391,7 @@ const sharedCi = {
|
|
|
2327
2391
|
});
|
|
2328
2392
|
const actions = /* @__PURE__ */ new Set();
|
|
2329
2393
|
for (const file of files) {
|
|
2330
|
-
const folder = ACTION.exec(file)?.[1];
|
|
2394
|
+
const folder = ACTION$1.exec(file)?.[1];
|
|
2331
2395
|
if (folder !== void 0 && SHARED_ACTIONS.includes(folder) && !actions.has(folder)) {
|
|
2332
2396
|
actions.add(folder);
|
|
2333
2397
|
breaks.push({
|
|
@@ -3379,7 +3443,7 @@ const HOMES = [
|
|
|
3379
3443
|
{
|
|
3380
3444
|
area: "cluster-design",
|
|
3381
3445
|
title: "Computer cluster design",
|
|
3382
|
-
covers: "part classes and fit rules (socket, memory type, power supply), runner capacity, watts, heat, noise, circuit
|
|
3446
|
+
covers: "part classes and fit rules (socket, memory type, power supply), runner capacity, watts, heat, noise, the load of a design on each circuit (the circuit math comes from electrical), as formulas with units over a configuration",
|
|
3383
3447
|
packages: [],
|
|
3384
3448
|
repo: "mark1russell7/cluster-design",
|
|
3385
3449
|
state: "planned",
|
|
@@ -3390,7 +3454,6 @@ const HOMES = [
|
|
|
3390
3454
|
"socket",
|
|
3391
3455
|
"psu",
|
|
3392
3456
|
"watts",
|
|
3393
|
-
"circuit",
|
|
3394
3457
|
"runner capacity",
|
|
3395
3458
|
"heat",
|
|
3396
3459
|
"noise",
|
|
@@ -3422,26 +3485,73 @@ const HOMES = [
|
|
|
3422
3485
|
note: "Loops go to @mark1russell7/service, the machine state machine to @mark1russell7/algebra. It has no site facts."
|
|
3423
3486
|
},
|
|
3424
3487
|
{
|
|
3425
|
-
area: "
|
|
3426
|
-
title: "3D
|
|
3427
|
-
covers: "
|
|
3428
|
-
packages: [],
|
|
3429
|
-
repo: "mark1russell7/
|
|
3430
|
-
state: "
|
|
3488
|
+
area: "3d-stages",
|
|
3489
|
+
title: "3D stages and marks",
|
|
3490
|
+
covers: "the stage on three.js for any scene (camera and named views, picking, themes), the camera maths with no browser, the shared marks of the viewers (a point on a surface, a run along a wall, a heat map on a floor) and a globe of areas and places over time. Composable views: lenses with named knobs, a pure model, lanes and one shared timeline",
|
|
3491
|
+
packages: ["@mark1russell7/visuals"],
|
|
3492
|
+
repo: "mark1russell7/visuals",
|
|
3493
|
+
state: "published",
|
|
3431
3494
|
words: [
|
|
3432
3495
|
"3d",
|
|
3433
3496
|
"three.js",
|
|
3434
3497
|
"threejs",
|
|
3498
|
+
"webgl",
|
|
3499
|
+
"globe",
|
|
3500
|
+
"scene",
|
|
3501
|
+
"camera",
|
|
3502
|
+
"picking",
|
|
3503
|
+
"viewer",
|
|
3504
|
+
"marks",
|
|
3505
|
+
"markers",
|
|
3506
|
+
"heat map",
|
|
3507
|
+
"stage",
|
|
3508
|
+
"lens",
|
|
3509
|
+
"lanes",
|
|
3510
|
+
"timeline",
|
|
3511
|
+
"osi"
|
|
3512
|
+
],
|
|
3513
|
+
note: "Each viewer maps its records to these marks. 3D geometry records go to layout-contract. Points on the Earth and great circles go to geo."
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
area: "room-view",
|
|
3517
|
+
title: "3D room viewer",
|
|
3518
|
+
covers: "the core of a room model: rooms, walls, openings, placed objects and anchors, with no topic. Each topic is an add-on package in the same repository, with its records on the anchors, its checks, its Vex formulas and its marks: electrical first, then plumbing, light and sound. The add-ons do not know each other. The viewer maps the records to the marks of visuals",
|
|
3519
|
+
packages: ["@mark1russell7/room-view"],
|
|
3520
|
+
repo: "mark1russell7/room-view",
|
|
3521
|
+
state: "published",
|
|
3522
|
+
words: [
|
|
3435
3523
|
"gltf",
|
|
3436
3524
|
"room",
|
|
3525
|
+
"wall",
|
|
3526
|
+
"opening",
|
|
3527
|
+
"anchor",
|
|
3528
|
+
"add-on",
|
|
3437
3529
|
"floor plan",
|
|
3438
|
-
"scene",
|
|
3439
|
-
"outlet",
|
|
3440
3530
|
"blender",
|
|
3441
|
-
"
|
|
3531
|
+
"apartment model"
|
|
3442
3532
|
],
|
|
3443
3533
|
note: "3D geometry records go to layout-contract."
|
|
3444
3534
|
},
|
|
3535
|
+
{
|
|
3536
|
+
area: "electrical",
|
|
3537
|
+
title: "Electrical circuits and loads",
|
|
3538
|
+
covers: "circuits, breakers, outlets and loads as data, the continuous-load check, and the formulas with units from quantity. The root entry has no browser. The entry /add-on is the add-on of room-view, the entry /marks has the marks of a room, and the entry /schema reads a layer from JSON",
|
|
3539
|
+
packages: ["@mark1russell7/electrical"],
|
|
3540
|
+
repo: "mark1russell7/room-view",
|
|
3541
|
+
state: "published",
|
|
3542
|
+
words: [
|
|
3543
|
+
"electrical",
|
|
3544
|
+
"circuit",
|
|
3545
|
+
"breaker",
|
|
3546
|
+
"outlet",
|
|
3547
|
+
"load",
|
|
3548
|
+
"amps",
|
|
3549
|
+
"volts",
|
|
3550
|
+
"panel",
|
|
3551
|
+
"wiring"
|
|
3552
|
+
],
|
|
3553
|
+
note: "It is the first add-on of room-view. cluster-design takes the load of each circuit from it."
|
|
3554
|
+
},
|
|
3445
3555
|
{
|
|
3446
3556
|
area: "packing",
|
|
3447
3557
|
title: "Rectangle packing",
|
|
@@ -15152,6 +15262,14 @@ const SITE_CONFIG_KEYS = {
|
|
|
15152
15262
|
kind: "string",
|
|
15153
15263
|
default: "1.64.1"
|
|
15154
15264
|
},
|
|
15265
|
+
"playwright-browsers": {
|
|
15266
|
+
kind: "string",
|
|
15267
|
+
default: ""
|
|
15268
|
+
},
|
|
15269
|
+
"playwright-command": {
|
|
15270
|
+
kind: "string",
|
|
15271
|
+
default: "npx --no-install playwright"
|
|
15272
|
+
},
|
|
15155
15273
|
"site-bar": {
|
|
15156
15274
|
kind: "boolean",
|
|
15157
15275
|
default: false
|
|
@@ -15569,9 +15687,9 @@ function runSteps(lines) {
|
|
|
15569
15687
|
const jobShell = defaultShell(lines, job);
|
|
15570
15688
|
const steps = childKeys(lines, job).find((at) => keyValue(lines[at] ?? "", "steps") !== void 0);
|
|
15571
15689
|
if (steps === void 0) continue;
|
|
15572
|
-
const dashes =
|
|
15690
|
+
const dashes = listItems$1(lines, steps);
|
|
15573
15691
|
dashes.forEach((dash, order) => {
|
|
15574
|
-
const end = dashes[order + 1] ??
|
|
15692
|
+
const end = dashes[order + 1] ?? listEnd(lines, steps);
|
|
15575
15693
|
const indent = indentOf$1(lines[dash] ?? "") + 2;
|
|
15576
15694
|
let run;
|
|
15577
15695
|
let shell;
|
|
@@ -15599,29 +15717,6 @@ function runSteps(lines) {
|
|
|
15599
15717
|
}
|
|
15600
15718
|
return found;
|
|
15601
15719
|
}
|
|
15602
|
-
/** This function gives the end of the list of steps under the key at the line `steps`. A list can have the same indent as its key. */
|
|
15603
|
-
function blockAfter(lines, steps) {
|
|
15604
|
-
const indent = indentOf$1(lines[steps] ?? "");
|
|
15605
|
-
for (let at = steps + 1; at < lines.length; at++) {
|
|
15606
|
-
const line = lines[at] ?? "";
|
|
15607
|
-
if (line.trim() === "") continue;
|
|
15608
|
-
if (indentOf$1(line) < indent || indentOf$1(line) === indent && !line.trimStart().startsWith("- ")) return at;
|
|
15609
|
-
}
|
|
15610
|
-
return lines.length;
|
|
15611
|
-
}
|
|
15612
|
-
/** This function gives the lines of the items of the list of steps. */
|
|
15613
|
-
function stepStarts(lines, steps) {
|
|
15614
|
-
const end = blockAfter(lines, steps);
|
|
15615
|
-
let indent;
|
|
15616
|
-
const starts = [];
|
|
15617
|
-
for (let at = steps + 1; at < end; at++) {
|
|
15618
|
-
const line = lines[at] ?? "";
|
|
15619
|
-
if (line.trim() === "") continue;
|
|
15620
|
-
indent ??= indentOf$1(line);
|
|
15621
|
-
if (indentOf$1(line) === indent && line.trimStart().startsWith("- ")) starts.push(at);
|
|
15622
|
-
}
|
|
15623
|
-
return starts;
|
|
15624
|
-
}
|
|
15625
15720
|
/** This function tells if a shell hides a failure on the left of a pipe. A shell that is not bash or sh has other rules, and the rule does not read it. */
|
|
15626
15721
|
function hidesFailure(shell) {
|
|
15627
15722
|
if (shell === void 0) return true;
|
|
@@ -15690,6 +15785,321 @@ const pipeFails = {
|
|
|
15690
15785
|
return breaks;
|
|
15691
15786
|
}
|
|
15692
15787
|
};
|
|
15788
|
+
// src/rules/job-fails.ts
|
|
15789
|
+
/**
|
|
15790
|
+
* The rule `job-fails`: a failed job fails its run and each job that reads it. When a job with `continue-on-error`
|
|
15791
|
+
* fails, `needs.<job>.result` is `success`. Thus a summary job of a gate passes over a job that crashed. A test step with
|
|
15792
|
+
* `continue-on-error`, or a test command with `|| true`, hides a failed test in the same way. The rule `pipe-fails`
|
|
15793
|
+
* holds the third form, a pipe with no `pipefail`.
|
|
15794
|
+
*/
|
|
15795
|
+
/**
|
|
15796
|
+
* A command that starts tests or checks. It is vitest, jest, mocha, pytest, `playwright test` or `node --test`. It can
|
|
15797
|
+
* also be a script `test`, `check` or `e2e` (also `check:types`) of pnpm, npm, yarn or bun.
|
|
15798
|
+
*/
|
|
15799
|
+
const TEST_COMMAND = /\b(?:vitest|jest|mocha|pytest)\b|\bplaywright\s+test\b|\bnode\s+(?:--[\w-]+\s+)*--test\b|\b(?:pnpm|npm|yarn|bun)\b[^;&|]*?\s(?:run\s+)?(?:test|check|e2e)(?::[\w:.-]+)?(?=\s|$)/;
|
|
15800
|
+
/** A `||` with a command after it that does not fail: `true`, `:`, `exit 0`, `echo` or `printf`. */
|
|
15801
|
+
const SWALLOW = /\|\|\s*(?:(?:true|:|exit\s+0)(?=\s*(?:$|[;&|)]))|(?:echo|printf)\b)/;
|
|
15802
|
+
/** An entry of the option `advisory`: `<file>#<job> until <YYYY-MM-DD>: <reason>`. */
|
|
15803
|
+
const ENTRY = /^([^\s#/]+\.ya?ml)#([\w-]+)\s+until\s+(\d{4}-\d{2}-\d{2})\s*:\s*(\S.*)$/;
|
|
15804
|
+
/** This function tells if a line of a script starts tests or checks. A word in a quote or a comment starts no test. */
|
|
15805
|
+
function startsTests(line) {
|
|
15806
|
+
return TEST_COMMAND.test(shellCode(line));
|
|
15807
|
+
}
|
|
15808
|
+
/** This function tells if a line of a script starts tests and then hides their failure with `||`. */
|
|
15809
|
+
function swallowsTests(line) {
|
|
15810
|
+
const text = shellCode(line);
|
|
15811
|
+
const test = TEST_COMMAND.exec(text);
|
|
15812
|
+
return test !== null && SWALLOW.test(text.slice(test.index + test[0].length));
|
|
15813
|
+
}
|
|
15814
|
+
/** This function reads the keys of the step between the lines `start` and `end`. */
|
|
15815
|
+
function stepKeys(lines, start, end) {
|
|
15816
|
+
const indent = indentOf$1(lines[start] ?? "") + 2;
|
|
15817
|
+
const keys = {};
|
|
15818
|
+
for (let at = start; at < end; at++) {
|
|
15819
|
+
const line = lines[at] ?? "";
|
|
15820
|
+
if (at !== start && (line.trim() === "" || indentOf$1(line) !== indent)) continue;
|
|
15821
|
+
const id = keyValue(line, "id");
|
|
15822
|
+
if (id !== void 0) keys.id = id;
|
|
15823
|
+
const value = keyValue(line, "continue-on-error");
|
|
15824
|
+
if (value !== void 0) keys.continueOnError = {
|
|
15825
|
+
line: at,
|
|
15826
|
+
value
|
|
15827
|
+
};
|
|
15828
|
+
const run = keyValue(line, "run");
|
|
15829
|
+
if (run === void 0) continue;
|
|
15830
|
+
if (!/^[|>]/.test(run)) {
|
|
15831
|
+
keys.run = {
|
|
15832
|
+
line: at,
|
|
15833
|
+
lines: [run]
|
|
15834
|
+
};
|
|
15835
|
+
continue;
|
|
15836
|
+
}
|
|
15837
|
+
const body = [];
|
|
15838
|
+
for (let next = at + 1; next < end; next++) {
|
|
15839
|
+
const text = lines[next] ?? "";
|
|
15840
|
+
if (text.trim() !== "" && indentOf$1(text) <= indent) break;
|
|
15841
|
+
body.push(text);
|
|
15842
|
+
}
|
|
15843
|
+
keys.run = {
|
|
15844
|
+
line: at + 1,
|
|
15845
|
+
lines: body
|
|
15846
|
+
};
|
|
15847
|
+
}
|
|
15848
|
+
return keys;
|
|
15849
|
+
}
|
|
15850
|
+
/** This function gives each place of a workflow where a failure does not fail its job or its run. It does not read comments. */
|
|
15851
|
+
function hiddenFailures(text) {
|
|
15852
|
+
const lines = workflowLines(text);
|
|
15853
|
+
const jobs = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "jobs") !== void 0);
|
|
15854
|
+
if (jobs < 0) return [];
|
|
15855
|
+
const found = [];
|
|
15856
|
+
for (const jobLine of childKeys(lines, jobs)) {
|
|
15857
|
+
const job = /^\s*["']?([^"':\s]+)["']?\s*:/.exec(lines[jobLine] ?? "")?.[1] ?? "";
|
|
15858
|
+
const keys = childKeys(lines, jobLine);
|
|
15859
|
+
for (const at of keys) {
|
|
15860
|
+
const value = keyValue(lines[at] ?? "", "continue-on-error");
|
|
15861
|
+
if (value !== void 0 && value !== "false") found.push({
|
|
15862
|
+
job,
|
|
15863
|
+
line: at + 1,
|
|
15864
|
+
kind: "job",
|
|
15865
|
+
value
|
|
15866
|
+
});
|
|
15867
|
+
}
|
|
15868
|
+
const steps = keys.find((at) => keyValue(lines[at] ?? "", "steps") !== void 0);
|
|
15869
|
+
if (steps === void 0) continue;
|
|
15870
|
+
const jobEnd = blockEnd(lines, jobLine);
|
|
15871
|
+
const starts = listItems$1(lines, steps);
|
|
15872
|
+
starts.forEach((start, order) => {
|
|
15873
|
+
const end = starts[order + 1] ?? listEnd(lines, steps);
|
|
15874
|
+
const step = stepKeys(lines, start, end);
|
|
15875
|
+
const script = step.run?.lines ?? [];
|
|
15876
|
+
const coe = step.continueOnError;
|
|
15877
|
+
if (coe !== void 0 && coe.value !== "false" && script.some(startsTests)) {
|
|
15878
|
+
if (!(step.id !== void 0 && lines.slice(end, jobEnd).some((line) => line.includes(`steps.${step.id}.outcome`)))) found.push({
|
|
15879
|
+
job,
|
|
15880
|
+
line: coe.line + 1,
|
|
15881
|
+
kind: "step",
|
|
15882
|
+
value: coe.value
|
|
15883
|
+
});
|
|
15884
|
+
}
|
|
15885
|
+
script.forEach((line, offset) => {
|
|
15886
|
+
if (swallowsTests(line)) found.push({
|
|
15887
|
+
job,
|
|
15888
|
+
line: (step.run?.line ?? 0) + offset + 1,
|
|
15889
|
+
kind: "or",
|
|
15890
|
+
value: line.trim()
|
|
15891
|
+
});
|
|
15892
|
+
});
|
|
15893
|
+
});
|
|
15894
|
+
}
|
|
15895
|
+
return found;
|
|
15896
|
+
}
|
|
15897
|
+
/** This function reads an entry of the option `advisory`, or gives undefined when the entry has another form. */
|
|
15898
|
+
function parseAdvisory(entry) {
|
|
15899
|
+
const match = ENTRY.exec(entry.trim());
|
|
15900
|
+
if (match === null) return void 0;
|
|
15901
|
+
const [, file = "", job = "", until = "", reason = ""] = match;
|
|
15902
|
+
return {
|
|
15903
|
+
file,
|
|
15904
|
+
job,
|
|
15905
|
+
until,
|
|
15906
|
+
reason
|
|
15907
|
+
};
|
|
15908
|
+
}
|
|
15909
|
+
/** The text of each kind of hidden failure, for the message of a break. */
|
|
15910
|
+
const WHAT = {
|
|
15911
|
+
job: (failure, file) => `The job ${failure.job} of ${file} has continue-on-error: ${failure.value}. When it fails, needs.${failure.job}.result is success, and the run passes.`,
|
|
15912
|
+
step: (failure, file) => `A test step of the job ${failure.job} of ${file} has continue-on-error: ${failure.value}, and no later step reads its outcome. A failed test does not fail the job.`,
|
|
15913
|
+
or: (failure, file) => `A test command of the job ${failure.job} of ${file} ends with a "||" that does not fail: ${failure.value}. A failed test does not fail the step.`
|
|
15914
|
+
};
|
|
15915
|
+
const jobFails = {
|
|
15916
|
+
id: "job-fails",
|
|
15917
|
+
title: "A failed job fails its run and each job that reads it: no `continue-on-error` on a job or a test step, and no `|| true` after a test.",
|
|
15918
|
+
reason: "When a job with `continue-on-error` fails, `needs.<job>.result` is `success`, so a summary job of a gate passes over a crash. On 2026-11-05 the gate Speed OK of coeval stayed green over a failed job of this form.",
|
|
15919
|
+
fix: "Remove `continue-on-error` from the job or the test step, and `|| true` from the test command. A job that must not stop a merge stays out of the `needs` of the gate: its failure stays red, and the gate passes. To keep the key for a time, add `<file>#<job> until <YYYY-MM-DD>: <reason>` to the option `advisory`.",
|
|
15920
|
+
sources: [
|
|
15921
|
+
{
|
|
15922
|
+
repo: "coeval",
|
|
15923
|
+
rule: "gate",
|
|
15924
|
+
doc: "run 42034457935 (2026-11-05): a job with continue-on-error ended in failure, and needs.<job>.result read success, so Speed OK passed"
|
|
15925
|
+
},
|
|
15926
|
+
{
|
|
15927
|
+
repo: "vex",
|
|
15928
|
+
rule: "workflow-faults",
|
|
15929
|
+
doc: "vex-testkit src/workflow-faults.ts (2026-11-04): continue-on-error and || after a test hide a failed property"
|
|
15930
|
+
},
|
|
15931
|
+
{
|
|
15932
|
+
repo: "lag",
|
|
15933
|
+
rule: "ci",
|
|
15934
|
+
doc: "ci.yml (2026-11-16): the jobs safari and ios have continue-on-error: true"
|
|
15935
|
+
}
|
|
15936
|
+
],
|
|
15937
|
+
options: { advisory: {
|
|
15938
|
+
type: "strings",
|
|
15939
|
+
default: [],
|
|
15940
|
+
description: "The jobs that keep a hidden failure for a time, each as `<file>#<job> until <YYYY-MM-DD>: <reason>`. An entry covers the job and its steps. It fails after its day, and when its job hides no failure."
|
|
15941
|
+
} },
|
|
15942
|
+
failsFrom: "2026-12-07",
|
|
15943
|
+
check(context, options) {
|
|
15944
|
+
const files = context.gitFiles();
|
|
15945
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
15946
|
+
const today = context.today ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
15947
|
+
const config = context.rootPackage;
|
|
15948
|
+
const breaks = [];
|
|
15949
|
+
const entryLine = (entry) => lineOf(config.text, JSON.stringify(entry)) ?? 1;
|
|
15950
|
+
const live = /* @__PURE__ */ new Map();
|
|
15951
|
+
const entries = /* @__PURE__ */ new Map();
|
|
15952
|
+
for (const entry of options["advisory"] ?? []) {
|
|
15953
|
+
const advisory = parseAdvisory(entry);
|
|
15954
|
+
if (advisory === void 0) {
|
|
15955
|
+
breaks.push({
|
|
15956
|
+
file: config.file,
|
|
15957
|
+
line: entryLine(entry),
|
|
15958
|
+
message: `The entry "${entry}" of the option advisory has another form than "<file>#<job> until <YYYY-MM-DD>: <reason>".`
|
|
15959
|
+
});
|
|
15960
|
+
continue;
|
|
15961
|
+
}
|
|
15962
|
+
const key = `${advisory.file}#${advisory.job}`;
|
|
15963
|
+
entries.set(key, entry);
|
|
15964
|
+
if (advisory.until < today) breaks.push({
|
|
15965
|
+
file: config.file,
|
|
15966
|
+
line: entryLine(entry),
|
|
15967
|
+
message: `The exception ${key} ended on ${advisory.until}. Remove continue-on-error from the job, or give a new day with its reason.`
|
|
15968
|
+
});
|
|
15969
|
+
else live.set(key, advisory);
|
|
15970
|
+
}
|
|
15971
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
15972
|
+
for (const file of files.filter((path) => WORKFLOW$1.test(path)).sort(byCode)) {
|
|
15973
|
+
let text;
|
|
15974
|
+
try {
|
|
15975
|
+
text = readFileSync(join(context.root, file), "utf8");
|
|
15976
|
+
} catch {
|
|
15977
|
+
continue;
|
|
15978
|
+
}
|
|
15979
|
+
for (const failure of hiddenFailures(text)) {
|
|
15980
|
+
const key = `${basename(file)}#${failure.job}`;
|
|
15981
|
+
hidden.add(key);
|
|
15982
|
+
if (live.has(key)) continue;
|
|
15983
|
+
breaks.push({
|
|
15984
|
+
file,
|
|
15985
|
+
line: failure.line,
|
|
15986
|
+
message: WHAT[failure.kind](failure, file)
|
|
15987
|
+
});
|
|
15988
|
+
}
|
|
15989
|
+
}
|
|
15990
|
+
for (const [key, entry] of entries) if (!hidden.has(key)) breaks.push({
|
|
15991
|
+
file: config.file,
|
|
15992
|
+
line: entryLine(entry),
|
|
15993
|
+
message: `The exception ${key} of the option advisory names no job with a hidden failure. Remove it.`
|
|
15994
|
+
});
|
|
15995
|
+
return breaks;
|
|
15996
|
+
}
|
|
15997
|
+
};
|
|
15998
|
+
// src/rules/playwright-install.ts
|
|
15999
|
+
/**
|
|
16000
|
+
* The rule `playwright-install`: no workflow, action or site config installs the Playwright browsers with its own
|
|
16001
|
+
* command. The shared action `setup-playwright` of the template installs them from a cache, with a time limit and one
|
|
16002
|
+
* more try. A bare `playwright install --with-deps` waits for the package mirror with no limit.
|
|
16003
|
+
*/
|
|
16004
|
+
/** The files of a composite action. */
|
|
16005
|
+
const ACTION = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
16006
|
+
/** The folder of the action of the template itself. It is the one place with the install. */
|
|
16007
|
+
const SHARED_ACTION = ".github/actions/setup-playwright/";
|
|
16008
|
+
/**
|
|
16009
|
+
* A command of the Playwright CLI that installs: `install` or `install-deps`. The CLI comes first on the line, or after a
|
|
16010
|
+
* space or a shell operator. It can have a folder and a version, as in `node_modules/.bin/playwright` or
|
|
16011
|
+
* `playwright@1.64.1`. A name in quotes, for example in a message that a test looks for, is not a command.
|
|
16012
|
+
*/
|
|
16013
|
+
const INSTALL = /(?:^|[\s;&|(`])(?:[^\s"'`;&|()]*\/)?playwright(?:@[\w.^~-]+)?\s+(install(?:-deps)?)(?=$|[\s;&|)"'])/;
|
|
16014
|
+
/** This function gives each line of a workflow or an action that installs the Playwright browsers with its own command. It does not read a comment line. */
|
|
16015
|
+
function playwrightInstalls(text) {
|
|
16016
|
+
const found = [];
|
|
16017
|
+
text.split(/\r?\n/).forEach((line, index) => {
|
|
16018
|
+
if (line.trimStart().startsWith("#")) return;
|
|
16019
|
+
const match = INSTALL.exec(line);
|
|
16020
|
+
if (match === null) return;
|
|
16021
|
+
found.push({
|
|
16022
|
+
line: index + 1,
|
|
16023
|
+
command: match[1]
|
|
16024
|
+
});
|
|
16025
|
+
});
|
|
16026
|
+
return found;
|
|
16027
|
+
}
|
|
16028
|
+
/** This function gives the install in the value `build` of a site config, with the line of the key, or undefined. */
|
|
16029
|
+
function siteConfigInstall(text) {
|
|
16030
|
+
let data;
|
|
16031
|
+
try {
|
|
16032
|
+
data = JSON.parse(text);
|
|
16033
|
+
} catch {
|
|
16034
|
+
return;
|
|
16035
|
+
}
|
|
16036
|
+
const build = data?.build;
|
|
16037
|
+
if (typeof build !== "string") return void 0;
|
|
16038
|
+
const match = build.split(/\r?\n/).map((line) => INSTALL.exec(line)).find((each) => each !== null);
|
|
16039
|
+
if (match === void 0 || match === null) return void 0;
|
|
16040
|
+
return {
|
|
16041
|
+
line: text.split(/\r?\n/).findIndex((each) => /^\s*"build"\s*:/.test(each)) + 1,
|
|
16042
|
+
command: match[1]
|
|
16043
|
+
};
|
|
16044
|
+
}
|
|
16045
|
+
const FIX_STEP = "Use the action setup-playwright of the template, with the inputs browsers and command";
|
|
16046
|
+
const FIX_SITE = "Give \"playwright-browsers\" (and \"playwright-command\") in the site config, and remove the install from \"build\"";
|
|
16047
|
+
const playwrightInstall = {
|
|
16048
|
+
id: "playwright-install",
|
|
16049
|
+
title: "The Playwright browsers come from the shared action `setup-playwright`, not from an install in a workflow.",
|
|
16050
|
+
reason: "A bare `playwright install --with-deps` waits for the package mirror with no time limit and no cache. On 2026-11-11 the mirror of the runners did not resolve, and the browser jobs of client and lag stopped in apt until a restart.",
|
|
16051
|
+
fix: "A job step uses `uses: mark1russell7/template/.github/actions/setup-playwright@<commit>` with `browsers` and `command`. The build of `reusable-pages.yml` gives `\"playwright-browsers\"` in `.github/site.json`, or the input of the same name.",
|
|
16052
|
+
sources: [
|
|
16053
|
+
{
|
|
16054
|
+
repo: "client",
|
|
16055
|
+
rule: "ci",
|
|
16056
|
+
doc: "run 43034026417 of main (2026-11-11): playwright install --with-deps failed two times on the package mirror, and the required check CI OK stayed red"
|
|
16057
|
+
},
|
|
16058
|
+
{
|
|
16059
|
+
repo: "lag",
|
|
16060
|
+
rule: "ci",
|
|
16061
|
+
doc: "lag #113 and #115 (2026-11-11): apt of playwright install --with-deps got about 20 kB/s from the mirror, and each job needed a restart"
|
|
16062
|
+
},
|
|
16063
|
+
{
|
|
16064
|
+
repo: "template",
|
|
16065
|
+
rule: "setup-playwright",
|
|
16066
|
+
doc: "template #315 (2026-11-11): the action survives a fault of the package mirror, with a cache, a time limit and the mode best-effort"
|
|
16067
|
+
}
|
|
16068
|
+
],
|
|
16069
|
+
options: {},
|
|
16070
|
+
failsFrom: "2026-12-01",
|
|
16071
|
+
check(context) {
|
|
16072
|
+
const files = context.gitFiles();
|
|
16073
|
+
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
16074
|
+
const breaks = [];
|
|
16075
|
+
const read = (file) => {
|
|
16076
|
+
try {
|
|
16077
|
+
return readFileSync(join(context.root, file), "utf8");
|
|
16078
|
+
} catch {
|
|
16079
|
+
return;
|
|
16080
|
+
}
|
|
16081
|
+
};
|
|
16082
|
+
for (const file of files.filter((path) => (WORKFLOW$1.test(path) || ACTION.test(path)) && !path.startsWith(SHARED_ACTION)).sort(byCode)) {
|
|
16083
|
+
const text = read(file);
|
|
16084
|
+
if (text === void 0) continue;
|
|
16085
|
+
for (const install of playwrightInstalls(text)) breaks.push({
|
|
16086
|
+
file,
|
|
16087
|
+
line: install.line,
|
|
16088
|
+
message: `${file} starts "playwright ${install.command}" with its own command, with no cache and no time limit. ${FIX_STEP}, or the key playwright-browsers of the site config.`
|
|
16089
|
+
});
|
|
16090
|
+
}
|
|
16091
|
+
if (files.includes(".github/site.json")) {
|
|
16092
|
+
const text = read(SITE_CONFIG_PATH);
|
|
16093
|
+
const install = text === void 0 ? void 0 : siteConfigInstall(text);
|
|
16094
|
+
if (install !== void 0) breaks.push({
|
|
16095
|
+
file: SITE_CONFIG_PATH,
|
|
16096
|
+
line: install.line,
|
|
16097
|
+
message: `The build of ${SITE_CONFIG_PATH} starts "playwright ${install.command}", with no cache and no time limit. ${FIX_SITE}.`
|
|
16098
|
+
});
|
|
16099
|
+
}
|
|
16100
|
+
return breaks;
|
|
16101
|
+
}
|
|
16102
|
+
};
|
|
15693
16103
|
// src/rules/unreleased-change.ts
|
|
15694
16104
|
/**
|
|
15695
16105
|
* The rule `unreleased-change`: a change does not set a version that npm has. With the option `versionEachChange`, a
|
|
@@ -18123,11 +18533,13 @@ const RULES = [
|
|
|
18123
18533
|
mainRunsFinish,
|
|
18124
18534
|
pushMainOnly,
|
|
18125
18535
|
pipeFails,
|
|
18536
|
+
jobFails,
|
|
18126
18537
|
gateAfterCancel,
|
|
18127
18538
|
gateTrigger,
|
|
18128
18539
|
securityOneJob,
|
|
18129
18540
|
sharedCi,
|
|
18130
18541
|
setupCue,
|
|
18542
|
+
playwrightInstall,
|
|
18131
18543
|
homePackage,
|
|
18132
18544
|
homeModule,
|
|
18133
18545
|
licenseFile,
|
|
@@ -18575,6 +18987,7 @@ function createContext(root, config, options = {}) {
|
|
|
18575
18987
|
packages,
|
|
18576
18988
|
env: options.env ?? {},
|
|
18577
18989
|
...options.base === void 0 ? {} : { base: options.base },
|
|
18990
|
+
...options.today === void 0 ? {} : { today: options.today },
|
|
18578
18991
|
gitFiles() {
|
|
18579
18992
|
if (files === null) {
|
|
18580
18993
|
const out = runGit(root, [
|
|
@@ -19035,6 +19448,6 @@ function runHook(args, io) {
|
|
|
19035
19448
|
git: (gitArgs) => runGit(io.cwd, gitArgs)
|
|
19036
19449
|
}, io);
|
|
19037
19450
|
}
|
|
19038
|
-
export { unreleasedChangeRule as $,
|
|
19451
|
+
export { unreleasedChangeRule as $, keyLine as $n, repositoryIsPublic as $t, typedFiles as A, setupCue as An, privatePatterns as At, roadmapParses as B, prPathFilters as Bn, parsePrivateNames as Bt, versionTitle as C, hasTests as Cn, HOME_PATTERNS as Ct, typedScripts as D, SHARED_WORKFLOWS as Dn, invalidPatternBreaks as Dt, trustPolicy as E, SHARED_CI as En, PRIVATE_PATTERNS_VARIABLE as Et, HOME_TIMEOUT_MS as F, securityOneJob as Fn, isAllowedHit as Ft, publishedMinor as G, STRICT_OPTIONS as Gn, mainCheck as Gt, releaseFiles as H, gateAfterCancel as Hn, noBuildOutput as Ht, blockHash as I, withOneJob as In, isCommonUse as It, NPM_REGISTRY as J, RULE_WARN_DAYS as Jn, LICENSE_TEXTS as Jt, publishedMinorRule as K, cuePreset as Kn, coverageProvider as Kt, githubFetch as L, ACTIONS_COMMIT as Ln, lineNameHit as Lt, isSourcePath as M, SECURITY_SCAN_INPUTS as Mn, PRIVATE_NAME_LIST as Mt, pathsOf as N, SECURITY_TIMEOUT_MINUTES as Nn, PrivateNameListError as Nt, configsOfScript as O, callsSharedCi as On, noLocalPaths as Ot, sourceMain as P, securityCallers as Pn, firstNameMatch as Pt, unreleasedChange as Q, inFolder as Qn, mitText as Qt, sharedDocsRule as R, convertGate as Rn, lineNameHits as Rt, setVersions as S, serviceRunMain as Sn, DEFAULT_ALLOWED as St, TRAIN_SCOPES as T, SHARED_ACTIONS as Tn, PRIVATE_NAMES_FILE_VARIABLE as Tt, lockedVersions as U, readAction as Un, REAL_COMPARE as Ut, requiredScripts as V, summaryName as Vn, pathNameHit as Vt, minorOf as W, readWorkflow as Wn, hasImportMetaMain as Wt, UNSHIPPED_FILES as X, codePackages as Xn, licenseFile as Xt, SHIPPED_FIELDS as Y, cleanPath as Yn, authorOf as Yt, npmLookup as Z, hasFile as Zn, licenseFileOf as Zt, workspaceProtocol as _, npmDrift as _n, pagesCalls as _t, listRules as a, homePackage as an, runGit as ar, swallowsTests as at, yamlFaults as b, SERVICE_PACKAGE as bn, publishTextSafe as bt, runCli as c, reposOf as cn, parseConfig as cr, isPinned as ct, HOOK_MARKER as d, HOMES as dn, pagesAfterRelease as dt, homeModule as en, lineOf as er, playwrightInstall as et, NO_READ_LINE as f, MAP_RULE as fn, repositoryOfRemote as ft, RULES as g, mergeHomes as gn, PAGES_WORKFLOWS as gt, prePush as h, mapText as hn, pushMainOnly as ht, formatResult as i, declaredName as in, replaceLine as ir, startsTests as it, testsRequired as j, SECURITY_SCAN_COMMIT as jn, privateTextBreaks as jt, scriptsOf as k, sharedCi as kn, privateNamesFile as kt, runFix as l, signaturesOf as ln, pinnedGitDeps as lt, installHook as m, mapMarkdown as mn, scheduleMinute as mt, annotations as n, moduleUses as nn, parseJsonc as nr, jobFails as nt, readConfig as o, messageOf as on, specifiersOf as or, pipeFails as ot, PRE_PUSH_HOOK as p, findHomes as pn, runnerBudget as pt, reachOf as q, DEPENDENCY_FIELDS as qn, apiReportScript as qt, createContext as r, modulesOf as rn, readJsonc as rr, parseAdvisory as rt, runChecks as s, repoOf as sn, defaultOptions as sr, isGitSpecifier as st, USAGE as t, moduleMessage as tn, matchesAny as tr, hiddenFailures as tt, summaryMarkdown as u, HOME_EXPORTS as un, siteCheckInCi as ut, GITHUB_YAML as v, npmNames as vn, pagesSite as vt, IGNORE_AFTER as w, tsconfigTest as wn, PRIVATE_NAMES_FILE_CONFIG as wt, namedVersions as x, runCalls as xn, packNoBuildinfo as xt, workflowParses as y, readOverlay as yn, exportsRequire as yt, roadmapOfLine as z, gateTrigger as zn, nameMatches as zt };
|
|
19039
19452
|
|
|
19040
|
-
//# sourceMappingURL=run-
|
|
19453
|
+
//# sourceMappingURL=run-BezUWj3N.js.map
|