@theholocron/astromech 5.0.0-alpha.576 → 5.0.0-alpha.578

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
@@ -239,7 +239,7 @@ aggregate (`ci: { aggregate: "none" }`; SPEC-0118, #2754, step 1): the same ques
239
239
  answered from the newest run of each required check, as `{ state: "success" | "failure" | "pending" | "none", failing }`
240
240
  (the shape of the CLI's `PullRequestChecks`; each `failing` entry is `{ name, url?, required }`). It is pure and runs
241
241
  `evaluateAggregate()` and `newestCheckRuns()` with no deadline, so matching is theirs, and `evaluateAggregate()` itself is
242
- unchanged. Nothing calls it yet; `close work`, the board and Sentinel will, so the rule lives in one place. The rules:
242
+ unchanged. When a required check is not yet green and not failed, the verdict also has `pending`, the ids of those checks in the order of `expected` then `statuses` (a cancelled newest run counts; absent when there are none or the state is `none`). Nothing calls it yet; `close work`, the board and Sentinel will, so the rule lives in one place. The rules:
243
243
 
244
244
  - Only the newest run of each name counts; `skipped` and `neutral` pass.
245
245
  - `success` only when every required check is satisfied; one that has not posted is `pending`.
package/dist/index.d.mts CHANGED
@@ -231,21 +231,14 @@ interface RequiredChecksVerdict {
231
231
  state: RequiredChecksState;
232
232
  /** The failing checks of the commit, the required ones first; empty unless something failed. */
233
233
  failing: RequiredChecksFailure[];
234
+ /** Ids of the required checks not yet green and not failed (unposted, running, cancelled); absent when none. */
235
+ pending?: string[];
234
236
  }
235
237
  /**
236
- * Decides whether the required checks of one commit are green, without the `ci / Required checks` aggregate.
237
- *
238
- * Pure: no clock, no network, no GitHub types. It is the one place the rule lives; callers pass it the runs and
239
- * statuses they read and the `{ expected, statuses }` list of the required checks. Matching and the newest-run rule
240
- * are {@link evaluateAggregate}'s and `newestCheckRuns()`'s, run with no deadline.
241
- *
242
- * - Only the newest run of each check name counts; `skipped` and `neutral` pass.
243
- * - `success` only when every required check is satisfied; one that has not posted is `pending`.
244
- * - `failure` as soon as a required check's newest run failed, even while a sibling run is still going.
245
- * - A re-run still going over an earlier failure is `pending`, and so is a `cancelled` newest run (which
246
- * {@link evaluateAggregate} itself counts as a failure; its own behaviour is unchanged).
247
- * - An empty `expected` list or an `incomplete` read is `none` (unknown), never `success`.
248
- * - Only required checks decide. A failing optional check is listed in `failing` with `required: false`.
238
+ * Whether the required checks of one commit are green, with no aggregate; the one place the rule lives. Pure. The newest
239
+ * run of each name counts (`skipped`, `neutral` pass); `success` needs every required check, an unposted one or a
240
+ * `cancelled` newest run is `pending`, a failed required check is `failure` at once, an empty list or an `incomplete`
241
+ * read is `none` (no `pending`), `pending` names the required checks not yet green and not failed (absent when none), and only required checks decide (optional failures are listed with `required: false`).
249
242
  */
250
243
  export declare function requiredChecksVerdict(input: RequiredChecksInput): RequiredChecksVerdict;
251
244
  /** A commit status a coverage provider reports on a pull request (names only), as `Coverage.statusContexts()` returns it. */
@@ -538,7 +531,7 @@ export declare function normalizeWorkflowWith(raw: Record<string, unknown>): Rec
538
531
  export declare function deriveDeployPaths(raw: Record<string, unknown>): string[];
539
532
  /**
540
533
  * The context of the aggregate check: the caller's job (`ci`) and the called job (`Required checks`), as GitHub joins
541
- * them for a reusable workflow.
534
+ * them for a reusable workflow. The same value as {@link AGGREGATE_CHECK_NAME}, which holds the one definition.
542
535
  */
543
536
  export declare const AGGREGATE_CHECK = "ci / Required checks";
544
537
  /**
package/dist/index.mjs CHANGED
@@ -319,19 +319,10 @@ function failure(name, url, required) {
319
319
  };
320
320
  }
321
321
  /**
322
- * Decides whether the required checks of one commit are green, without the `ci / Required checks` aggregate.
323
- *
324
- * Pure: no clock, no network, no GitHub types. It is the one place the rule lives; callers pass it the runs and
325
- * statuses they read and the `{ expected, statuses }` list of the required checks. Matching and the newest-run rule
326
- * are {@link evaluateAggregate}'s and `newestCheckRuns()`'s, run with no deadline.
327
- *
328
- * - Only the newest run of each check name counts; `skipped` and `neutral` pass.
329
- * - `success` only when every required check is satisfied; one that has not posted is `pending`.
330
- * - `failure` as soon as a required check's newest run failed, even while a sibling run is still going.
331
- * - A re-run still going over an earlier failure is `pending`, and so is a `cancelled` newest run (which
332
- * {@link evaluateAggregate} itself counts as a failure; its own behaviour is unchanged).
333
- * - An empty `expected` list or an `incomplete` read is `none` (unknown), never `success`.
334
- * - Only required checks decide. A failing optional check is listed in `failing` with `required: false`.
322
+ * Whether the required checks of one commit are green, with no aggregate; the one place the rule lives. Pure. The newest
323
+ * run of each name counts (`skipped`, `neutral` pass); `success` needs every required check, an unposted one or a
324
+ * `cancelled` newest run is `pending`, a failed required check is `failure` at once, an empty list or an `incomplete`
325
+ * read is `none` (no `pending`), `pending` names the required checks not yet green and not failed (absent when none), and only required checks decide (optional failures are listed with `required: false`).
335
326
  */
336
327
  function requiredChecksVerdict(input) {
337
328
  const newest = newestCheckRuns(input.checkRuns);
@@ -347,13 +338,18 @@ function requiredChecksVerdict(input) {
347
338
  } : run);
348
339
  const failed = rowsFor(input, settled.filter((run) => run.status === "completed")).filter((row) => row.state === "failure");
349
340
  const failing = [...failed.map((row) => failure(row.id, row.url, true)), ...optional];
341
+ const failedIds = new Set(failed.map((row) => row.id));
342
+ const pending = rowsFor(input, settled).filter((row) => row.state !== "success" && !failedIds.has(row.id)).map((row) => row.id);
343
+ const names = pending.length > 0 ? { pending } : {};
350
344
  if (failed.length > 0) return {
351
345
  state: "failure",
352
- failing
346
+ failing,
347
+ ...names
353
348
  };
354
349
  return {
355
- state: rowsFor(input, settled).every((row) => row.state === "success") ? "success" : "pending",
356
- failing
350
+ state: pending.length === 0 ? "success" : "pending",
351
+ failing,
352
+ ...names
357
353
  };
358
354
  }
359
355
  // src/vocabulary/suites/suites.ts
@@ -1924,10 +1920,22 @@ function taskCheckContexts(config, statusContexts) {
1924
1920
  }
1925
1921
  // src/generators/required-checks/required-checks.ts
1926
1922
  /**
1923
+ * `requiredChecks(config, aggregate)` — the branch-protection required-status-check list.
1924
+ *
1925
+ * With the `ci` aggregate (the repo hosts it) the ruleset is `ci / Required checks` and the DCO check: that check waits on every `required: true` task,
1926
+ * the hand-written checks and the coverage provider's required statuses ({@link aggregateChecks}), and the DCO check stays its own context
1927
+ * (Sentinel's `validate:dco`, {@link DCO_CHECK}; it was the DCO app's `DCO` until #1044). Without it, the list is what it was before the aggregate: the DCO check, the per-task
1928
+ * contexts, then `extraRequiredChecks` ({@link taskCheckContexts}); a repo that has no `ci` caller yet must not be told
1929
+ * to require a check nobody posts.
1930
+ *
1931
+ * `statusContexts` are the statuses a `coverage` provider reports; its required ones join the list, and the aggregate
1932
+ * recognises them as statuses. `@theholocron/cli`'s `holocron setup` calls this. Policy-free — it only knows the manifest.
1933
+ */
1934
+ /**
1927
1935
  * The context of the aggregate check: the caller's job (`ci`) and the called job (`Required checks`), as GitHub joins
1928
- * them for a reusable workflow.
1936
+ * them for a reusable workflow. The same value as {@link AGGREGATE_CHECK_NAME}, which holds the one definition.
1929
1937
  */
1930
- const AGGREGATE_CHECK = "ci / Required checks";
1938
+ const AGGREGATE_CHECK = AGGREGATE_CHECK_NAME;
1931
1939
  /**
1932
1940
  * The context of the DCO check: Sentinel's `validate:dco / Run Developer Certificate of Origin`. It replaced the probot DCO
1933
1941
  * app's `DCO` (#1044). Required on its own, outside the aggregate.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.576",
3
+ "version": "5.0.0-alpha.578",
4
4
  "description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
5
5
  "keywords": [
6
6
  "ci",
@@ -55,9 +55,9 @@
55
55
  "@commitlint/lint": "^21.2.3",
56
56
  "@commitlint/load": "^21.2.3",
57
57
  "@commitlint/types": "^21.2.3",
58
- "@theholocron/datapad": "5.0.0-alpha.576",
59
- "@theholocron/json-utils": "^1.17.0-alpha.9",
58
+ "@theholocron/datapad": "5.0.0-alpha.578",
60
59
  "@theholocron/fs-utils": "^1.17.0-alpha.9",
60
+ "@theholocron/json-utils": "^1.17.0-alpha.9",
61
61
  "@theholocron/misc-utils": "^1.17.0-alpha.9",
62
62
  "@theholocron/pkg-utils": "^1.17.0-alpha.9"
63
63
  },