@antelopejs/tooling-configs 0.8.1-next.372.g1d7ef26 → 0.8.1-next.374.g2cfc8a1

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
@@ -57,7 +57,7 @@ The AntelopeJS guardrail pack: shared lint, format and dead-code presets, the co
57
57
  - `--apply` turns `delete_branch_on_merge` on for each repository the `conformance` check reports it off on, and writes nothing else.
58
58
  - The `stale-branches` check lists, in one finding per repository, the branches other than the default, `next` and protected ones that head a merged or closed pull request at their current commit, or have no open pull request and no commit for 30 days. A branch that heads or receives an open pull request is never listed. `prunes` holds one `{ repo, branch, reason }` per listed branch, and `--apply-prunes` deletes exactly those refs.
59
59
 
60
- Both profiles of `antelopejs-sync` keep the shared CI caller on the job id `ci`, so the check is reported as `ci / checks`. The `ci` job is read-only (`contents: read`) and passes `renovate-sync: false` and `test-job: true`, which runs the tests in their own job (sync adds `test-job: true` to a caller that does not set it and keeps a value the caller set); the `contents: write` and `actions: write` grants that let the Renovate sync push its commit and dispatch the caller live on a separate `renovate-sync` job calling `ci-renovate-sync.yml`, which sync adds when it is missing and never re-pins. Under the full profile it also sets the `docs-files` input of every ci-node caller to the existing `README.md` and `docs` of the root and of each workspace package that is not private, then keeps the caller's other listed paths that still exist. Renaming a caller to `ci` also rewrites `needs:` lists and `needs.<old-id>` reads in expressions, and sync (and `--check`) fails a caller in which a job needs a job that does not exist or reads `needs.<id>` of a job missing from its own `needs:`, since GitHub evaluates that read to null and a gate like `needs.checks.result == 'skipped'` then never fails.
60
+ Both profiles of `antelopejs-sync` keep the shared CI caller on the job id `ci`, so the check is reported as `ci / checks`. The `ci` job is read-only (`contents: read`) and passes `renovate-sync: false` and `test-job: true`, which runs the tests in their own job (sync adds `test-job: true` to a caller that does not set it and keeps a value the caller set); the `contents: write`, `actions: write` and `statuses: write` grants that let the Renovate sync push its commit, dispatch the caller and set the `ci / checks` status live on a separate `renovate-sync` job calling `ci-renovate-sync.yml`, which sync adds when it is missing and never re-pins. Under the full profile it also sets the `docs-files` input of every ci-node caller to the existing `README.md` and `docs` of the root and of each workspace package that is not private, then keeps the caller's other listed paths that still exist. Renaming a caller to `ci` also rewrites `needs:` lists and `needs.<old-id>` reads in expressions, and sync (and `--check`) fails a caller in which a job needs a job that does not exist or reads `needs.<id>` of a job missing from its own `needs:`, since GitHub evaluates that read to null and a gate like `needs.checks.result == 'skipped'` then never fails.
61
61
 
62
62
  ## antelopejs-triage
63
63
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as runCliAsync } from "../cli-4Tv71vYk.mjs";
3
3
  import { s as repositoryRoot } from "../files-C0avD1Eo.mjs";
4
- import { i as runChecks, n as CI_TIER_ENV, t as CHECKS_SKIP_ENV } from "../checks-CH55mAfP.mjs";
4
+ import { i as runChecks, n as CI_TIER_ENV, t as CHECKS_SKIP_ENV } from "../checks-DLYDbTCN.mjs";
5
5
  import { parseArgs } from "node:util";
6
6
  //#region src/bin/checks.ts
7
7
  const SIGNAL_EXIT = /* @__PURE__ */ new Map([
package/dist/bin/sync.mjs CHANGED
@@ -9,7 +9,7 @@ import { _ as ciRenovateSyncCallers, a as GITATTRIBUTES_ARTIFACT, b as sharedWor
9
9
  import { i as gitFiles, s as repositoryRoot } from "../files-C0avD1Eo.mjs";
10
10
  import { n as workspaceDirectories, r as workspacePatterns, t as planDocs } from "../docs-compat-CdgBviGf.mjs";
11
11
  import { n as shimInvocation } from "../run-command-BlFRPORx.mjs";
12
- import { a as verifyLayers, c as pnpmLockfiles, d as moveDependencyRanges, f as runPnpm, l as inWorkspace, o as matchingScripts, r as droppedChecksSteps, s as stepsOf, u as installsWithPnpm } from "../checks-CH55mAfP.mjs";
12
+ import { a as verifyLayers, c as pnpmLockfiles, d as moveDependencyRanges, f as runPnpm, l as inWorkspace, o as matchingScripts, r as droppedChecksSteps, s as stepsOf, u as installsWithPnpm } from "../checks-DLYDbTCN.mjs";
13
13
  import { n as SUPPRESSIONS_FILE, r as adoptedBudget } from "../suppression-budget-B30kar1T.mjs";
14
14
  import { c as typescript } from "../suppressions-BWTxQbDL.mjs";
15
15
  import { t as DEFAULT_SHARED } from "../map-C3j9QGqf.mjs";
@@ -372,6 +372,26 @@ const PORT_RANGE = {
372
372
  high: 2e4
373
373
  };
374
374
  const PORT_ATTEMPTS = 50;
375
+ /** The variable through which `journey --jobs` gives each feature process its own share of {@link PORT_RANGE}, as `<low>-<high>`. */
376
+ const PORT_LANE_ENV = "ANTELOPEJS_VERIFY_PORTS";
377
+ /** Share `lane` of `lanes` equal, disjoint shares of {@link PORT_RANGE}, as {@link PORT_LANE_ENV} carries it. */
378
+ function portLane(lane, lanes) {
379
+ const size = Math.floor((PORT_RANGE.high - PORT_RANGE.low) / lanes);
380
+ const low = PORT_RANGE.low + lane * size;
381
+ return `${low}-${low + size}`;
382
+ }
383
+ /** The share of {@link PORT_RANGE} {@link PORT_LANE_ENV} gives this process, or undefined when it shares the whole range with no other process. */
384
+ function lane() {
385
+ const value = process.env[PORT_LANE_ENV];
386
+ if (value === void 0) return void 0;
387
+ const match = /^(\d+)-(\d+)$/.exec(value);
388
+ const range = match && {
389
+ low: Number(match[1]),
390
+ high: Number(match[2])
391
+ };
392
+ if (!range || range.low < PORT_RANGE.low || range.high > PORT_RANGE.high || range.low >= range.high) throw new Error(`${PORT_LANE_ENV}=${value} is not a range <low>-<high> within ${PORT_RANGE.low}-${PORT_RANGE.high}`);
393
+ return range;
394
+ }
375
395
  function isAddressInfo(address) {
376
396
  return address instanceof Object;
377
397
  }
@@ -388,19 +408,19 @@ function bindable(port) {
388
408
  }
389
409
  /** Ports `freePort` already returned in this process, so concurrent callers never get the same one. */
390
410
  const handedOut = /* @__PURE__ */ new Set();
411
+ /** Hands out `port` when this process has not and it binds, recorded before the bind so a concurrent call skips it. */
391
412
  async function claim(port) {
392
413
  if (handedOut.has(port)) return null;
393
414
  handedOut.add(port);
394
- const bound = await bindable(port);
395
- if (bound === null) {
396
- handedOut.delete(port);
397
- return null;
398
- }
399
- if (bound !== port) {
400
- if (handedOut.has(bound)) return null;
401
- handedOut.delete(port);
402
- handedOut.add(bound);
403
- }
415
+ if (await bindable(port) !== null) return port;
416
+ handedOut.delete(port);
417
+ return null;
418
+ }
419
+ /** Hands out the port the kernel binds next when this process has not handed it out yet. */
420
+ async function claimKernelPort() {
421
+ const bound = await bindable(0);
422
+ if (bound === null || handedOut.has(bound)) return null;
423
+ handedOut.add(bound);
404
424
  return bound;
405
425
  }
406
426
  /**
@@ -408,15 +428,25 @@ async function claim(port) {
408
428
  * next, never returned twice in this process, so parallel journeys cannot
409
429
  * share one. It tries random ports below the kernel's ephemeral range first,
410
430
  * where no outgoing connection on a busy host takes it between this check and
411
- * the app's own bind, and falls back to a port the kernel picks.
431
+ * the app's own bind. A process given a share of that range through
432
+ * {@link PORT_LANE_ENV} stays in it, trying each of its ports in turn after
433
+ * the random ones, so no other feature process of the same `journey --jobs`
434
+ * call is handed the same port. Any other process falls back to a port the
435
+ * kernel picks.
412
436
  */
413
437
  async function freePort() {
438
+ const own = lane();
439
+ const range = own ?? PORT_RANGE;
414
440
  for (let attempt = 0; attempt < PORT_ATTEMPTS; attempt++) {
415
- const claimed = await claim(PORT_RANGE.low + Math.floor(Math.random() * (PORT_RANGE.high - PORT_RANGE.low)));
441
+ const claimed = await claim(range.low + Math.floor(Math.random() * (range.high - range.low)));
416
442
  if (claimed !== null) return claimed;
417
443
  }
418
- for (let attempt = 0; attempt < PORT_ATTEMPTS; attempt++) {
419
- const claimed = await claim(0);
444
+ if (own !== void 0) for (let port = own.low; port < own.high; port++) {
445
+ const claimed = await claim(port);
446
+ if (claimed !== null) return claimed;
447
+ }
448
+ else for (let attempt = 0; attempt < PORT_ATTEMPTS; attempt++) {
449
+ const claimed = await claimKernelPort();
420
450
  if (claimed !== null) return claimed;
421
451
  }
422
452
  throw new Error("no free loopback port");
@@ -564,9 +594,13 @@ function dependencies(runs, journeysOf) {
564
594
  * collects what it prints into `slot`. Resolves once it exited. A process
565
595
  * that ended on a signal or could not start is named on its stderr.
566
596
  */
567
- function runProcess(slot, args) {
597
+ function runProcess(slot, args, ports) {
568
598
  return new Promise((resolve) => {
569
599
  const child = spawn(process.execPath, args, {
600
+ env: {
601
+ ...process.env,
602
+ [PORT_LANE_ENV]: ports
603
+ },
570
604
  stdio: [
571
605
  "ignore",
572
606
  "pipe",
@@ -592,7 +626,9 @@ function runProcess(slot, args) {
592
626
  * as soon as it and every feature before it have ended. A process per
593
627
  * feature gives each one the `process.env`, verify.config.ts module state
594
628
  * and uncaught-error handler its own call would have, which features
595
- * sharing one process could not keep apart while running at once. A feature
629
+ * sharing one process could not keep apart while running at once. Each
630
+ * running process holds one of `jobs` lanes, a share of the ports
631
+ * `freePort` draws from that no other running process holds. A feature
596
632
  * whose process fails, ends on a signal or leaves an uncaught error does not
597
633
  * stop the others.
598
634
  *
@@ -631,6 +667,12 @@ async function runConcurrently(dir, runs, jobs, journeysOf, argsOf) {
631
667
  let interrupted;
632
668
  const ready = () => interrupted === void 0 ? slots.find((slot) => slot.state === "waiting" && slot.after.every((index) => slots[index].state === "ended")) : void 0;
633
669
  const busy = () => slots.filter((slot) => slot.state === "running").length;
670
+ const freeLane = () => {
671
+ const held = new Set(slots.flatMap((slot) => slot.state === "running" ? [slot.lane] : []));
672
+ let lane = 0;
673
+ while (held.has(lane)) lane++;
674
+ return lane;
675
+ };
634
676
  const kill = () => {
635
677
  for (const slot of slots) {
636
678
  const pid = slot.child?.pid;
@@ -654,8 +696,9 @@ async function runConcurrently(dir, runs, jobs, journeysOf, argsOf) {
654
696
  const fill = () => {
655
697
  for (let slot = ready(); slot !== void 0 && busy() < jobs; slot = ready()) {
656
698
  const started = slot;
699
+ started.lane = freeLane();
657
700
  started.state = "running";
658
- runProcess(started, argsOf(started.run)).then(() => {
701
+ runProcess(started, argsOf(started.run), portLane(started.lane, jobs)).then(() => {
659
702
  started.state = "ended";
660
703
  flush();
661
704
  fill();
@@ -37,10 +37,12 @@ function runPnpm(root, args) {
37
37
  * and from 1.0 alike, so a range open past the next minor of its floor lets an
38
38
  * install resolve a breaking release its dependent was never built against.
39
39
  * Every range on one stops below that minor: `>=0.4.0 <0.5.0` on 0.x,
40
- * `~1.2.0` from 1.0. A narrower range, such as an exact pin, fails too:
41
- * `@antelopejs/core` keeps one copy of each interface and refuses to start a
42
- * module whose range that copy falls outside, so a pin breaks startup at the
43
- * next patch release.
40
+ * `~1.2.0` from 1.0. A narrower range, such as an exact pin on a release,
41
+ * fails too: `@antelopejs/core` keeps one copy of each interface and refuses
42
+ * to start a module whose range that copy falls outside, so a pin breaks
43
+ * startup at the next patch release. An exact pin on a preview `next`
44
+ * publishes, `X.Y.Z-next.<count>.g<sha>`, passes: the release train turns it
45
+ * into the capped range on `X.Y.Z` at release.
44
46
  */
45
47
  const ANTELOPEJS_SCOPE$1 = "@antelopejs/";
46
48
  const INTERFACE_PREFIX = `${ANTELOPEJS_SCOPE$1}interface-`;
@@ -1369,7 +1371,10 @@ function pinnedPreview(version, by, versions) {
1369
1371
  return isPreview(version) && pulledByImporter(by) && [...versions].every(([other, pullers]) => other === version || releaseOnMinor(version, other) && !pulledByImporter(pullers));
1370
1372
  }
1371
1373
  function report(file, copies) {
1372
- return [...copies].filter(([, versions]) => [...versions].filter(([version, by]) => !pinnedPreview(version, by, versions)).length > 1).map(([name, versions]) => `${file} resolves "${name}" at ${versions.size} versions, and an interface package must load once:\n${[...versions].map(([version, by]) => ` ${version}, pulled by ${[...by].join(", ") || "nothing"}\n`).join("")}${REPAIR}`).join("");
1374
+ return [...copies].map(([name, versions]) => ({
1375
+ name,
1376
+ counted: [...versions].filter(([version, by]) => !pinnedPreview(version, by, versions))
1377
+ })).filter(({ counted }) => counted.length > 1).map(({ name, counted }) => `${file} resolves "${name}" at ${counted.length} versions, and an interface package must load once:\n${counted.map(([version, by]) => ` ${version}, pulled by ${[...by].join(", ") || "nothing"}\n`).join("")}${REPAIR}`).join("");
1373
1378
  }
1374
1379
  /** The folder holding a project's module locks, whose dev-only copies no production install reaches. */
1375
1380
  const MODULE_LOCKS = "antelope-lock";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.8.1-next.372.g1d7ef26",
3
+ "version": "0.8.1-next.374.g2cfc8a1",
4
4
  "description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and a dependency range check",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -152,7 +152,7 @@
152
152
  "engines": {
153
153
  "node": ">=22.18.0"
154
154
  },
155
- "gitHead": "1d7ef26135ea155b53a9d53db29144651c129c92",
155
+ "gitHead": "2cfc8a1195ab90bd0aaf48488beabdc429776632",
156
156
  "scripts": {
157
157
  "build": "tsdown",
158
158
  "lint": "oxlint",