@patronage/software-factory 0.25.0 → 0.30.0-beta.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/index.d.ts CHANGED
@@ -26,7 +26,7 @@ interface GithubIssueComment {
26
26
  }
27
27
  declare const normalizeIssueComments: (value: GithubIssueCommentApi[] | GithubIssueCommentApi[][]) => GithubIssueComment[];
28
28
  declare namespace boundary_review_proof_d_exports {
29
- export { BOUNDARY_REVIEW_PROOF_KIND, BoundaryReviewProof, BoundaryReviewProofComment, boundaryReviewProofSchema, selectBoundaryReviewProof, undispositionedBlockingFindings };
29
+ export { BOUNDARY_REVIEW_PROOF_KIND, BoundaryReviewProof, BoundaryReviewProofComment, boundaryReviewProofAuthorsSeen, boundaryReviewProofSchema, selectBoundaryReviewProof, undispositionedBlockingFindings };
30
30
  }
31
31
  declare const BOUNDARY_REVIEW_PROOF_KIND = "boundary-review-proof";
32
32
  declare const boundaryReviewProofBaseSchema: z.ZodObject<{
@@ -124,6 +124,7 @@ interface BoundaryReviewProofComment {
124
124
  commentUrl?: string;
125
125
  }
126
126
  declare const selectBoundaryReviewProof: (comments: GithubIssueComment[], boundary: string, declaredBy: string) => BoundaryReviewProofComment | undefined;
127
+ declare const boundaryReviewProofAuthorsSeen: (comments: GithubIssueComment[], boundary: string) => string[];
127
128
  declare const undispositionedBlockingFindings: (proof: BoundaryReviewProof) => string[];
128
129
  //#endregion
129
130
  //#region src/hq-ingest-sink.d.ts
@@ -370,8 +371,8 @@ interface DemandWaiver {
370
371
  operator: string;
371
372
  rationale: string;
372
373
  recordedAt: string;
373
- /** The operator session the waiver was recorded in. */
374
- session: string;
374
+ /** Optional audit metadata; never waiver authority. */
375
+ session?: string;
375
376
  }
376
377
  interface DemandWaiverStore {
377
378
  command: "patronage-factory demand:waive";
@@ -391,7 +392,7 @@ interface WaivedDemand {
391
392
  operator: string;
392
393
  rationale: string;
393
394
  recordedAt: string;
394
- session: string;
395
+ session?: string;
395
396
  /** The demand's refusals at evaluation time, preserved verbatim. */
396
397
  unmetReasons: string[];
397
398
  }
@@ -430,7 +431,7 @@ declare const applyDemandWaiver: ({
430
431
  declare const waivedDemandNotice: (waived: WaivedDemand) => string;
431
432
  interface DemandWaiverAuthorization {
432
433
  operator: string;
433
- session: string;
434
+ session?: string;
434
435
  }
435
436
  type AuthorizeDemandWaiverResult = {
436
437
  authorization: DemandWaiverAuthorization;
@@ -441,16 +442,15 @@ type AuthorizeDemandWaiverResult = {
441
442
  };
442
443
  /**
443
444
  * Operator identity, `declaredBy`-style: a named human account, recorded on
444
- * the waiver and enforced here plus session distinctness from the candidate
445
- * the waiver applies to. Every refusal is named; nothing falls open.
445
+ * the waiver and enforced here. Session is optional audit metadata only: it is
446
+ * not credential-backed, so its absence or equality never authorizes or
447
+ * refuses an operator act.
446
448
  */
447
449
  declare const authorizeDemandWaiver: ({
448
450
  authenticatedLogin,
449
- authoringSession,
450
451
  session
451
452
  }: {
452
453
  authenticatedLogin: string | undefined;
453
- authoringSession: string | undefined;
454
454
  session: string | undefined;
455
455
  }) => AuthorizeDemandWaiverResult;
456
456
  //#endregion
@@ -461,6 +461,27 @@ declare const blockedReasonSchema: z.ZodObject<{
461
461
  }, z.core.$strip>;
462
462
  type BlockedReason = z.infer<typeof blockedReasonSchema>;
463
463
  //#endregion
464
+ //#region src/arm-auto-merge.d.ts
465
+ interface ArmAutoMergeInput {
466
+ cwd: string;
467
+ /** The validated PR head this arming is a compare-and-set against. */
468
+ headSha: string;
469
+ owner: string;
470
+ pr: number;
471
+ repo: string;
472
+ }
473
+ /**
474
+ * What the PR actually did, read back after the call — never inferred from the
475
+ * exit code. `not-armed` is a failure: the candidate is admitted but nothing
476
+ * will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
477
+ */
478
+ interface ArmAutoMergeOutcome {
479
+ /** Why the arming did not take effect, or what the invocation reported. */
480
+ detail?: string;
481
+ headSha: string;
482
+ outcome: "armed" | "merged" | "not-armed";
483
+ }
484
+ //#endregion
464
485
  //#region src/checkout-repository.d.ts
465
486
  interface CheckoutRepository {
466
487
  name: string;
@@ -497,235 +518,9 @@ declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
497
518
  /** Canonical zod schema for the optional follow-up field on JSON outputs. */
498
519
  declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
499
520
  //#endregion
500
- //#region src/github-client.d.ts
501
- interface GithubPullRequestReview {
502
- author: {
503
- login?: string;
504
- };
505
- body: string;
506
- /** GraphQL `PullRequestReview.lastEditedAt` — REST's `/pulls/reviews` has no equivalent (#843). */
507
- lastEditedAt?: string;
508
- state: string;
509
- submittedAt?: string;
510
- url: string;
511
- }
512
- //#endregion
513
- //#region src/merge-freeze.d.ts
514
- declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
515
- declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
516
- declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
517
- active: z.ZodLiteral<true>;
518
- generationId: z.ZodNumber;
519
- headSha: z.ZodString;
520
- outcome: z.ZodEnum<{
521
- active: "active";
522
- stale: "stale";
523
- }>;
524
- reason: z.ZodString;
525
- recordedAt: z.ZodISODateTime;
526
- schemaVersion: z.ZodLiteral<1>;
527
- }, z.core.$strip>, z.ZodObject<{
528
- active: z.ZodLiteral<false>;
529
- clearRationale: z.ZodOptional<z.ZodString>;
530
- generationId: z.ZodNumber;
531
- headSha: z.ZodString;
532
- outcome: z.ZodLiteral<"inactive">;
533
- reason: z.ZodString;
534
- recordedAt: z.ZodISODateTime;
535
- schemaVersion: z.ZodLiteral<1>;
536
- }, z.core.$strip>], "active">;
537
- type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
538
- /**
539
- * The write side of this contract lives in the generated main-push verify
540
- * workflow (#356, ADR 0016 as amended): it is the ONLY producer of
541
- * `patronage-factory/merge-freeze` generations. Its emitted `output.text`
542
- * payload must parse under this exact reader schema, which is what the
543
- * workflow's own tests assert through this export.
544
- */
545
- declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
546
- interface MergeFreezeStoreInput {
547
- cwd: string;
548
- headSha: string;
549
- repository: CheckoutRepository;
550
- }
551
- interface MergeFreezeStore {
552
- read: (input: MergeFreezeStoreInput) => unknown;
553
- }
554
- declare namespace worktree_held_branch_d_exports {
555
- export { MergeOperationalNotices, WorktreeHeldBranch, WorktreeHeldBranchCheck, WorktreeListEntry, checkWorktreeHeldBranch, findWorktreeHeldBranch, formatHeldBranchCloseoutSummary, listWorktreesPorcelain, parseGitWorktreeList, resolveMergeOperationalNotices, worktreeHeldBranchNotice };
556
- }
557
- /**
558
- * Detects when a PR head branch is checked out in a local git worktree.
559
- *
560
- * `gh pr merge --delete-branch` fails when the local branch is held by a
561
- * worktree (git refuses to delete a checked-out branch), which previously
562
- * broke the auto-merge lane mid-merge (patronage/internal#284). The merge
563
- * preflight surfaces this as an actionable notice — not a hard fail — so the
564
- * operator merges without `--delete-branch` (or prunes the worktree first)
565
- * and defers local branch cleanup to closeout.
566
- */
567
- interface WorktreeHeldBranch {
568
- branch: string;
569
- worktreePath: string;
570
- }
571
- interface WorktreeListEntry {
572
- branch?: string;
573
- path: string;
574
- }
575
- /**
576
- * Parses `git worktree list --porcelain` output. Entries are separated by
577
- * blank lines; each starts with `worktree <path>` and carries an optional
578
- * `branch refs/heads/<name>` attribute (detached worktrees have none).
579
- */
580
- declare function parseGitWorktreeList(porcelain: string): WorktreeListEntry[];
581
- /**
582
- * Returns the worktree holding `branch`, or undefined when no local worktree
583
- * has it checked out (or the porcelain listing was unavailable).
584
- */
585
- declare function findWorktreeHeldBranch({
586
- branch,
587
- worktreeListPorcelain
588
- }: {
589
- branch: string;
590
- worktreeListPorcelain: string | undefined;
591
- }): undefined | WorktreeHeldBranch;
592
- declare function worktreeHeldBranchNotice(held: WorktreeHeldBranch): string;
593
- interface MergeOperationalNotices {
594
- notices: string[];
595
- worktreeHeldBranch?: WorktreeHeldBranch;
596
- worktreeHeldBranches?: WorktreeHeldBranch[];
597
- }
598
- /**
599
- * Single entry point for non-blocking merge preflight notices, mirroring
600
- * `resolveMergeGuardIdentity`/`mergeGuardBlockingReasons` in
601
- * merge-identity.ts: adding a notice kind never requires coordinated edits
602
- * in the command runner, and persisted notice strings cannot drift from the
603
- * structured detection result.
604
- */
605
- declare function resolveMergeOperationalNotices({
606
- headRefName,
607
- worktreeListPorcelain
608
- }: {
609
- headRefName: string | undefined;
610
- worktreeListPorcelain: string | undefined;
611
- }): MergeOperationalNotices;
612
- /**
613
- * Shared `git worktree list --porcelain` reader for merge preflight and
614
- * closeout. Returns undefined when the directory is missing, not a git
615
- * repository, or git is unavailable — detection is best-effort and callers
616
- * report "skipped" rather than fabricating a result.
617
- */
618
- declare function listWorktreesPorcelain(cwd: string): string | undefined;
619
- interface WorktreeHeldBranchCheck {
620
- held?: WorktreeHeldBranch;
621
- /** "skipped" means no branch was recorded or worktrees were unlistable. */
622
- status: "clean" | "held" | "skipped";
623
- }
624
- /**
625
- * Closeout-side counterpart to the merge-preflight notice: the merge step
626
- * defers local branch cleanup to closeout, so closeout planning checks
627
- * whether the worker branch is still held by a worktree (#284).
628
- */
629
- declare function checkWorktreeHeldBranch({
630
- branch,
631
- worktreeListPorcelain
632
- }: {
633
- branch: string | undefined;
634
- worktreeListPorcelain: string | undefined;
635
- }): WorktreeHeldBranchCheck;
636
- /** One-line closeout summary, owned beside the detection logic. */
637
- declare function formatHeldBranchCloseoutSummary(check: WorktreeHeldBranchCheck): string;
638
- declare namespace merge_identity_d_exports {
639
- export { LiveHeadInput, MergeGuardIdentity, MergeIdentityResult, PostProofCommit, ReadyProofForMergeIdentity, evaluateMergeIdentity, mergeGuardBlockingReasons, mergeGuardIdentitySchema, resolveMergeGuardIdentity };
640
- }
641
- interface PostProofCommit {
642
- sha: string;
643
- subject: string;
644
- }
645
- /**
646
- * The slice of the pr:ready proof the merge guard actually consumes, so this
647
- * module does not depend on the parent proof envelope. `PrReadyProof` is
648
- * structurally assignable to this type.
649
- */
650
- interface ReadyProofForMergeIdentity {
651
- blockingReasons: string[];
652
- ledger: {
653
- /**
654
- * The evaluated head SHA recorded by pr:ready: `pr.headRefOid` captured
655
- * at evaluation time. The merge guard compares it to the live pushed
656
- * HEAD with exact equality.
657
- */
658
- headSha: string;
659
- pr: number;
660
- };
661
- status: string;
662
- }
663
- type MergeIdentityResult = {
664
- kind: "match";
665
- headSha: string;
666
- } | {
667
- kind: "diverged";
668
- liveHeadSha: string;
669
- postProofCommits?: PostProofCommit[];
670
- proofHeadSha: string;
671
- };
672
- type MergeGuardIdentity = MergeIdentityResult | {
673
- kind: "live-head-invalid";
674
- pr: number;
675
- received: string;
676
- } | {
677
- kind: "ready-proof-missing";
678
- errorDetail?: string;
679
- readyProofPath: string;
680
- } | {
681
- kind: "ready-proof-pr-mismatch";
682
- proofPr: number;
683
- requestedPr: number;
684
- } | {
685
- kind: "ready-proof-not-ready";
686
- blockingReasons: string[];
687
- status: string;
688
- };
689
- declare const evaluateMergeIdentity: ({
690
- liveHeadSha,
691
- postProofCommits,
692
- proofHeadSha
693
- }: {
694
- liveHeadSha: string;
695
- postProofCommits?: PostProofCommit[];
696
- proofHeadSha: string;
697
- }) => MergeIdentityResult;
698
- /**
699
- * The live PR head as fetched from GitHub: either a validated 40-hex SHA or
700
- * the raw (stringified) response that failed validation.
701
- */
702
- type LiveHeadInput = {
703
- headSha: string;
704
- } | {
705
- invalidResponse: string;
706
- };
707
- /**
708
- * Single entry point that owns construction of every MergeGuardIdentity
709
- * kind, so adding or changing a kind never requires coordinated edits in the
710
- * command runner.
711
- */
712
- declare const resolveMergeGuardIdentity: ({
713
- commitsBetween,
714
- liveHead,
715
- pr,
716
- readyProof,
717
- readyProofError,
718
- readyProofPath
719
- }: {
720
- commitsBetween?: (fromSha: string, toSha: string) => PostProofCommit[] | undefined;
721
- liveHead: LiveHeadInput;
722
- pr: number;
723
- readyProof: ReadyProofForMergeIdentity | undefined;
724
- readyProofError?: unknown;
725
- readyProofPath: string;
726
- }) => MergeGuardIdentity;
727
- declare const mergeGuardIdentitySchema: z.ZodType<MergeGuardIdentity>;
728
- declare const mergeGuardBlockingReasons: (identity: MergeGuardIdentity) => string[];
521
+ //#region src/diff-classification.d.ts
522
+ declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
523
+ type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
729
524
  //#endregion
730
525
  //#region src/profile.d.ts
731
526
  declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
@@ -762,12 +557,11 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
762
557
  }>;
763
558
  name: z.ZodString;
764
559
  scope: z.ZodOptional<z.ZodObject<{
765
- classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
560
+ classifications: z.ZodArray<z.ZodEnum<{
766
561
  trivial: "trivial";
767
562
  "docs/process-only": "docs/process-only";
768
563
  "non-trivial": "non-trivial";
769
- }>>>;
770
- labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
564
+ }>>;
771
565
  }, z.core.$strict>>;
772
566
  }, z.core.$strict>>>;
773
567
  review: z.ZodObject<{
@@ -779,16 +573,10 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
779
573
  paths: z.ZodArray<z.ZodString>;
780
574
  }, z.core.$strict>>>;
781
575
  defaultMaxCycles: z.ZodNumber;
782
- ladder: z.ZodOptional<z.ZodObject<{
783
- gate: z.ZodOptional<z.ZodObject<{
784
- cap: z.ZodNumber;
785
- }, z.core.$strict>>;
786
- }, z.core.$strict>>;
787
576
  modes: z.ZodArray<z.ZodEnum<{
788
577
  correctness: "correctness";
789
578
  security: "security";
790
579
  }>>;
791
- standingChecklist: z.ZodOptional<z.ZodArray<z.ZodString>>;
792
580
  }, z.core.$strict>;
793
581
  schemaVersion: z.ZodLiteral<4>;
794
582
  verification: z.ZodObject<{
@@ -817,138 +605,6 @@ interface LoadProjectProfileResult {
817
605
  }
818
606
  declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
819
607
  //#endregion
820
- //#region src/review-rungs.d.ts
821
- declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
822
- type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
823
- //#endregion
824
- //#region src/pr-merge-check.d.ts
825
- interface PrMergeCheckArgs extends LoadProjectProfileInput {
826
- epic?: number;
827
- json?: boolean;
828
- output?: string;
829
- pr: number;
830
- readyProof?: string;
831
- }
832
- interface PrMergeCheckProof {
833
- schemaVersion: 1;
834
- blockingReasons: string[];
835
- boundary?: {
836
- autoMerge: boolean;
837
- epic: number;
838
- review: EvidenceReviewRung;
839
- wave: string;
840
- };
841
- command: "patronage-factory pr:merge-check";
842
- /**
843
- * Machine-safe arg array for the obvious next action (#523): on `pass`, the
844
- * remote-only GitHub merge API invocation for this PR; on `fail`, the re-run that clears the
845
- * block (`pr:ready`, or `pr:verify` then `pr:ready` after a head
846
- * divergence). Same `argv` shape `factory:delegate --print` emits. Optional
847
- * and purely additive — existing consumers ignore it.
848
- */
849
- followUp?: FollowUpAction;
850
- identity: MergeGuardIdentity;
851
- /**
852
- * The pushed PR head SHA fetched from GitHub at check time. Absent only
853
- * when GitHub returned no usable 40-hex head (identity kind
854
- * "live-head-invalid"), which is itself a fail-closed blocking state.
855
- */
856
- liveHeadSha?: string;
857
- /**
858
- * Actionable operational notices that do not block the merge, e.g. a PR
859
- * head branch held by a local worktree, which makes
860
- * `gh pr merge --delete-branch` fail (patronage/internal#284).
861
- */
862
- notices?: string[];
863
- pr: number;
864
- status: "pass" | "fail";
865
- /**
866
- * Demands that were in force, were NOT met, and were waived by the operator
867
- * (#354). Each entry carries the demand's refusals verbatim, so a waived
868
- * demand can never read as a met one; the merge proceeds on the recorded
869
- * operator act, not on evidence.
870
- */
871
- waivedDemands?: WaivedDemand[];
872
- /** Present when the PR head branch is checked out in a local worktree. */
873
- worktreeHeldBranch?: WorktreeHeldBranch;
874
- /** All merge-relevant branches held by local worktrees (head and default). */
875
- worktreeHeldBranches?: WorktreeHeldBranch[];
876
- }
877
- interface PrMergeCheckGitDependencies {
878
- checkoutRepository: (cwd: string) => CheckoutRepository;
879
- commitsBetween: (cwd: string, fromSha: string, toSha: string) => PostProofCommit[] | undefined;
880
- worktreeListPorcelain: (cwd: string) => string | undefined;
881
- showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
882
- objectIdAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
883
- }
884
- interface PrMergeCheckDependencies {
885
- git?: Partial<PrMergeCheckGitDependencies>;
886
- github?: {
887
- fetchClosingPullRequests?: (input: {
888
- issue: number;
889
- owner: string;
890
- repo: string;
891
- }) => {
892
- number: number;
893
- }[];
894
- fetchIssueBody?: (input: {
895
- issue: number;
896
- owner: string;
897
- repo: string;
898
- }) => string;
899
- fetchPullRequestHead: (input: {
900
- cwd: string;
901
- owner: string;
902
- pr: number;
903
- repo: string;
904
- }) => {
905
- headRefName?: string;
906
- headRefOid: string;
907
- baseRefName?: string;
908
- baseRefOid?: string;
909
- mergedAt?: string | null;
910
- remoteHeadRefExists?: boolean;
911
- labels?: {
912
- name: string;
913
- }[];
914
- };
915
- fetchPullRequestReviews?: (input: {
916
- owner: string;
917
- pr: number;
918
- repo: string;
919
- }) => GithubPullRequestReview[];
920
- };
921
- mergeFreeze?: MergeFreezeStore;
922
- }
923
- declare function validatePrMergeCheckProof(value: unknown): PrMergeCheckProof;
924
- declare function readPrMergeCheckProof(filePath: string): PrMergeCheckProof;
925
- declare function runPrMergeCheck(args: PrMergeCheckArgs, dependencies?: PrMergeCheckDependencies): PrMergeCheckProof;
926
- //#endregion
927
- //#region src/pr-readiness/handled-human-comments.d.ts
928
- declare const HANDLED_COMMENTS_PAYLOAD_KIND: "handled-human-comments";
929
- /**
930
- * Authenticated producer of the durable handled set. Recorded on the readiness
931
- * ledger; unverifiable producers are ignored on read (fail closed).
932
- */
933
- type HandledCommentsProducerMode = "app" | "commit-status";
934
- interface HandledCommentsProducer {
935
- /** App id (stringified) or GitHub login, depending on mode. */
936
- identity: string;
937
- mode: HandledCommentsProducerMode;
938
- }
939
- interface HandledCommentsCheckPayload {
940
- clearedAt?: string;
941
- handledCommentUrls: string[];
942
- kind: typeof HANDLED_COMMENTS_PAYLOAD_KIND;
943
- pr: number;
944
- schemaVersion: 1;
945
- sessionId?: string;
946
- }
947
- //#endregion
948
- //#region src/diff-classification.d.ts
949
- declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
950
- type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
951
- //#endregion
952
608
  //#region src/pr-verify-mode.d.ts
953
609
  /**
954
610
  * The verification mode `pr:verify` resolved for a run.
@@ -1074,17 +730,104 @@ interface CheckRunDependencies {
1074
730
  * human-readable mirror, not a proof surface, so a caller that needs an
1075
731
  * App-verified check run must be told plainly whether it got one. Returns
1076
732
  * `true` only when the App-owned check run landed.
733
+ *
734
+ * "Landed" means GitHub serves it, not that the POST was accepted (#520). On
735
+ * PR #519 the POST was accepted, `pr:ready` reported ready and armed, and the
736
+ * source-pinned required check read `in_progress` across three runs — so GitHub
737
+ * never scheduled the merge and emitted no rollup row saying why. Arming
738
+ * already refuses to infer its outcome from the invocation and reads the pull
739
+ * request back (`arm-auto-merge.ts`); publication now does the same.
740
+ *
741
+ * "Landed" is judged against every run of the name from the pinned App, not
742
+ * against the one GitHub collapses to (#524): the newest must be *this* run, in
743
+ * the status and conclusion that were published, and no run of the name may
744
+ * still be unfinished. A surviving `in_progress` run blocks the required check
745
+ * on its own, so confirming past it would report success on a pull request
746
+ * GitHub will never merge. One read, no polling: an unconfirmed publication
747
+ * returns `false`, which `pr:ready` already turns into a notice and an
748
+ * idempotent re-dispatch.
749
+ *
750
+ * Confirmation is a point-in-time read, deliberately: a later publication for
751
+ * the same name changes the answer — a completed one by becoming the newest, an
752
+ * unfinished one by holding the check open beside this verdict rather than
753
+ * replacing it — and every remaining writer publishes once, as the last thing
754
+ * its invocation does. No retry, no poll, no re-confirm.
1077
755
  */
1078
756
  declare function ensureFactoryCheckRunPublished(input: PublishFactoryCheckInput, dependencies?: CheckRunDependencies & {
1079
757
  onDiagnostic?: (message: string) => void;
1080
758
  }): Promise<boolean>;
1081
- interface PublishHandledCommentsCheckInput {
759
+ //#endregion
760
+ //#region src/merge-freeze.d.ts
761
+ declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
762
+ declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
763
+ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
764
+ active: z.ZodLiteral<true>;
765
+ generationId: z.ZodNumber;
766
+ headSha: z.ZodString;
767
+ outcome: z.ZodEnum<{
768
+ active: "active";
769
+ stale: "stale";
770
+ }>;
771
+ reason: z.ZodString;
772
+ recordedAt: z.ZodISODateTime;
773
+ schemaVersion: z.ZodLiteral<1>;
774
+ }, z.core.$strip>, z.ZodObject<{
775
+ active: z.ZodLiteral<false>;
776
+ clearRationale: z.ZodOptional<z.ZodString>;
777
+ generationId: z.ZodNumber;
778
+ headSha: z.ZodString;
779
+ outcome: z.ZodLiteral<"inactive">;
780
+ reason: z.ZodString;
781
+ recordedAt: z.ZodISODateTime;
782
+ schemaVersion: z.ZodLiteral<1>;
783
+ }, z.core.$strip>], "active">;
784
+ type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
785
+ /**
786
+ * The write side of this contract lives in the generated main-push verify
787
+ * workflow (#356, ADR 0016 as amended): it is the ONLY producer of
788
+ * `patronage-factory/merge-freeze` generations. Its emitted `output.text`
789
+ * payload must parse under this exact reader schema, which is what the
790
+ * workflow's own tests assert through this export.
791
+ */
792
+ declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
793
+ interface MergeFreezeStoreInput {
1082
794
  cwd: string;
1083
- owner: string;
1084
- payload: HandledCommentsCheckPayload;
1085
- pr: number;
1086
- repo: string;
1087
- sha: string;
795
+ headSha: string;
796
+ repository: CheckoutRepository;
797
+ }
798
+ interface MergeFreezeStore {
799
+ read: (input: MergeFreezeStoreInput) => unknown;
800
+ }
801
+ /**
802
+ * The freeze generation as a readiness decision needs to see it (#477).
803
+ *
804
+ * `read` above collapses three different situations into one refusal, because
805
+ * merge time treated all of them as "do not merge". Readiness distinguishes
806
+ * them: a settled generation is the writer's verdict, a **settling** one is the
807
+ * window between a merge landing and its main-push verify completing (a
808
+ * running generation, or a missing generation proven by the immediately prior
809
+ * settled tip plus a current source-pinned verify run), and an **unreadable**
810
+ * one is ambiguous, malformed, foreign-App, or unavailable state. Same
811
+ * selection, same pinned App, same `started_at` ordering — only the reporting
812
+ * is finer.
813
+ */
814
+ type MergeFreezeGeneration = {
815
+ kind: "settled";
816
+ state: MergeFreezeState;
817
+ } | {
818
+ kind: "settling";
819
+ reason: string;
820
+ running?: {
821
+ headSha: string;
822
+ id: number;
823
+ };
824
+ } | {
825
+ kind: "unreadable";
826
+ reason: string;
827
+ };
828
+ /** A merge-freeze reader that can also report the settle window (#477). */
829
+ interface MergeFreezeAuthority extends MergeFreezeStore {
830
+ readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
1088
831
  }
1089
832
  //#endregion
1090
833
  //#region src/pr-proof-io.d.ts
@@ -1099,7 +842,6 @@ interface ProofDescriptor<T> {
1099
842
  declare const reviewPromptSectionSchema: z.ZodObject<{
1100
843
  provenance: z.ZodEnum<{
1101
844
  "prior-review-ledger": "prior-review-ledger";
1102
- "profile-standing-checklist": "profile-standing-checklist";
1103
845
  "issue-review-focus": "issue-review-focus";
1104
846
  }>;
1105
847
  source: z.ZodString;
@@ -1110,7 +852,6 @@ type ReviewPromptSectionProvenance = ReviewPromptSection["provenance"];
1110
852
  declare const reviewPromptSectionsSchema: z.ZodArray<z.ZodObject<{
1111
853
  provenance: z.ZodEnum<{
1112
854
  "prior-review-ledger": "prior-review-ledger";
1113
- "profile-standing-checklist": "profile-standing-checklist";
1114
855
  "issue-review-focus": "issue-review-focus";
1115
856
  }>;
1116
857
  source: z.ZodString;
@@ -1150,6 +891,10 @@ interface ReviewLadderPolicy {
1150
891
  }
1151
892
  declare const resolveReviewLadderPolicy: (profile: Pick<FactoryProjectProfile, "review">) => ReviewLadderPolicy;
1152
893
  //#endregion
894
+ //#region src/review-rungs.d.ts
895
+ declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
896
+ type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
897
+ //#endregion
1153
898
  //#region src/review-ladder-ledger.d.ts
1154
899
  type LadderCycleStage = "interior" | "gate";
1155
900
  interface LadderCycleRef {
@@ -1388,33 +1133,11 @@ interface PrReviewProof {
1388
1133
  //#endregion
1389
1134
  //#region src/pr-readiness/readiness-ledger.d.ts
1390
1135
  declare const SCHEMA_VERSION = 1;
1391
- declare const previewDeploySchema: z.ZodObject<{
1392
- adminUrl: z.ZodOptional<z.ZodString>;
1393
- apiHealthUrl: z.ZodOptional<z.ZodString>;
1394
- headSha: z.ZodOptional<z.ZodString>;
1395
- localPreviewProof: z.ZodOptional<z.ZodUnknown>;
1396
- localProofPath: z.ZodOptional<z.ZodString>;
1397
- proofSource: z.ZodOptional<z.ZodEnum<{
1398
- "github-actions": "github-actions";
1399
- "local-self-certified": "local-self-certified";
1400
- }>>;
1401
- publicUrl: z.ZodOptional<z.ZodString>;
1402
- seedStatus: z.ZodEnum<{
1403
- unknown: "unknown";
1404
- skipped: "skipped";
1405
- passed: "passed";
1406
- failed: "failed";
1407
- }>;
1408
- stage: z.ZodOptional<z.ZodString>;
1409
- timingsMs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
1410
- workflowRunUrl: z.ZodOptional<z.ZodString>;
1411
- }, z.core.$strip>;
1412
- declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "render-pr-body-sections", "await-post-undraft-checks"];
1136
+ declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "await-post-undraft-checks"];
1413
1137
  declare const readinessRepairSchema: z.ZodObject<{
1414
1138
  action: z.ZodString;
1415
1139
  code: z.ZodEnum<{
1416
1140
  "undraft-pr": "undraft-pr";
1417
- "render-pr-body-sections": "render-pr-body-sections";
1418
1141
  "await-post-undraft-checks": "await-post-undraft-checks";
1419
1142
  }>;
1420
1143
  command: z.ZodString;
@@ -1436,12 +1159,11 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1436
1159
  name: z.ZodString;
1437
1160
  reason: z.ZodOptional<z.ZodString>;
1438
1161
  scope: z.ZodOptional<z.ZodObject<{
1439
- classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1162
+ classifications: z.ZodArray<z.ZodEnum<{
1440
1163
  trivial: "trivial";
1441
1164
  "docs/process-only": "docs/process-only";
1442
1165
  "non-trivial": "non-trivial";
1443
- }>>>;
1444
- labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1166
+ }>>;
1445
1167
  }, z.core.$strict>>;
1446
1168
  scopeReason: z.ZodString;
1447
1169
  status: z.ZodEnum<{
@@ -1450,80 +1172,28 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1450
1172
  "out-of-scope": "out-of-scope";
1451
1173
  }>;
1452
1174
  }, z.core.$strip>>>;
1453
- finalReviewPoint: z.ZodBoolean;
1454
1175
  github: z.ZodObject<{
1455
- currentWithBase: z.ZodBoolean;
1456
1176
  draft: z.ZodBoolean;
1457
1177
  mergeStateStatus: z.ZodString;
1458
1178
  mergeable: z.ZodString;
1459
1179
  requiredChecks: z.ZodEnum<{
1460
1180
  unknown: "unknown";
1461
- pending: "pending";
1462
1181
  passed: "passed";
1463
1182
  failed: "failed";
1183
+ pending: "pending";
1464
1184
  none: "none";
1465
1185
  }>;
1186
+ reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1466
1187
  unresolvedReviewThreads: z.ZodNumber;
1467
1188
  }, z.core.$strip>;
1468
- handledCommentsProducer: z.ZodOptional<z.ZodObject<{
1469
- identity: z.ZodString;
1470
- mode: z.ZodEnum<{
1471
- app: "app";
1472
- "commit-status": "commit-status";
1473
- }>;
1474
- }, z.core.$strip>>;
1475
- handledHumanComments: z.ZodOptional<z.ZodArray<z.ZodObject<{
1476
- clearedAt: z.ZodOptional<z.ZodString>;
1477
- sessionId: z.ZodOptional<z.ZodString>;
1478
- source: z.ZodEnum<{
1479
- "check-run": "check-run";
1480
- cli: "cli";
1481
- }>;
1482
- url: z.ZodString;
1483
- }, z.core.$strip>>>;
1484
1189
  headSha: z.ZodString;
1485
1190
  mergeBaseSha: z.ZodOptional<z.ZodString>;
1486
1191
  patchId: z.ZodString;
1487
- postReadinessHumanComments: z.ZodOptional<z.ZodArray<z.ZodObject<{
1488
- author: z.ZodString;
1489
- createdAt: z.ZodString;
1490
- summary: z.ZodString;
1491
- url: z.ZodString;
1492
- }, z.core.$strip>>>;
1493
- postReadinessHumanReviews: z.ZodOptional<z.ZodArray<z.ZodObject<{
1494
- author: z.ZodString;
1495
- createdAt: z.ZodString;
1496
- summary: z.ZodString;
1497
- url: z.ZodString;
1498
- }, z.core.$strip>>>;
1499
1192
  pr: z.ZodNumber;
1500
- previewDeploy: z.ZodOptional<z.ZodObject<{
1501
- adminUrl: z.ZodOptional<z.ZodString>;
1502
- apiHealthUrl: z.ZodOptional<z.ZodString>;
1503
- headSha: z.ZodOptional<z.ZodString>;
1504
- localPreviewProof: z.ZodOptional<z.ZodUnknown>;
1505
- localProofPath: z.ZodOptional<z.ZodString>;
1506
- proofSource: z.ZodOptional<z.ZodEnum<{
1507
- "github-actions": "github-actions";
1508
- "local-self-certified": "local-self-certified";
1509
- }>>;
1510
- publicUrl: z.ZodOptional<z.ZodString>;
1511
- seedStatus: z.ZodEnum<{
1512
- unknown: "unknown";
1513
- skipped: "skipped";
1514
- passed: "passed";
1515
- failed: "failed";
1516
- }>;
1517
- stage: z.ZodOptional<z.ZodString>;
1518
- timingsMs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
1519
- workflowRunUrl: z.ZodOptional<z.ZodString>;
1520
- }, z.core.$strip>>;
1521
- previewDeployRequired: z.ZodBoolean;
1522
1193
  repairs: z.ZodDefault<z.ZodArray<z.ZodObject<{
1523
1194
  action: z.ZodString;
1524
1195
  code: z.ZodEnum<{
1525
1196
  "undraft-pr": "undraft-pr";
1526
- "render-pr-body-sections": "render-pr-body-sections";
1527
1197
  "await-post-undraft-checks": "await-post-undraft-checks";
1528
1198
  }>;
1529
1199
  command: z.ZodString;
@@ -1589,39 +1259,31 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1589
1259
  }>>;
1590
1260
  reviews: z.ZodObject<{
1591
1261
  correctness: z.ZodObject<{
1592
- docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1593
1262
  required: z.ZodBoolean;
1594
1263
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1595
1264
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1596
1265
  status: z.ZodEnum<{
1597
1266
  blocked: "blocked";
1598
- "not-required": "not-required";
1599
1267
  stale: "stale";
1268
+ "not-required": "not-required";
1600
1269
  current: "current";
1601
1270
  missing: "missing";
1602
1271
  }>;
1603
1272
  }, z.core.$strip>;
1604
1273
  security: z.ZodOptional<z.ZodObject<{
1605
- docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
1606
1274
  required: z.ZodBoolean;
1607
1275
  reviewedHeadSha: z.ZodOptional<z.ZodString>;
1608
1276
  reviewedPatchId: z.ZodOptional<z.ZodString>;
1609
1277
  status: z.ZodEnum<{
1610
1278
  blocked: "blocked";
1611
- "not-required": "not-required";
1612
1279
  stale: "stale";
1280
+ "not-required": "not-required";
1613
1281
  current: "current";
1614
1282
  missing: "missing";
1615
1283
  }>;
1616
1284
  }, z.core.$strip>>;
1617
1285
  }, z.core.$strip>;
1618
1286
  schemaVersion: z.ZodLiteral<1>;
1619
- stackRole: z.ZodEnum<{
1620
- slice: "slice";
1621
- single: "single";
1622
- rollup: "rollup";
1623
- "merge-gate prerequisite": "merge-gate prerequisite";
1624
- }>;
1625
1287
  verification: z.ZodObject<{
1626
1288
  command: z.ZodLiteral<"patronage-factory pr:verify">;
1627
1289
  docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
@@ -1636,14 +1298,12 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
1636
1298
  verifiedHeadSha: z.ZodOptional<z.ZodString>;
1637
1299
  }, z.core.$strip>;
1638
1300
  }, z.core.$strip>;
1639
- type PreviewDeployProof = z.infer<typeof previewDeploySchema>;
1640
- type PreviewSeedStatus = PreviewDeployProof["seedStatus"];
1641
1301
  type ReadinessRepair = z.infer<typeof readinessRepairSchema>;
1642
- type ReadinessStatus = "ready" | "blocked" | "slice-ready/not-final";
1302
+ type ReadinessStatus = "ready" | "blocked";
1643
1303
  type ManagedReadinessLedger = z.infer<typeof managedReadinessLedgerSchema>;
1644
1304
  declare function validateManagedReadinessLedger(value: unknown): ManagedReadinessLedger;
1645
1305
  declare namespace status_check_rollup_d_exports {
1646
- export { CheckState, StatusCheckRollup, isFactoryReadyCheck, statusCheckState };
1306
+ export { CheckState, HOSTED_VERIFY_CHECK_NAME, StatusCheckRollup, hostedVerifyCheckState, isFactoryReadyCheck, isHostedVerifyCheck, statusCheckState };
1647
1307
  }
1648
1308
  type CheckState = "passed" | "failed" | "pending" | "none" | "unknown";
1649
1309
  interface StatusCheckRollup {
@@ -1658,15 +1318,45 @@ interface StatusCheckRollup {
1658
1318
  workflowName?: string;
1659
1319
  }
1660
1320
  declare const isFactoryReadyCheck: (check: StatusCheckRollup) => boolean;
1321
+ /**
1322
+ * The hosted verification gate's context name — the branch ruleset's other
1323
+ * source-pinned required check, alongside `patronage-factory/pr-ready`. One
1324
+ * name across the fleet because one generator emits the workflow that posts
1325
+ * it (ADR 0016, 2026-07-31 amendment).
1326
+ */
1327
+ declare const HOSTED_VERIFY_CHECK_NAME = "verify";
1328
+ /**
1329
+ * Is this rollup entry the hosted `verify` gate, from the producer the
1330
+ * ruleset pins it to?
1331
+ *
1332
+ * `workflowName` is the producer signal the rollup actually carries: GitHub
1333
+ * Actions check runs name their workflow, App-posted check runs come back with
1334
+ * an empty one, and a user-token commit status arrives as a `context` with no
1335
+ * `name` at all. Epic #473 wave 2 measured that a same-named check from the
1336
+ * wrong writer is as inert as no check at all, so matching the name alone
1337
+ * would accept exactly the thing the pin rejects.
1338
+ */
1339
+ declare const isHostedVerifyCheck: (check: StatusCheckRollup) => boolean;
1340
+ /**
1341
+ * The hosted `verify` gate's state on this head, read by presence (#477).
1342
+ *
1343
+ * This is the one rollup question the rollup can answer honestly. Wave 2
1344
+ * measured that GitHub omits an *unsatisfied pinned requirement* from
1345
+ * `statusCheckRollup` entirely — there is no "expected" or "missing" row — so
1346
+ * a green rollup is not evidence of mergeability. What the rollup does report
1347
+ * faithfully is the checks that ran. Asking whether this specific check ran,
1348
+ * and passed, on this head turns the rollup's silence from a false green into
1349
+ * a named refusal: `"none"` means the pinned requirement is unsatisfied and
1350
+ * nothing else in the rollup would have said so.
1351
+ */
1352
+ declare const hostedVerifyCheckState: (rollup: StatusCheckRollup[] | undefined) => CheckState;
1661
1353
  declare const statusCheckState: (rollup: StatusCheckRollup[] | undefined, exclude?: (check: StatusCheckRollup) => boolean) => CheckState;
1662
1354
  //#endregion
1663
1355
  //#region src/pr-ready.d.ts
1664
1356
  interface PrReadyArgs extends LoadProjectProfileInput {
1665
1357
  authoringSessionIds?: string[];
1666
1358
  base: string;
1667
- bodyForEvaluation?: string;
1668
1359
  epic?: number;
1669
- handledCommentUrls?: string[];
1670
1360
  json?: boolean;
1671
1361
  output?: string;
1672
1362
  report?: boolean;
@@ -1676,44 +1366,50 @@ interface PrReadyArgs extends LoadProjectProfileInput {
1676
1366
  verifyProof?: string;
1677
1367
  }
1678
1368
  interface GitHubPullRequest {
1369
+ /**
1370
+ * GitHub's live auto-merge enablement, or `null` when nothing is scheduled.
1371
+ *
1372
+ * Required, not optional (#515 review). `gh pr view --json autoMergeRequest`
1373
+ * always returns the key — explicitly `null` when nothing is scheduled — and
1374
+ * errors loudly on a field name it does not know, so there is no shape where
1375
+ * the real CLI omits it. But `fetchPullRequest` is injectable, and an
1376
+ * implementation that left the field out would silently disable the
1377
+ * `boundary-wave` refusal that stops an epicless run from greening a
1378
+ * candidate GitHub is already scheduled to merge. Requiring it makes the
1379
+ * compiler enforce what `gh` already promises.
1380
+ */
1381
+ autoMergeRequest: {
1382
+ enabledAt?: string;
1383
+ } | null;
1679
1384
  baseRefName: string;
1680
1385
  baseRefOid: string;
1681
1386
  body: string;
1682
- comments: {
1683
- author?: {
1684
- login?: string;
1685
- };
1686
- body: string;
1687
- createdAt?: string;
1688
- id?: string | number;
1689
- updatedAt?: string;
1690
- url?: string;
1691
- }[];
1692
1387
  headRefOid: string;
1693
1388
  isDraft: boolean;
1694
- labels?: {
1695
- name: string;
1696
- }[];
1697
1389
  mergeStateStatus: string;
1698
1390
  mergeable: string;
1699
1391
  number: number;
1700
- reviews?: {
1701
- author?: {
1702
- login?: string;
1703
- };
1704
- body?: string;
1705
- lastEditedAt?: string;
1706
- state: string;
1707
- submittedAt?: string;
1708
- url?: string;
1709
- }[];
1392
+ reviewDecision: string | null;
1710
1393
  statusCheckRollup?: StatusCheckRollup[];
1711
1394
  title: string;
1712
1395
  unresolvedReviewThreads: number;
1713
1396
  url: string;
1714
1397
  }
1715
1398
  interface PrReadyProof {
1716
- schemaVersion: 2;
1399
+ schemaVersion: 3;
1400
+ /**
1401
+ * What GitHub actually did when this run armed native auto-merge (#477).
1402
+ * Present exactly when a ready wave authorizes machine merge and arming ran;
1403
+ * read back from the PR rather than inferred from the invocation, because `gh pr merge
1404
+ * --auto` arms, merges, or does nothing with the same exit code and the same
1405
+ * empty output. `not-armed` means the candidate is admitted but nothing will
1406
+ * merge it, and `followUp` carries the re-dispatch.
1407
+ */
1408
+ arming?: {
1409
+ detail?: string;
1410
+ headSha: string;
1411
+ outcome: "armed" | "merged" | "not-armed";
1412
+ };
1717
1413
  /**
1718
1414
  * Why this run blocked, one entry per refusing demand (#391): `code` is the
1719
1415
  * demand key from the resolver's vocabulary, `detail` the one-sentence
@@ -1726,11 +1422,12 @@ interface PrReadyProof {
1726
1422
  humanBlockingReasons: string[];
1727
1423
  command: "patronage-factory pr:ready";
1728
1424
  /**
1729
- * Machine-safe arg array for the obvious next action (#523): when `ready`,
1730
- * the `pr:merge-check` that must precede a merge; otherwise the `pr:verify`
1731
- * re-run that the blocking reasons name (re-verify the head, then re-run
1732
- * pr:ready). Same `argv` shape `factory:delegate --print` emits. Optional
1733
- * and purely additive.
1425
+ * Machine-safe arg array for the obvious next action (#523): when `ready`
1426
+ * but arming did not take effect, a `pr:ready` re-dispatch (idempotent on
1427
+ * an unchanged head); otherwise the `gh pr ready` undraft repair or the
1428
+ * `pr:verify` re-run that the blocking reasons name (re-verify the head,
1429
+ * then re-run pr:ready). Same `argv` shape `factory:delegate --print`
1430
+ * emits. Optional and purely additive.
1734
1431
  */
1735
1432
  followUp?: FollowUpAction;
1736
1433
  /**
@@ -1740,6 +1437,13 @@ interface PrReadyProof {
1740
1437
  * pushed HEAD, not a re-derivation. See the ledger schema.
1741
1438
  */
1742
1439
  ledger: ManagedReadinessLedger;
1440
+ /**
1441
+ * Actionable facts that did not block (#477): a settling merge-freeze
1442
+ * generation that permitted readiness and any authorized arming with a
1443
+ * notice, an admitted-but-unscheduled false boundary wave, and how each
1444
+ * waived demand reads to a human. Absent when there are none.
1445
+ */
1446
+ notices?: string[];
1743
1447
  /** Committed profile blob evaluated by readiness. Required for merge. */
1744
1448
  profileBlobSha?: string;
1745
1449
  /** Checkout-relative committed profile path evaluated by readiness. */
@@ -1748,9 +1452,21 @@ interface PrReadyProof {
1748
1452
  /** Trusted checkout repository used for all GitHub reads and writes. */
1749
1453
  repository?: string;
1750
1454
  status: ReadinessStatus;
1455
+ /**
1456
+ * Demands that were in force, were NOT met, and were waived by the operator
1457
+ * (#354, moved here from the merge-time proof by #477). Each entry carries
1458
+ * the demand's refusals verbatim, so a waived demand can never read as a met
1459
+ * one; readiness proceeds on the recorded operator act, not on evidence.
1460
+ */
1461
+ waivedDemands?: WaivedDemand[];
1751
1462
  }
1752
- type PublishHandledCommentsResult = HandledCommentsProducer | Promise<HandledCommentsProducer | undefined> | undefined;
1753
1463
  interface PrReadyDependencies {
1464
+ /**
1465
+ * Arms GitHub native auto-merge only for a passing boundary wave that
1466
+ * authorizes machine merge (#477). Defaults to the real `gh pr merge --auto`
1467
+ * call plus the read-back that says what actually happened.
1468
+ */
1469
+ armAutoMerge?: (input: ArmAutoMergeInput) => ArmAutoMergeOutcome;
1754
1470
  github?: {
1755
1471
  fetchClosingPullRequests?: (input: {
1756
1472
  issue: number;
@@ -1764,33 +1480,36 @@ interface PrReadyDependencies {
1764
1480
  owner: string;
1765
1481
  repo: string;
1766
1482
  }) => string;
1767
- fetchHandledComments?: (input: {
1768
- owner: string;
1769
- pr: number;
1770
- repo: string;
1771
- }) => {
1772
- producer?: HandledCommentsProducer;
1773
- urls: string[];
1774
- }; /** @deprecated Prefer fetchHandledComments (includes producer identity). */
1775
- fetchHandledCommentUrls?: (input: {
1776
- owner: string;
1777
- pr: number;
1778
- repo: string;
1779
- }) => string[];
1780
1483
  fetchPullRequest: (input: {
1781
1484
  owner: string;
1782
1485
  repo: string;
1783
1486
  pr: number;
1784
1487
  }) => GitHubPullRequest;
1785
- publishHandledCommentsCheck?: (input: PublishHandledCommentsCheckInput) => PublishHandledCommentsResult;
1786
1488
  };
1787
1489
  git?: PrReadyGitDependencies;
1788
1490
  hq?: HqIngestDependencies;
1789
- publishCheckRun?: (input: PublishFactoryCheckInput) => void;
1491
+ /**
1492
+ * The authoritative merge-freeze reader (#477). Defaults to the pinned-App
1493
+ * GitHub check-run authority — readiness is a control, so an absent
1494
+ * dependency must not mean an unread freeze.
1495
+ */
1496
+ mergeFreeze?: Pick<MergeFreezeAuthority, "readGeneration">;
1497
+ /**
1498
+ * Awaited publication of the branded check, which is a source-pinned
1499
+ * required check rather than a mirror (#477). Returns true only when the
1500
+ * App-owned run landed. Defaults to `ensureFactoryCheckRunPublished`.
1501
+ *
1502
+ * `pr:ready` has no other publication seam, and this one cannot express a
1503
+ * non-terminal run (#526): `status` is omitted from the input, so every run
1504
+ * readiness creates is completed with a conclusion. A `pr:ready` invocation
1505
+ * therefore cannot leave a run holding the source-pinned required check
1506
+ * open, which is a permanent block on the pull request (#524).
1507
+ */
1508
+ publishFinalCheckRun?: (input: Omit<PublishFactoryCheckInput, "status"> & {
1509
+ conclusion: "failure" | "success";
1510
+ }) => Promise<boolean> | boolean;
1790
1511
  /** Injectable delay for the UNKNOWN-mergeable brief poll (tests). */
1791
1512
  sleep?: (ms: number) => Promise<void>;
1792
- /** Injectable clock for CLI handled-comment provenance (tests). */
1793
- now?: () => Date;
1794
1513
  }
1795
1514
  interface PrReadyGitDependencies {
1796
1515
  canResolveCommit: (cwd: string, sha: string) => boolean;
@@ -1811,16 +1530,14 @@ declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencie
1811
1530
  declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
1812
1531
  type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
1813
1532
  declare const requiredCheckScopeSchema: z.ZodObject<{
1814
- classifications: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1533
+ classifications: z.ZodArray<z.ZodEnum<{
1815
1534
  trivial: "trivial";
1816
1535
  "docs/process-only": "docs/process-only";
1817
1536
  "non-trivial": "non-trivial";
1818
- }>>>;
1819
- labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
1537
+ }>>;
1820
1538
  }, z.core.$strict>;
1821
1539
  type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
1822
1540
  interface RequiredCheckScopeContext {
1823
- labels: string[] | undefined;
1824
1541
  classification: DiffClassification | undefined;
1825
1542
  }
1826
1543
  interface ScopeDecision {
@@ -1983,8 +1700,8 @@ declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
1983
1700
  declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
1984
1701
  declare const reviewStatusSchema: z.ZodEnum<{
1985
1702
  blocked: "blocked";
1986
- "not-required": "not-required";
1987
1703
  stale: "stale";
1704
+ "not-required": "not-required";
1988
1705
  current: "current";
1989
1706
  missing: "missing";
1990
1707
  }>;
@@ -2342,11 +2059,6 @@ declare const retroEnvelopeV1Schema: z.ZodObject<{
2342
2059
  }, z.core.$strict>;
2343
2060
  kind: z.ZodLiteral<"retro-envelope">;
2344
2061
  outcome: z.ZodOptional<z.ZodObject<{
2345
- mergeCheck: z.ZodOptional<z.ZodEnum<{
2346
- pass: "pass";
2347
- fail: "fail";
2348
- "not-run": "not-run";
2349
- }>>;
2350
2062
  status: z.ZodEnum<{
2351
2063
  success: "success";
2352
2064
  fail: "fail";
@@ -2571,9 +2283,6 @@ declare const runDemandWaive: (args: DemandWaiveArgs, dependencies?: DemandWaive
2571
2283
  //#region src/commands/demand-waive.d.ts
2572
2284
  type DemandWaiveAction = (args: DemandWaiveArgs) => DemandWaiver;
2573
2285
  //#endregion
2574
- //#region src/commands/pr-merge-check.d.ts
2575
- type PrMergeCheckAction = (args: PrMergeCheckArgs) => PrMergeCheckProof;
2576
- //#endregion
2577
2286
  //#region src/hq-credentials.d.ts
2578
2287
  /**
2579
2288
  * Why a reference did not resolve. Each value names a different remedy, and
@@ -2703,6 +2412,15 @@ type FollowUpRunner = (followUp: FollowUpAction, cwd: string) => Promise<void> |
2703
2412
  interface PrPublishHandoff {
2704
2413
  humanActions: string[];
2705
2414
  routeOwnedRepairs: ReadinessRepair[];
2415
+ /**
2416
+ * Whether the merge is actually on GitHub's schedule (#477, #515 review).
2417
+ * An admitted candidate is not a handed-off one: `pr:ready` arms only when a
2418
+ * boundary wave authorized it, and the arming can fail to take effect. A
2419
+ * readiness status of `ready` says the candidate passed, never that anything
2420
+ * will merge it — only an auto-merge-authorized boundary wave can schedule
2421
+ * one — so publish reads this before claiming nothing is owed.
2422
+ */
2423
+ scheduled: boolean;
2706
2424
  status: PrReadyProof["status"];
2707
2425
  }
2708
2426
  type PrPublishFollowUpOutcome = {
@@ -2930,11 +2648,11 @@ declare const LegacyWorkerCloseoutStatusTraceEventSchema: z.ZodObject<{
2930
2648
  threadId: z.ZodOptional<z.ZodString>;
2931
2649
  workerId: z.ZodOptional<z.ZodString>;
2932
2650
  archiveStatus: z.ZodOptional<z.ZodEnum<{
2651
+ pending: "pending";
2933
2652
  unavailable: "unavailable";
2934
2653
  archived: "archived";
2935
2654
  skipped: "skipped";
2936
2655
  "not-applicable": "not-applicable";
2937
- pending: "pending";
2938
2656
  }>>;
2939
2657
  closeoutReason: z.ZodOptional<z.ZodString>;
2940
2658
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3325,11 +3043,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3325
3043
  threadId: z.ZodOptional<z.ZodString>;
3326
3044
  workerId: z.ZodOptional<z.ZodString>;
3327
3045
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3046
+ pending: "pending";
3328
3047
  unavailable: "unavailable";
3329
3048
  archived: "archived";
3330
3049
  skipped: "skipped";
3331
3050
  "not-applicable": "not-applicable";
3332
- pending: "pending";
3333
3051
  }>>;
3334
3052
  closeoutReason: z.ZodOptional<z.ZodString>;
3335
3053
  eventType: z.ZodLiteral<"worker-closeout-lessons">;
@@ -3366,11 +3084,11 @@ declare const FACTORY_TRACE_EVENT_DEFINITIONS: readonly [DefinedTraceEvent<"revi
3366
3084
  }, z.core.$strict>], "lessonStatus">;
3367
3085
  readonly 2: z.ZodObject<{
3368
3086
  archiveStatus: z.ZodOptional<z.ZodEnum<{
3087
+ pending: "pending";
3369
3088
  unavailable: "unavailable";
3370
3089
  archived: "archived";
3371
3090
  skipped: "skipped";
3372
3091
  "not-applicable": "not-applicable";
3373
- pending: "pending";
3374
3092
  }>>;
3375
3093
  closeoutReason: z.ZodOptional<z.ZodString>;
3376
3094
  lessonStatus: z.ZodOptional<z.ZodEnum<{
@@ -3857,7 +3575,7 @@ declare const scanFactoryTraceDiagnostics: ({
3857
3575
  //#endregion
3858
3576
  //#region src/interior-telemetry/gate-timing.d.ts
3859
3577
  declare const GATE_TIMING_SCHEMA_VERSION = 1;
3860
- type FactoryGateName = "boundary:check" | "factory:closeout" | "pr:merge-check" | "pr:ready" | "pr:review" | "pr:verify";
3578
+ type FactoryGateName = "boundary:check" | "factory:closeout" | "pr:ready" | "pr:review" | "pr:verify";
3861
3579
  type GateTimingOutcome = "fail" | "pass";
3862
3580
  interface GateTimingRecord {
3863
3581
  agentRunId: string;
@@ -4042,119 +3760,10 @@ type WorktreeRootLister = (worktreePath: string) => string[] | undefined;
4042
3760
  declare function checkWorktreeScratchFiles(worktreePath?: string, listRootEntries?: WorktreeRootLister): WorktreeScratchFileCheck;
4043
3761
  /**
4044
3762
  * Human-readable one-line summary of a scratch-file check, owned beside the
4045
- * detection logic (mirroring worktreeHeldBranchNotice) so planner output,
4046
- * docs, and future surfaces cannot drift apart.
3763
+ * detection logic so planner output, docs, and future surfaces cannot drift
3764
+ * apart.
4047
3765
  */
4048
3766
  declare function formatScratchFileCheckSummary(check: WorktreeScratchFileCheck): string;
4049
- declare namespace pr_body_metadata_d_exports {
4050
- export { PrBodyMetadata, StackRole, readPrBodyMetadata };
4051
- }
4052
- type StackRole = "single" | "slice" | "rollup" | "merge-gate prerequisite";
4053
- interface PrBodyMetadata {
4054
- requiredSectionsPresent: boolean;
4055
- stackRole: StackRole;
4056
- finalReviewPoint: boolean;
4057
- trivialWaiverAccepted: boolean;
4058
- }
4059
- declare const readPrBodyMetadata: (body: string) => PrBodyMetadata;
4060
- declare namespace post_readiness_comments_d_exports {
4061
- export { BLOCKING_REVIEW_STATE, HandledCommentEntry, PostReadinessHumanComment, PrReadinessComment, PrReadinessReview, activePostReadinessHumanComments, activePostReadinessHumanReviews, isBotLogin, postReadinessHumanCommentReason, postReadinessHumanReviewReason, selectPostReadinessHumanComments };
4062
- }
4063
- interface PrReadinessComment {
4064
- author?: {
4065
- login?: string;
4066
- };
4067
- body: string;
4068
- createdAt?: string;
4069
- id?: string | number;
4070
- updatedAt?: string;
4071
- url?: string;
4072
- }
4073
- interface PrReadinessReview {
4074
- author?: {
4075
- login?: string;
4076
- };
4077
- body?: string;
4078
- /** GraphQL `PullRequestReview.lastEditedAt` — the body-edit signal used to re-arm a cleared review (#843). */
4079
- lastEditedAt?: string;
4080
- state: string;
4081
- submittedAt?: string;
4082
- url?: string;
4083
- }
4084
- interface PostReadinessHumanComment {
4085
- author: string;
4086
- createdAt: string;
4087
- summary: string;
4088
- url: string;
4089
- }
4090
- declare const BLOCKING_REVIEW_STATE = "CHANGES_REQUESTED";
4091
- interface HandledCommentEntry {
4092
- clearedAt?: string;
4093
- url: string;
4094
- }
4095
- /**
4096
- * Active human blocking comments: all non-bot human PR comments minus the
4097
- * explicitly-handled URL set. No review-timestamp recency gate — an unhandled
4098
- * blocker blocks regardless of later review runs (#819 cycle 3). A handled
4099
- * comment that is EDITED after it was cleared re-arms (#825a).
4100
- */
4101
- declare const selectPostReadinessHumanComments: ({
4102
- comments,
4103
- handledComments
4104
- }: {
4105
- comments: PrReadinessComment[];
4106
- handledComments?: HandledCommentEntry[];
4107
- }) => PostReadinessHumanComment[];
4108
- /**
4109
- * Active human blockers are recomputed from live GitHub comments each run
4110
- * (#819). The prior local readiness proof is not a carry source —
4111
- * `.factory-memory/` is gitignored and vanishes on clean checkout. Clearing
4112
- * persists only via the durable handled set (factory check-run
4113
- * `patronage-factory/handled-comments`) plus explicit `--handled-comment`.
4114
- */
4115
- declare const activePostReadinessHumanComments: ({
4116
- comments,
4117
- handledComments
4118
- }: {
4119
- comments: PrReadinessComment[];
4120
- handledComments?: HandledCommentEntry[];
4121
- }) => PostReadinessHumanComment[];
4122
- /**
4123
- * Active CHANGES_REQUESTED PR review submissions (#825b): a top-level review
4124
- * body carries no inline thread, so without this scan it is the only human
4125
- * channel auto-merge would sail over — unwatched by both the issue-comment
4126
- * scan and the unresolved-review-thread count. Shares the handled-set /
4127
- * re-arm rules with comments so an operator can clear a stale request the
4128
- * same way (`--handled-comment <review-url>`). The clear-comparison uses
4129
- * `lastEditedAt` when present so a body edit after a clear re-arms the
4130
- * blocker the same way an edited comment does — resubmission is not the
4131
- * only edit signal GitHub exposes (#843).
4132
- */
4133
- declare const activePostReadinessHumanReviews: ({
4134
- handledComments,
4135
- reviews
4136
- }: {
4137
- handledComments?: HandledCommentEntry[];
4138
- reviews: PrReadinessReview[];
4139
- }) => PostReadinessHumanComment[];
4140
- declare const postReadinessHumanCommentReason: ({
4141
- comment,
4142
- pr,
4143
- prTitle
4144
- }: {
4145
- comment: PostReadinessHumanComment;
4146
- pr: number;
4147
- prTitle?: string;
4148
- }) => string;
4149
- declare const postReadinessHumanReviewReason: ({
4150
- pr,
4151
- prTitle,
4152
- review
4153
- }: {
4154
- pr: number;
4155
- prTitle?: string;
4156
- review: PostReadinessHumanComment;
4157
- }) => string;
4158
3767
  //#endregion
4159
3768
  //#region src/pr-readiness/pr-body-sections.d.ts
4160
3769
  declare const MANAGED_SECTION_NAMES: readonly ["Verification", "Review proof", "How to review"];
@@ -4271,29 +3880,27 @@ interface WaveReviewDemand {
4271
3880
  wave: string;
4272
3881
  }
4273
3882
  declare namespace readiness_evaluation_d_exports {
4274
- export { CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON, DRAFT_BLOCKER_REASON, EvaluationInput, ManagedReadinessLedger, PENDING_CHECKS_BLOCKER_REASON_PREFIX, PreviewDeployProof, PreviewSeedStatus, READINESS_REPAIR_CODES, RENDER_PR_BODY_SECTIONS_BLOCKER_REASON, ReadinessRepair, ReadinessStatus, SCHEMA_VERSION, SECURITY_UNTYPED_REVIEW_BLOCKER_REASON, evaluateReadiness, managedReadinessLedgerSchema, readinessExitCode, readinessRepairSchema, validateManagedReadinessLedger };
3883
+ export { CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON, DRAFT_BLOCKER_REASON, EvaluationInput, ManagedReadinessLedger, PENDING_CHECKS_BLOCKER_REASON_PREFIX, READINESS_REPAIR_CODES, ReadinessRepair, ReadinessStatus, SCHEMA_VERSION, SECURITY_UNTYPED_REVIEW_BLOCKER_REASON, evaluateReadiness, managedReadinessLedgerSchema, readinessExitCode, readinessRepairSchema, validateManagedReadinessLedger };
4275
3884
  }
4276
3885
  declare const CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON = "Correctness review proof is not a head-bound typed findings verdict; re-run pr:review with a valid findings file.";
4277
3886
  declare const SECURITY_UNTYPED_REVIEW_BLOCKER_REASON = "Security review proof is not a head-bound typed findings verdict; re-run pr:review with a valid findings file.";
4278
3887
  declare const DRAFT_BLOCKER_REASON = "PR is still marked draft.";
4279
- declare const RENDER_PR_BODY_SECTIONS_BLOCKER_REASON = "PR body must include Verification, Review proof, and How to review sections.";
4280
3888
  declare const PENDING_CHECKS_BLOCKER_REASON_PREFIX = "Required/current checks are";
4281
3889
  declare const readinessExitCode: (status: ReadinessStatus) => 1 | 0;
4282
3890
  interface EvaluationInput {
4283
3891
  pr: number;
4284
3892
  prTitle?: string;
4285
- body: string;
4286
3893
  headSha: string;
4287
3894
  localHeadSha?: string;
4288
3895
  baseSha: string;
4289
3896
  patchId: string;
4290
3897
  classification: DiffClassification;
4291
- comments?: PrReadinessComment[];
4292
- reviews?: PrReadinessReview[];
3898
+ reviewDecision: string | null;
4293
3899
  unresolvedReviewThreads: number;
4294
3900
  requiredChecks: CheckState;
3901
+ hostedVerifyCheck?: CheckState;
3902
+ autoMergeEnabled?: boolean;
4295
3903
  draft: boolean;
4296
- currentWithBase: boolean;
4297
3904
  mergeable: string;
4298
3905
  mergeStateStatus: string;
4299
3906
  ladderPolicy?: ReviewLadderPolicy;
@@ -4301,22 +3908,17 @@ interface EvaluationInput {
4301
3908
  reviewProof?: PrReviewProof;
4302
3909
  verificationProof?: VerificationProofState;
4303
3910
  docsOnlyVerifyBaselineHeadShas?: string[];
4304
- docsOnlySinceReviewProof?: boolean;
4305
3911
  externalRequiredChecks?: RequiredCheck[];
4306
3912
  evidenceEnvelopes?: LoadedEvidenceEnvelope[];
4307
3913
  mergeBaseSha?: string;
4308
3914
  authoringSessionIds?: string[];
4309
- prLabels?: string[];
4310
3915
  priorLedger?: Pick<ManagedReadinessLedger, "reviewRuns">;
4311
- handledCommentUrls?: string[];
4312
- checkRunHandledCommentUrls?: string[];
4313
- handledCommentsProducer?: {
4314
- identity: string;
4315
- mode: "app" | "commit-status";
3916
+ waveReviewDemand?: Pick<WaveReviewDemand, "autoMerge" | "review" | "wave">;
3917
+ mergeFreeze?: {
3918
+ blockingReasons: string[];
3919
+ notices: string[];
4316
3920
  };
4317
- handledCommentSessionId?: string;
4318
- handledCommentClearedAt?: string;
4319
- waveReviewDemand?: Pick<WaveReviewDemand, "review" | "wave">;
3921
+ waivers?: DemandWaiver[];
4320
3922
  }
4321
3923
  declare const evaluateReadiness: (input: EvaluationInput) => {
4322
3924
  blockedReasons: {
@@ -4329,42 +3931,37 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4329
3931
  baseSha: string;
4330
3932
  blockingReasons: string[];
4331
3933
  classification: "trivial" | "docs/process-only" | "non-trivial";
4332
- finalReviewPoint: boolean;
4333
3934
  github: {
4334
- currentWithBase: boolean;
4335
3935
  draft: boolean;
4336
3936
  mergeStateStatus: string;
4337
3937
  mergeable: string;
4338
- requiredChecks: "unknown" | "pending" | "passed" | "failed" | "none";
3938
+ requiredChecks: "unknown" | "passed" | "failed" | "pending" | "none";
4339
3939
  unresolvedReviewThreads: number;
3940
+ reviewDecision?: string | null | undefined;
4340
3941
  };
4341
3942
  headSha: string;
4342
3943
  patchId: string;
4343
3944
  pr: number;
4344
- previewDeployRequired: boolean;
4345
3945
  repairs: {
4346
3946
  action: string;
4347
- code: "undraft-pr" | "render-pr-body-sections" | "await-post-undraft-checks";
3947
+ code: "undraft-pr" | "await-post-undraft-checks";
4348
3948
  command: string;
4349
3949
  }[];
4350
3950
  reviews: {
4351
3951
  correctness: {
4352
3952
  required: boolean;
4353
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4354
- docsOnlyDeltaAccepted?: boolean | undefined;
3953
+ status: "blocked" | "stale" | "not-required" | "current" | "missing";
4355
3954
  reviewedHeadSha?: string | undefined;
4356
3955
  reviewedPatchId?: string | undefined;
4357
3956
  };
4358
3957
  security?: {
4359
3958
  required: boolean;
4360
- status: "blocked" | "not-required" | "stale" | "current" | "missing";
4361
- docsOnlyDeltaAccepted?: boolean | undefined;
3959
+ status: "blocked" | "stale" | "not-required" | "current" | "missing";
4362
3960
  reviewedHeadSha?: string | undefined;
4363
3961
  reviewedPatchId?: string | undefined;
4364
3962
  } | undefined;
4365
3963
  };
4366
3964
  schemaVersion: 1;
4367
- stackRole: "slice" | "single" | "rollup" | "merge-gate prerequisite";
4368
3965
  verification: {
4369
3966
  command: "patronage-factory pr:verify";
4370
3967
  prVerify: "stale" | "passed" | "missing";
@@ -4382,46 +3979,10 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4382
3979
  status: "satisfied" | "unmet" | "out-of-scope";
4383
3980
  reason?: string | undefined;
4384
3981
  scope?: {
4385
- classifications?: ("trivial" | "docs/process-only" | "non-trivial")[] | undefined;
4386
- labels?: string[] | undefined;
3982
+ classifications: ("trivial" | "docs/process-only" | "non-trivial")[];
4387
3983
  } | undefined;
4388
3984
  }[] | undefined;
4389
- handledCommentsProducer?: {
4390
- identity: string;
4391
- mode: "app" | "commit-status";
4392
- } | undefined;
4393
- handledHumanComments?: {
4394
- source: "check-run" | "cli";
4395
- url: string;
4396
- clearedAt?: string | undefined;
4397
- sessionId?: string | undefined;
4398
- }[] | undefined;
4399
3985
  mergeBaseSha?: string | undefined;
4400
- postReadinessHumanComments?: {
4401
- author: string;
4402
- createdAt: string;
4403
- summary: string;
4404
- url: string;
4405
- }[] | undefined;
4406
- postReadinessHumanReviews?: {
4407
- author: string;
4408
- createdAt: string;
4409
- summary: string;
4410
- url: string;
4411
- }[] | undefined;
4412
- previewDeploy?: {
4413
- seedStatus: "unknown" | "skipped" | "passed" | "failed";
4414
- adminUrl?: string | undefined;
4415
- apiHealthUrl?: string | undefined;
4416
- headSha?: string | undefined;
4417
- localPreviewProof?: unknown;
4418
- localProofPath?: string | undefined;
4419
- proofSource?: "github-actions" | "local-self-certified" | undefined;
4420
- publicUrl?: string | undefined;
4421
- stage?: string | undefined;
4422
- timingsMs?: Record<string, number | undefined> | undefined;
4423
- workflowRunUrl?: string | undefined;
4424
- } | undefined;
4425
3986
  reviewCycleState?: {
4426
3987
  autoBlockingFindings: number;
4427
3988
  countsBySeverity: {
@@ -4452,12 +4013,19 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
4452
4013
  reviewRuns?: PrReviewResult[] | undefined;
4453
4014
  reviewTerminalState?: "blocked" | "accepted-with-findings" | "clean" | undefined;
4454
4015
  };
4016
+ /**
4017
+ * Facts a reader needs that are not refusals (#477): the settle-window
4018
+ * arming notice, and every waived demand rendered so it can never read as
4019
+ * a met one.
4020
+ */
4021
+ notices: string[];
4455
4022
  repairs: {
4456
4023
  action: string;
4457
- code: "undraft-pr" | "render-pr-body-sections" | "await-post-undraft-checks";
4024
+ code: "undraft-pr" | "await-post-undraft-checks";
4458
4025
  command: string;
4459
4026
  }[];
4460
- status: ReadinessStatus;
4027
+ status: ReadinessStatus; /** Demands that were in force, were NOT met, and the operator waived. */
4028
+ waivedDemands: WaivedDemand[];
4461
4029
  };
4462
4030
  //#endregion
4463
4031
  //#region src/evidence-emit.d.ts
@@ -4711,7 +4279,6 @@ interface AssembleReviewPromptInput {
4711
4279
  patchId: string;
4712
4280
  priorLedgerEntries?: FindingLedgerEntry[];
4713
4281
  profile: FactoryProjectProfile;
4714
- standingChecklist?: readonly string[];
4715
4282
  }
4716
4283
  interface AssembledReviewPrompt {
4717
4284
  prompt: string;
@@ -4725,8 +4292,7 @@ declare const assembleReviewPrompt: ({
4725
4292
  kind,
4726
4293
  patchId,
4727
4294
  priorLedgerEntries,
4728
- profile,
4729
- standingChecklist
4295
+ profile
4730
4296
  }: AssembleReviewPromptInput) => AssembledReviewPrompt;
4731
4297
  //#endregion
4732
4298
  //#region src/review-ladder-trace.d.ts
@@ -4798,7 +4364,6 @@ interface CreateProgramOptions {
4798
4364
  actions?: {
4799
4365
  boundaryCheck?: BoundaryCheckAction;
4800
4366
  demandWaive?: DemandWaiveAction;
4801
- prMergeCheck?: PrMergeCheckAction;
4802
4367
  prPublish?: PrPublishAction;
4803
4368
  prReady?: PrReadyAction;
4804
4369
  prReview?: PrReviewAction;
@@ -4809,4 +4374,4 @@ interface CreateProgramOptions {
4809
4374
  declare function createProgram(options?: CreateProgramOptions): Command;
4810
4375
  declare function run(argv?: string[]): Promise<void>;
4811
4376
  //#endregion
4812
- export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type BuildRetroEnvelopeInput, type CloudflareAccessServiceToken, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeState, type ParsedRetroEnvelope, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, RETRO_ENVELOPE_SCHEMA_VERSION, RETRO_ENVELOPE_VALIDATORS, REVIEW_FOCUS_SECTION, type RetroEnvelope, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationReuse, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertWorkerCheckoutAllowed, authorizeDemandWaiver, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildRetroEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, inferFixedInThreadDispositions, isProductionHqUrl, isRetroEnvelopeWireComplete, loadProjectProfile, normalizeIssueComments, openLadderFindings, parseRetroEnvelope, planPublishFollowUp, worktree_held_branch_d_exports as prMergePreflight, pr_body_metadata_d_exports as prReadinessBodyMetadata, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, merge_identity_d_exports as prReadinessMergeIdentity, post_readiness_comments_d_exports as prReadinessPostComments, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, publishEpicStructure, readDemandWaivers, readPrMergeCheckProof, readPrReadyProof, readPrReviewProof, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, retroEnvelopeSchemaVersionOf, retroEnvelopeV1Schema, retroEpicReference, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrMergeCheck, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrMergeCheckProof, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
4377
+ export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type BuildRetroEnvelopeInput, type CloudflareAccessServiceToken, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeState, type ParsedRetroEnvelope, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, RETRO_ENVELOPE_SCHEMA_VERSION, RETRO_ENVELOPE_VALIDATORS, REVIEW_FOCUS_SECTION, type RetroEnvelope, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, SUPPORTED_RETRO_ENVELOPE_SCHEMA_VERSIONS, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationReuse, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertWorkerCheckoutAllowed, authorizeDemandWaiver, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildRetroEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, inferFixedInThreadDispositions, isProductionHqUrl, isRetroEnvelopeWireComplete, loadProjectProfile, normalizeIssueComments, openLadderFindings, parseRetroEnvelope, planPublishFollowUp, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, publishEpicStructure, readDemandWaivers, readPrReadyProof, readPrReviewProof, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, retroEnvelopeSchemaVersionOf, retroEnvelopeV1Schema, retroEpicReference, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };