@mark1russell7/conventions 0.25.0 → 0.26.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 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` or on `workflow_call`. The fix writes `${{ github.event_name == 'pull_request' }}`.
26
+ - `main-runs-finish`: a `cancel-in-progress: true` or a concurrency group that ends with `${{ github.ref }}`, in a workflow that starts on `push` or on `workflow_call`. The fix writes `${{ github.event_name == 'pull_request' }}` and `${{ github.event_name == 'pull_request' && github.ref || github.sha }}`.
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` 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). |
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' }}`. Each commit of `main` has its own concurrency group: `${{ github.event_name == 'pull_request' && github.ref || github.sha }}`. In one group, GitHub cancels a run that waits when a newer run comes, whatever `cancel-in-progress` says. On 2026-11-03 four waiting CI runs of `main` in client were cancelled, so its version commit had no result and no release. 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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as runCli } from "./run-DrDMwxGF.js";
2
+ import { c as runCli } from "./run-DORqvzBZ.js";
3
3
  // src/cli.ts
4
4
  try {
5
5
  process.exitCode = runCli(process.argv.slice(2), {
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-DrDMwxGF.js";
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-DORqvzBZ.js";
@@ -1492,10 +1492,15 @@ function readWorkflow(file, text) {
1492
1492
  // src/rules/main-runs-finish.ts
1493
1493
  /**
1494
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.
1495
+ * Only the run of a pull request is cancelled by a newer push. Each commit of main has its own concurrency group, because
1496
+ * GitHub keeps only the newest run that waits in a group.
1496
1497
  */
1497
1498
  /** The value of `cancel-in-progress` that cancels only the run of a pull request. */
1498
1499
  const PULL_REQUEST_ONLY = "${{ github.event_name == 'pull_request' }}";
1500
+ /** The end of a concurrency group: a pull request has one group, and each other run has the group of its commit. */
1501
+ const OWN_GROUP = "${{ github.event_name == 'pull_request' && github.ref || github.sha }}";
1502
+ /** The end of a concurrency group that one run of main can share with the next run. */
1503
+ const SHARED_GROUP = "${{ github.ref }}";
1499
1504
  /** This function tells if the workflow starts on the event: `on: <event>`, `on: [<event>, ...]` or a key `<event>` under `on`. */
1500
1505
  function startsOn(lines, event) {
1501
1506
  const on = lines.findIndex((line) => indentOf$1(line) === 0 && keyValue(line, "on") !== void 0);
@@ -1520,18 +1525,26 @@ function runsOnMain(lines) {
1520
1525
  }
1521
1526
  const mainRunsFinish = {
1522
1527
  id: "main-runs-finish",
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.",
1528
+ title: "A workflow that starts on push or on workflow_call does not cancel a run in progress, and each commit of main has its own concurrency group. A newer push cancels only the run of a pull request.",
1524
1529
  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).",
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.`,
1526
- sources: [{
1527
- repo: "fleet",
1528
- rule: "main-runs-finish",
1529
- doc: "docs/STRATEGY.md (2026-11-03, a run of main ends)"
1530
- }, {
1531
- repo: "algebra",
1532
- rule: "main-check",
1533
- doc: "the A2 and A5 results (2026-11-03): a cancelled main run, and a cancelled bench run"
1534
- }],
1530
+ fix: `Set \`cancel-in-progress: ${PULL_REQUEST_ONLY}\`, and end the concurrency group with \`${OWN_GROUP}\`. In one group, GitHub cancels a run that waits when a newer run comes, whatever \`cancel-in-progress\` says.`,
1531
+ sources: [
1532
+ {
1533
+ repo: "fleet",
1534
+ rule: "main-runs-finish",
1535
+ doc: "docs/STRATEGY.md (2026-11-03, a run of main ends)"
1536
+ },
1537
+ {
1538
+ repo: "client",
1539
+ rule: "release",
1540
+ doc: "the release of 0.47.0 (2026-11-03): four waiting CI runs of main were cancelled, so the version commit had no result"
1541
+ },
1542
+ {
1543
+ repo: "algebra",
1544
+ rule: "main-check",
1545
+ doc: "the A2 and A5 results (2026-11-03): a cancelled main run, and a cancelled bench run"
1546
+ }
1547
+ ],
1535
1548
  options: {},
1536
1549
  check(context) {
1537
1550
  const files = context.gitFiles();
@@ -1550,6 +1563,20 @@ const mainRunsFinish = {
1550
1563
  if (!runsOnMain(lines)) continue;
1551
1564
  pushed += 1;
1552
1565
  lines.forEach((line, index) => {
1566
+ if (keyValue(line, "group")?.includes(SHARED_GROUP) === true) {
1567
+ const original = text.split(/\r?\n/)[index] ?? line;
1568
+ breaks.push({
1569
+ file,
1570
+ line: index + 1,
1571
+ message: `${file} starts on push or on workflow_call, and its concurrency group ends with the ref. Runs of main share the group, so a newer push cancels a run that waits, and that commit gets no result.`,
1572
+ edits: [{
1573
+ file,
1574
+ before: text,
1575
+ after: replaceLine(text, index + 1, [original.replace(SHARED_GROUP, () => OWN_GROUP)])
1576
+ }]
1577
+ });
1578
+ return;
1579
+ }
1553
1580
  if (keyValue(line, "cancel-in-progress") !== "true") return;
1554
1581
  const original = text.split(/\r?\n/)[index] ?? line;
1555
1582
  const after = replaceLine(text, index + 1, [original.replace(/cancel-in-progress:\s*["']?true["']?/, () => `cancel-in-progress: ${PULL_REQUEST_ONLY}`)]);
@@ -1762,7 +1789,7 @@ function convertGate(text, file, commit = ACTIONS_COMMIT) {
1762
1789
  const grouped = top("concurrency") >= 0;
1763
1790
  const group = (id) => grouped ? [] : [
1764
1791
  `${job}concurrency:`,
1765
- `${job}${unit}group: \${{ github.workflow }}-${id}-\${{ github.ref }}`,
1792
+ `${job}${unit}group: \${{ github.workflow }}-${id}-${OWN_GROUP}`,
1766
1793
  `${job}${unit}cancel-in-progress: ${PULL_REQUEST_ONLY}`
1767
1794
  ];
1768
1795
  const changes = [
@@ -8699,7 +8726,7 @@ function jobsOf(lines) {
8699
8726
  const hasTopGroup = (lines) => lines.some((line) => indentOf$1(line) === 0 && line.startsWith("concurrency:"));
8700
8727
  /**
8701
8728
  * This function gives the edit that adds a concurrency group at the top of a workflow, before `jobs:`. A new run of a pull
8702
- * request stops the old run. A run of another event waits for the old run, so that no release or scheduled run stops.
8729
+ * request stops the old run. A run of another event has the group of its commit, so that no release or scheduled run stops.
8703
8730
  */
8704
8731
  function groupEdits(file, text, lines) {
8705
8732
  const jobs = lines.findIndex((line) => indentOf$1(line) === 0 && line.startsWith("jobs:"));
@@ -8708,7 +8735,7 @@ function groupEdits(file, text, lines) {
8708
8735
  const original = text.split(/\r?\n/)[jobs] ?? "jobs:";
8709
8736
  const group = [
8710
8737
  "concurrency:",
8711
- pad + "group: ${{ github.workflow }}-${{ github.ref }}",
8738
+ pad + "group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}",
8712
8739
  pad + "cancel-in-progress: ${{ github.event_name == 'pull_request' }}",
8713
8740
  "",
8714
8741
  original
@@ -8836,7 +8863,7 @@ const runnerBudget = {
8836
8863
  id: "runner-budget",
8837
8864
  title: "Each matrix has a max-parallel of 3 or less, each workflow has a concurrency group, and each schedule starts at the minute that the repository and the file give.",
8838
8865
  reason: "All repositories of the account share 40 runners, and heavy work keeps at most 28 of them. On 2026-10-30, a matrix with no max-parallel and the sync pull requests of about 20 repositories filled 39 of the 40 runners, with 88 jobs in the queue. Each repository copied the weekly scan at `23 5 * * 1`, so all scans started at the same minute. A workflow with no concurrency group starts a new run on each push, and the old runs keep their runners.",
8839
- fix: "Add `max-parallel: 3` (or less) under `strategy`. Add a concurrency group at the top of the workflow (`concurrency: { group: <name>-${{ github.ref }}, cancel-in-progress: ${{ github.event_name == 'pull_request' }} }`), or in each job. Change the minute of each `cron` to the minute that the message gives; the hour and the days stay.",
8866
+ fix: "Add `max-parallel: 3` (or less) under `strategy`. Add a concurrency group at the top of the workflow (`concurrency: { group: <name>-${{ github.event_name == 'pull_request' && github.ref || github.sha }}, cancel-in-progress: ${{ github.event_name == 'pull_request' }} }`), or in each job. Change the minute of each `cron` to the minute that the message gives; the hour and the days stay.",
8840
8867
  sources: [{
8841
8868
  repo: "fleet",
8842
8869
  rule: "runner-slots",
@@ -10884,4 +10911,4 @@ function runMap(args, io) {
10884
10911
  }
10885
10912
  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 };
10886
10913
 
10887
- //# sourceMappingURL=run-DrDMwxGF.js.map
10914
+ //# sourceMappingURL=run-DORqvzBZ.js.map