@patronage/software-factory 0.23.0 → 0.30.0-alpha.1

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/schemas.d.ts CHANGED
@@ -19,6 +19,32 @@ interface WaivedDemand {
19
19
  }
20
20
  declare const waivedDemandSchema: z.ZodType<WaivedDemand>;
21
21
  //#endregion
22
+ //#region src/blocked-reasons.d.ts
23
+ /**
24
+ * The wire bound on one `detail`. A blocked proof carries one short sentence
25
+ * per demand, never a transcript: HQ's ingest cap is 256 KB and this field
26
+ * must stay far under it even when a candidate blocks on every gate at once.
27
+ */
28
+ declare const BLOCKED_REASON_DETAIL_MAX = 280;
29
+ /**
30
+ * The wire bound on how many demands one proof may name. Well past any real
31
+ * candidate (there are a dozen fixed demands plus the profile's checks and the
32
+ * live human blockers) and, with the detail bound, keeps the whole field two
33
+ * orders of magnitude under the ingest cap. Bounded here rather than trimmed
34
+ * downstream: HQ rejects an over-long list loudly instead of storing a quietly
35
+ * truncated one.
36
+ */
37
+ declare const BLOCKED_REASONS_MAX = 100;
38
+ declare const blockedReasonSchema: z.ZodObject<{
39
+ code: z.ZodString;
40
+ detail: z.ZodString;
41
+ }, z.core.$strip>;
42
+ declare const blockedReasonsSchema: z.ZodArray<z.ZodObject<{
43
+ code: z.ZodString;
44
+ detail: z.ZodString;
45
+ }, z.core.$strip>>;
46
+ type BlockedReason = z.infer<typeof blockedReasonSchema>;
47
+ //#endregion
22
48
  //#region src/boundary-review-proof.d.ts
23
49
  declare const boundaryReviewProofBaseSchema: z.ZodObject<{
24
50
  boundary: z.ZodString;
@@ -83,105 +109,6 @@ interface FollowUpAction {
83
109
  command: string;
84
110
  }
85
111
  //#endregion
86
- //#region src/merge-preflight/worktree-held-branch.d.ts
87
- /**
88
- * Detects when a PR head branch is checked out in a local git worktree.
89
- *
90
- * `gh pr merge --delete-branch` fails when the local branch is held by a
91
- * worktree (git refuses to delete a checked-out branch), which previously
92
- * broke the auto-merge lane mid-merge (patronage/internal#284). The merge
93
- * preflight surfaces this as an actionable notice — not a hard fail — so the
94
- * operator merges without `--delete-branch` (or prunes the worktree first)
95
- * and defers local branch cleanup to closeout.
96
- */
97
- interface WorktreeHeldBranch {
98
- branch: string;
99
- worktreePath: string;
100
- }
101
- //#endregion
102
- //#region src/pr-readiness/merge-identity.d.ts
103
- interface PostProofCommit {
104
- sha: string;
105
- subject: string;
106
- }
107
- type MergeIdentityResult = {
108
- kind: "match";
109
- headSha: string;
110
- } | {
111
- kind: "diverged";
112
- liveHeadSha: string;
113
- postProofCommits?: PostProofCommit[];
114
- proofHeadSha: string;
115
- };
116
- type MergeGuardIdentity = MergeIdentityResult | {
117
- kind: "live-head-invalid";
118
- pr: number;
119
- received: string;
120
- } | {
121
- kind: "ready-proof-missing";
122
- errorDetail?: string;
123
- readyProofPath: string;
124
- } | {
125
- kind: "ready-proof-pr-mismatch";
126
- proofPr: number;
127
- requestedPr: number;
128
- } | {
129
- kind: "ready-proof-not-ready";
130
- blockingReasons: string[];
131
- status: string;
132
- };
133
- //#endregion
134
- //#region src/review-rungs.d.ts
135
- declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
136
- type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
137
- //#endregion
138
- //#region src/pr-merge-check.d.ts
139
- interface PrMergeCheckProof {
140
- schemaVersion: 1;
141
- blockingReasons: string[];
142
- boundary?: {
143
- autoMerge: boolean;
144
- epic: number;
145
- review: EvidenceReviewRung;
146
- wave: string;
147
- };
148
- command: "patronage-factory pr:merge-check";
149
- /**
150
- * Machine-safe arg array for the obvious next action (#523): on `pass`, the
151
- * remote-only GitHub merge API invocation for this PR; on `fail`, the re-run that clears the
152
- * block (`pr:ready`, or `pr:verify` then `pr:ready` after a head
153
- * divergence). Same `argv` shape `factory:delegate --print` emits. Optional
154
- * and purely additive — existing consumers ignore it.
155
- */
156
- followUp?: FollowUpAction;
157
- identity: MergeGuardIdentity;
158
- /**
159
- * The pushed PR head SHA fetched from GitHub at check time. Absent only
160
- * when GitHub returned no usable 40-hex head (identity kind
161
- * "live-head-invalid"), which is itself a fail-closed blocking state.
162
- */
163
- liveHeadSha?: string;
164
- /**
165
- * Actionable operational notices that do not block the merge, e.g. a PR
166
- * head branch held by a local worktree, which makes
167
- * `gh pr merge --delete-branch` fail (patronage/internal#284).
168
- */
169
- notices?: string[];
170
- pr: number;
171
- status: "pass" | "fail";
172
- /**
173
- * Demands that were in force, were NOT met, and were waived by the operator
174
- * (#354). Each entry carries the demand's refusals verbatim, so a waived
175
- * demand can never read as a met one; the merge proceeds on the recorded
176
- * operator act, not on evidence.
177
- */
178
- waivedDemands?: WaivedDemand[];
179
- /** Present when the PR head branch is checked out in a local worktree. */
180
- worktreeHeldBranch?: WorktreeHeldBranch;
181
- /** All merge-relevant branches held by local worktrees (head and default). */
182
- worktreeHeldBranches?: WorktreeHeldBranch[];
183
- }
184
- //#endregion
185
112
  //#region src/diff-classification.d.ts
186
113
  declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
187
114
  type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
@@ -226,6 +153,10 @@ interface ReviewFindingAttributes {
226
153
  title: string;
227
154
  }
228
155
  //#endregion
156
+ //#region src/review-rungs.d.ts
157
+ declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
158
+ type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
159
+ //#endregion
229
160
  //#region src/review-ladder-ledger.d.ts
230
161
  type LadderCycleStage = "interior" | "gate";
231
162
  type LadderFindingReport = ReviewFindingAttributes;
@@ -345,12 +276,11 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
345
276
  name: z.ZodString;
346
277
  reason: z.ZodOptional<z.ZodString>;
347
278
  scope: z.ZodOptional<z.ZodObject<{
348
- classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
279
+ classifications: z.ZodArray<z.ZodEnum<{
349
280
  "docs/process-only": "docs/process-only";
350
281
  trivial: "trivial";
351
282
  "non-trivial": "non-trivial";
352
- }>>>;
353
- labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
+ }>>;
354
284
  }, z.core.$strict>>;
355
285
  scopeReason: z.ZodString;
356
286
  status: z.ZodEnum<{
@@ -551,16 +481,38 @@ type ManagedReadinessLedger = z.infer<typeof managedReadinessLedgerSchema>;
551
481
  //#endregion
552
482
  //#region src/pr-ready.d.ts
553
483
  interface PrReadyProof {
554
- schemaVersion: 1;
484
+ schemaVersion: 3;
485
+ /**
486
+ * What GitHub actually did when this run armed native auto-merge (#477).
487
+ * Present exactly when readiness passed and the arming ran; read back from
488
+ * the PR rather than inferred from the invocation, because `gh pr merge
489
+ * --auto` arms, merges, or does nothing with the same exit code and the same
490
+ * empty output. `not-armed` means the candidate is admitted but nothing will
491
+ * merge it, and `followUp` carries the re-dispatch.
492
+ */
493
+ arming?: {
494
+ detail?: string;
495
+ headSha: string;
496
+ outcome: "armed" | "merged" | "not-armed";
497
+ };
498
+ /**
499
+ * Why this run blocked, one entry per refusing demand (#391): `code` is the
500
+ * demand key from the resolver's vocabulary, `detail` the one-sentence
501
+ * refusal. Same refusals as `blockingReasons`, in the same order — the
502
+ * analyzable projection of a flat string list, so a wall of blocked proofs
503
+ * on one PR can be counted by cause. Absent when nothing blocked.
504
+ */
505
+ blockedReasons?: BlockedReason[];
555
506
  blockingReasons: string[];
556
507
  humanBlockingReasons: string[];
557
508
  command: "patronage-factory pr:ready";
558
509
  /**
559
- * Machine-safe arg array for the obvious next action (#523): when `ready`,
560
- * the `pr:merge-check` that must precede a merge; otherwise the `pr:verify`
561
- * re-run that the blocking reasons name (re-verify the head, then re-run
562
- * pr:ready). Same `argv` shape `factory:delegate --print` emits. Optional
563
- * and purely additive.
510
+ * Machine-safe arg array for the obvious next action (#523): when `ready`
511
+ * but arming did not take effect, a `pr:ready` re-dispatch (idempotent on
512
+ * an unchanged head); otherwise the `gh pr ready` undraft repair or the
513
+ * `pr:verify` re-run that the blocking reasons name (re-verify the head,
514
+ * then re-run pr:ready). Same `argv` shape `factory:delegate --print`
515
+ * emits. Optional and purely additive.
564
516
  */
565
517
  followUp?: FollowUpAction;
566
518
  /**
@@ -570,6 +522,12 @@ interface PrReadyProof {
570
522
  * pushed HEAD, not a re-derivation. See the ledger schema.
571
523
  */
572
524
  ledger: ManagedReadinessLedger;
525
+ /**
526
+ * Actionable facts that did not block (#477): a settling merge-freeze
527
+ * generation that armed with a notice, and how each waived demand reads to a
528
+ * human. Absent when there are none.
529
+ */
530
+ notices?: string[];
573
531
  /** Committed profile blob evaluated by readiness. Required for merge. */
574
532
  profileBlobSha?: string;
575
533
  /** Checkout-relative committed profile path evaluated by readiness. */
@@ -578,6 +536,13 @@ interface PrReadyProof {
578
536
  /** Trusted checkout repository used for all GitHub reads and writes. */
579
537
  repository?: string;
580
538
  status: ReadinessStatus;
539
+ /**
540
+ * Demands that were in force, were NOT met, and were waived by the operator
541
+ * (#354, moved here from the merge-time proof by #477). Each entry carries
542
+ * the demand's refusals verbatim, so a waived demand can never read as a met
543
+ * one; the arming proceeds on the recorded operator act, not on evidence.
544
+ */
545
+ waivedDemands?: WaivedDemand[];
581
546
  }
582
547
  //#endregion
583
548
  //#region src/pr-readiness/external-evidence.d.ts
@@ -1262,58 +1227,28 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
1262
1227
  }>;
1263
1228
  }, z.core.$strip>;
1264
1229
  type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
1265
- declare const PR_MERGE_CHECK_SCHEMA_VERSION = 1;
1266
- declare const prMergeCheckProofSchema: z.ZodObject<{
1267
- blockingReasons: z.ZodArray<z.ZodString>;
1268
- command: z.ZodLiteral<"patronage-factory pr:merge-check">;
1269
- followUp: z.ZodOptional<z.ZodObject<{
1270
- argv: z.ZodArray<z.ZodString>;
1271
- command: z.ZodString;
1272
- }, z.core.$strict>>;
1273
- identity: z.ZodDiscriminatedUnion<[z.ZodObject<{
1230
+ declare const PR_READY_SCHEMA_VERSION = 3;
1231
+ /**
1232
+ * The pr:ready proof versions a reader still accepts. `pr:ready` emits v3 only
1233
+ * (#477) — one current contract — but v1 and v2 events were spooled before the
1234
+ * bumps and HQ must ingest them without degrading, so the wire schema parses
1235
+ * all three.
1236
+ */
1237
+ declare const SUPPORTED_PR_READY_SCHEMA_VERSIONS: readonly [1, 2, 3];
1238
+ declare const prReadyProofSchema: z.ZodObject<{
1239
+ arming: z.ZodOptional<z.ZodObject<{
1240
+ detail: z.ZodOptional<z.ZodString>;
1274
1241
  headSha: z.ZodString;
1275
- kind: z.ZodLiteral<"match">;
1276
- }, z.core.$strip>, z.ZodObject<{
1277
- kind: z.ZodLiteral<"diverged">;
1278
- liveHeadSha: z.ZodString;
1279
- postProofCommits: z.ZodOptional<z.ZodArray<z.ZodObject<{
1280
- sha: z.ZodString;
1281
- subject: z.ZodString;
1282
- }, z.core.$strip>>>;
1283
- proofHeadSha: z.ZodString;
1284
- }, z.core.$strip>, z.ZodObject<{
1285
- kind: z.ZodLiteral<"live-head-invalid">;
1286
- pr: z.ZodNumber;
1287
- received: z.ZodString;
1288
- }, z.core.$strip>, z.ZodObject<{
1289
- errorDetail: z.ZodOptional<z.ZodString>;
1290
- kind: z.ZodLiteral<"ready-proof-missing">;
1291
- readyProofPath: z.ZodString;
1292
- }, z.core.$strip>, z.ZodObject<{
1293
- kind: z.ZodLiteral<"ready-proof-pr-mismatch">;
1294
- proofPr: z.ZodNumber;
1295
- requestedPr: z.ZodNumber;
1296
- }, z.core.$strip>, z.ZodObject<{
1297
- blockingReasons: z.ZodArray<z.ZodString>;
1298
- kind: z.ZodLiteral<"ready-proof-not-ready">;
1299
- status: z.ZodString;
1300
- }, z.core.$strip>], "kind">;
1301
- liveHeadSha: z.ZodOptional<z.ZodString>;
1302
- notices: z.ZodOptional<z.ZodArray<z.ZodString>>;
1303
- pr: z.ZodNumber;
1304
- schemaVersion: z.ZodLiteral<1>;
1305
- status: z.ZodEnum<{
1306
- pass: "pass";
1307
- fail: "fail";
1308
- }>;
1309
- waivedDemands: z.ZodOptional<z.ZodArray<z.ZodType<WaivedDemand, unknown, z.core.$ZodTypeInternals<WaivedDemand, unknown>>>>;
1310
- worktreeHeldBranch: z.ZodOptional<z.ZodObject<{
1311
- branch: z.ZodString;
1312
- worktreePath: z.ZodString;
1242
+ outcome: z.ZodEnum<{
1243
+ merged: "merged";
1244
+ armed: "armed";
1245
+ "not-armed": "not-armed";
1246
+ }>;
1313
1247
  }, z.core.$strip>>;
1314
- }, z.core.$strip>;
1315
- declare const PR_READY_SCHEMA_VERSION = 1;
1316
- declare const prReadyProofSchema: z.ZodObject<{
1248
+ blockedReasons: z.ZodOptional<z.ZodArray<z.ZodObject<{
1249
+ code: z.ZodString;
1250
+ detail: z.ZodString;
1251
+ }, z.core.$strip>>>;
1317
1252
  blockingReasons: z.ZodArray<z.ZodString>;
1318
1253
  command: z.ZodLiteral<"patronage-factory pr:ready">;
1319
1254
  followUp: z.ZodOptional<z.ZodObject<{
@@ -1338,12 +1273,11 @@ declare const prReadyProofSchema: z.ZodObject<{
1338
1273
  name: z.ZodString;
1339
1274
  reason: z.ZodOptional<z.ZodString>;
1340
1275
  scope: z.ZodOptional<z.ZodObject<{
1341
- classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1276
+ classifications: z.ZodArray<z.ZodEnum<{
1342
1277
  "docs/process-only": "docs/process-only";
1343
1278
  trivial: "trivial";
1344
1279
  "non-trivial": "non-trivial";
1345
- }>>>;
1346
- labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1280
+ }>>;
1347
1281
  }, z.core.$strict>>;
1348
1282
  scopeReason: z.ZodString;
1349
1283
  status: z.ZodEnum<{
@@ -1617,6 +1551,7 @@ declare const prReadyProofSchema: z.ZodObject<{
1617
1551
  verifiedHeadSha: z.ZodOptional<z.ZodString>;
1618
1552
  }, z.core.$strip>;
1619
1553
  }, z.core.$strip>;
1554
+ notices: z.ZodOptional<z.ZodArray<z.ZodString>>;
1620
1555
  profileBlobSha: z.ZodOptional<z.ZodString>;
1621
1556
  profilePath: z.ZodOptional<z.ZodString>;
1622
1557
  repairs: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1629,12 +1564,13 @@ declare const prReadyProofSchema: z.ZodObject<{
1629
1564
  command: z.ZodString;
1630
1565
  }, z.core.$strip>>>;
1631
1566
  repository: z.ZodOptional<z.ZodString>;
1632
- schemaVersion: z.ZodLiteral<1>;
1567
+ schemaVersion: z.ZodNumber & z.ZodType<1 | 2 | 3, number, z.core.$ZodTypeInternals<1 | 2 | 3, number>>;
1633
1568
  status: z.ZodEnum<{
1634
1569
  ready: "ready";
1635
1570
  blocked: "blocked";
1636
1571
  "slice-ready/not-final": "slice-ready/not-final";
1637
1572
  }>;
1573
+ waivedDemands: z.ZodOptional<z.ZodArray<z.ZodType<WaivedDemand, unknown, z.core.$ZodTypeInternals<WaivedDemand, unknown>>>>;
1638
1574
  }, z.core.$strip>;
1639
1575
  //#endregion
1640
- export { BOUNDARY_CHECK_SCHEMA_VERSION, BOUNDARY_REVIEW_PROOF_KIND, BoundaryCheckProofRecord, type BoundaryReviewProof, type CloseoutArtifact, EVIDENCE_ENVELOPE_SCHEMA_VERSION, type EvidenceEnvelope, PR_MERGE_CHECK_SCHEMA_VERSION, PR_READY_SCHEMA_VERSION, PR_REVIEW_SCHEMA_VERSION, type ParsedRetroEnvelope, type PrMergeCheckProof, type PrReadyProof, type PrReviewProof, type PrVerifyProof, RETRO_ENVELOPE_SCHEMA_VERSION, RETRO_ENVELOPE_VALIDATORS, RETRO_ENVELOPE_WIRE_BOUNDS, type RetroEnvelope, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS, type WaivedDemand, boundaryCheckProofSchema, boundaryReviewProofSchema, closeoutArtifactSchema, evidenceEnvelopeSchema, prMergeCheckProofSchema, prReadyProofSchema, prReviewProofSchema, prVerifyProofSchema, retroEnvelopeV1Schema, retroEpicReference, waivedDemandSchema };
1576
+ export { BLOCKED_REASONS_MAX, BLOCKED_REASON_DETAIL_MAX, BOUNDARY_CHECK_SCHEMA_VERSION, BOUNDARY_REVIEW_PROOF_KIND, type BlockedReason, BoundaryCheckProofRecord, type BoundaryReviewProof, type CloseoutArtifact, EVIDENCE_ENVELOPE_SCHEMA_VERSION, type EvidenceEnvelope, PR_READY_SCHEMA_VERSION, PR_REVIEW_SCHEMA_VERSION, type ParsedRetroEnvelope, type PrReadyProof, type PrReviewProof, type PrVerifyProof, RETRO_ENVELOPE_SCHEMA_VERSION, RETRO_ENVELOPE_VALIDATORS, RETRO_ENVELOPE_WIRE_BOUNDS, type RetroEnvelope, SUPPORTED_PR_READY_SCHEMA_VERSIONS, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS, type WaivedDemand, blockedReasonSchema, blockedReasonsSchema, boundaryCheckProofSchema, boundaryReviewProofSchema, closeoutArtifactSchema, evidenceEnvelopeSchema, prReadyProofSchema, prReviewProofSchema, prVerifyProofSchema, retroEnvelopeV1Schema, retroEpicReference, waivedDemandSchema };