@rmartz/pr-policy 1.8.0 → 3.0.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
@@ -12,19 +12,18 @@ new required-status name.
12
12
 
13
13
  ## Checks
14
14
 
15
- | Check | Blocks when |
16
- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
- | **Blocking labels** ([docs](docs/checks/merge-block.md)) | The PR carries `do not merge`, `dnm`, `blocked`, or `escalation needed` (shows as pending). |
18
- | **CI-change classification** ([docs](docs/checks/ci-change.md)) | pr-lifecycle's `pr-lifecycle/sign-off` status asks for a CI sign-off (or, before a repo cuts over, a `.github/workflows/**` change loosens CI), and no human has applied `CI change approved` (shows as pending). |
19
- | **Base branch** ([docs](docs/checks/base-branch.md)) | The PR targets a branch other than the default and it isn't a non-epic PR on an open epic's branch. A stacked PR waits for its base PR (shows as pending); a base no open PR heads blocks. |
20
- | **Title-type rules** ([docs](docs/checks/title.md)) | The squash title isn't a valid Conventional Commit, puts `!` on a non-functional type, disagrees with the `breaking change` label, types a linter/formatter bump as a non-release, non-`ci` type, or changes paths its type rules out (`docs`, `test`, `refactor`, `ci`). |
21
- | **UAT sign-off** ([docs](docs/checks/uat.md)) | pr-lifecycle's sign-off status says the head needs UAT (or, before a repo cuts over, the PR isn't docs, tests, CI, repo tooling, dependency-only, or repo metadata), or the status can't be trusted, and the head isn't signed off: a `v2` status reports `signoff=absent`, or, under `v1` or no status, no trusted user has applied `no UAT needed`, or `UAT passed` (or `tested`) since the last push (shows as pending). |
22
- | **UAT label presence** ([docs](docs/checks/uat-label.md)), opt-in | `require-uat-label` is on and the PR carries none of `no UAT needed`, `UAT pending`, `UAT ready`, `UAT passed` (shows as pending). |
23
- | **Dependabot claim verification** ([docs](docs/checks/dependabot.md)) | A Dependabot PR touches a non-dependency path, changes a dependency its description doesn't claim, pins a version other than the claimed one, or edits anything Dependabot never edits (a `package.json` script, a workflow step). |
24
- | Domain labels (backlog) | Never blocks. Additive path-glob → domain-label map. |
25
- | Milestone inheritance (backlog) | Never blocks. Issue → PR milestone. |
26
-
27
- The design, and why this is separate from `merge-safety` and `pr-lifecycle`, is
15
+ | Check | Blocks when |
16
+ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | **Blocking labels** ([docs](docs/checks/merge-block.md)) | The PR carries `do not merge`, `dnm`, or `blocked` (shows as pending). |
18
+ | **CI-change classification** ([docs](docs/checks/ci-change.md)) | A `.github/workflows/**` change loosens CI and no human has applied `CI change approved` (shows as pending). |
19
+ | **Base branch** ([docs](docs/checks/base-branch.md)) | The PR targets a branch other than the default and it isn't a non-epic PR on an open epic's branch. A stacked PR waits for its base PR (shows as pending); a base no open PR heads blocks. |
20
+ | **Title-type rules** ([docs](docs/checks/title.md)) | The squash title isn't a valid Conventional Commit, puts `!` on a non-functional type, disagrees with the `breaking change` label, types a linter/formatter bump as a non-release, non-`ci` type, or changes paths its type rules out (`docs`, `test`, `refactor`, `ci`). |
21
+ | **UAT sign-off** ([docs](docs/checks/uat.md)) | The PR isn't docs, tests, CI, repo tooling, dependency-only, repo metadata, or a `refactor`, and no trusted user has applied `no UAT needed`, or `UAT passed` since the last push (shows as pending). |
22
+ | **Dependabot claim verification** ([docs](docs/checks/dependabot.md)) | A Dependabot PR touches a non-dependency path, changes a dependency its description doesn't claim, pins a version other than the claimed one, or edits anything Dependabot never edits (a `package.json` script, a workflow step). |
23
+ | Domain labels (backlog) | Never blocks. Additive path-glob → domain-label map. |
24
+ | Milestone inheritance (backlog) | Never blocks. Issue → PR milestone. |
25
+
26
+ The design, and why this is separate from `merge-safety`, is
28
27
  in [docs/decisions.md](docs/decisions.md).
29
28
 
30
29
  ## Using it
@@ -42,8 +41,7 @@ pr-policy evaluate --pr 12 --repo rmartz/pr-policy # post the check-r
42
41
  pr-policy evaluate --pr 12 --repo rmartz/pr-policy --json # evaluate only, change nothing
43
42
  pr-policy evaluate --facts pr.json # offline, from a JSON facts file
44
43
  pr-policy evaluate --pr 12 --repo rmartz/pr-policy --skip-uat # for a repo with no UAT
45
- pr-policy evaluate --pr 12 --repo rmartz/pr-policy --sign-off-status-creators "rmartz-merge-bot[bot]" # trust that App's pr-lifecycle/sign-off status
46
- pr-policy evaluate --sha <sha> --repo rmartz/pr-policy # re-run every open PR at that head (status trigger)
44
+ pr-policy evaluate --sha <sha> --repo rmartz/pr-policy # re-run every open PR at that head
47
45
  ```
48
46
 
49
47
  ## Documentation
@@ -8,7 +8,7 @@ import {
8
8
  postVerdict,
9
9
  resolveRepoTarget,
10
10
  selectChecks
11
- } from "../chunk-ISEUZ3TA.js";
11
+ } from "../chunk-U57FR2KO.js";
12
12
 
13
13
  // src/bin/pr-policy.ts
14
14
  import { readFile } from "fs/promises";
@@ -22,20 +22,11 @@ var USAGE = `Usage:
22
22
  its head, and apply the label edits the checks planned. --json
23
23
  prints the evaluation instead and changes nothing.
24
24
  --sha Evaluate every open PR whose head is <sha>, as --pr does. For a
25
- caller's "status" trigger, which carries a SHA, not a PR: re-run when
26
- pr-lifecycle posts its pr-lifecycle/sign-off status.
25
+ caller trigger that carries a SHA, not a PR.
27
26
  --facts Evaluate an offline JSON facts document ("-" reads stdin) and print
28
27
  the evaluation. Exits 1 only on "failure" ("pending" exits 0).
29
28
  --skip-uat
30
- Don't run the UAT gate, for a repo with no user-acceptance testing.
31
- --sign-off-status-creators <login,...>
32
- GitHub App logins trusted to post the pr-lifecycle/sign-off status,
33
- e.g. rmartz-merge-bot[bot]. Exact matches only; github-actions[bot]
34
- is refused. A person who could merge is always trusted.
35
- --require-uat-label
36
- Hold any PR that carries no UAT label (no UAT needed, UAT pending,
37
- UAT ready, UAT passed). Off by default; turn it on once pr-lifecycle,
38
- which applies the labels, runs on the default branch.`;
29
+ Don't run the UAT gate, for a repo with no user-acceptance testing.`;
39
30
  async function readInput(path) {
40
31
  if (path !== "-") return readFile(path, "utf8");
41
32
  const chunks = [];
@@ -53,8 +44,6 @@ async function main(argv) {
53
44
  repo: { type: "string" },
54
45
  json: { type: "boolean" },
55
46
  "skip-uat": { type: "boolean" },
56
- "sign-off-status-creators": { type: "string" },
57
- "require-uat-label": { type: "boolean" },
58
47
  help: { type: "boolean", short: "h" }
59
48
  }
60
49
  });
@@ -66,11 +55,7 @@ async function main(argv) {
66
55
  console.error(USAGE);
67
56
  return 2;
68
57
  }
69
- const checks = selectChecks({
70
- skipUat: values["skip-uat"],
71
- signOffStatusCreators: (values["sign-off-status-creators"] ?? "").split(","),
72
- requireUatLabel: values["require-uat-label"]
73
- });
58
+ const checks = selectChecks({ skipUat: values["skip-uat"] });
74
59
  if (values.facts !== void 0) {
75
60
  const evaluation = await evaluatePolicy(parseFacts(await readInput(values.facts)), checks);
76
61
  console.log(JSON.stringify(evaluation, null, 2));
@@ -1,163 +1,25 @@
1
1
  // src/contract.ts
2
2
  var PR_POLICY_CHECK_NAME = "pr-policy";
3
- var SIGN_OFF_STATUS_CONTEXT = "pr-lifecycle/sign-off";
4
3
  var CI_APPROVAL_NEEDED_LABEL = "CI approval needed";
5
4
  var CI_CHANGE_APPROVED_LABEL = "CI change approved";
6
5
  var UAT_PASSED_LABEL = "UAT passed";
7
- var LEGACY_UAT_PASSED_LABEL = "tested";
8
6
  var NO_UAT_NEEDED_LABEL = "no UAT needed";
9
- var UAT_PENDING_LABEL = "UAT pending";
10
- var UAT_READY_LABEL = "UAT ready";
11
- var LEGACY_UAT_READY_LABEL = "ready for UAT";
12
- var UAT_LABELS = [
13
- NO_UAT_NEEDED_LABEL,
14
- UAT_PENDING_LABEL,
15
- UAT_READY_LABEL,
16
- UAT_PASSED_LABEL,
17
- LEGACY_UAT_PASSED_LABEL,
18
- LEGACY_UAT_READY_LABEL
19
- ];
20
7
  var CONTAINED_BREAK_LABEL = "contained break";
21
8
  var SIGN_OFF_LABELS = [
22
9
  CI_CHANGE_APPROVED_LABEL,
23
10
  UAT_PASSED_LABEL,
24
- LEGACY_UAT_PASSED_LABEL,
25
11
  NO_UAT_NEEDED_LABEL,
26
12
  CONTAINED_BREAK_LABEL
27
13
  ];
28
14
  var DO_NOT_MERGE_LABEL = "do not merge";
29
15
  var DNM_LABEL = "dnm";
30
16
  var BLOCKED_LABEL = "blocked";
31
- var ESCALATION_NEEDED_LABEL = "escalation needed";
32
- var BLOCKING_LABELS = [
33
- DO_NOT_MERGE_LABEL,
34
- DNM_LABEL,
35
- BLOCKED_LABEL,
36
- ESCALATION_NEEDED_LABEL
37
- ];
17
+ var BLOCKING_LABELS = [DO_NOT_MERGE_LABEL, DNM_LABEL, BLOCKED_LABEL];
38
18
  var EPIC_LABEL = "epic";
39
19
  var BREAKING_CHANGE_LABEL = "breaking change";
40
20
  var HOTFIX_LABEL = "hotfix";
41
21
  var RELEASE_PLEASE_PENDING_LABEL = "autorelease: pending";
42
22
 
43
- // src/policy.ts
44
- var REPO_PERMISSIONS = ["admin", "maintain", "write", "triage", "read", "none"];
45
-
46
- // src/sign-off.ts
47
- function isRepoPermission(value) {
48
- return REPO_PERMISSIONS.some((permission) => permission === value);
49
- }
50
- var MERGE_PERMISSIONS = /* @__PURE__ */ new Set(["admin", "maintain", "write"]);
51
- function vet(actor) {
52
- if (actor === void 0) return "no labeling event names a live account";
53
- if (actor.type !== "User") return `\`${actor.login}\` is a ${actor.type}, not a person`;
54
- if (!MERGE_PERMISSIONS.has(actor.permission)) {
55
- return `\`${actor.login}\` has \`${actor.permission}\` permission; write, maintain, or admin is required`;
56
- }
57
- return actor;
58
- }
59
- function signOffState(pr, names) {
60
- const present = names.filter((name) => pr.labels.includes(name));
61
- let untrusted;
62
- for (const label of present) {
63
- const vetted = vet(pr.signOffs.find((signOff) => signOff.label === label)?.appliedBy);
64
- if (typeof vetted !== "string") return { status: "trusted", label, appliedBy: vetted };
65
- untrusted ??= { status: "untrusted", label, reason: vetted };
66
- }
67
- return untrusted ?? { status: "absent" };
68
- }
69
-
70
- // src/sign-off-status.ts
71
- var SIGN_OFF_STATUS_VERSIONS = ["v1", "v2"];
72
- var SIGN_OFF_REQUIREMENTS = ["none", "ci", "uat"];
73
- var WAIVER_STATES = ["current", "stale", "absent"];
74
- var UAT_SIGN_OFF_OUTCOMES = ["waived", "passed", "absent"];
75
- var UAT_KEY = { v1: "waiver", v2: "signoff" };
76
- var member = (values, value) => values.find((candidate) => candidate === value);
77
- function parseSignOffDescription(description) {
78
- const [versionText, ...pairs] = description.trim().split(/\s+/);
79
- const version = member(SIGN_OFF_STATUS_VERSIONS, versionText);
80
- if (version === void 0) {
81
- return `its format version \`${versionText ?? ""}\` is not one this pr-policy understands (${SIGN_OFF_STATUS_VERSIONS.join(", ")})`;
82
- }
83
- const uatKey = UAT_KEY[version];
84
- const knownKeys = /* @__PURE__ */ new Set(["requirement", "loosening", uatKey]);
85
- const fields = /* @__PURE__ */ new Map();
86
- for (const pair of pairs) {
87
- const [key = "", value, ...rest] = pair.split("=");
88
- if (value === void 0 || rest.length > 0) return `\`${pair}\` is not a \`key=value\` pair`;
89
- if (!knownKeys.has(key)) return `\`${key}\` is not a known key in \`${version}\``;
90
- if (fields.has(key)) return `\`${key}\` appears twice`;
91
- fields.set(key, value);
92
- }
93
- const requirement = member(SIGN_OFF_REQUIREMENTS, fields.get("requirement"));
94
- if (requirement === void 0) return "`requirement` must be `none`, `ci`, or `uat`";
95
- const looseningText = fields.get("loosening") ?? "no";
96
- if (looseningText !== "yes" && looseningText !== "no") return "`loosening` must be `yes` or `no`";
97
- const loosening = looseningText === "yes";
98
- if (requirement !== "uat") {
99
- if (fields.has(uatKey)) return `\`${uatKey}\` is only meaningful with \`requirement=uat\``;
100
- return { requirement, loosening };
101
- }
102
- if (version === "v2") {
103
- const signoff = member(UAT_SIGN_OFF_OUTCOMES, fields.get("signoff"));
104
- if (signoff === void 0) {
105
- return "`requirement=uat` needs `signoff=waived`, `passed`, or `absent`";
106
- }
107
- return { requirement, loosening, signoff };
108
- }
109
- const waiver = member(WAIVER_STATES, fields.get("waiver"));
110
- if (waiver === void 0) return "`requirement=uat` needs `waiver=current`, `stale`, or `absent`";
111
- return { requirement, loosening, waiver };
112
- }
113
- var GITHUB_ACTIONS_BOT = "github-actions[bot]";
114
- var CREATORS_OPTION = "`sign-off-status-creators` (CLI `--sign-off-status-creators`)";
115
- function parseSignOffStatusCreators(entries) {
116
- const logins = entries.map((entry) => entry.trim()).filter((entry) => entry !== "");
117
- for (const login of logins) {
118
- if (login.toLowerCase() === GITHUB_ACTIONS_BOT) {
119
- throw new Error(
120
- `${GITHUB_ACTIONS_BOT} can't be a sign-off status creator: any workflow in the repo can post as it.`
121
- );
122
- }
123
- if (!login.endsWith("[bot]")) {
124
- throw new Error(
125
- `\`${login}\` isn't a GitHub App login: sign-off status creators end in \`[bot]\`. People are trusted by their repo permission, without being named.`
126
- );
127
- }
128
- }
129
- return [...new Set(logins)];
130
- }
131
- function untrustedCreator(creator, trustedBots) {
132
- if (creator.type === "Bot") {
133
- if (trustedBots.includes(creator.login)) return void 0;
134
- if (creator.login.toLowerCase() === GITHUB_ACTIONS_BOT) {
135
- return `it was posted by \`${creator.login}\`, which any workflow in the repo can post as`;
136
- }
137
- return `it was posted by \`${creator.login}\`, a GitHub App this caller doesn't trust. If it is the repo's pr-lifecycle App, name it in ${CREATORS_OPTION}`;
138
- }
139
- const vetted = vet(creator);
140
- return typeof vetted === "string" ? vetted : void 0;
141
- }
142
- function readSignOffStatus(pr, trustedBots = []) {
143
- const status = pr.signOffStatus;
144
- if (status === void 0) return { kind: "absent" };
145
- const untrusted = status.creator === void 0 ? "GitHub names no account that posted it" : untrustedCreator(status.creator, trustedBots);
146
- if (untrusted !== void 0) return { kind: "ignored", reason: untrusted };
147
- if (status.state !== "success") {
148
- return { kind: "rejected", reason: `its state is \`${status.state}\`, not \`success\`` };
149
- }
150
- const parsed = parseSignOffDescription(status.description);
151
- if (typeof parsed === "string") return { kind: "rejected", reason: parsed };
152
- return { kind: "valid", classification: parsed, postedBy: status.creator?.login ?? "" };
153
- }
154
- function ignoredStatusMessage(reason) {
155
- return `Ignored the \`${SIGN_OFF_STATUS_CONTEXT}\` status on this head, because ${reason}. This check classified the PR itself instead.`;
156
- }
157
- function rejectedStatusMessage(reason) {
158
- return `Waiting on pr-lifecycle: its \`${SIGN_OFF_STATUS_CONTEXT}\` status on this head can't be used, because ${reason}. pr-lifecycle posts a fresh one on its next run.`;
159
- }
160
-
161
23
  // src/checks/ci-change/indicators.ts
162
24
  var LOOSENING_INDICATORS = [
163
25
  "workflow-removed",
@@ -671,30 +533,38 @@ function classifyWorkflowChanges(changes) {
671
533
  return { verdict: indicators.length > 0 ? "loosening" : "tightening", indicators };
672
534
  }
673
535
 
536
+ // src/policy.ts
537
+ var REPO_PERMISSIONS = ["admin", "maintain", "write", "triage", "read", "none"];
538
+
539
+ // src/sign-off.ts
540
+ function isRepoPermission(value) {
541
+ return REPO_PERMISSIONS.some((permission) => permission === value);
542
+ }
543
+ var MERGE_PERMISSIONS = /* @__PURE__ */ new Set(["admin", "maintain", "write"]);
544
+ function vet(actor) {
545
+ if (actor === void 0) return "no labeling event names a live account";
546
+ if (actor.type !== "User") return `\`${actor.login}\` is a ${actor.type}, not a person`;
547
+ if (!MERGE_PERMISSIONS.has(actor.permission)) {
548
+ return `\`${actor.login}\` has \`${actor.permission}\` permission; write, maintain, or admin is required`;
549
+ }
550
+ return actor;
551
+ }
552
+ function signOffState(pr, names) {
553
+ const present = names.filter((name) => pr.labels.includes(name));
554
+ let untrusted;
555
+ for (const label of present) {
556
+ const vetted = vet(pr.signOffs.find((signOff) => signOff.label === label)?.appliedBy);
557
+ if (typeof vetted !== "string") return { status: "trusted", label, appliedBy: vetted };
558
+ untrusted ??= { status: "untrusted", label, reason: vetted };
559
+ }
560
+ return untrusted ?? { status: "absent" };
561
+ }
562
+
674
563
  // src/checks/ci-change/index.ts
675
564
  var CI_CHANGE_CHECK = "ci-change";
676
565
  function indicatorMessage(indicator) {
677
566
  return `\`${indicator.file}\` \`${indicator.location}\` \u2014 ${indicator.kind} (${indicator.class}): ${indicator.detail}`;
678
567
  }
679
- function decideCiChange(classification, pr, trustedBots = []) {
680
- const reading = readSignOffStatus(pr, trustedBots);
681
- switch (reading.kind) {
682
- case "valid":
683
- return decideFromStatus(classification, pr, reading.classification);
684
- case "ignored": {
685
- const result = decideWithoutStatus(classification, pr);
686
- const note = {
687
- check: CI_CHANGE_CHECK,
688
- message: ignoredStatusMessage(reading.reason),
689
- effect: "info"
690
- };
691
- return { ...result, findings: [...result.findings, note] };
692
- }
693
- case "absent":
694
- case "rejected":
695
- return decideWithoutStatus(classification, pr);
696
- }
697
- }
698
568
  function untrustedApproval(approval) {
699
569
  return approval.status === "untrusted" ? [
700
570
  {
@@ -711,23 +581,7 @@ function evidenceOf(classification) {
711
581
  effect: "info"
712
582
  }));
713
583
  }
714
- function decideFromStatus(classification, pr, status) {
715
- const why = status.requirement === "ci" ? "pr-lifecycle classified this `ci` PR as needing a CI sign-off" : status.loosening ? "pr-lifecycle reports that this PR loosens CI" : void 0;
716
- if (why === void 0) return { findings: [] };
717
- const approval = signOffState(pr, [CI_CHANGE_APPROVED_LABEL]);
718
- const headline = approval.status === "trusted" ? {
719
- check: CI_CHANGE_CHECK,
720
- message: `CI change signed off with \`${CI_CHANGE_APPROVED_LABEL}\` by \`${approval.appliedBy.login}\``,
721
- effect: "info",
722
- headline: true
723
- } : {
724
- check: CI_CHANGE_CHECK,
725
- message: `Waiting for a CI sign-off: ${why}. A person reviews the change and applies \`${CI_CHANGE_APPROVED_LABEL}\`. No code change clears this.`,
726
- effect: "hold"
727
- };
728
- return { findings: [headline, ...untrustedApproval(approval), ...evidenceOf(classification)] };
729
- }
730
- function decideWithoutStatus(classification, pr) {
584
+ function decideCiChange(classification, pr) {
731
585
  const approval = signOffState(pr, [CI_CHANGE_APPROVED_LABEL]);
732
586
  const signedOff = approval.status === "trusted";
733
587
  const flagged = pr.labels.includes(CI_APPROVAL_NEEDED_LABEL);
@@ -759,13 +613,10 @@ function decideWithoutStatus(classification, pr) {
759
613
  labelsToRemove
760
614
  };
761
615
  }
762
- function ciChangeCheckFor(trustedBots) {
763
- return {
764
- name: CI_CHANGE_CHECK,
765
- evaluate: async (pr) => decideCiChange(classifyWorkflowChanges(pr.workflowChanges), pr, trustedBots)
766
- };
767
- }
768
- var ciChangeCheck = ciChangeCheckFor([]);
616
+ var ciChangeCheck = {
617
+ name: CI_CHANGE_CHECK,
618
+ evaluate: async (pr) => decideCiChange(classifyWorkflowChanges(pr.workflowChanges), pr)
619
+ };
769
620
 
770
621
  // src/checks/dependabot/claims.ts
771
622
  var NAME = /(?:\[([^\[\]\n]+)\]\([^()\n]*\)|`([^`]+)`|([^\s[\]`]+))/.source;
@@ -1572,38 +1423,6 @@ var titleCheck = {
1572
1423
  evaluate: async (pr) => decideTitle(pr)
1573
1424
  };
1574
1425
 
1575
- // src/checks/uat-label.ts
1576
- var UAT_LABEL_CHECK = "uat-label";
1577
- var UAT = new Set(UAT_LABELS.map((label) => label.toLowerCase()));
1578
- function decideUatLabel(pr) {
1579
- const present = pr.labels.filter((label) => UAT.has(label.toLowerCase()));
1580
- if (present.length > 0) {
1581
- const names = present.map((label) => `\`${label}\``).join(", ");
1582
- return {
1583
- findings: [
1584
- {
1585
- check: UAT_LABEL_CHECK,
1586
- message: `UAT determination recorded: ${names}.`,
1587
- effect: "info"
1588
- }
1589
- ]
1590
- };
1591
- }
1592
- return {
1593
- findings: [
1594
- {
1595
- check: UAT_LABEL_CHECK,
1596
- message: "Waiting for a UAT determination: no UAT label is on the PR. pr-lifecycle applies one of `no UAT needed`, `UAT pending`, `UAT ready`, or `UAT passed` when it runs; a person can apply one too.",
1597
- effect: "hold"
1598
- }
1599
- ]
1600
- };
1601
- }
1602
- var uatLabelCheck = {
1603
- name: UAT_LABEL_CHECK,
1604
- evaluate: async (pr) => decideUatLabel(pr)
1605
- };
1606
-
1607
1426
  // src/checks/base-branch.ts
1608
1427
  var BASE_BRANCH_CHECK = "base-branch";
1609
1428
  var isEpic = (labels) => labels.some((label) => label.trim().toLowerCase() === EPIC_LABEL);
@@ -1682,8 +1501,8 @@ function trivialCategories(pr) {
1682
1501
 
1683
1502
  // src/checks/uat/index.ts
1684
1503
  var UAT_CHECK = "uat";
1685
- var PASSING_LABELS = [UAT_PASSED_LABEL, LEGACY_UAT_PASSED_LABEL, NO_UAT_NEEDED_LABEL];
1686
- var HEAD_BOUND_SIGN_OFFS = [UAT_PASSED_LABEL, LEGACY_UAT_PASSED_LABEL];
1504
+ var PASSING_LABELS = [UAT_PASSED_LABEL, NO_UAT_NEEDED_LABEL];
1505
+ var HEAD_BOUND_SIGN_OFFS = [UAT_PASSED_LABEL];
1687
1506
  function info2(message) {
1688
1507
  return { check: UAT_CHECK, message, effect: "info" };
1689
1508
  }
@@ -1700,65 +1519,21 @@ function staleReason(pr, label) {
1700
1519
  if (Date.parse(appliedAt) > Date.parse(pr.headPushedAt)) return void 0;
1701
1520
  return "it was applied before the current head was pushed, and a new head needs a person to test it again";
1702
1521
  }
1703
- function decideUat(pr, trustedBots = []) {
1704
- const reading = readSignOffStatus(pr, trustedBots);
1705
- switch (reading.kind) {
1706
- case "absent":
1707
- return { findings: decideWithoutStatus2(pr) };
1708
- case "ignored":
1709
- return {
1710
- findings: [...decideWithoutStatus2(pr), info2(ignoredStatusMessage(reading.reason))]
1711
- };
1712
- case "rejected":
1713
- return { findings: [hold(rejectedStatusMessage(reading.reason))] };
1714
- case "valid":
1715
- return { findings: decideFromStatus2(pr, reading.classification) };
1716
- }
1717
- }
1718
- function decideFromStatus2(pr, status) {
1719
- switch (status.requirement) {
1720
- case "none":
1721
- return [info2("No UAT needed: pr-lifecycle classified this head as needing no sign-off.")];
1722
- case "ci":
1723
- return [info2("No UAT needed: this head needs a CI sign-off instead (`ci-change`).")];
1724
- case "uat": {
1725
- if ("signoff" in status) return fromReportedSignOff(status.signoff);
1726
- const waiver = status.waiver === "current" ? [] : [
1727
- {
1728
- label: NO_UAT_NEEDED_LABEL,
1729
- reason: `pr-lifecycle reports the waiver as \`${status.waiver}\` for this head`
1730
- }
1731
- ];
1732
- return signOffFindings(pr, waiver);
1733
- }
1734
- }
1735
- }
1736
- function fromReportedSignOff(signoff) {
1737
- const reported = `pr-lifecycle reports the UAT sign-off as \`${signoff}\` for this head`;
1738
- if (signoff === "absent") {
1739
- return [
1740
- hold(
1741
- `Waiting for UAT: ${reported}. A person applies \`${UAT_PASSED_LABEL}\` after testing, or the review agent or a person waives it with \`${NO_UAT_NEEDED_LABEL}\`.`
1742
- )
1743
- ];
1744
- }
1745
- return [{ ...info2(`UAT signed off: ${reported}.`), headline: true }];
1746
- }
1747
- function decideWithoutStatus2(pr) {
1522
+ function decideUat(pr) {
1748
1523
  const categories = trivialCategories(pr);
1749
1524
  if (categories !== void 0) {
1750
1525
  const kinds = categories.length > 0 ? categories.join(", ") : "no files";
1751
- return [info2(`No UAT needed: the PR changes only ${kinds}.`)];
1526
+ return { findings: [info2(`No UAT needed: the PR changes only ${kinds}.`)] };
1752
1527
  }
1753
1528
  if (parseTitle(pr.title)?.type === "refactor") {
1754
- return [info2("No UAT needed: a refactor changes no behaviour.")];
1529
+ return { findings: [info2("No UAT needed: a refactor changes no behaviour.")] };
1755
1530
  }
1756
- return signOffFindings(pr, []);
1531
+ return { findings: signOffFindings(pr) };
1757
1532
  }
1758
- function signOffFindings(pr, setAside) {
1533
+ function signOffFindings(pr) {
1759
1534
  const stale = PASSING_LABELS.flatMap((label) => {
1760
1535
  if (!pr.labels.includes(label)) return [];
1761
- const reason = setAside.find((entry) => entry.label === label)?.reason ?? staleReason(pr, label);
1536
+ const reason = staleReason(pr, label);
1762
1537
  return reason === void 0 ? [] : [{ label, reason }];
1763
1538
  });
1764
1539
  const current = PASSING_LABELS.filter((label) => !stale.some((entry) => entry.label === label));
@@ -1772,7 +1547,7 @@ function signOffFindings(pr, setAside) {
1772
1547
  ];
1773
1548
  }
1774
1549
  const waiting = hold(
1775
- `Waiting for UAT. A person applies \`${UAT_PASSED_LABEL}\` after testing, or the review agent or a person applies \`${NO_UAT_NEEDED_LABEL}\`.`
1550
+ `Waiting for UAT. Apply \`${UAT_PASSED_LABEL}\` once a person has tested the current head, or \`${NO_UAT_NEEDED_LABEL}\` for a change that needs no user testing.`
1776
1551
  );
1777
1552
  const why = stale.map(({ label, reason }) => info2(`\`${label}\` doesn't count: ${reason}.`));
1778
1553
  if (state.status === "untrusted") {
@@ -1780,10 +1555,10 @@ function signOffFindings(pr, setAside) {
1780
1555
  }
1781
1556
  return [waiting, ...why];
1782
1557
  }
1783
- function uatCheckFor(trustedBots) {
1784
- return { name: UAT_CHECK, evaluate: async (pr) => decideUat(pr, trustedBots) };
1785
- }
1786
- var uatCheck = uatCheckFor([]);
1558
+ var uatCheck = {
1559
+ name: UAT_CHECK,
1560
+ evaluate: async (pr) => decideUat(pr)
1561
+ };
1787
1562
 
1788
1563
  // src/checks/index.ts
1789
1564
  var CHECKS = [
@@ -1795,17 +1570,7 @@ var CHECKS = [
1795
1570
  dependabotCheck
1796
1571
  ];
1797
1572
  function selectChecks(options = {}) {
1798
- const trustedBots = parseSignOffStatusCreators(options.signOffStatusCreators ?? []);
1799
- const configured = trustedBots.length === 0 ? CHECKS : CHECKS.map((check) => {
1800
- if (check === uatCheck) return uatCheckFor(trustedBots);
1801
- if (check === ciChangeCheck) return ciChangeCheckFor(trustedBots);
1802
- return check;
1803
- });
1804
- const selected = options.skipUat ? configured.filter((check) => check.name !== uatCheck.name) : configured;
1805
- if (!options.requireUatLabel) return selected;
1806
- return selected.flatMap(
1807
- (check) => check === dependabotCheck ? [uatLabelCheck, check] : [check]
1808
- );
1573
+ return options.skipUat ? CHECKS.filter((check) => check !== uatCheck) : CHECKS;
1809
1574
  }
1810
1575
 
1811
1576
  // src/report.ts
@@ -1924,17 +1689,6 @@ function parseBase(value) {
1924
1689
  }
1925
1690
  return { branch, defaultBranch, headOf: (headOf ?? []).map(parseOpenPullRequest) };
1926
1691
  }
1927
- function parseSignOffStatus(value) {
1928
- if (value === void 0) return void 0;
1929
- const where = "facts.signOffStatus";
1930
- if (typeof value !== "object" || value === null) throw new Error(`${where} must be an object`);
1931
- const { state, description, creator } = value;
1932
- if (typeof state !== "string" || typeof description !== "string") {
1933
- throw new Error(`${where}.state / description must be strings`);
1934
- }
1935
- const actor = parseActor(`${where}.creator`, creator);
1936
- return actor === void 0 ? { state, description } : { state, description, creator: actor };
1937
- }
1938
1692
  function parseFacts(raw) {
1939
1693
  const parsed = JSON.parse(raw);
1940
1694
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
@@ -1951,8 +1705,7 @@ function parseFacts(raw) {
1951
1705
  workflowChanges,
1952
1706
  manifestChanges,
1953
1707
  signOffs,
1954
- headPushedAt,
1955
- signOffStatus
1708
+ headPushedAt
1956
1709
  } = parsed;
1957
1710
  if (typeof title !== "string") throw new Error("facts.title must be a string");
1958
1711
  if (!isOptionalString(body)) throw new Error("facts.body must be a string");
@@ -1977,8 +1730,6 @@ function parseFacts(raw) {
1977
1730
  if (parsedBase !== void 0) pr.base = parsedBase;
1978
1731
  if (draft !== void 0) pr.draft = draft;
1979
1732
  if (headPushedAt !== void 0) pr.headPushedAt = headPushedAt;
1980
- const parsedStatus = parseSignOffStatus(signOffStatus);
1981
- if (parsedStatus !== void 0) pr.signOffStatus = parsedStatus;
1982
1733
  return pr;
1983
1734
  }
1984
1735
 
@@ -2287,22 +2038,6 @@ async function gatherSignOffs(target, labels) {
2287
2038
  );
2288
2039
  }
2289
2040
 
2290
- // src/github/sign-off-status.ts
2291
- async function gatherSignOffStatus(target, sha) {
2292
- const endpoint = `repos/${target.repo}/commits/${sha}/statuses`;
2293
- const out = await clientOf(target).list(endpoint);
2294
- if (out === null) throw new Error(`could not read ${endpoint}`);
2295
- const latest = out.find(
2296
- (status2) => status2.context === SIGN_OFF_STATUS_CONTEXT
2297
- );
2298
- if (latest === void 0) return void 0;
2299
- const status = { state: latest.state, description: latest.description ?? "" };
2300
- if (latest.creator === null) return status;
2301
- const { login, type } = latest.creator;
2302
- const permission = type === "User" ? await lookupPermission(target, login) : "none";
2303
- return { ...status, creator: { login, type, permission } };
2304
- }
2305
-
2306
2041
  // src/github/pull-request.ts
2307
2042
  async function getJson(target, path) {
2308
2043
  const out = await clientOf(target).getJson(path);
@@ -2382,8 +2117,6 @@ async function gatherFacts(pullRequest) {
2382
2117
  const pushedAt = await gatherHeadPushedAt(target, headSha);
2383
2118
  if (pushedAt !== void 0) facts.headPushedAt = pushedAt;
2384
2119
  }
2385
- const signOffStatus = await gatherSignOffStatus(target, headSha);
2386
- if (signOffStatus !== void 0) facts.signOffStatus = signOffStatus;
2387
2120
  return { facts, headSha };
2388
2121
  }
2389
2122
  async function openPullRequestsAtHead(target, sha) {
@@ -2404,26 +2137,15 @@ async function applyLabelEdits(target, evaluation) {
2404
2137
 
2405
2138
  export {
2406
2139
  PR_POLICY_CHECK_NAME,
2407
- SIGN_OFF_STATUS_CONTEXT,
2408
2140
  CI_APPROVAL_NEEDED_LABEL,
2409
2141
  CI_CHANGE_APPROVED_LABEL,
2410
- UAT_LABELS,
2411
2142
  DO_NOT_MERGE_LABEL,
2412
2143
  DNM_LABEL,
2413
2144
  BLOCKED_LABEL,
2414
- ESCALATION_NEEDED_LABEL,
2415
2145
  BLOCKING_LABELS,
2416
2146
  BREAKING_CHANGE_LABEL,
2417
2147
  HOTFIX_LABEL,
2418
2148
  RELEASE_PLEASE_PENDING_LABEL,
2419
- SIGN_OFF_STATUS_VERSIONS,
2420
- SIGN_OFF_REQUIREMENTS,
2421
- WAIVER_STATES,
2422
- UAT_SIGN_OFF_OUTCOMES,
2423
- parseSignOffDescription,
2424
- GITHUB_ACTIONS_BOT,
2425
- parseSignOffStatusCreators,
2426
- readSignOffStatus,
2427
2149
  LOOSENING_INDICATORS,
2428
2150
  AMBIGUOUS_INDICATORS,
2429
2151
  CI_CHANGE_VERDICTS,
@@ -2451,9 +2173,6 @@ export {
2451
2173
  TITLE_CHECK,
2452
2174
  decideTitle,
2453
2175
  titleCheck,
2454
- UAT_LABEL_CHECK,
2455
- decideUatLabel,
2456
- uatLabelCheck,
2457
2176
  CHECKS,
2458
2177
  selectChecks,
2459
2178
  POLICY_OUTCOMES,
package/dist/index.d.ts CHANGED
@@ -33,16 +33,6 @@ interface SignOff {
33
33
  /** When its latest `labeled` event happened (ISO 8601), as GitHub records it. */
34
34
  appliedAt?: string;
35
35
  }
36
- /**
37
- * The latest commit status on the head SHA for one context, as GitHub reports
38
- * it. `creator` is absent when GitHub names no live account.
39
- */
40
- interface CommitStatus {
41
- /** `success`, `pending`, `failure`, or `error`. */
42
- state: string;
43
- description: string;
44
- creator?: LabelActor;
45
- }
46
36
  /** The account that opened a PR, as GitHub reports it (`dependabot[bot]`, `Bot`). */
47
37
  interface PullRequestAuthor {
48
38
  login: string;
@@ -68,8 +58,7 @@ interface PullRequestBase {
68
58
  /**
69
59
  * The facts about a pull request that policy checks judge. Every field is a
70
60
  * property of the PR's current state — its content and the labels on it, never
71
- * its review history, which belongs to the separate lifecycle reconciler in
72
- * `rmartz/pr-lifecycle`.
61
+ * its review history.
73
62
  */
74
63
  interface PullRequestFacts {
75
64
  title: string;
@@ -100,16 +89,9 @@ interface PullRequestFacts {
100
89
  * When the current head was pushed (ISO 8601), from times the author can't
101
90
  * forge: the latest force-push event and the head commit's earliest check
102
91
  * suite, never a commit date. `gatherFacts` sets it whenever a head-bound
103
- * sign-off (`UAT passed`, `tested`) is on the PR; absent, those don't count.
92
+ * sign-off (`UAT passed`) is on the PR; absent, it doesn't count.
104
93
  */
105
94
  headPushedAt?: string;
106
- /**
107
- * The latest `pr-lifecycle/sign-off` status on the head SHA: pr-lifecycle's
108
- * classification of which human sign-off this head needs. Absent when
109
- * pr-lifecycle hasn't posted one, which keeps the checks on their own
110
- * classification until the repo cuts over (src/sign-off-status.ts).
111
- */
112
- signOffStatus?: CommitStatus;
113
95
  }
114
96
  /**
115
97
  * What a finding does to the `pr-policy` check-run:
@@ -166,185 +148,10 @@ declare const CHECKS: readonly PolicyCheck[];
166
148
  interface PolicyOptions {
167
149
  /** Drop the UAT gate, for a repo with no user-acceptance testing to wait on. */
168
150
  skipUat?: boolean;
169
- /**
170
- * GitHub App logins (exact, ending in `[bot]`) trusted to post the
171
- * `pr-lifecycle/sign-off` status, besides a person who could merge. Empty by
172
- * default. `github-actions[bot]` is refused. Human sign-off labels are
173
- * unaffected: they still need a trusted person.
174
- */
175
- signOffStatusCreators?: readonly string[];
176
- /**
177
- * Hold every PR that carries no UAT label (`uat-label`, rmartz/pr-policy#103).
178
- * Off by default: turn it on once the repo's pr-lifecycle caller, which
179
- * applies the labels, is on the default branch. It runs even with `skipUat`.
180
- */
181
- requireUatLabel?: boolean;
182
151
  }
183
- /**
184
- * The checks to run for a repo configured with `options`, in report order.
185
- * The opt-in `uat-label` check is not in `CHECKS`; it runs just before
186
- * `dependabot` when `requireUatLabel` is set. Throws on an invalid
187
- * `signOffStatusCreators` entry.
188
- */
152
+ /** The checks to run for a repo configured with `options`, in report order. */
189
153
  declare function selectChecks(options?: PolicyOptions): readonly PolicyCheck[];
190
154
 
191
- /**
192
- * Names read outside this repo. Each is a fleet contract: consumers' rulesets
193
- * require the check-run by literal name, the coordinator's gate model parks a PR
194
- * on the label, and a human applies the sign-off label by hand. Renaming any of
195
- * them is a coordinated cross-repo migration, never a local refactor — see
196
- * docs/check-run-contract.md. `test/contract.test.ts` pins every value.
197
- */
198
- /**
199
- * The one check-run this package posts. Every policy check reports into it, so
200
- * adding a check never adds a required-status name.
201
- */
202
- declare const PR_POLICY_CHECK_NAME = "pr-policy";
203
- /**
204
- * The commit status pr-lifecycle posts on each head with its classification of
205
- * the sign-off that head needs. Read here, never written; pr-lifecycle owns the
206
- * name and the description format (rmartz/pr-lifecycle#119).
207
- */
208
- declare const SIGN_OFF_STATUS_CONTEXT = "pr-lifecycle/sign-off";
209
- /** The merge-gate label the CI-change check applies to an unsigned loosening. */
210
- declare const CI_APPROVAL_NEEDED_LABEL = "CI approval needed";
211
- /**
212
- * The human sign-off on a CI loosening. Read-only here: this package never
213
- * applies it.
214
- */
215
- declare const CI_CHANGE_APPROVED_LABEL = "CI change approved";
216
- /**
217
- * Every label that records a UAT determination on a PR, current and legacy
218
- * names alike. The `uat-label` check passes when any one is present.
219
- */
220
- declare const UAT_LABELS: readonly ["no UAT needed", "UAT pending", "UAT ready", "UAT passed", "tested", "ready for UAT"];
221
- /**
222
- * Labels a person puts on a PR to stop it merging. The merge-block check holds
223
- * `pr-policy` while any of them is present, and never applies or removes one.
224
- * `dnm` is shorthand for `do not merge`.
225
- */
226
- declare const DO_NOT_MERGE_LABEL = "do not merge";
227
- declare const DNM_LABEL = "dnm";
228
- declare const BLOCKED_LABEL = "blocked";
229
- declare const ESCALATION_NEEDED_LABEL = "escalation needed";
230
- declare const BLOCKING_LABELS: readonly ["do not merge", "dnm", "blocked", "escalation needed"];
231
- /**
232
- * Labels the title check reads and never writes. They belong to the review and
233
- * release flow: `breaking change` must agree with the title's `!`, which is what
234
- * the release and merge-safety read; `hotfix` implies one; and release-please
235
- * marks its release PRs with `autorelease: pending`.
236
- */
237
- declare const BREAKING_CHANGE_LABEL = "breaking change";
238
- declare const HOTFIX_LABEL = "hotfix";
239
- declare const RELEASE_PLEASE_PENDING_LABEL = "autorelease: pending";
240
-
241
- /**
242
- * pr-lifecycle's sign-off status: the one signal pr-lifecycle sends this gate.
243
- * pr-lifecycle classifies each head and posts a `pr-lifecycle/sign-off` commit
244
- * status on it whose description says which human sign-off the head needs, for
245
- * example `v2 requirement=uat signoff=passed`. The format is pr-lifecycle's
246
- * contract (its docs/sign-off-status.md, rmartz/pr-lifecycle#119); the two
247
- * must stay compatible.
248
- *
249
- * GitHub ties a status to its SHA, so a push can never leave the gate reading a
250
- * classification of an older head. The gate never reads pr-lifecycle's labels.
251
- *
252
- * A status from a creator the gate doesn't trust is `ignored`: the checks
253
- * classify the PR themselves, exactly as with no status, so it can't loosen
254
- * anything. A trusted creator's status that the gate can't use (an unknown
255
- * version, an unknown key or value, a state other than `success`) is
256
- * `rejected`, and the checks hold. A missing status is `absent`, which keeps
257
- * the checks on their own classification until the repo cuts over.
258
- */
259
-
260
- /** The description format versions this gate understands. */
261
- declare const SIGN_OFF_STATUS_VERSIONS: readonly ["v1", "v2"];
262
- declare const SIGN_OFF_REQUIREMENTS: readonly ["none", "ci", "uat"];
263
- type SignOffRequirement = (typeof SIGN_OFF_REQUIREMENTS)[number];
264
- /** `v1`'s `waiver`: whether a `no UAT needed` label counts for this head. */
265
- declare const WAIVER_STATES: readonly ["current", "stale", "absent"];
266
- type WaiverState = (typeof WAIVER_STATES)[number];
267
- /**
268
- * `v2`'s `signoff`: the UAT sign-off pr-lifecycle resolved for this head, from
269
- * people's labels and the review agent's verdict records (rmartz/pr-policy#109).
270
- */
271
- declare const UAT_SIGN_OFF_OUTCOMES: readonly ["waived", "passed", "absent"];
272
- type UatSignOffOutcome = (typeof UAT_SIGN_OFF_OUTCOMES)[number];
273
- /**
274
- * A parsed, valid sign-off status. A `uat` head carries `waiver` from a `v1`
275
- * status, or `signoff` from a `v2` one.
276
- */
277
- type SignOffClassification = {
278
- requirement: 'none';
279
- loosening: boolean;
280
- } | {
281
- requirement: 'ci';
282
- loosening: boolean;
283
- } | {
284
- requirement: 'uat';
285
- loosening: boolean;
286
- waiver: WaiverState;
287
- } | {
288
- requirement: 'uat';
289
- loosening: boolean;
290
- signoff: UatSignOffOutcome;
291
- };
292
- /**
293
- * - `absent`: no status on the head.
294
- * - `ignored`: a status from a creator the gate doesn't trust. It is treated as
295
- * no status, so the checks fall back to their own classification
296
- * (rmartz/pr-policy#101); `reason` says who posted it and how to trust them.
297
- * - `rejected`: a status from a trusted creator that the gate can't use (a
298
- * state other than `success`, or an unknown format). The checks hold.
299
- * - `valid`: a trusted, well-formed status.
300
- */
301
- type SignOffStatusReading = {
302
- kind: 'absent';
303
- } | {
304
- kind: 'ignored';
305
- reason: string;
306
- } | {
307
- kind: 'rejected';
308
- reason: string;
309
- } | {
310
- kind: 'valid';
311
- classification: SignOffClassification;
312
- postedBy: string;
313
- };
314
- /**
315
- * Parse a status description, or say why it can't be trusted. Strict on
316
- * purpose: a key this gate doesn't know could change what the status means, so
317
- * pr-lifecycle bumps the version for any new key.
318
- */
319
- declare function parseSignOffDescription(description: string): SignOffClassification | string;
320
- /**
321
- * The Bot any workflow in a repo can post as with its `GITHUB_TOKEN`. It can
322
- * never be trusted to post the status, so a caller can't name it.
323
- */
324
- declare const GITHUB_ACTIONS_BOT = "github-actions[bot]";
325
- /**
326
- * Validate a caller's list of GitHub App logins trusted to post the status
327
- * (rmartz/pr-policy#97). Each entry is an exact login ending in `[bot]`, such
328
- * as `rmartz-merge-bot[bot]`; blanks are dropped. `github-actions[bot]` is
329
- * refused in any case, because any workflow can post as it. Throws on a bad
330
- * entry, so a misconfigured caller fails loudly rather than trusting less or
331
- * more than it meant to.
332
- */
333
- declare function parseSignOffStatusCreators(entries: readonly string[]): string[];
334
- /**
335
- * Read pr-lifecycle's sign-off status on the head, judging its creator and
336
- * format. The creator must be a `User` who could merge, or a Bot named in
337
- * `trustedBots` (validated by `parseSignOffStatusCreators`).
338
- *
339
- * An untrusted creator is `ignored`, not held on. While the checks keep their
340
- * own classification, ignoring a status can't loosen anything: the PR is
341
- * judged as if pr-lifecycle hadn't posted. Holding instead would lock the repo
342
- * whenever pr-lifecycle's identity and the caller's trust list drift apart,
343
- * including the PR that fixes the list (rmartz/pr-policy#101). Once
344
- * rmartz/pr-policy#85 removes the fallback, this has to hold again.
345
- */
346
- declare function readSignOffStatus(pr: Pick<PullRequestFacts, 'signOffStatus'>, trustedBots?: readonly string[]): SignOffStatusReading;
347
-
348
155
  /**
349
156
  * The indicator vocabulary — the classifier's whole output surface.
350
157
  *
@@ -399,19 +206,9 @@ declare function classifyWorkflowFile(change: WorkflowFileChange): Indicator[];
399
206
  declare function classifyWorkflowChanges(changes: readonly WorkflowFileChange[]): Classification;
400
207
 
401
208
  declare const CI_CHANGE_CHECK = "ci-change";
402
- type CiFacts = Pick<PullRequestFacts, 'labels' | 'signOffs' | 'signOffStatus'>;
403
- /**
404
- * Decide the findings and label edits for one classified PR. With a valid
405
- * `pr-lifecycle/sign-off` status, that status says whether a CI sign-off is
406
- * needed, and this check edits no label: pr-lifecycle writes `CI approval
407
- * needed` then. Without one, with one from a creator the gate doesn't trust,
408
- * or with a trusted one it can't use (the `uat` check holds on that), this
409
- * check classifies the workflow diff itself, as before the cutover.
410
- * `trustedBots` are the GitHub Apps the caller trusts to post the status,
411
- * besides a trusted person.
412
- */
413
- declare function decideCiChange(classification: Classification, pr: CiFacts, trustedBots?: readonly string[]): CheckResult;
414
- /** The CI-change check trusting only people to post the sign-off status. */
209
+ type CiFacts = Pick<PullRequestFacts, 'labels' | 'signOffs'>;
210
+ /** Decide the findings and label edits for one classified PR: hold on a loosening, and reconcile the label. */
211
+ declare function decideCiChange(classification: Classification, pr: CiFacts): CheckResult;
415
212
  declare const ciChangeCheck: PolicyCheck;
416
213
 
417
214
  /**
@@ -468,10 +265,6 @@ declare const MERGE_BLOCK_CHECK = "merge-block";
468
265
  declare function decideMergeBlock(pr: PullRequestFacts): CheckResult;
469
266
  declare const mergeBlockCheck: PolicyCheck;
470
267
 
471
- declare const UAT_LABEL_CHECK = "uat-label";
472
- declare function decideUatLabel(pr: Pick<PullRequestFacts, 'labels'>): CheckResult;
473
- declare const uatLabelCheck: PolicyCheck;
474
-
475
268
  /**
476
269
  * Which files this guard considers "a CI workflow".
477
270
  *
@@ -532,6 +325,44 @@ declare function isManifestPath(path: string): boolean;
532
325
  */
533
326
  declare function sensitiveBumps(changes: readonly FileChange[]): string[];
534
327
 
328
+ /**
329
+ * Names read outside this repo. Each is a fleet contract: consumers' rulesets
330
+ * require the check-run by literal name, the coordinator's gate model parks a PR
331
+ * on the label, and a human applies the sign-off label by hand. Renaming any of
332
+ * them is a coordinated cross-repo migration, never a local refactor — see
333
+ * docs/check-run-contract.md. `test/contract.test.ts` pins every value.
334
+ */
335
+ /**
336
+ * The one check-run this package posts. Every policy check reports into it, so
337
+ * adding a check never adds a required-status name.
338
+ */
339
+ declare const PR_POLICY_CHECK_NAME = "pr-policy";
340
+ /** The merge-gate label the CI-change check applies to an unsigned loosening. */
341
+ declare const CI_APPROVAL_NEEDED_LABEL = "CI approval needed";
342
+ /**
343
+ * The human sign-off on a CI loosening. Read-only here: this package never
344
+ * applies it.
345
+ */
346
+ declare const CI_CHANGE_APPROVED_LABEL = "CI change approved";
347
+ /**
348
+ * Labels a person puts on a PR to stop it merging. The merge-block check holds
349
+ * `pr-policy` while any of them is present, and never applies or removes one.
350
+ * `dnm` is shorthand for `do not merge`.
351
+ */
352
+ declare const DO_NOT_MERGE_LABEL = "do not merge";
353
+ declare const DNM_LABEL = "dnm";
354
+ declare const BLOCKED_LABEL = "blocked";
355
+ declare const BLOCKING_LABELS: readonly ["do not merge", "dnm", "blocked"];
356
+ /**
357
+ * Labels the title check reads and never writes. They belong to the review and
358
+ * release flow: `breaking change` must agree with the title's `!`, which is what
359
+ * the release and merge-safety read; `hotfix` implies one; and release-please
360
+ * marks its release PRs with `autorelease: pending`.
361
+ */
362
+ declare const BREAKING_CHANGE_LABEL = "breaking change";
363
+ declare const HOTFIX_LABEL = "hotfix";
364
+ declare const RELEASE_PLEASE_PENDING_LABEL = "autorelease: pending";
365
+
535
366
  /**
536
367
  * The overall result of one evaluation. `pending` posts the check-run as
537
368
  * `in_progress` (no conclusion), so a PR waiting on a human sign-off shows as
@@ -566,10 +397,9 @@ declare function evaluatePolicy(pr: PullRequestFacts, checks?: readonly PolicyCh
566
397
  /**
567
398
  * Parse and validate a JSON facts document into `PullRequestFacts`.
568
399
  * `workflowChanges`, `manifestChanges`, and `signOffs` are optional and default
569
- * to none; `body`, `author`, `base`, `draft`, `headPushedAt`, and
570
- * `signOffStatus` are optional and stay absent. With no `signOffs`, no sign-off
571
- * label counts, and with no `headPushedAt`, no `UAT passed` does: trust fails
572
- * closed. With no `signOffStatus`, the checks classify the PR themselves.
400
+ * to none; `body`, `author`, `base`, `draft`, and `headPushedAt` are optional
401
+ * and stay absent. With no `signOffs`, no sign-off label counts, and with no
402
+ * `headPushedAt`, no `UAT passed` does: trust fails closed.
573
403
  */
574
404
  declare function parseFacts(raw: string): PullRequestFacts;
575
405
 
@@ -619,10 +449,10 @@ declare function gatherFacts(pullRequest: PullRequestTarget): Promise<{
619
449
  headSha: string;
620
450
  }>;
621
451
  /**
622
- * The open PRs whose head is `sha`. A `status` event carries a SHA, not a PR,
623
- * so this is how a caller re-evaluates when pr-lifecycle posts its sign-off
624
- * status. A PR whose head has since moved isn't returned: its newer head gets
625
- * its own status. A failed lookup throws.
452
+ * The open PRs whose head is `sha`. An event such as `status` or
453
+ * `workflow_run` carries a SHA, not a PR, so this is how a caller re-evaluates
454
+ * on one. A PR whose head has since moved isn't returned: its newer head gets
455
+ * its own run. A failed lookup throws.
626
456
  */
627
457
  declare function openPullRequestsAtHead(target: ClientTarget & {
628
458
  repo: string;
@@ -710,5 +540,5 @@ interface FetchClientOptions {
710
540
  }
711
541
  declare function createFetchClient(options: FetchClientOptions): GitHubClient;
712
542
 
713
- export { AMBIGUOUS_INDICATORS, BLOCKED_LABEL, BLOCKING_LABELS, BREAKING_CHANGE_LABEL, CHECKS, CI_APPROVAL_NEEDED_LABEL, CI_CHANGE_APPROVED_LABEL, CI_CHANGE_CHECK, CI_CHANGE_VERDICTS, CI_SENSITIVE_PACKAGES, COMMIT_TYPES, DEPENDABOT_CHECK, DEPENDABOT_LOGIN, DNM_LABEL, DO_NOT_MERGE_LABEL, ESCALATION_NEEDED_LABEL, FUNCTIONAL_TYPES, GITHUB_ACTIONS_BOT, HOTFIX_LABEL, LOOSENING_INDICATORS, MERGE_BLOCK_CHECK, POLICY_OUTCOMES, PR_POLICY_CHECK_NAME, RELEASE_PLEASE_PENDING_LABEL, SIGN_OFF_REQUIREMENTS, SIGN_OFF_STATUS_CONTEXT, SIGN_OFF_STATUS_VERSIONS, TITLE_CHECK, UAT_LABELS, UAT_LABEL_CHECK, UAT_SIGN_OFF_OUTCOMES, WAIVER_STATES, applyLabelEdits, buildReport, checkRunBody, checkStatuses, ciChangeCheck, ciRetitle, classifyWorkflowChanges, classifyWorkflowFile, clientOf, createFetchClient, createGhClient, decideCiChange, decideDependabot, decideMergeBlock, decideTitle, decideUatLabel, dependabotCheck, evaluatePolicy, gatherFacts, isManifestPath, isWorkflowPath, mergeBlockCheck, openPullRequestsAtHead, parseClaims, parseFacts, parseSignOffDescription, parseSignOffStatusCreators, parseTitle, postCheckRun, postCheckStatuses, postVerdict, readSignOffStatus, selectChecks, sensitiveBumps, statusBody, titleCheck, uatLabelCheck };
714
- export type { AmbiguousIndicator, CheckResult, CheckRunReport, CheckStatus, CheckStatusOptions, CiChangeVerdict, Claim, Classification, ClientTarget, CommitStatus, CommitType, FetchClientOptions, FileChange, Finding, GitHubClient, Indicator, IndicatorClass, IndicatorKind, LooseningIndicator, ParsedTitle, PolicyCheck, PolicyEvaluation, PolicyOptions, PolicyOutcome, PullRequestAuthor, PullRequestFacts, PullRequestTarget, SignOffClassification, SignOffRequirement, SignOffStatusReading, UatSignOffOutcome, VerdictOptions, WaiverState, WorkflowFileChange };
543
+ export { AMBIGUOUS_INDICATORS, BLOCKED_LABEL, BLOCKING_LABELS, BREAKING_CHANGE_LABEL, CHECKS, CI_APPROVAL_NEEDED_LABEL, CI_CHANGE_APPROVED_LABEL, CI_CHANGE_CHECK, CI_CHANGE_VERDICTS, CI_SENSITIVE_PACKAGES, COMMIT_TYPES, DEPENDABOT_CHECK, DEPENDABOT_LOGIN, DNM_LABEL, DO_NOT_MERGE_LABEL, FUNCTIONAL_TYPES, HOTFIX_LABEL, LOOSENING_INDICATORS, MERGE_BLOCK_CHECK, POLICY_OUTCOMES, PR_POLICY_CHECK_NAME, RELEASE_PLEASE_PENDING_LABEL, TITLE_CHECK, applyLabelEdits, buildReport, checkRunBody, checkStatuses, ciChangeCheck, ciRetitle, classifyWorkflowChanges, classifyWorkflowFile, clientOf, createFetchClient, createGhClient, decideCiChange, decideDependabot, decideMergeBlock, decideTitle, dependabotCheck, evaluatePolicy, gatherFacts, isManifestPath, isWorkflowPath, mergeBlockCheck, openPullRequestsAtHead, parseClaims, parseFacts, parseTitle, postCheckRun, postCheckStatuses, postVerdict, selectChecks, sensitiveBumps, statusBody, titleCheck };
544
+ export type { AmbiguousIndicator, CheckResult, CheckRunReport, CheckStatus, CheckStatusOptions, CiChangeVerdict, Claim, Classification, ClientTarget, CommitType, FetchClientOptions, FileChange, Finding, GitHubClient, Indicator, IndicatorClass, IndicatorKind, LooseningIndicator, ParsedTitle, PolicyCheck, PolicyEvaluation, PolicyOptions, PolicyOutcome, PullRequestAuthor, PullRequestFacts, PullRequestTarget, VerdictOptions, WorkflowFileChange };
package/dist/index.js CHANGED
@@ -14,23 +14,14 @@ import {
14
14
  DEPENDABOT_LOGIN,
15
15
  DNM_LABEL,
16
16
  DO_NOT_MERGE_LABEL,
17
- ESCALATION_NEEDED_LABEL,
18
17
  FUNCTIONAL_TYPES,
19
- GITHUB_ACTIONS_BOT,
20
18
  HOTFIX_LABEL,
21
19
  LOOSENING_INDICATORS,
22
20
  MERGE_BLOCK_CHECK,
23
21
  POLICY_OUTCOMES,
24
22
  PR_POLICY_CHECK_NAME,
25
23
  RELEASE_PLEASE_PENDING_LABEL,
26
- SIGN_OFF_REQUIREMENTS,
27
- SIGN_OFF_STATUS_CONTEXT,
28
- SIGN_OFF_STATUS_VERSIONS,
29
24
  TITLE_CHECK,
30
- UAT_LABELS,
31
- UAT_LABEL_CHECK,
32
- UAT_SIGN_OFF_OUTCOMES,
33
- WAIVER_STATES,
34
25
  applyLabelEdits,
35
26
  buildReport,
36
27
  checkRunBody,
@@ -43,7 +34,6 @@ import {
43
34
  decideDependabot,
44
35
  decideMergeBlock,
45
36
  decideTitle,
46
- decideUatLabel,
47
37
  dependabotCheck,
48
38
  evaluatePolicy,
49
39
  gatherFacts,
@@ -54,18 +44,14 @@ import {
54
44
  openPullRequestsAtHead,
55
45
  parseClaims,
56
46
  parseFacts,
57
- parseSignOffDescription,
58
- parseSignOffStatusCreators,
59
47
  parseTitle,
60
48
  postCheckRun,
61
49
  postVerdict,
62
- readSignOffStatus,
63
50
  selectChecks,
64
51
  sensitiveBumps,
65
52
  statusBody,
66
- titleCheck,
67
- uatLabelCheck
68
- } from "./chunk-ISEUZ3TA.js";
53
+ titleCheck
54
+ } from "./chunk-U57FR2KO.js";
69
55
 
70
56
  // src/github/check-statuses.ts
71
57
  var MAX_DESCRIPTION = 140;
@@ -204,23 +190,14 @@ export {
204
190
  DEPENDABOT_LOGIN,
205
191
  DNM_LABEL,
206
192
  DO_NOT_MERGE_LABEL,
207
- ESCALATION_NEEDED_LABEL,
208
193
  FUNCTIONAL_TYPES,
209
- GITHUB_ACTIONS_BOT,
210
194
  HOTFIX_LABEL,
211
195
  LOOSENING_INDICATORS,
212
196
  MERGE_BLOCK_CHECK,
213
197
  POLICY_OUTCOMES,
214
198
  PR_POLICY_CHECK_NAME,
215
199
  RELEASE_PLEASE_PENDING_LABEL,
216
- SIGN_OFF_REQUIREMENTS,
217
- SIGN_OFF_STATUS_CONTEXT,
218
- SIGN_OFF_STATUS_VERSIONS,
219
200
  TITLE_CHECK,
220
- UAT_LABELS,
221
- UAT_LABEL_CHECK,
222
- UAT_SIGN_OFF_OUTCOMES,
223
- WAIVER_STATES,
224
201
  applyLabelEdits,
225
202
  buildReport,
226
203
  checkRunBody,
@@ -236,7 +213,6 @@ export {
236
213
  decideDependabot,
237
214
  decideMergeBlock,
238
215
  decideTitle,
239
- decideUatLabel,
240
216
  dependabotCheck,
241
217
  evaluatePolicy,
242
218
  gatherFacts,
@@ -246,16 +222,12 @@ export {
246
222
  openPullRequestsAtHead,
247
223
  parseClaims,
248
224
  parseFacts,
249
- parseSignOffDescription,
250
- parseSignOffStatusCreators,
251
225
  parseTitle,
252
226
  postCheckRun,
253
227
  postCheckStatuses,
254
228
  postVerdict,
255
- readSignOffStatus,
256
229
  selectChecks,
257
230
  sensitiveBumps,
258
231
  statusBody,
259
- titleCheck,
260
- uatLabelCheck
232
+ titleCheck
261
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmartz/pr-policy",
3
- "version": "1.8.0",
3
+ "version": "3.0.0",
4
4
  "description": "Read-only PR content classifiers — CI-change classification, title-type rules, and more — reported as one blocking pr-policy check-run. Distributed as a pinned Action kept current by Dependabot.",
5
5
  "keywords": [
6
6
  "pr-policy",
@@ -17,7 +17,7 @@
17
17
  "type": "module",
18
18
  "packageManager": "pnpm@9.12.0",
19
19
  "engines": {
20
- "node": ">=20.11.0"
20
+ "node": ">=26.0.0"
21
21
  },
22
22
  "exports": {
23
23
  ".": {