@mark1russell7/conventions 0.23.0 → 0.24.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 +2 -2
- package/build/cli.js +1 -1
- package/build/index.js +1 -1
- package/build/{run-BDESgKjd.js → run-C-ZlaTL7.js} +23 -12
- package/build/run-C-ZlaTL7.js.map +1 -0
- package/package.json +2 -2
- package/build/run-BDESgKjd.js.map +0 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Each break shows the file, the line, the rule and the fix. In GitHub Actions, th
|
|
|
23
23
|
`conventions fix` writes the fixes that the rules know, and checks again. It continues until no fix applies. Each fix is an exact change of a file, and the fix writes it only when the file did not change after the check. These breaks have a fix:
|
|
24
24
|
|
|
25
25
|
- `runner-budget`: the minute of a schedule, a `max-parallel` of a matrix, and a concurrency group at the top of a workflow. A new run of a pull request stops the old run. A run of another event waits for the old run.
|
|
26
|
-
- `main-runs-finish`: a `cancel-in-progress: true` in a workflow that starts on `push`. The fix writes `${{ github.event_name == 'pull_request' }}`.
|
|
26
|
+
- `main-runs-finish`: a `cancel-in-progress: true` in a workflow that starts on `push` or on `workflow_call`. The fix writes `${{ github.event_name == 'pull_request' }}`.
|
|
27
27
|
- `tests-required`: the option `passWithNoTests` in a config or a script, in a package with test files. A package with no tests needs a person, who removes its test script.
|
|
28
28
|
- `typed-files`: a config file at the root of a package (`vitest.config.ts`). The fix adds `*.config.ts` and `rootDir: "."` to the `tsconfig.test.json` of the package, when that file has no comments.
|
|
29
29
|
- `trust-policy`: the settings `trustPolicy`, `trustPolicyIgnoreAfter` and `trustPolicyExclude` of `pnpm-workspace.yaml`. The fix makes the file when the repository has none.
|
|
@@ -56,7 +56,7 @@ The rules come from the invariants audit of 2026-10-26 (strategy item s38). The
|
|
|
56
56
|
| `tests-required` | No test runner passes when it finds no test: no `passWithNoTests: true` in a config of vitest, vite, jest or Playwright, and no `--passWithNoTests` in `package.json`. With the option, a broken include pattern turns the test gate green with no test run. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
|
|
57
57
|
| `roadmap-parses` | Each call of the Pages workflow of the template (`reusable-pages.yml`) gives a `roadmap`, or `site-pages: false`. Without it, the Status page shows no item of the plan. Each roadmap that a workflow gives to the Status page (a `roadmap:` key) parses as `@mark1russell7/site-pages` reads it. The rule uses the parser of site-pages. Thus a pull request finds a bad row, and the Pages job on `main` does not stop on it. | fleet `fail-closed` (STRATEGY.md, 2026-10-30). |
|
|
58
58
|
| `runner-budget` | All repositories of the account share 40 runners. Each `strategy` with a `matrix` has a `max-parallel` of 3 or less. Each workflow has a concurrency group at the top or in each job. A job that calls a shared workflow of the option `grouped` gets its group from that workflow, and each job of that workflow has a group. The minute of each `cron` comes from a hash of the repository and the file (1 to 59), so the schedules of the repositories do not start together. The repository comes from `GITHUB_REPOSITORY` or from the remote `origin`. | fleet `runner-slots` (STRATEGY.md, 2026-10-30). |
|
|
59
|
-
| `main-runs-finish` | A workflow that starts on `push` does not cancel a run in progress. A newer push cancels only the run of a pull request: `cancel-in-progress: ${{ github.event_name == 'pull_request' }}`. A newer run of `main` waits, and GitHub keeps only the newest run that waits. On 2026-11-03 the next merge cancelled the CI run of a commit on `main`, so the main check of that commit had no result. A bench run on `main` was cancelled too, and its claim had no measurement. | fleet `main-runs-finish` (STRATEGY.md, 2026-11-03). |
|
|
59
|
+
| `main-runs-finish` | A workflow that starts on `push` or on `workflow_call` does not cancel a run in progress. A called workflow gets the event of its caller. A newer push cancels only the run of a pull request: `cancel-in-progress: ${{ github.event_name == 'pull_request' }}`. A newer run of `main` waits, and GitHub keeps only the newest run that waits. On 2026-11-03 the next merge cancelled the CI run of a commit on `main`, so the main check of that commit had no result. A bench run on `main` was cancelled too, and its claim had no measurement. | fleet `main-runs-finish` (STRATEGY.md, 2026-11-03). |
|
|
60
60
|
| `gate-trigger` | No workflow has `paths` or `paths-ignore` on `on.pull_request` or `on.pull_request_target`. The ruleset needs the summary check `<Name> OK` of each gate, and a workflow with a path filter does not start on each pull request. Then its check is not there, the ruleset cannot ask for it, and a pull request can merge before the gate ends. A gate uses the actions `changes` and `gate-summary` of the template (`CI.md`, "A gate with paths"). | fleet `gate-trigger` (STRATEGY.md, 2026-11-02). |
|
|
61
61
|
| `license-file` | Each public package has a license field, and a license file with the same license in its own folder. A public repository, or a repository with a public package, has a license file at its root. In a GitHub Actions run, the event file tells if the repository is public, and the option `license` (MIT by default) is the license of a root with no public package. npm packs only the license file of the folder of the package, and GitHub reads only the one of the root: on 2026-11-02 five public repositories showed no license on GitHub while npm said MIT. `conventions fix` writes the missing files. | fleet strategy (2026-11-02). |
|
|
62
62
|
| `home-package` | A change does not add a function with a signature name of another home of the map (for example `median`, `mulberry32` or `writeFileAtomic`). A local copy drifts from the home and splits the fixes. On 2026-11-02 the fleet had 68 local statistics functions in 14 repositories. The rule examines only the lines that the change adds, so the copies that exist do not break. | fleet direction 18 (STRATEGY.md, 2026-11-02). |
|
package/build/cli.js
CHANGED
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { xt as ACTIONS_COMMIT, Y as DEFAULT_ALLOWED, kt as DEPENDENCY_FIELDS, pt as HOMES, bt as HOME_EXPORTS, X as HOME_PATTERNS, M as HOME_TIMEOUT_MS, y as IGNORE_AFTER, nt as LICENSE_TEXTS, mt as MAP_RULE, p as NPM_REGISTRY, K as PAGES_WORKFLOWS, $ as REAL_COMPARE, d as RULES, m as SHIPPED_FIELDS, Dt as STRICT_OPTIONS, b as TRAIN_SCOPES, h as UNSHIPPED_FILES, t as USAGE, n as annotations, rt as authorOf, N as blockHash, At as cleanPath, jt as codePackages, C as configsOfScript, St as convertGate, r as createContext, Ot as cuePreset, ct as declaredName, Kt as defaultOptions, ht as findHomes, i as formatResult, Ct as gateTrigger, P as githubFetch, Ht as globFolders, Ut as globToRegExp, Mt as hasFile, et as hasImportMetaMain, D as hasTests, lt as homePackage, Nt as inFolder, U as isGitSpecifier, W as isPinned, k as isSourcePath, Pt as keyLine, it as licenseFile, at as licenseFileOf, Ft as lineOf, a as listRules, tt as mainCheck, gt as mapMarkdown, _t as mapText, It as matchesAny, vt as mergeHomes, ut as messageOf, ot as mitText, Q as noBuildOutput, Z as noLocalPaths, g as npmLookup, Wt as packageFolders, q as pagesCalls, J as pagesSite, qt as parseConfig, Lt as parseJsonc, A as pathsOf, G as pinnedGitDeps, wt as prPathFilters, o as readConfig, Rt as readJsonc, yt as readOverlay, Et as readWorkflow, H as releaseFiles, zt as replaceLine, dt as repoOf, st as repositoryIsPublic, I as repositoryOfRemote, V as requiredScripts, z as roadmapOfLine, B as roadmapParses, s as runChecks, c as runCli, l as runFix, Bt as runGit, L as runnerBudget, R as scheduleMinute, w as scriptsOf, F as sharedDocsRule, ft as signaturesOf, j as sourceMain, Vt as specifiersOf, u as summaryMarkdown, Tt as summaryName, E as testsRequired, x as trustPolicy, O as tsconfigTest, T as typedFiles, S as typedScripts, _ as unreleasedChange, v as unreleasedChangeRule, Gt as workspaceGlobs, f as workspaceProtocol } from "./run-
|
|
1
|
+
export { xt as ACTIONS_COMMIT, Y as DEFAULT_ALLOWED, kt as DEPENDENCY_FIELDS, pt as HOMES, bt as HOME_EXPORTS, X as HOME_PATTERNS, M as HOME_TIMEOUT_MS, y as IGNORE_AFTER, nt as LICENSE_TEXTS, mt as MAP_RULE, p as NPM_REGISTRY, K as PAGES_WORKFLOWS, $ as REAL_COMPARE, d as RULES, m as SHIPPED_FIELDS, Dt as STRICT_OPTIONS, b as TRAIN_SCOPES, h as UNSHIPPED_FILES, t as USAGE, n as annotations, rt as authorOf, N as blockHash, At as cleanPath, jt as codePackages, C as configsOfScript, St as convertGate, r as createContext, Ot as cuePreset, ct as declaredName, Kt as defaultOptions, ht as findHomes, i as formatResult, Ct as gateTrigger, P as githubFetch, Ht as globFolders, Ut as globToRegExp, Mt as hasFile, et as hasImportMetaMain, D as hasTests, lt as homePackage, Nt as inFolder, U as isGitSpecifier, W as isPinned, k as isSourcePath, Pt as keyLine, it as licenseFile, at as licenseFileOf, Ft as lineOf, a as listRules, tt as mainCheck, gt as mapMarkdown, _t as mapText, It as matchesAny, vt as mergeHomes, ut as messageOf, ot as mitText, Q as noBuildOutput, Z as noLocalPaths, g as npmLookup, Wt as packageFolders, q as pagesCalls, J as pagesSite, qt as parseConfig, Lt as parseJsonc, A as pathsOf, G as pinnedGitDeps, wt as prPathFilters, o as readConfig, Rt as readJsonc, yt as readOverlay, Et as readWorkflow, H as releaseFiles, zt as replaceLine, dt as repoOf, st as repositoryIsPublic, I as repositoryOfRemote, V as requiredScripts, z as roadmapOfLine, B as roadmapParses, s as runChecks, c as runCli, l as runFix, Bt as runGit, L as runnerBudget, R as scheduleMinute, w as scriptsOf, F as sharedDocsRule, ft as signaturesOf, j as sourceMain, Vt as specifiersOf, u as summaryMarkdown, Tt as summaryName, E as testsRequired, x as trustPolicy, O as tsconfigTest, T as typedFiles, S as typedScripts, _ as unreleasedChange, v as unreleasedChangeRule, Gt as workspaceGlobs, f as workspaceProtocol } from "./run-C-ZlaTL7.js";
|
|
@@ -1491,26 +1491,37 @@ function readWorkflow(file, text) {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
// src/rules/main-runs-finish.ts
|
|
1493
1493
|
/**
|
|
1494
|
-
* The rule `main-runs-finish`: a workflow that starts on `push` does not cancel a run in progress.
|
|
1495
|
-
* request is cancelled by a newer push.
|
|
1494
|
+
* The rule `main-runs-finish`: a workflow that starts on `push` or on `workflow_call` does not cancel a run in progress.
|
|
1495
|
+
* Only the run of a pull request is cancelled by a newer push.
|
|
1496
1496
|
*/
|
|
1497
1497
|
/** The value of `cancel-in-progress` that cancels only the run of a pull request. */
|
|
1498
1498
|
const PULL_REQUEST_ONLY = "${{ github.event_name == 'pull_request' }}";
|
|
1499
|
-
/** This function tells if the workflow starts on
|
|
1500
|
-
function
|
|
1499
|
+
/** This function tells if the workflow starts on the event: `on: <event>`, `on: [<event>, ...]` or a key `<event>` under `on`. */
|
|
1500
|
+
function startsOn(lines, event) {
|
|
1501
1501
|
const on = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "on") !== void 0);
|
|
1502
1502
|
if (on < 0) return false;
|
|
1503
1503
|
const value = keyValue(lines[on] ?? "", "on") ?? "";
|
|
1504
|
-
if (value !== "") return
|
|
1504
|
+
if (value !== "") return new RegExp(`(^|[\\s[,])${event}([\\s\\],]|$)`).test(value);
|
|
1505
1505
|
return childKeys(lines, on).some((index) => {
|
|
1506
1506
|
const key = (lines[index] ?? "").trim().replace(/^- /, "");
|
|
1507
|
-
return key ===
|
|
1507
|
+
return key === event || key.startsWith(`${event}:`);
|
|
1508
1508
|
});
|
|
1509
1509
|
}
|
|
1510
|
+
/** This function tells if the workflow starts on `push`. */
|
|
1511
|
+
function startsOnPush(lines) {
|
|
1512
|
+
return startsOn(lines, "push");
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* This function tells if a run of the workflow can be a run of main. A workflow that starts on `workflow_call` gets
|
|
1516
|
+
* the event of its caller, and a caller can start on `push`.
|
|
1517
|
+
*/
|
|
1518
|
+
function runsOnMain(lines) {
|
|
1519
|
+
return startsOnPush(lines) || startsOn(lines, "workflow_call");
|
|
1520
|
+
}
|
|
1510
1521
|
const mainRunsFinish = {
|
|
1511
1522
|
id: "main-runs-finish",
|
|
1512
|
-
title: "A workflow that starts on push does not cancel a run in progress. A newer push cancels only the run of a pull request.",
|
|
1513
|
-
reason: "On 2026-11-03 the next merge cancelled the CI run of a commit on main, so the main check of that commit had no result. A shared concurrency group also cancelled a bench run on main, and its claim had no measurement. The CI workflow of the template had `cancel-in-progress: true`, and each repository copied it.",
|
|
1523
|
+
title: "A workflow that starts on push or on workflow_call does not cancel a run in progress. A newer push cancels only the run of a pull request.",
|
|
1524
|
+
reason: "On 2026-11-03 the next merge cancelled the CI run of a commit on main, so the main check of that commit had no result. A shared concurrency group also cancelled a bench run on main, and its claim had no measurement. The CI workflow of the template had `cancel-in-progress: true`, and each repository copied it. A called workflow gets the event of its caller, so a `true` in a workflow that starts on `workflow_call` cancels the run of main too (packing, time-gate.yml, 2026-11-03).",
|
|
1514
1525
|
fix: `Set \`cancel-in-progress: ${PULL_REQUEST_ONLY}\`. A newer run of main then waits for the older run, and GitHub keeps only the newest run that waits.`,
|
|
1515
1526
|
sources: [{
|
|
1516
1527
|
repo: "fleet",
|
|
@@ -1536,7 +1547,7 @@ const mainRunsFinish = {
|
|
|
1536
1547
|
continue;
|
|
1537
1548
|
}
|
|
1538
1549
|
const lines = workflowLines(text);
|
|
1539
|
-
if (!
|
|
1550
|
+
if (!runsOnMain(lines)) continue;
|
|
1540
1551
|
pushed += 1;
|
|
1541
1552
|
lines.forEach((line, index) => {
|
|
1542
1553
|
if (keyValue(line, "cancel-in-progress") !== "true") return;
|
|
@@ -1545,7 +1556,7 @@ const mainRunsFinish = {
|
|
|
1545
1556
|
breaks.push({
|
|
1546
1557
|
file,
|
|
1547
1558
|
line: index + 1,
|
|
1548
|
-
message: `${file} starts on push and has \`cancel-in-progress: true\`. A newer push cancels the run of main in progress, and that commit gets no result.`,
|
|
1559
|
+
message: `${file} starts on push or on workflow_call and has \`cancel-in-progress: true\`. A newer push cancels the run of main in progress, and that commit gets no result.`,
|
|
1549
1560
|
edits: [{
|
|
1550
1561
|
file,
|
|
1551
1562
|
before: text,
|
|
@@ -1554,7 +1565,7 @@ const mainRunsFinish = {
|
|
|
1554
1565
|
});
|
|
1555
1566
|
});
|
|
1556
1567
|
}
|
|
1557
|
-
if (pushed === 0) return { skipped: "no workflow starts on push" };
|
|
1568
|
+
if (pushed === 0) return { skipped: "no workflow starts on push or on workflow_call" };
|
|
1558
1569
|
return breaks;
|
|
1559
1570
|
}
|
|
1560
1571
|
};
|
|
@@ -10866,4 +10877,4 @@ function runMap(args, io) {
|
|
|
10866
10877
|
}
|
|
10867
10878
|
export { REAL_COMPARE as $, pathsOf as A, cleanPath as At, roadmapParses as B, runGit as Bt, configsOfScript as C, gateTrigger as Ct, hasTests as D, STRICT_OPTIONS as Dt, testsRequired as E, readWorkflow as Et, sharedDocsRule as F, lineOf as Ft, pinnedGitDeps as G, workspaceGlobs as Gt, releaseFiles as H, globFolders as Ht, repositoryOfRemote as I, matchesAny as It, pagesSite as J, PAGES_WORKFLOWS as K, defaultOptions as Kt, runnerBudget as L, parseJsonc as Lt, HOME_TIMEOUT_MS as M, hasFile as Mt, blockHash as N, inFolder as Nt, tsconfigTest as O, cuePreset as Ot, githubFetch as P, keyLine as Pt, noBuildOutput as Q, scheduleMinute as R, readJsonc as Rt, typedScripts as S, convertGate as St, typedFiles as T, summaryName as Tt, isGitSpecifier as U, globToRegExp as Ut, requiredScripts as V, specifiersOf as Vt, isPinned as W, packageFolders as Wt, HOME_PATTERNS as X, DEFAULT_ALLOWED as Y, noLocalPaths as Z, unreleasedChange as _, mapText as _t, listRules as a, licenseFileOf as at, TRAIN_SCOPES as b, HOME_EXPORTS as bt, runCli as c, declaredName as ct, RULES as d, repoOf as dt, hasImportMetaMain as et, workspaceProtocol as f, signaturesOf as ft, npmLookup as g, mapMarkdown as gt, UNSHIPPED_FILES as h, findHomes as ht, formatResult as i, licenseFile as it, sourceMain as j, codePackages as jt, isSourcePath as k, DEPENDENCY_FIELDS as kt, runFix as l, homePackage as lt, SHIPPED_FIELDS as m, MAP_RULE as mt, annotations as n, LICENSE_TEXTS as nt, readConfig as o, mitText as ot, NPM_REGISTRY as p, HOMES as pt, pagesCalls as q, parseConfig as qt, createContext as r, authorOf as rt, runChecks as s, repositoryIsPublic as st, USAGE as t, mainCheck as tt, summaryMarkdown as u, messageOf as ut, unreleasedChangeRule as v, mergeHomes as vt, scriptsOf as w, prPathFilters as wt, trustPolicy as x, ACTIONS_COMMIT as xt, IGNORE_AFTER as y, readOverlay as yt, roadmapOfLine as z, replaceLine as zt };
|
|
10868
10879
|
|
|
10869
|
-
//# sourceMappingURL=run-
|
|
10880
|
+
//# sourceMappingURL=run-C-ZlaTL7.js.map
|