@mark1russell7/conventions 0.43.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 +15 -2
- package/build/cli.js +1 -1
- package/build/index.d.ts +37 -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-BWdt9YOd.js → run-BezUWj3N.js} +626 -72
- package/build/run-BezUWj3N.js.map +1 -0
- package/package.json +8 -2
- package/build/run-BWdt9YOd.js.map +0 -1
|
@@ -3,6 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { basename, dirname, extname, isAbsolute, join, posix, relative, resolve } from "node:path";
|
|
6
|
+
import { SECRET_SHAPES, findSecretShapes, findSecretShapesInValue, redactSecretShapes } from "@mark1russell7/text/redact";
|
|
6
7
|
import { createHash } from "node:crypto";
|
|
7
8
|
import { parseAllDocuments } from "yaml";
|
|
8
9
|
// src/config.ts
|
|
@@ -1220,6 +1221,47 @@ const WORKFLOW$1 = /^\.github\/workflows\/[^/]+\.ya?ml$/;
|
|
|
1220
1221
|
const indentOf$1 = (line) => line.length - line.trimStart().length;
|
|
1221
1222
|
/** This function gives the lines of a workflow, with each line of a comment made empty. */
|
|
1222
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
|
+
}
|
|
1223
1265
|
/** This function removes a comment at the end of a value, and the quotes around it. */
|
|
1224
1266
|
function valueOf$1(raw) {
|
|
1225
1267
|
const comment = raw.search(/\s#/);
|
|
@@ -1262,6 +1304,29 @@ function childKeys(lines, index) {
|
|
|
1262
1304
|
for (let i = index + 1; i < blockEnd(lines, index); i++) if ((lines[i] ?? "").trim() !== "" && indentOf$1(lines[i] ?? "") === indent) keys.push(i);
|
|
1263
1305
|
return keys;
|
|
1264
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
|
+
}
|
|
1265
1330
|
/**
|
|
1266
1331
|
* This function applies changes to the lines of `text`, and keeps its line ends. The changes go from the end to the
|
|
1267
1332
|
* start, so each index stays correct. At one index, a splice that removes lines goes first, so it removes only the old
|
|
@@ -2150,9 +2215,9 @@ const securityOneJob = {
|
|
|
2150
2215
|
* GitHub fails at times with a 504, and a bare `curl` then fails the job.
|
|
2151
2216
|
*/
|
|
2152
2217
|
/** The files of a composite action. */
|
|
2153
|
-
const ACTION$
|
|
2218
|
+
const ACTION$2 = /^\.github\/actions\/.+\/action\.ya?ml$/;
|
|
2154
2219
|
/** The action of the template itself. It is the one place with the download. */
|
|
2155
|
-
const SHARED_ACTION = ".github/actions/setup-cue/action.yml";
|
|
2220
|
+
const SHARED_ACTION$1 = ".github/actions/setup-cue/action.yml";
|
|
2156
2221
|
/** A hand-written install of the cue CLI: a download of a release asset, or a build with `go install`. */
|
|
2157
2222
|
const DOWNLOAD = /github\.com\/cue-lang\/cue\/releases\/download\/(v[0-9][^/\s"']*)\/|cuelang\.org\/go\/cmd\/cue@(v?[0-9][^\s"']*|latest)/;
|
|
2158
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. */
|
|
@@ -2197,7 +2262,7 @@ const setupCue = {
|
|
|
2197
2262
|
const files = context.gitFiles();
|
|
2198
2263
|
if (files === void 0) return { skipped: "the root is not in a git repository" };
|
|
2199
2264
|
const breaks = [];
|
|
2200
|
-
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)) {
|
|
2201
2266
|
let text;
|
|
2202
2267
|
try {
|
|
2203
2268
|
text = readFileSync(join(context.root, file), "utf8");
|
|
@@ -2262,7 +2327,7 @@ const SHARED_ACTIONS = [
|
|
|
2262
2327
|
/** The `uses` value of a job that calls the shared CI, with no pin. */
|
|
2263
2328
|
const SHARED_CI = "mark1russell7/template/.github/workflows/reusable-ci.yml";
|
|
2264
2329
|
/** The action folder of a path: `.github/actions/<name>/action.yml` gives `<name>`. */
|
|
2265
|
-
const ACTION = /^\.github\/actions\/([^/]+)\//;
|
|
2330
|
+
const ACTION$1 = /^\.github\/actions\/([^/]+)\//;
|
|
2266
2331
|
/** The file name of a path. */
|
|
2267
2332
|
const baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
2268
2333
|
/** This function tells if a job of a workflow text uses the shared CI of the template. */
|
|
@@ -2326,7 +2391,7 @@ const sharedCi = {
|
|
|
2326
2391
|
});
|
|
2327
2392
|
const actions = /* @__PURE__ */ new Set();
|
|
2328
2393
|
for (const file of files) {
|
|
2329
|
-
const folder = ACTION.exec(file)?.[1];
|
|
2394
|
+
const folder = ACTION$1.exec(file)?.[1];
|
|
2330
2395
|
if (folder !== void 0 && SHARED_ACTIONS.includes(folder) && !actions.has(folder)) {
|
|
2331
2396
|
actions.add(folder);
|
|
2332
2397
|
breaks.push({
|
|
@@ -3378,7 +3443,7 @@ const HOMES = [
|
|
|
3378
3443
|
{
|
|
3379
3444
|
area: "cluster-design",
|
|
3380
3445
|
title: "Computer cluster design",
|
|
3381
|
-
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",
|
|
3382
3447
|
packages: [],
|
|
3383
3448
|
repo: "mark1russell7/cluster-design",
|
|
3384
3449
|
state: "planned",
|
|
@@ -3389,7 +3454,6 @@ const HOMES = [
|
|
|
3389
3454
|
"socket",
|
|
3390
3455
|
"psu",
|
|
3391
3456
|
"watts",
|
|
3392
|
-
"circuit",
|
|
3393
3457
|
"runner capacity",
|
|
3394
3458
|
"heat",
|
|
3395
3459
|
"noise",
|
|
@@ -3421,26 +3485,73 @@ const HOMES = [
|
|
|
3421
3485
|
note: "Loops go to @mark1russell7/service, the machine state machine to @mark1russell7/algebra. It has no site facts."
|
|
3422
3486
|
},
|
|
3423
3487
|
{
|
|
3424
|
-
area: "
|
|
3425
|
-
title: "3D
|
|
3426
|
-
covers: "
|
|
3427
|
-
packages: [],
|
|
3428
|
-
repo: "mark1russell7/
|
|
3429
|
-
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",
|
|
3430
3494
|
words: [
|
|
3431
3495
|
"3d",
|
|
3432
3496
|
"three.js",
|
|
3433
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: [
|
|
3434
3523
|
"gltf",
|
|
3435
3524
|
"room",
|
|
3525
|
+
"wall",
|
|
3526
|
+
"opening",
|
|
3527
|
+
"anchor",
|
|
3528
|
+
"add-on",
|
|
3436
3529
|
"floor plan",
|
|
3437
|
-
"scene",
|
|
3438
|
-
"outlet",
|
|
3439
3530
|
"blender",
|
|
3440
|
-
"
|
|
3531
|
+
"apartment model"
|
|
3441
3532
|
],
|
|
3442
3533
|
note: "3D geometry records go to layout-contract."
|
|
3443
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
|
+
},
|
|
3444
3555
|
{
|
|
3445
3556
|
area: "packing",
|
|
3446
3557
|
title: "Rectangle packing",
|
|
@@ -13666,17 +13777,25 @@ const packNoBuildinfo = {
|
|
|
13666
13777
|
// src/rules/publish-text-safe.ts
|
|
13667
13778
|
/**
|
|
13668
13779
|
* The rule `publish-text-safe`: the text that npm puts in the publish document of a public package has no line in the
|
|
13669
|
-
* shape of an attack. This text is each README file of the package folder,
|
|
13670
|
-
*
|
|
13671
|
-
*
|
|
13780
|
+
* shape of an attack. It also has no token of a known service. This text is each README file of the package folder,
|
|
13781
|
+
* and each key and each string of `package.json`. The document holds the whole manifest with `publishConfig`, so
|
|
13782
|
+
* `scripts`, `repository`, `bugs`, `config` and `bin` go to the registry with `description` and `keywords`.
|
|
13783
|
+
*
|
|
13784
|
+
* The registry screens the document. On 2026-11-15 it refused a document with the shape of a SQL probe (E403), and the
|
|
13785
|
+
* error did not name the cause. The registry also shows the text to each reader, and its mirrors keep each version.
|
|
13786
|
+
*
|
|
13787
|
+
* The walk of the manifest is `findSecretShapesInValue` of `@mark1russell7/text/redact`. The shapes of the tokens are
|
|
13788
|
+
* `SECRET_SHAPES` of the same module, the home of the redaction of secrets. This file has no copy of these patterns. A
|
|
13789
|
+
* break gives the line and the name of the shape, not the token.
|
|
13672
13790
|
*
|
|
13673
13791
|
* This rule does not wait `RULE_WARN_DAYS`: it fails from its release day. The wait gives the owners time to fix the
|
|
13674
|
-
* breaks of a new rule. On 2026-11-16 a first read of the local clones used the shapes of this file. It found
|
|
13675
|
-
* example, the README of text 0.0.7 (in 2 old clones), and 0 false hits. Thus the wait protects no repository.
|
|
13676
|
-
* of 14 days lets a repeat of the text case pass with only a warning.
|
|
13792
|
+
* breaks of a new rule. On 2026-11-16 a first read of the local clones used the attack shapes of this file. It found
|
|
13793
|
+
* 1 true example, the README of text 0.0.7 (in 2 old clones), and 0 false hits. Thus the wait protects no repository.
|
|
13794
|
+
* A wait of 14 days lets a repeat of the text case pass with only a warning.
|
|
13677
13795
|
*
|
|
13678
|
-
* At 11:32 UTC of the same day, one read of 446 README files and 664 manifests
|
|
13679
|
-
*
|
|
13796
|
+
* At 11:32 UTC of the same day, one read of both scopes took 446 README files and 664 manifests (56,049 keys and
|
|
13797
|
+
* strings) of the local clones. It found 0 attack shapes and 0 tokens. The sessions add, pull and remove clones during
|
|
13798
|
+
* a day, so each count is the count of one read.
|
|
13680
13799
|
*/
|
|
13681
13800
|
/**
|
|
13682
13801
|
* The shapes of the attacks. Only the shape `sql-boolean` has a refusal on record: it stopped each publish of
|
|
@@ -13727,30 +13846,136 @@ function attackLines(text, shapes = ATTACK_SHAPES) {
|
|
|
13727
13846
|
});
|
|
13728
13847
|
return found;
|
|
13729
13848
|
}
|
|
13849
|
+
/** The attack shapes in the form of the shapes of text, for the walk of a value. The label is the field `what`. */
|
|
13850
|
+
const ATTACKS_AS_SECRET_SHAPES = Object.freeze(ATTACK_SHAPES.map((shape) => Object.freeze({
|
|
13851
|
+
id: shape.id,
|
|
13852
|
+
label: shape.what,
|
|
13853
|
+
pattern: shape.pattern
|
|
13854
|
+
})));
|
|
13855
|
+
/**
|
|
13856
|
+
* This function gives each match of an attack shape in each key and each string of `value`, with the path to the
|
|
13857
|
+
* string. It is `findSecretShapesInValue` of text with the attack shapes. The order is the order of the document.
|
|
13858
|
+
*/
|
|
13859
|
+
function attacksInValue(value, shapes = ATTACK_SHAPES) {
|
|
13860
|
+
const asSecretShapes = shapes === ATTACK_SHAPES ? ATTACKS_AS_SECRET_SHAPES : shapes.map((shape) => ({
|
|
13861
|
+
id: shape.id,
|
|
13862
|
+
label: shape.what,
|
|
13863
|
+
pattern: shape.pattern
|
|
13864
|
+
}));
|
|
13865
|
+
return findSecretShapesInValue(value, asSecretShapes);
|
|
13866
|
+
}
|
|
13867
|
+
/**
|
|
13868
|
+
* This function gives the line and the shape of each token in `text`, in the order of the text. A private key block
|
|
13869
|
+
* can go across lines: its line is the line of its start. The result has no text of the token.
|
|
13870
|
+
*/
|
|
13871
|
+
function secretLines(text, shapes = SECRET_SHAPES) {
|
|
13872
|
+
const byId = new Map(shapes.map((shape) => [shape.id, shape]));
|
|
13873
|
+
const found = [];
|
|
13874
|
+
let line = 1;
|
|
13875
|
+
let at = 0;
|
|
13876
|
+
for (const match of findSecretShapes(text, shapes)) {
|
|
13877
|
+
for (; at < match.start; at++) if (text.charCodeAt(at) === 10) line++;
|
|
13878
|
+
const shape = byId.get(match.shape);
|
|
13879
|
+
if (shape !== void 0) found.push({
|
|
13880
|
+
line,
|
|
13881
|
+
shape
|
|
13882
|
+
});
|
|
13883
|
+
}
|
|
13884
|
+
return found;
|
|
13885
|
+
}
|
|
13730
13886
|
/** The names of the README files that npm packs from the folder of a package, with each case and extension. */
|
|
13731
13887
|
const README = /^readme(?:\.[\w-]+)?$/i;
|
|
13732
|
-
/**
|
|
13733
|
-
|
|
13888
|
+
/**
|
|
13889
|
+
* This function gives a text with each token of a known service as `[secret]`. A break message holds a matched text
|
|
13890
|
+
* and the keys of a path. A token can be in each of them: in the span of `sql-tautology`, in a key, or in the key of
|
|
13891
|
+
* a parent. Each part goes through this function before its cut to 60 characters. A token that the cut divides has
|
|
13892
|
+
* no shape for a later pass. Each finished message goes through it again.
|
|
13893
|
+
*/
|
|
13894
|
+
const secretFree = (text) => redactSecretShapes(text);
|
|
13895
|
+
/** This function gives a matched text for a message, with no token, no line end and at most 60 characters. */
|
|
13896
|
+
const shown = (text) => {
|
|
13897
|
+
const free = secretFree(text);
|
|
13898
|
+
return JSON.stringify(free.length > 60 ? `${free.slice(0, 57)}...` : free);
|
|
13899
|
+
};
|
|
13900
|
+
/** This function gives the path of a match in words for a message, with each token in a key as `[secret]`. */
|
|
13901
|
+
const shownPath = (path) => fieldOf(path.map((part) => typeof part === "string" ? secretFree(part) : part));
|
|
13734
13902
|
/** This function gives the end of the message of an attack shape: the refusal on record, or the source of the shape. */
|
|
13735
13903
|
const refusalOf = (shape) => shape.seen === null ? "The shape follows a SQL rule of the OWASP Core Rule Set, so the npm registry can refuse the publish (E403). No refusal of it is on record." : `The npm registry refused a publish with this shape (${shape.seen}).`;
|
|
13904
|
+
/** This function gives the end of the message of a token. It names the shape, and it does not show the token. */
|
|
13905
|
+
const tokenOf = (shape) => `${shape.label} (${shape.id}). npm shows this text to each reader of the package. Revoke the secret at its service, and then remove it.`;
|
|
13906
|
+
/** A name of a key that a path shows after a dot. Each other key goes in brackets as JSON, for example `exports["./a"]`. */
|
|
13907
|
+
const PLAIN_KEY = /^[A-Za-z_$][\w$-]*$/;
|
|
13908
|
+
/** This function gives the path to a string of a manifest in words, for example `scripts.build` or `keywords[1]`. */
|
|
13909
|
+
function fieldOf(path) {
|
|
13910
|
+
return path.map((part, index) => typeof part === "number" ? `[${part}]` : PLAIN_KEY.test(part) ? `${index === 0 ? "" : "."}${part}` : `[${JSON.stringify(part)}]`).join("");
|
|
13911
|
+
}
|
|
13912
|
+
/** This function gives the key or the string at the end of a path in a value, or `undefined` if no string is there. */
|
|
13913
|
+
function stringAt(value, path, inKey) {
|
|
13914
|
+
if (inKey) {
|
|
13915
|
+
const key = path[path.length - 1];
|
|
13916
|
+
return typeof key === "string" ? key : void 0;
|
|
13917
|
+
}
|
|
13918
|
+
let at = value;
|
|
13919
|
+
for (const part of path) {
|
|
13920
|
+
if (at === null || typeof at !== "object") return void 0;
|
|
13921
|
+
at = at[part];
|
|
13922
|
+
}
|
|
13923
|
+
return typeof at === "string" ? at : void 0;
|
|
13924
|
+
}
|
|
13925
|
+
/**
|
|
13926
|
+
* This function gives the line of the string at the end of a path in the text of a manifest. It finds each key of the
|
|
13927
|
+
* path after the line of the key before it, as `"key":` and then as `"key"`. An index of an array keeps the line of
|
|
13928
|
+
* its key. For a string that is not a key, it then finds the string as JSON after that line. When a part is not in the
|
|
13929
|
+
* text, the line of the part before stays. An example is a key that the file writes with an escape.
|
|
13930
|
+
*
|
|
13931
|
+
* A key with the same name in an earlier object under the same parent gives an earlier line. An example is the path
|
|
13932
|
+
* `a.x` in `{"a": {"z": {"x": 1}, "x": "bad"}}`. The search of the string corrects this for a value with a distinct
|
|
13933
|
+
* text, but not for a match in a key. Only the line is wrong: the path and the shape of the break stay correct.
|
|
13934
|
+
*/
|
|
13935
|
+
function pathLine(text, path, leaf) {
|
|
13936
|
+
let line;
|
|
13937
|
+
for (const part of path) {
|
|
13938
|
+
if (typeof part === "number") continue;
|
|
13939
|
+
const name = JSON.stringify(part);
|
|
13940
|
+
line = lineOf(text, `${name}:`, line ?? 1) ?? lineOf(text, name, line ?? 1) ?? line;
|
|
13941
|
+
}
|
|
13942
|
+
if (leaf !== void 0) line = lineOf(text, JSON.stringify(leaf), line ?? 1) ?? line;
|
|
13943
|
+
return line;
|
|
13944
|
+
}
|
|
13736
13945
|
const publishTextSafe = {
|
|
13737
13946
|
id: "publish-text-safe",
|
|
13738
|
-
title: "The text that npm puts in the publish document of a public package (each README,
|
|
13739
|
-
reason: "The npm registry screens the publish document, and it refused a document with the shape of a SQL probe. On 2026-11-15 and 2026-11-16, each publish of @mark1russell7/text 0.0.7 failed with E403. An example in its README had AND, a number, an equal sign and a number. The error does not name the cause, so the release looked like a fault of the trust of the package. A new README example went out, and the same trust published 0.0.7.",
|
|
13740
|
-
fix: "Write the example with other words
|
|
13741
|
-
sources: [
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13749
|
-
|
|
13947
|
+
title: "The text that npm puts in the publish document of a public package (each README, and each key and string of `package.json`) has no line in the shape of an attack, and no token of a known service.",
|
|
13948
|
+
reason: "The npm registry screens the publish document, and it refused a document with the shape of a SQL probe. On 2026-11-15 and 2026-11-16, each publish of @mark1russell7/text 0.0.7 failed with E403. An example in its README had AND, a number, an equal sign and a number. The error does not name the cause, so the release looked like a fault of the trust of the package. A new README example went out, and the same trust published 0.0.7. The document holds the whole manifest, so a shape in `scripts` or a token in `repository.url` goes to the same screen. A token in this text goes to each reader of the package, and the mirrors of the registry keep each version, so a later fix does not remove the token.",
|
|
13949
|
+
fix: "Write the example or the value with other words, for example `partsAt(\"A wide river\", [[2, 6]])`. For a token, revoke it at its service first, and then write a fake value, for example `TOKEN-EXAMPLE`. A changed README or manifest of a released package needs a PATCH version.",
|
|
13950
|
+
sources: [
|
|
13951
|
+
{
|
|
13952
|
+
repo: "text",
|
|
13953
|
+
rule: "publish-text-safe",
|
|
13954
|
+
doc: "packages/text/README.md (0.0.7, pull request 32)"
|
|
13955
|
+
},
|
|
13956
|
+
{
|
|
13957
|
+
repo: "text",
|
|
13958
|
+
rule: "secret-shapes",
|
|
13959
|
+
doc: "packages/text/src/redact.ts (SECRET_SHAPES, findSecretShapesInValue, 0.0.8)"
|
|
13960
|
+
},
|
|
13961
|
+
{
|
|
13962
|
+
repo: "private",
|
|
13963
|
+
rule: "publish-text-safe",
|
|
13964
|
+
doc: "docs/STRATEGY.md (2026-11-16, the publish document has no attack shape and no token)"
|
|
13965
|
+
}
|
|
13966
|
+
],
|
|
13750
13967
|
options: {},
|
|
13751
13968
|
failsFrom: "2026-11-16",
|
|
13752
13969
|
check(context) {
|
|
13753
13970
|
const breaks = [];
|
|
13971
|
+
const push = (found) => {
|
|
13972
|
+
breaks.push({
|
|
13973
|
+
...found,
|
|
13974
|
+
message: secretFree(found.message)
|
|
13975
|
+
});
|
|
13976
|
+
};
|
|
13977
|
+
const byId = new Map(ATTACK_SHAPES.map((shape) => [shape.id, shape]));
|
|
13978
|
+
const secretById = new Map(SECRET_SHAPES.map((shape) => [shape.id, shape]));
|
|
13754
13979
|
for (const pkg of versionedPackages(context)) {
|
|
13755
13980
|
const name = String(pkg.manifest["name"]);
|
|
13756
13981
|
let names;
|
|
@@ -13766,20 +13991,46 @@ const publishTextSafe = {
|
|
|
13766
13991
|
} catch {
|
|
13767
13992
|
continue;
|
|
13768
13993
|
}
|
|
13769
|
-
for (const hit of attackLines(text))
|
|
13994
|
+
for (const hit of attackLines(text)) push({
|
|
13770
13995
|
file: inFolder(pkg.folder, file),
|
|
13771
13996
|
line: hit.line,
|
|
13772
13997
|
message: `The README of ${name} has ${shown(hit.text)}, ${hit.shape.what} (${hit.shape.id}). ${refusalOf(hit.shape)}`
|
|
13773
13998
|
});
|
|
13999
|
+
for (const hit of secretLines(text)) push({
|
|
14000
|
+
file: inFolder(pkg.folder, file),
|
|
14001
|
+
line: hit.line,
|
|
14002
|
+
message: `The README of ${name} has ${tokenOf(hit.shape)}`
|
|
14003
|
+
});
|
|
13774
14004
|
}
|
|
13775
|
-
const
|
|
13776
|
-
const
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
14005
|
+
const done = /* @__PURE__ */ new Set();
|
|
14006
|
+
for (const match of attacksInValue(pkg.manifest)) {
|
|
14007
|
+
const once = `${match.inKey}:${JSON.stringify(match.path)}:${match.shape}`;
|
|
14008
|
+
if (done.has(once)) continue;
|
|
14009
|
+
done.add(once);
|
|
14010
|
+
const shape = byId.get(match.shape);
|
|
14011
|
+
const value = stringAt(pkg.manifest, match.path, match.inKey);
|
|
14012
|
+
const line = pathLine(pkg.text, match.path, match.inKey ? void 0 : value);
|
|
14013
|
+
const what = shape === void 0 ? `the shape ${match.shape}` : `${shape.what} (${shape.id})`;
|
|
14014
|
+
const has = value === void 0 ? `${what}, in a text that the rule cannot read` : `${shown(value.slice(match.start, match.end))}, ${what}`;
|
|
14015
|
+
push({
|
|
14016
|
+
file: pkg.file,
|
|
14017
|
+
...line === void 0 ? {} : { line },
|
|
14018
|
+
message: `The ${match.inKey ? "key" : "field"} "${shownPath(match.path)}" of ${name} has ${has}.${shape === void 0 ? "" : ` ${refusalOf(shape)}`}`
|
|
14019
|
+
});
|
|
14020
|
+
}
|
|
14021
|
+
for (const match of findSecretShapesInValue(pkg.manifest)) {
|
|
14022
|
+
const once = `secret:${match.inKey}:${JSON.stringify(match.path)}:${match.shape}`;
|
|
14023
|
+
if (done.has(once)) continue;
|
|
14024
|
+
done.add(once);
|
|
14025
|
+
const shape = secretById.get(match.shape) ?? {
|
|
14026
|
+
id: match.shape,
|
|
14027
|
+
label: "a token of a known service"
|
|
14028
|
+
};
|
|
14029
|
+
const line = pathLine(pkg.text, match.path, match.inKey ? void 0 : stringAt(pkg.manifest, match.path, false));
|
|
14030
|
+
push({
|
|
13780
14031
|
file: pkg.file,
|
|
13781
14032
|
...line === void 0 ? {} : { line },
|
|
13782
|
-
message: `The
|
|
14033
|
+
message: `The ${match.inKey ? "key" : "field"} "${shownPath(match.path)}" of ${name} has ${tokenOf(shape)}`
|
|
13783
14034
|
});
|
|
13784
14035
|
}
|
|
13785
14036
|
}
|
|
@@ -15011,6 +15262,14 @@ const SITE_CONFIG_KEYS = {
|
|
|
15011
15262
|
kind: "string",
|
|
15012
15263
|
default: "1.64.1"
|
|
15013
15264
|
},
|
|
15265
|
+
"playwright-browsers": {
|
|
15266
|
+
kind: "string",
|
|
15267
|
+
default: ""
|
|
15268
|
+
},
|
|
15269
|
+
"playwright-command": {
|
|
15270
|
+
kind: "string",
|
|
15271
|
+
default: "npx --no-install playwright"
|
|
15272
|
+
},
|
|
15014
15273
|
"site-bar": {
|
|
15015
15274
|
kind: "boolean",
|
|
15016
15275
|
default: false
|
|
@@ -15428,9 +15687,9 @@ function runSteps(lines) {
|
|
|
15428
15687
|
const jobShell = defaultShell(lines, job);
|
|
15429
15688
|
const steps = childKeys(lines, job).find((at) => keyValue(lines[at] ?? "", "steps") !== void 0);
|
|
15430
15689
|
if (steps === void 0) continue;
|
|
15431
|
-
const dashes =
|
|
15690
|
+
const dashes = listItems$1(lines, steps);
|
|
15432
15691
|
dashes.forEach((dash, order) => {
|
|
15433
|
-
const end = dashes[order + 1] ??
|
|
15692
|
+
const end = dashes[order + 1] ?? listEnd(lines, steps);
|
|
15434
15693
|
const indent = indentOf$1(lines[dash] ?? "") + 2;
|
|
15435
15694
|
let run;
|
|
15436
15695
|
let shell;
|
|
@@ -15458,29 +15717,6 @@ function runSteps(lines) {
|
|
|
15458
15717
|
}
|
|
15459
15718
|
return found;
|
|
15460
15719
|
}
|
|
15461
|
-
/** 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. */
|
|
15462
|
-
function blockAfter(lines, steps) {
|
|
15463
|
-
const indent = indentOf$1(lines[steps] ?? "");
|
|
15464
|
-
for (let at = steps + 1; at < lines.length; at++) {
|
|
15465
|
-
const line = lines[at] ?? "";
|
|
15466
|
-
if (line.trim() === "") continue;
|
|
15467
|
-
if (indentOf$1(line) < indent || indentOf$1(line) === indent && !line.trimStart().startsWith("- ")) return at;
|
|
15468
|
-
}
|
|
15469
|
-
return lines.length;
|
|
15470
|
-
}
|
|
15471
|
-
/** This function gives the lines of the items of the list of steps. */
|
|
15472
|
-
function stepStarts(lines, steps) {
|
|
15473
|
-
const end = blockAfter(lines, steps);
|
|
15474
|
-
let indent;
|
|
15475
|
-
const starts = [];
|
|
15476
|
-
for (let at = steps + 1; at < end; at++) {
|
|
15477
|
-
const line = lines[at] ?? "";
|
|
15478
|
-
if (line.trim() === "") continue;
|
|
15479
|
-
indent ??= indentOf$1(line);
|
|
15480
|
-
if (indentOf$1(line) === indent && line.trimStart().startsWith("- ")) starts.push(at);
|
|
15481
|
-
}
|
|
15482
|
-
return starts;
|
|
15483
|
-
}
|
|
15484
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. */
|
|
15485
15721
|
function hidesFailure(shell) {
|
|
15486
15722
|
if (shell === void 0) return true;
|
|
@@ -15549,6 +15785,321 @@ const pipeFails = {
|
|
|
15549
15785
|
return breaks;
|
|
15550
15786
|
}
|
|
15551
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
|
+
};
|
|
15552
16103
|
// src/rules/unreleased-change.ts
|
|
15553
16104
|
/**
|
|
15554
16105
|
* The rule `unreleased-change`: a change does not set a version that npm has. With the option `versionEachChange`, a
|
|
@@ -17982,11 +18533,13 @@ const RULES = [
|
|
|
17982
18533
|
mainRunsFinish,
|
|
17983
18534
|
pushMainOnly,
|
|
17984
18535
|
pipeFails,
|
|
18536
|
+
jobFails,
|
|
17985
18537
|
gateAfterCancel,
|
|
17986
18538
|
gateTrigger,
|
|
17987
18539
|
securityOneJob,
|
|
17988
18540
|
sharedCi,
|
|
17989
18541
|
setupCue,
|
|
18542
|
+
playwrightInstall,
|
|
17990
18543
|
homePackage,
|
|
17991
18544
|
homeModule,
|
|
17992
18545
|
licenseFile,
|
|
@@ -18434,6 +18987,7 @@ function createContext(root, config, options = {}) {
|
|
|
18434
18987
|
packages,
|
|
18435
18988
|
env: options.env ?? {},
|
|
18436
18989
|
...options.base === void 0 ? {} : { base: options.base },
|
|
18990
|
+
...options.today === void 0 ? {} : { today: options.today },
|
|
18437
18991
|
gitFiles() {
|
|
18438
18992
|
if (files === null) {
|
|
18439
18993
|
const out = runGit(root, [
|
|
@@ -18894,6 +19448,6 @@ function runHook(args, io) {
|
|
|
18894
19448
|
git: (gitArgs) => runGit(io.cwd, gitArgs)
|
|
18895
19449
|
}, io);
|
|
18896
19450
|
}
|
|
18897
|
-
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 };
|
|
18898
19452
|
|
|
18899
|
-
//# sourceMappingURL=run-
|
|
19453
|
+
//# sourceMappingURL=run-BezUWj3N.js.map
|