@rmartz/pr-policy 0.11.0 → 0.12.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.
@@ -7,7 +7,7 @@ import {
7
7
  postVerdict,
8
8
  resolveRepoTarget,
9
9
  selectChecks
10
- } from "../chunk-LWLZD5YW.js";
10
+ } from "../chunk-VJXHTDY2.js";
11
11
 
12
12
  // src/bin/pr-policy.ts
13
13
  import { readFile } from "fs/promises";
@@ -5,11 +5,13 @@ var CI_CHANGE_APPROVED_LABEL = "CI change approved";
5
5
  var UAT_PASSED_LABEL = "UAT passed";
6
6
  var LEGACY_UAT_PASSED_LABEL = "tested";
7
7
  var NO_UAT_NEEDED_LABEL = "no UAT needed";
8
+ var CONTAINED_BREAK_LABEL = "contained break";
8
9
  var SIGN_OFF_LABELS = [
9
10
  CI_CHANGE_APPROVED_LABEL,
10
11
  UAT_PASSED_LABEL,
11
12
  LEGACY_UAT_PASSED_LABEL,
12
- NO_UAT_NEEDED_LABEL
13
+ NO_UAT_NEEDED_LABEL,
14
+ CONTAINED_BREAK_LABEL
13
15
  ];
14
16
  var DO_NOT_MERGE_LABEL = "do not merge";
15
17
  var DNM_LABEL = "dnm";
@@ -1263,18 +1265,37 @@ function decideTitle(pr) {
1263
1265
  } else if (!breakingIntent && title.breaking) {
1264
1266
  findings.push(
1265
1267
  block2(
1266
- `The title marks a breaking change but the PR lacks the \`${BREAKING_CHANGE_LABEL}\` label, which is the source of truth. Add the label, or drop the \`!\`.`
1268
+ `The title marks a breaking change but the PR lacks the \`${BREAKING_CHANGE_LABEL}\` label; the two must agree. Add the label, or drop the \`!\`.`
1267
1269
  )
1268
1270
  );
1269
1271
  }
1270
- const majors = majorBumps(pr.manifestChanges);
1271
- if (functional && !breakingIntent && !title.breaking && majors.length > 0) {
1272
+ const containedBreakLabel = labels.has(CONTAINED_BREAK_LABEL);
1273
+ if (containedBreakLabel && (breakingIntent || title.breaking)) {
1272
1274
  findings.push(
1273
1275
  block2(
1274
- `This PR bumps a dependency's major version (${majors.map((bump) => `\`${bump}\``).join(", ")}), so it is a breaking change. Retitle to \`${breakingTitle}\` and add the \`${BREAKING_CHANGE_LABEL}\` label.`
1276
+ `\`${CONTAINED_BREAK_LABEL}\` says the break doesn't reach consumers, but the PR is also marked breaking. Remove \`${CONTAINED_BREAK_LABEL}\`, or drop the \`!\` and the breaking label.`
1275
1277
  )
1276
1278
  );
1277
1279
  }
1280
+ const majors = majorBumps(pr.manifestChanges);
1281
+ if (functional && !breakingIntent && !title.breaking && majors.length > 0) {
1282
+ const bumped = majors.map((bump) => `\`${bump}\``).join(", ");
1283
+ const waiver = signOffState(pr, [CONTAINED_BREAK_LABEL]);
1284
+ if (waiver.status === "trusted") {
1285
+ findings.push({
1286
+ check: TITLE_CHECK,
1287
+ effect: "info",
1288
+ message: `\`${waiver.appliedBy.login}\` waived the dependency major bump (${bumped}) with \`${CONTAINED_BREAK_LABEL}\`, so it releases without \`!\`.`
1289
+ });
1290
+ } else {
1291
+ const untrusted = waiver.status === "untrusted" ? ` The \`${CONTAINED_BREAK_LABEL}\` label doesn't count: ${waiver.reason}.` : "";
1292
+ findings.push(
1293
+ block2(
1294
+ `This PR bumps a dependency's major version (${bumped}), so it is a breaking change. Retitle to \`${breakingTitle}\` and add the \`${BREAKING_CHANGE_LABEL}\` label. If the bump is invisible to this package's consumers, someone who can merge may add \`${CONTAINED_BREAK_LABEL}\` instead.${untrusted}`
1295
+ )
1296
+ );
1297
+ }
1298
+ }
1278
1299
  const pathViolation = typePathViolation(title.type, pr.changedFiles);
1279
1300
  if (pathViolation !== void 0) findings.push(block2(pathViolation));
1280
1301
  const mayRetitle = !functional && title.type !== "ci";
package/dist/index.d.ts CHANGED
@@ -337,9 +337,9 @@ declare const ESCALATION_NEEDED_LABEL = "escalation needed";
337
337
  declare const BLOCKING_LABELS: readonly ["do not merge", "dnm", "blocked", "escalation needed"];
338
338
  /**
339
339
  * Labels the title check reads and never writes. They belong to the review and
340
- * release flow: `breaking change` is the source of truth for a breaking PR,
341
- * `hotfix` implies one, and release-please marks its release PRs with
342
- * `autorelease: pending`.
340
+ * release flow: `breaking change` must agree with the title's `!`, which is what
341
+ * the release and merge-safety read; `hotfix` implies one; and release-please
342
+ * marks its release PRs with `autorelease: pending`.
343
343
  */
344
344
  declare const BREAKING_CHANGE_LABEL = "breaking change";
345
345
  declare const HOTFIX_LABEL = "hotfix";
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  sensitiveBumps,
49
49
  statusBody,
50
50
  titleCheck
51
- } from "./chunk-LWLZD5YW.js";
51
+ } from "./chunk-VJXHTDY2.js";
52
52
  export {
53
53
  AMBIGUOUS_INDICATORS,
54
54
  BLOCKED_LABEL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmartz/pr-policy",
3
- "version": "0.11.0",
3
+ "version": "0.12.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",