@patronage/software-factory 1.0.0-alpha.47 → 1.0.0-alpha.48

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.js";
2
2
  import path from "node:path";
3
3
  import { Command, InvalidArgumentError } from "commander";
4
4
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -22,7 +22,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
22
22
  import { pathToFileURL } from "node:url";
23
23
  // package.json
24
24
  var name = "@patronage/software-factory";
25
- var version = "1.0.0-alpha.47";
25
+ var version = "1.0.0-alpha.48";
26
26
  // src/git-globals-parse.ts
27
27
  const VALUE_TAKING_GIT_OPTIONS = /* @__PURE__ */ new Set([
28
28
  "-C",
@@ -405,6 +405,8 @@ function gitEnv() {
405
405
  for (const [key, value] of Object.entries(process.env)) if (!omit.has(key)) env[key] = value;
406
406
  return env;
407
407
  }
408
+ const RUN_CAPTURE_MAX_BUFFER_BYTES = 67108864;
409
+ const RUN_CAPTURE_TIMEOUT_MS = 6e5;
408
410
  function runCapture(command, args, cwd, options = {}) {
409
411
  const baseEnv = path.basename(command) === "git" ? gitEnv() : process.env;
410
412
  const env = options.extraEnv === void 0 ? baseEnv : {
@@ -427,17 +429,25 @@ function runCapture(command, args, cwd, options = {}) {
427
429
  cwd,
428
430
  env: guardEnv
429
431
  });
432
+ const timeoutMs = options.timeoutMs ?? RUN_CAPTURE_TIMEOUT_MS;
430
433
  const result = spawnSync(command, args, {
431
434
  cwd,
432
435
  encoding: "utf-8",
433
436
  env,
437
+ maxBuffer: RUN_CAPTURE_MAX_BUFFER_BYTES,
434
438
  stdio: [
435
439
  "ignore",
436
440
  "pipe",
437
441
  "pipe"
438
- ]
442
+ ],
443
+ timeout: timeoutMs
439
444
  });
440
- if (result.error) throw result.error;
445
+ if (result.error) {
446
+ const { code } = result.error;
447
+ if (code === "ETIMEDOUT") throw new Error(`${command} ${args.join(" ")} did not finish within ${timeoutMs}ms`, { cause: result.error });
448
+ if (code === "ENOBUFS") throw new Error(`${command} ${args.join(" ")} wrote more than ${RUN_CAPTURE_MAX_BUFFER_BYTES} bytes of output`, { cause: result.error });
449
+ throw result.error;
450
+ }
441
451
  if (!(options.acceptableExitCodes ?? [0]).includes(result.status ?? -1)) throw new Error(`${command} ${args.join(" ")} failed:\n${result.stderr.trim()}`);
442
452
  return {
443
453
  stderr: result.stderr,
@@ -547,6 +557,15 @@ function showFileAtRef(cwd, ref, repositoryRelativePath) {
547
557
  return;
548
558
  }
549
559
  }
560
+ /** Every path tracked in the tree of `ref` (#1658). */
561
+ function trackedFilesAt(cwd, ref) {
562
+ return runCapture("git", [
563
+ "ls-tree",
564
+ "-r",
565
+ "--name-only",
566
+ ref
567
+ ], cwd).stdout.split("\n").filter(Boolean);
568
+ }
550
569
  function emptyTreeHash(cwd) {
551
570
  return runCapture("git", [
552
571
  "hash-object",
@@ -1584,7 +1603,9 @@ const parseLockfile = (content) => {
1584
1603
  try {
1585
1604
  const documents = parseAllDocuments(content);
1586
1605
  if (!Array.isArray(documents) || documents.some((document) => document.errors.length > 0)) return;
1587
- const values = documents.map((document) => document.toJS());
1606
+ const values = documents.map((document) => {
1607
+ return document.toJS();
1608
+ });
1588
1609
  const [first, second] = values;
1589
1610
  const project = values.length === 2 ? second : first;
1590
1611
  if (values.length === 0 || values.length > 2 || values.length === 2 && !isPackageManagerLockfile(first) || !isRecord$2(project)) return;
@@ -1993,6 +2014,103 @@ const requiredCheckInScope = ({ context, scope }) => {
1993
2014
  reason: `out of scope — classification "${context.classification}" is not one of: ${scope.classifications.join(", ")}`
1994
2015
  };
1995
2016
  };
2017
+ // src/review-ladder-policy.ts
2018
+ const REVIEW_SEVERITIES = [
2019
+ "critical",
2020
+ "high",
2021
+ "medium",
2022
+ "low",
2023
+ "unknown"
2024
+ ];
2025
+ const REVIEW_CATEGORIES = [
2026
+ "correctness",
2027
+ "safety",
2028
+ "coordination",
2029
+ "maintainability",
2030
+ "unknown"
2031
+ ];
2032
+ const resolveReviewFindingSeverity = (priority) => {
2033
+ const normalized = priority?.trim().toLowerCase();
2034
+ if (!normalized) return "unknown";
2035
+ if ([
2036
+ "p0",
2037
+ "critical",
2038
+ "crit",
2039
+ "blocker",
2040
+ "blocking"
2041
+ ].includes(normalized)) return "critical";
2042
+ if ([
2043
+ "p1",
2044
+ "high",
2045
+ "severe",
2046
+ "major"
2047
+ ].includes(normalized)) return "high";
2048
+ if ([
2049
+ "p2",
2050
+ "medium",
2051
+ "moderate",
2052
+ "normal",
2053
+ "refinement"
2054
+ ].includes(normalized)) return "medium";
2055
+ if ([
2056
+ "p3",
2057
+ "p4",
2058
+ "low",
2059
+ "minor",
2060
+ "info",
2061
+ "informational"
2062
+ ].includes(normalized)) return "low";
2063
+ return "unknown";
2064
+ };
2065
+ const countFindingsBySeverity = (findings) => {
2066
+ const counts = {
2067
+ critical: 0,
2068
+ high: 0,
2069
+ low: 0,
2070
+ medium: 0,
2071
+ unknown: 0
2072
+ };
2073
+ for (const finding of findings) counts[resolveReviewFindingSeverity(finding.priority)] += 1;
2074
+ return counts;
2075
+ };
2076
+ const resolveReviewFindingCategory = (category) => REVIEW_CATEGORIES.find((value) => value === category?.trim().toLowerCase()) ?? "unknown";
2077
+ const resolveFindingBlocking = (finding, disposition = "open") => {
2078
+ if (disposition !== "open") return false;
2079
+ if (resolveReviewFindingCategory(finding.category) !== "maintainability") return true;
2080
+ if (finding.blockingAfterCap !== void 0) return finding.blockingAfterCap;
2081
+ const severity = resolveReviewFindingSeverity(finding.priority);
2082
+ return severity === "critical" || severity === "high" || severity === "unknown";
2083
+ };
2084
+ /**
2085
+ * The review-round limit in force: the base profile's
2086
+ * `review.roundsWithoutWaiver`, or the default when the base declares none.
2087
+ *
2088
+ * Callers pass the AUTHORITATIVE base policy (#922), never the candidate's, and
2089
+ * pass `undefined` when the base could not be read, so an unreadable authority
2090
+ * falls back to the stricter default rather than to anything the candidate
2091
+ * wrote.
2092
+ */
2093
+ const resolveReviewRoundsWithoutWaiver = (basePolicy) => basePolicy?.roundsWithoutWaiver ?? 2;
2094
+ const ORDINALS = [
2095
+ "first",
2096
+ "second",
2097
+ "third",
2098
+ "fourth",
2099
+ "fifth"
2100
+ ];
2101
+ /**
2102
+ * The limit as an ordinal ("second"), for the "a round past the ..." wording
2103
+ * the round-limit refusals share. Falls back to "round N" past the table.
2104
+ */
2105
+ const reviewRoundLimitOrdinal = (limit) => ORDINALS[limit - 1] ?? `round ${limit}`;
2106
+ /**
2107
+ * The review rounds a ladder holds (#1280). A round is every cycle recorded at
2108
+ * one reviewed patch-id, historical or live, so a pair of clean sessions at
2109
+ * one head is one round and a single-session review is one round. A cycle
2110
+ * with no recorded identity cannot share a patch, so it is a round of its own.
2111
+ */
2112
+ const reviewRoundCount = (cycles) => new Set(cycles.map((cycle, index) => cycle.identity?.patchId ?? `unidentified:${index}`)).size;
2113
+ const resolveReviewLadderPolicy = () => ({ gate: { cap: 5 } });
1996
2114
  // src/profile.ts
1997
2115
  const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
1998
2116
  /**
@@ -2034,7 +2152,10 @@ const conditionalReviewSchema = z.object({ paths: z.array(z.string().min(1).refi
2034
2152
  * class: a guardrail must not lock the operator out). One definition, two parse
2035
2153
  * scopes.
2036
2154
  */
2037
- const reviewPolicySchema = z.object({ conditional: z.array(conditionalReviewSchema).min(1) }).strict();
2155
+ const reviewPolicySchema = z.object({
2156
+ conditional: z.array(conditionalReviewSchema).min(1),
2157
+ roundsWithoutWaiver: z.number().int().min(1).max(5).optional().describe(`Review rounds one pull request may record before the next round needs an operator \`review-round-limit\` waiver. Defaults to 2. At most the factory review cycle cap (5). Read from the profile on the pull request's base ref, never the candidate's own, so a change here takes effect once it has merged.`)
2158
+ }).strict();
2038
2159
  const hqEndpointDeclarationSchema = z.intersection(z.string().url(), z.string().regex(/^https:\/\/[^/@\s]+(?:[/?#]|$)/u, "Must use HTTPS without embedded credentials"));
2039
2160
  const hqIngestConfigSchema = z.object({
2040
2161
  enabled: z.boolean(),
@@ -2367,10 +2488,11 @@ function createVerificationRunContext(input) {
2367
2488
  const lockfileImporters = input.lockfileImporters !== void 0 && input.lockfileImporters.length > 0 && matchingFiles.length === 1 && matchingFiles[0] === "pnpm-lock.yaml" ? input.lockfileImporters : void 0;
2368
2489
  const forcesFullSuite = matchingFiles.length > 0 || input.changedFiles.length === 0;
2369
2490
  const fullSuiteReasons = input.changedFiles.length === 0 ? ["no changed files detected; forcing full suite"] : matchingFiles.map(fullSuiteReasonForFile);
2491
+ const runScope = forcesFullSuite && lockfileImporters === void 0 && input.trackedFiles !== void 0 ? "whole-tree" : "diff-scoped";
2370
2492
  return {
2371
2493
  baseRef: input.baseRef,
2372
2494
  buildEnv: () => {
2373
- const payload = input.changedFiles.join("\n");
2495
+ const payload = (runScope === "whole-tree" && input.trackedFiles ? input.trackedFiles() : input.changedFiles).join("\n");
2374
2496
  const env = {
2375
2497
  [FACTORY_BASE_REF_ENV]: forcesFullSuite ? fullSuiteBaseRef : input.baseRef,
2376
2498
  [FACTORY_CHANGED_FILES_ENV]: "",
@@ -2402,6 +2524,7 @@ function createVerificationRunContext(input) {
2402
2524
  changedFiles: input.changedFiles,
2403
2525
  forcesFullSuite,
2404
2526
  fullSuiteReasons,
2527
+ runScope,
2405
2528
  runSummaryLines: () => {
2406
2529
  const lines = [];
2407
2530
  if (input.changedFiles.length > 0) {
@@ -2413,6 +2536,7 @@ function createVerificationRunContext(input) {
2413
2536
  lines.push("Forcing full verification suite:");
2414
2537
  for (const reason of fullSuiteReasons) lines.push(`- ${reason}`);
2415
2538
  }
2539
+ if (runScope === "whole-tree") lines.push("Run scope: whole-tree (commands see every tracked path as changed)");
2416
2540
  return lines;
2417
2541
  }
2418
2542
  };
@@ -2838,6 +2962,7 @@ function createAffectedCommand(output) {
2838
2962
  }
2839
2963
  // src/admission-credential.ts
2840
2964
  const OPERATION_LABELS = {
2965
+ "add-hold-label": "adding the factory:hold label",
2841
2966
  "create-pull-request": "creating the pull request",
2842
2967
  "edit-pull-request-body": "editing the pull request body",
2843
2968
  "read-issue": "reading an issue",
@@ -3124,7 +3249,7 @@ const membershipWaveDemand = (graph, pr) => {
3124
3249
  kind: "unbound",
3125
3250
  reasons: [`PR #${pr} closes no declared boundary issue; membership derives from closing links — found 0 matching issues.`]
3126
3251
  };
3127
- let strictest = memberships[0];
3252
+ let [strictest] = memberships;
3128
3253
  for (const membership of memberships) if (RUNG_ORDER[membership.wave.review] > RUNG_ORDER[strictest.wave.review]) strictest = membership;
3129
3254
  return {
3130
3255
  demand: {
@@ -3587,12 +3712,14 @@ const DEMAND_KEYS = {
3587
3712
  /** The profile-resolved review ladder policy. */
3588
3713
  reviewLadder: "review-ladder",
3589
3714
  /**
3590
- * A review round past the second on one pull request (#1280). A round is
3591
- * every review recorded at one patch, so a pair of clean sessions at one
3592
- * head is one round. Only an operator waiver clears it: `pr:review
3593
- * --assemble` refuses to start a third round without one, and `pr:ready`
3594
- * refuses a ladder that holds more than two. The waiver rationale carries
3595
- * the operator's disposition.
3715
+ * A review round past the repository's round limit on one pull request
3716
+ * (#1280). The limit is `review.roundsWithoutWaiver` in the profile on the
3717
+ * base ref, 2 when absent; the candidate's own value is never read (#922).
3718
+ * A round is every review recorded at one patch, so a pair of clean
3719
+ * sessions at one head is one round. Only an operator waiver clears it:
3720
+ * `pr:review --assemble` refuses to start a round past the limit without
3721
+ * one, and `pr:ready` refuses a ladder that holds more rounds than the
3722
+ * limit. The waiver rationale carries the operator's disposition.
3596
3723
  */
3597
3724
  reviewRoundLimit: "review-round-limit",
3598
3725
  /** Unresolved GitHub review threads. */
@@ -3836,80 +3963,80 @@ const authorizeDemandWaiver = ({ authenticatedLogin, session }) => {
3836
3963
  };
3837
3964
  // src/sha256-hex.ts
3838
3965
  const ROUND_CONSTANTS = new Uint32Array([
3839
- 1116352408,
3840
- 1899447441,
3841
- 3049323471,
3842
- 3921009573,
3966
+ 0x428a2f98,
3967
+ 0x71374491,
3968
+ 0xb5c0fbcf,
3969
+ 0xe9b5dba5,
3843
3970
  961987163,
3844
- 1508970993,
3845
- 2453635748,
3846
- 2870763221,
3847
- 3624381080,
3971
+ 0x59f111f1,
3972
+ 0x923f82a4,
3973
+ 0xab1c5ed5,
3974
+ 0xd807aa98,
3848
3975
  310598401,
3849
3976
  607225278,
3850
- 1426881987,
3851
- 1925078388,
3852
- 2162078206,
3853
- 2614888103,
3854
- 3248222580,
3855
- 3835390401,
3856
- 4022224774,
3857
- 264347078,
3977
+ 0x550c7dc3,
3978
+ 0x72be5d74,
3979
+ 0x80deb1fe,
3980
+ 0x9bdc06a7,
3981
+ 0xc19bf174,
3982
+ 0xe49b69c1,
3983
+ 0xefbe4786,
3984
+ 0xfc19dc6,
3858
3985
  604807628,
3859
3986
  770255983,
3860
- 1249150122,
3861
- 1555081692,
3862
- 1996064986,
3863
- 2554220882,
3864
- 2821834349,
3865
- 2952996808,
3866
- 3210313671,
3867
- 3336571891,
3868
- 3584528711,
3869
- 113926993,
3987
+ 0x4a7484aa,
3988
+ 0x5cb0a9dc,
3989
+ 0x76f988da,
3990
+ 0x983e5152,
3991
+ 0xa831c66d,
3992
+ 0xb00327c8,
3993
+ 0xbf597fc7,
3994
+ 0xc6e00bf3,
3995
+ 0xd5a79147,
3996
+ 0x6ca6351,
3870
3997
  338241895,
3871
3998
  666307205,
3872
3999
  773529912,
3873
- 1294757372,
3874
- 1396182291,
3875
- 1695183700,
3876
- 1986661051,
3877
- 2177026350,
3878
- 2456956037,
3879
- 2730485921,
3880
- 2820302411,
3881
- 3259730800,
3882
- 3345764771,
3883
- 3516065817,
3884
- 3600352804,
3885
- 4094571909,
4000
+ 0x4d2c6dfc,
4001
+ 0x53380d13,
4002
+ 0x650a7354,
4003
+ 0x766a0abb,
4004
+ 0x81c2c92e,
4005
+ 0x92722c85,
4006
+ 0xa2bfe8a1,
4007
+ 0xa81a664b,
4008
+ 0xc24b8b70,
4009
+ 0xc76c51a3,
4010
+ 0xd192e819,
4011
+ 0xd6990624,
4012
+ 0xf40e3585,
3886
4013
  275423344,
3887
4014
  430227734,
3888
4015
  506948616,
3889
4016
  659060556,
3890
4017
  883997877,
3891
4018
  958139571,
3892
- 1322822218,
3893
- 1537002063,
3894
- 1747873779,
3895
- 1955562222,
3896
- 2024104815,
3897
- 2227730452,
3898
- 2361852424,
3899
- 2428436474,
3900
- 2756734187,
3901
- 3204031479,
3902
- 3329325298
4019
+ 0x4ed8aa4a,
4020
+ 0x5b9cca4f,
4021
+ 0x682e6ff3,
4022
+ 0x748f82ee,
4023
+ 0x78a5636f,
4024
+ 0x84c87814,
4025
+ 0x8cc70208,
4026
+ 0x90befffa,
4027
+ 0xa4506ceb,
4028
+ 0xbef9a3f7,
4029
+ 0xc67178f2
3903
4030
  ]);
3904
4031
  const INITIAL_STATE = new Uint32Array([
3905
- 1779033703,
3906
- 3144134277,
3907
- 1013904242,
3908
- 2773480762,
3909
- 1359893119,
3910
- 2600822924,
4032
+ 0x6a09e667,
4033
+ 0xbb67ae85,
4034
+ 0x3c6ef372,
4035
+ 0xa54ff53a,
4036
+ 0x510e527f,
4037
+ 0x9b05688c,
3911
4038
  528734635,
3912
- 1541459225
4039
+ 0x5be0cd19
3913
4040
  ]);
3914
4041
  const BLOCK_BYTES = 64;
3915
4042
  const LENGTH_FIELD_BYTES = 8;
@@ -4053,82 +4180,6 @@ const findingKey = (finding) => {
4053
4180
  return sha256Hex(`${path}\0${spanDigest}\0${actionJoined}\0${legacyDiscriminator}`);
4054
4181
  };
4055
4182
  const declarationMatchesEntry = (entry, target) => normalizeTitle(entry.title) === normalizeTitle(target.title) && (target.file === void 0 || entry.file !== void 0 && normalizeFile(entry.file) === normalizeFile(target.file));
4056
- // src/review-ladder-policy.ts
4057
- const REVIEW_SEVERITIES = [
4058
- "critical",
4059
- "high",
4060
- "medium",
4061
- "low",
4062
- "unknown"
4063
- ];
4064
- const REVIEW_CATEGORIES = [
4065
- "correctness",
4066
- "safety",
4067
- "coordination",
4068
- "maintainability",
4069
- "unknown"
4070
- ];
4071
- const resolveReviewFindingSeverity = (priority) => {
4072
- const normalized = priority?.trim().toLowerCase();
4073
- if (!normalized) return "unknown";
4074
- if ([
4075
- "p0",
4076
- "critical",
4077
- "crit",
4078
- "blocker",
4079
- "blocking"
4080
- ].includes(normalized)) return "critical";
4081
- if ([
4082
- "p1",
4083
- "high",
4084
- "severe",
4085
- "major"
4086
- ].includes(normalized)) return "high";
4087
- if ([
4088
- "p2",
4089
- "medium",
4090
- "moderate",
4091
- "normal",
4092
- "refinement"
4093
- ].includes(normalized)) return "medium";
4094
- if ([
4095
- "p3",
4096
- "p4",
4097
- "low",
4098
- "minor",
4099
- "info",
4100
- "informational"
4101
- ].includes(normalized)) return "low";
4102
- return "unknown";
4103
- };
4104
- const countFindingsBySeverity = (findings) => {
4105
- const counts = {
4106
- critical: 0,
4107
- high: 0,
4108
- low: 0,
4109
- medium: 0,
4110
- unknown: 0
4111
- };
4112
- for (const finding of findings) counts[resolveReviewFindingSeverity(finding.priority)] += 1;
4113
- return counts;
4114
- };
4115
- const resolveReviewFindingCategory = (category) => REVIEW_CATEGORIES.find((value) => value === category?.trim().toLowerCase()) ?? "unknown";
4116
- const resolveFindingBlocking = (finding, disposition = "open") => {
4117
- if (disposition !== "open") return false;
4118
- if (resolveReviewFindingCategory(finding.category) !== "maintainability") return true;
4119
- if (finding.blockingAfterCap !== void 0) return finding.blockingAfterCap;
4120
- const severity = resolveReviewFindingSeverity(finding.priority);
4121
- return severity === "critical" || severity === "high" || severity === "unknown";
4122
- };
4123
- const FACTORY_REVIEW_CYCLE_CAP = 5;
4124
- /**
4125
- * The review rounds a ladder holds (#1280). A round is every cycle recorded at
4126
- * one reviewed patch-id, historical or live, so a pair of clean sessions at
4127
- * one head is one round and a single-session review is one round. A cycle
4128
- * with no recorded identity cannot share a patch, so it is a round of its own.
4129
- */
4130
- const reviewRoundCount = (cycles) => new Set(cycles.map((cycle, index) => cycle.identity?.patchId ?? `unidentified:${index}`)).size;
4131
- const resolveReviewLadderPolicy = () => ({ gate: { cap: FACTORY_REVIEW_CYCLE_CAP } });
4132
4183
  // src/review-ladder-ledger.ts
4133
4184
  const OCCURRENCE_ADDRESS_PATTERN = /^c[1-9][0-9]*f[1-9][0-9]*$/u;
4134
4185
  const occurrenceAddress = (cycle, finding) => `c${cycle}f${finding}`;
@@ -5243,7 +5294,10 @@ const compareStrings = (left, right) => {
5243
5294
  const canonicalReviewPolicy = (review) => {
5244
5295
  if (review === void 0) return JSON.stringify(null);
5245
5296
  const groups = review.conditional.map((group) => ({ paths: [...group.paths].toSorted(compareStrings) }));
5246
- return JSON.stringify({ conditional: groups.toSorted((left, right) => compareStrings(JSON.stringify(left.paths), JSON.stringify(right.paths))) });
5297
+ return JSON.stringify({
5298
+ conditional: groups.toSorted((left, right) => compareStrings(JSON.stringify(left.paths), JSON.stringify(right.paths))),
5299
+ ...review.roundsWithoutWaiver === void 0 ? {} : { roundsWithoutWaiver: review.roundsWithoutWaiver }
5300
+ });
5247
5301
  };
5248
5302
  /** Every protected path a policy declares, across all of its groups. */
5249
5303
  const reviewPolicyPaths = (review) => (review?.conditional ?? []).flatMap((group) => group.paths);
@@ -5476,6 +5530,7 @@ const resolveReviewDemand = ({ authority, callerBaseRef, candidatePolicy, change
5476
5530
  changedFiles
5477
5531
  });
5478
5532
  return {
5533
+ basePolicy: base.policy,
5479
5534
  demand,
5480
5535
  policyResolution: authoritativePolicyResolution({
5481
5536
  base,
@@ -5486,6 +5541,14 @@ const resolveReviewDemand = ({ authority, callerBaseRef, candidatePolicy, change
5486
5541
  };
5487
5542
  };
5488
5543
  /**
5544
+ * The review-round limit a stage enforces (#1280): the one the authoritative
5545
+ * base policy declares. The candidate's own `review.roundsWithoutWaiver` is
5546
+ * never read, so a pull request cannot raise its own limit; a change to the
5547
+ * limit takes effect once it is on the base ref. An unresolved authority falls
5548
+ * back to the factory default, the stricter answer.
5549
+ */
5550
+ const authoritativeReviewRoundsWithoutWaiver = (resolved) => resolveReviewRoundsWithoutWaiver(resolved.status === "authoritative" ? resolved.basePolicy : void 0);
5551
+ /**
5489
5552
  * The authoring stages' entry point (#922 Slice B): `pr:verify` and
5490
5553
  * `pr:review`, which hold a git ref and a checkout rather than a PR number.
5491
5554
  *
@@ -6078,7 +6141,7 @@ const hqAllowedOriginsFromEnv = (env) => {
6078
6141
  const candidate = segment.trim();
6079
6142
  if (candidate === "") continue;
6080
6143
  const endpoint = validatedHqOrigin(candidate);
6081
- if (endpoint !== void 0 && candidate === endpoint.origin) origins.push(endpoint.origin);
6144
+ if (candidate === endpoint?.origin) origins.push(endpoint.origin);
6082
6145
  }
6083
6146
  return origins;
6084
6147
  };
@@ -6572,7 +6635,7 @@ const reportDiagnostic = async (dependencies, deadline, message, prefix = "HQ in
6572
6635
  }
6573
6636
  if (remainingMs(deadline) <= 0) return;
6574
6637
  if (!usesCustomDiagnostic) {
6575
- diagnostic(line);
6638
+ defaultDiagnostic(line);
6576
6639
  return;
6577
6640
  }
6578
6641
  setImmediate(async () => {
@@ -8542,14 +8605,32 @@ async function postCheckRunThroughRelay(relay, body, request, timeoutMs) {
8542
8605
  return await response.json();
8543
8606
  }
8544
8607
  // src/github-app-client.ts
8608
+ const GITHUB_DEFAULT_HEADERS = {
8609
+ Accept: "application/vnd.github+json",
8610
+ "X-GitHub-Api-Version": "2022-11-28"
8611
+ };
8612
+ /**
8613
+ * The GitHub defaults overlaid with a caller's headers, as a plain record.
8614
+ * Spreading a `Headers` instance or a tuple list into an object literal copies
8615
+ * no headers (or numeric indices), so those two forms go through `Headers`. A
8616
+ * plain record keeps its key casing. A caller's header replaces a default of
8617
+ * the same name in any casing, rather than sitting beside it.
8618
+ */
8619
+ const githubRequestHeaders = (headers) => {
8620
+ const caller = {};
8621
+ if (headers instanceof Headers || Array.isArray(headers)) Object.assign(caller, Object.fromEntries(new Headers(headers)));
8622
+ else for (const [name, value] of Object.entries(headers ?? {})) if (value !== void 0) caller[name] = value;
8623
+ const overridden = new Set(Object.keys(caller).map((name) => name.toLowerCase()));
8624
+ const defaults = Object.entries(GITHUB_DEFAULT_HEADERS).filter(([name]) => !overridden.has(name.toLowerCase()));
8625
+ return {
8626
+ ...Object.fromEntries(defaults),
8627
+ ...caller
8628
+ };
8629
+ };
8545
8630
  const readExchange = async (request, url, init, timeoutMs) => {
8546
8631
  const response = await request(url, {
8547
8632
  ...init,
8548
- headers: {
8549
- Accept: "application/vnd.github+json",
8550
- "X-GitHub-Api-Version": "2022-11-28",
8551
- ...init.headers
8552
- },
8633
+ headers: githubRequestHeaders(init.headers),
8553
8634
  signal: init.signal ?? AbortSignal.timeout(timeoutMs)
8554
8635
  });
8555
8636
  const etag = response.headers.get("etag") ?? void 0;
@@ -9025,6 +9106,7 @@ const prVerifyProofSchema = z.object({
9025
9106
  projectKey: z.string().min(1),
9026
9107
  repository: z.string().min(1),
9027
9108
  runner: runnerSchema.optional(),
9109
+ runScope: z.literal("whole-tree").optional(),
9028
9110
  schemaVersion: prVerifySchemaVersionSchema,
9029
9111
  startedAt: z.iso.datetime(),
9030
9112
  verificationCommands: z.array(z.object({
@@ -9086,6 +9168,7 @@ const prVerifyCheckPayloadFor = (proof) => {
9086
9168
  schemaVersion: PR_VERIFY_CHECK_PAYLOAD_SCHEMA_VERSION,
9087
9169
  ...typeof value.patchId === "string" ? { patchId: value.patchId } : {},
9088
9170
  ...typeof value.repository === "string" ? { repository: value.repository } : {},
9171
+ ...value.runScope === "whole-tree" ? { runScope: "whole-tree" } : {},
9089
9172
  ...carriesReleases && value.verificationCommands !== void 0 ? { verificationCommands: value.verificationCommands } : {}
9090
9173
  };
9091
9174
  try {
@@ -9102,6 +9185,12 @@ const readTransportedVerifyProof = (value, text) => {
9102
9185
  if (value === void 0 || new TextEncoder().encode(text).length > 6e4) return {};
9103
9186
  return { verificationProof: validatePrVerifyProof(value) };
9104
9187
  };
9188
+ /** The parsed payload's optional identity and scope fields, kept only when well-typed. */
9189
+ const optionalIdentityFields = (parsed) => ({
9190
+ ...typeof parsed.patchId === "string" ? { patchId: parsed.patchId } : {},
9191
+ ...typeof parsed.repository === "string" ? { repository: parsed.repository } : {},
9192
+ ...parsed.runScope === "whole-tree" ? { runScope: "whole-tree" } : {}
9193
+ });
9105
9194
  /**
9106
9195
  * Parse the binding back out of check-run `output.text` (preferred) or
9107
9196
  * `output.summary`. Absence / unparseable / wrong shape ⇒ `undefined`, so a
@@ -9125,8 +9214,7 @@ const parsePrVerifyCheckPayload = (text) => {
9125
9214
  outcome: parsed.outcome,
9126
9215
  proofSchemaVersion: typeof parsed.proofSchemaVersion === "number" ? parsed.proofSchemaVersion : 0,
9127
9216
  schemaVersion: PR_VERIFY_CHECK_PAYLOAD_SCHEMA_VERSION,
9128
- ...typeof parsed.patchId === "string" ? { patchId: parsed.patchId } : {},
9129
- ...typeof parsed.repository === "string" ? { repository: parsed.repository } : {},
9217
+ ...optionalIdentityFields(parsed),
9130
9218
  ...parsed.verificationCommands === void 0 ? {} : { verificationCommands: parsed.verificationCommands }
9131
9219
  };
9132
9220
  } catch {}
@@ -10985,6 +11073,7 @@ function defaultPrVerifyGit() {
10985
11073
  mergeBaseSha,
10986
11074
  recognizeCatchUp: recognizeCatchUpCandidate,
10987
11075
  resolveCommitSha,
11076
+ trackedFilesAt,
10988
11077
  runVerificationCommand(command, cwd, env) {
10989
11078
  return verificationOutcomeOf(runInheritedTee("bash", ["-lc", withPinnedNodeOnPath(command, path.dirname(process.execPath))], cwd, env));
10990
11079
  },
@@ -11018,7 +11107,7 @@ function baselineFullProofsForDocsOnly({ previousProof, profilePath, projectKey,
11018
11107
  seedFilter: matchesProfile
11019
11108
  });
11020
11109
  }
11021
- function buildPrVerifyProof({ authoringSession, base, baseSha, baselineFullProofs, catchUpRecognition, classification, commands, endedAt, executedCommands, files, headSha, impactStamp, mode, mergeBaseSha: proofMergeBaseSha, notRequiredCommands, outcome, patchId, policyResolution, profilePath, projectKey, repository, runner, startedAt }) {
11110
+ function buildPrVerifyProof({ authoringSession, base, baseSha, baselineFullProofs, catchUpRecognition, classification, commands, endedAt, executedCommands, files, headSha, impactStamp, mode, mergeBaseSha: proofMergeBaseSha, notRequiredCommands, outcome, patchId, policyResolution, profilePath, projectKey, repository, runner, runScope, startedAt }) {
11022
11111
  return {
11023
11112
  authoringSession,
11024
11113
  base,
@@ -11044,6 +11133,7 @@ function buildPrVerifyProof({ authoringSession, base, baseSha, baselineFullProof
11044
11133
  projectKey,
11045
11134
  repository,
11046
11135
  ...runner ? { runner } : {},
11136
+ ...runScope === "whole-tree" ? { runScope } : {},
11047
11137
  schemaVersion: 4,
11048
11138
  startedAt: startedAt.toISOString(),
11049
11139
  verificationCommands: commands
@@ -11177,7 +11267,8 @@ function runPrVerify(args, dependencies = {}) {
11177
11267
  changedFiles: files,
11178
11268
  fullSuiteBaseRef: git.emptyTreeHash(cwd),
11179
11269
  ...lockfileScope?.kind === "scoped" ? { lockfileImporters: lockfileScope.importers } : {},
11180
- rootSharedGlobs
11270
+ rootSharedGlobs,
11271
+ ...git.trackedFilesAt ? { trackedFiles: () => git.trackedFilesAt(cwd, headSha) } : {}
11181
11272
  });
11182
11273
  const resolvedMode = context.forcesFullSuite ? "full" : resolveMode({
11183
11274
  classification: classification.classification,
@@ -11231,7 +11322,7 @@ function runPrVerify(args, dependencies = {}) {
11231
11322
  sha: headSha
11232
11323
  });
11233
11324
  const accepted = binding?.payload.verificationProof;
11234
- if (binding?.conclusion === "success" && binding.payload.outcome === "passed" && accepted && accepted.outcome === "passed" && policyResolutionAllowsProofReuse(accepted.policyResolution) && accepted.authoringSession !== "unknown" && commands.every((command) => scopedOutNames.has(command.name) || accepted.executedCommands?.some((executed) => executed.name === command.name && executed.command === command.command && executed.scope === command.scope && executed.exitCode === 0)) && accepted.executedCommands?.every((executed) => executed.exitCode === 0) && accepted.headSha === headSha && accepted.patchId === patchId && accepted.repository === repository && accepted.base === base.ref && accepted.baseSha === base.sha && accepted.mergeBaseSha === proofMergeBaseSha && accepted.mode === resolvedMode && accepted.classification === classification.classification && vetoedTargets.length === 0 && isDeepStrictEqual(accepted.changedFiles.toSorted(), files.toSorted()) && isDeepStrictEqual(accepted.verificationCommands, commands) && isDeepStrictEqual(accepted.impactStamp, impactStamp) && isDeepStrictEqual(accepted.notRequiredCommands ?? [], notRequiredCommands) && isDeepStrictEqual(accepted.policyResolution, policyResolution)) {
11325
+ if (binding?.conclusion === "success" && binding.payload.outcome === "passed" && accepted?.outcome === "passed" && policyResolutionAllowsProofReuse(accepted.policyResolution) && accepted.authoringSession !== "unknown" && commands.every((command) => scopedOutNames.has(command.name) || accepted.executedCommands?.some((executed) => executed.name === command.name && executed.command === command.command && executed.scope === command.scope && executed.exitCode === 0)) && accepted.executedCommands?.every((executed) => executed.exitCode === 0) && accepted.headSha === headSha && accepted.patchId === patchId && accepted.repository === repository && accepted.base === base.ref && accepted.baseSha === base.sha && accepted.mergeBaseSha === proofMergeBaseSha && accepted.mode === resolvedMode && accepted.classification === classification.classification && vetoedTargets.length === 0 && isDeepStrictEqual(accepted.changedFiles.toSorted(), files.toSorted()) && isDeepStrictEqual(accepted.verificationCommands, commands) && isDeepStrictEqual(accepted.impactStamp, impactStamp) && isDeepStrictEqual(accepted.notRequiredCommands ?? [], notRequiredCommands) && isDeepStrictEqual(accepted.policyResolution, policyResolution)) {
11235
11326
  assertCleanWorktreeForProof({
11236
11327
  cwd,
11237
11328
  dirtyMessage: "Checkout changed while reading accepted verification.",
@@ -11281,6 +11372,7 @@ function runPrVerify(args, dependencies = {}) {
11281
11372
  projectKey: profile.repository.name,
11282
11373
  repository,
11283
11374
  runner: (dependencies.describeRunner ?? describeVerifyRunner)(dependencies.env ?? process.env),
11375
+ runScope: context.runScope,
11284
11376
  startedAt
11285
11377
  };
11286
11378
  const writePartialProof = (outcome) => {
@@ -17779,9 +17871,7 @@ const FACTORY_HOLD_LABEL = "factory:hold";
17779
17871
  /**
17780
17872
  * `--hold` on pr:publish and pr:ready (#1513): put `factory:hold` on the pull
17781
17873
  * request before anything can arm it, so readiness admits it and leaves the
17782
- * merge to a person. A REST call, so it works where GraphQL is refused, and
17783
- * on the operator's own credential, like every other write that is not a
17784
- * pull request create or body edit.
17874
+ * merge to a person. A REST call, so it works where GraphQL is refused.
17785
17875
  */
17786
17876
  const ghApiArgsForHoldLabel = ({ owner, pr, repo }) => [
17787
17877
  "api",
@@ -17791,8 +17881,20 @@ const ghApiArgsForHoldLabel = ({ owner, pr, repo }) => [
17791
17881
  "-f",
17792
17882
  `labels[]=${FACTORY_HOLD_LABEL}`
17793
17883
  ];
17794
- const holdPullRequest = (input) => {
17795
- runCapture("gh", ghApiArgsForHoldLabel(input), input.cwd);
17884
+ /**
17885
+ * Off a Cursor managed runtime the label goes on with the operator's own
17886
+ * credential. A Cursor VM's own `gh` token cannot write labels, so there it
17887
+ * runs on the Factory App broker's admission token, whose `pull_requests:
17888
+ * write` covers labelling a pull request (#1653). A failed mint throws
17889
+ * `AdmissionCredentialError` before `gh` runs: the VM's credential is never
17890
+ * tried.
17891
+ */
17892
+ const holdPullRequest = async (input, dependencies = {}) => {
17893
+ const extraEnv = await (dependencies.admission ?? processAdmissionCredential).ghEnv("add-hold-label", {
17894
+ owner: input.owner,
17895
+ repo: input.repo
17896
+ });
17897
+ (dependencies.run ?? runCapture)("gh", ghApiArgsForHoldLabel(input), input.cwd, extraEnv === void 0 ? {} : { extraEnv });
17796
17898
  };
17797
17899
  // src/pr-publish-transaction-error.ts
17798
17900
  /**
@@ -19470,18 +19572,20 @@ const armedWithoutBoundaryBlockers = (input) => {
19470
19572
  }];
19471
19573
  };
19472
19574
  /**
19473
- * #1280: a review round past the second is a demand only the operator waives.
19474
- * `pr:review --assemble` refuses to start a third round without the waiver;
19475
- * this is the same refusal at admission, for a ladder that reached a third
19476
- * round by any other route. A round is every cycle recorded at one patch,
19477
- * historical or live.
19575
+ * #1280: a review round past the repository's limit is a demand only the
19576
+ * operator waives. `pr:review --assemble` refuses to start such a round without
19577
+ * the waiver; this is the same refusal at admission, for a ladder that reached
19578
+ * it by any other route. A round is every cycle recorded at one patch,
19579
+ * historical or live. The limit is the base profile's
19580
+ * `review.roundsWithoutWaiver`, resolved at the command boundary (#922).
19478
19581
  */
19479
19582
  const reviewRoundLimitBlockers = (input) => {
19480
19583
  const recordedRounds = reviewRoundCount(input.reviewProof?.ladder?.cycles ?? []);
19481
- if (recordedRounds <= 2) return [];
19584
+ const limit = input.reviewRoundsWithoutWaiver ?? 2;
19585
+ if (recordedRounds <= limit) return [];
19482
19586
  return [{
19483
19587
  demand: DEMAND_KEYS.reviewRoundLimit,
19484
- reason: `The review ladder holds ${recordedRounds} review rounds, and a round past the second needs an operator waiver: demand:waive --pr ${input.pr} --demand ${DEMAND_KEYS.reviewRoundLimit} with the disposition (continue, re-scope, or waive the findings) as the rationale.`
19588
+ reason: `The review ladder holds ${recordedRounds} review rounds, and a round past the ${reviewRoundLimitOrdinal(limit)} needs an operator waiver: demand:waive --pr ${input.pr} --demand ${DEMAND_KEYS.reviewRoundLimit} with the disposition (continue, re-scope, or waive the findings) as the rationale.`
19485
19589
  }];
19486
19590
  };
19487
19591
  /**
@@ -21009,7 +21113,7 @@ async function runPrReady(args, dependencies = {}) {
21009
21113
  owner: repository.owner,
21010
21114
  pr: args.pr,
21011
21115
  repo: repository.name
21012
- });
21116
+ }, { admission });
21013
21117
  const pr = await withAdmissionReadRetry((extraEnv) => fetchPullRequestWithMergeablePoll({
21014
21118
  fetch: () => github.fetchPullRequest({
21015
21119
  owner: repository.owner,
@@ -21204,6 +21308,7 @@ async function runPrReady(args, dependencies = {}) {
21204
21308
  reviewDecision: pr.reviewDecision,
21205
21309
  reviewModes: authoritativeReview.reviewModes,
21206
21310
  reviewProof,
21311
+ reviewRoundsWithoutWaiver: authoritativeReviewRoundsWithoutWaiver(policy),
21207
21312
  unresolvedReviewThreads: pr.unresolvedReviewThreads,
21208
21313
  verificationProof: verification.verificationProof,
21209
21314
  waivers: candidateWaivers,
@@ -22143,19 +22248,20 @@ const assertPriorPromptRecorded = ({ checkoutLadder, existing, patchId, priorLad
22143
22248
  throw new Error(`pr:review --assemble refuses: ${DEFAULT_ASSEMBLED_REVIEW_PROMPT_PATH} holds a prompt for patch ${prompted.patchId} at ${prompted.headSha}, and the review ladder has no cycle for that patch. The candidate is now patch ${patchId}. Record the review of that patch first: patronage-factory pr:review --historical --findings <findings file for patch ${prompted.patchId}>. If no reviewer read that prompt, delete ${DEFAULT_ASSEMBLED_REVIEW_PROMPT_PATH} and assemble again.`);
22144
22249
  };
22145
22250
  /**
22146
- * `--assemble` refuses to start a review round past the second until the
22147
- * operator waives `review-round-limit` for this pull request at this head
22148
- * (#1280). A round is every review recorded at one patch, so a patch that
22251
+ * `--assemble` refuses to start a review round past the repository's limit
22252
+ * (`review.roundsWithoutWaiver` on the base profile, default
22253
+ * `REVIEW_ROUNDS_WITHOUT_WAIVER`) until the operator waives
22254
+ * `review-round-limit` for this pull request at this head (#1280). A round is every review recorded at one patch, so a patch that
22149
22255
  * already has a recorded cycle is another arm of that round and needs no
22150
22256
  * waiver. The waiver is the one `demand:waive` records, folded through the
22151
22257
  * same `applyDemandWaiver` that `pr:ready` uses. Its rationale carries the
22152
22258
  * operator's disposition: continue, re-scope, or waive the findings.
22153
22259
  */
22154
- const assertReviewRoundAllowed = ({ cwd, headSha, patchId, priorLadder, pullRequest }) => {
22260
+ const assertReviewRoundAllowed = ({ cwd, headSha, patchId, priorLadder, pullRequest, roundsWithoutWaiver }) => {
22155
22261
  const cycles = priorLadder?.cycles ?? [];
22156
22262
  if (cycles.some((cycle) => cycle.identity?.patchId === patchId)) return;
22157
22263
  const recordedRounds = reviewRoundCount(cycles);
22158
- if (recordedRounds < 2) return;
22264
+ if (recordedRounds < roundsWithoutWaiver) return;
22159
22265
  const demand = DEMAND_KEYS.reviewRoundLimit;
22160
22266
  const unmet = `The review ladder already holds ${recordedRounds} review rounds for this pull request, so the next review starts round ${recordedRounds + 1}.`;
22161
22267
  const outcome = applyDemandWaiver({
@@ -22173,7 +22279,7 @@ const assertReviewRoundAllowed = ({ cwd, headSha, patchId, priorLadder, pullRequ
22173
22279
  }
22174
22280
  const waiveCommand = `patronage-factory demand:waive --pr ${pullRequest ?? "<pr>"} --demand ${demand} --rationale "<continue | re-scope | waive the findings>: <why>"`;
22175
22281
  const pushStep = pullRequest === void 0 ? "The waiver binds to a pull request, and no pull request is open for this branch. Open one and push this head" : `Push this head (${headSha})`;
22176
- throw new Error(`pr:review --assemble refuses: ${unmet} A round past the second is a demand that only the operator waives. ${pushStep}, then record the operator's disposition in the waiver: ${waiveCommand}. Then assemble again and give the reviewer the prompt that run writes. The prompt already on disk is from the earlier round and describes an older head.`);
22282
+ throw new Error(`pr:review --assemble refuses: ${unmet} A round past the ${reviewRoundLimitOrdinal(roundsWithoutWaiver)} is a demand that only the operator waives. ${pushStep}, then record the operator's disposition in the waiver: ${waiveCommand}. Then assemble again and give the reviewer the prompt that run writes. The prompt already on disk is from the earlier round and describes an older head.`);
22177
22283
  };
22178
22284
  /**
22179
22285
  * The refusals `--assemble` makes before it writes a prompt (#1245, #1280),
@@ -22181,7 +22287,7 @@ const assertReviewRoundAllowed = ({ cwd, headSha, patchId, priorLadder, pullRequ
22181
22287
  * write reuses. Assembly is not a recording: an unreadable prior proof yields
22182
22288
  * no prior ladder here and is diagnosed by doctor and by the recording run.
22183
22289
  */
22184
- const assertAssembleMayPrepareReview = ({ args, base, cwd, git, headSha, output, patchId }) => {
22290
+ const assertAssembleMayPrepareReview = ({ args, base, cwd, git, headSha, output, patchId, roundsWithoutWaiver }) => {
22185
22291
  assertEpicPullRequestOpen({
22186
22292
  args,
22187
22293
  base
@@ -22205,7 +22311,8 @@ const assertAssembleMayPrepareReview = ({ args, base, cwd, git, headSha, output,
22205
22311
  headSha,
22206
22312
  patchId,
22207
22313
  priorLadder,
22208
- pullRequest: base.source.kind === "pull-request" ? base.source.number : void 0
22314
+ pullRequest: base.source.kind === "pull-request" ? base.source.number : void 0,
22315
+ roundsWithoutWaiver
22209
22316
  });
22210
22317
  return {
22211
22318
  existing,
@@ -22742,7 +22849,8 @@ async function runPrReview(args, dependencies = {}) {
22742
22849
  git,
22743
22850
  headSha,
22744
22851
  output,
22745
- patchId
22852
+ patchId,
22853
+ roundsWithoutWaiver: authoritativeReviewRoundsWithoutWaiver(policy)
22746
22854
  });
22747
22855
  const issueReads = await assembleIssueReads({
22748
22856
  args,
@@ -23045,9 +23153,10 @@ const resolveFollowUpArgv = (followUp, factoryCliInvocation) => {
23045
23153
  ...args
23046
23154
  ];
23047
23155
  };
23156
+ const FOLLOW_UP_TIMEOUT_MS = 36e5;
23048
23157
  const defaultFollowUpRunner = (factoryCliInvocation) => (followUp, cwd) => {
23049
23158
  const [command, ...args] = resolveFollowUpArgv(followUp, factoryCliInvocation);
23050
- runCapture(command, args, cwd);
23159
+ runCapture(command, args, cwd, { timeoutMs: FOLLOW_UP_TIMEOUT_MS });
23051
23160
  };
23052
23161
  const prPublishCliInvocation = (explicit) => explicit ?? defaultFactoryCliInvocation(factoryCliEntry());
23053
23162
  const errorMessage = (error) => error instanceof Error ? error.message : String(error);
@@ -23896,7 +24005,7 @@ async function runPrPublish(args, dependencies = {}) {
23896
24005
  owner: profile.repository.owner,
23897
24006
  pr: prNumber,
23898
24007
  repo: profile.repository.name
23899
- });
24008
+ }, { admission: dependencies.admission });
23900
24009
  const promotionStartedAt = promotionInstant(dependencies);
23901
24010
  const promotion = await promoteDraftBeforeDemandEvaluation({
23902
24011
  cwd,
@@ -25960,6 +26069,7 @@ const policySchema = z.object({
25960
26069
  })).min(1),
25961
26070
  targets: z.array(z.string().regex(/^preview:[a-z][a-z0-9-]*$/u)).min(1)
25962
26071
  });
26072
+ const profileExtensionsSchema = z.object({ extensions: z.object({ hostedPreviewReceipts: z.unknown() }).optional() });
25963
26073
  const safeCapture = (capture) => (args, cwd) => {
25964
26074
  try {
25965
26075
  const text = capture(args, cwd);
@@ -25978,7 +26088,7 @@ const readPreviewReceiptPolicy = (repository, cwd, rawCapture) => {
25978
26088
  content: z.string(),
25979
26089
  encoding: z.literal("base64")
25980
26090
  }).parse(JSON.parse(capture(["api", `repos/${repository}/contents/software-factory.profile.json?ref=${ref.object.sha}`], cwd)));
25981
- const profile = JSON.parse(Buffer.from(file.content, "base64").toString("utf-8"));
26091
+ const profile = profileExtensionsSchema.parse(JSON.parse(Buffer.from(file.content, "base64").toString("utf-8")));
25982
26092
  const policy = policySchema.parse(profile.extensions?.hostedPreviewReceipts);
25983
26093
  return {
25984
26094
  ...policy,