@patronage/software-factory 1.0.0-alpha.46 → 1.0.0-alpha.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/cloud/credentials.d.mts +21 -0
- package/dist/cloud/credentials.mjs +136 -0
- package/dist/cloud/install-tools.sh +59 -0
- package/dist/index.d.ts +1827 -1816
- package/dist/index.js +30 -67
- package/dist/schemas.d.ts +488 -480
- package/dist/schemas.js +8 -8
- package/package.json +8 -3
package/dist/index.d.ts
CHANGED
|
@@ -952,259 +952,6 @@ declare const blockedReasonSchema: z.ZodObject<{
|
|
|
952
952
|
detail: z.ZodString;
|
|
953
953
|
}, z.core.$strip>;
|
|
954
954
|
type BlockedReason = z.infer<typeof blockedReasonSchema>;
|
|
955
|
-
/**
|
|
956
|
-
* How GitHub merges the candidate. `pr:ready` chooses `merge` for a
|
|
957
|
-
* recognized faithful catch-up merge (ADR 0028), because a squash drops the
|
|
958
|
-
* second parent and the target loses the merged base as an ancestor (#829).
|
|
959
|
-
* Every other candidate is squashed.
|
|
960
|
-
*/
|
|
961
|
-
type AutoMergeMethod = "merge" | "squash";
|
|
962
|
-
interface ArmAutoMergeInput {
|
|
963
|
-
cwd: string;
|
|
964
|
-
/** The validated PR head this arming is a compare-and-set against. */
|
|
965
|
-
headSha: string;
|
|
966
|
-
mergeMethod: AutoMergeMethod;
|
|
967
|
-
owner: string;
|
|
968
|
-
pr: number;
|
|
969
|
-
repo: string;
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* What the PR actually did, read back after the call — never inferred from the
|
|
973
|
-
* exit code. `not-armed` is a failure: the candidate is admitted but nothing
|
|
974
|
-
* will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
|
|
975
|
-
*/
|
|
976
|
-
interface ArmAutoMergeOutcome {
|
|
977
|
-
/** Why the arming did not take effect, or what the invocation reported. */
|
|
978
|
-
detail?: string;
|
|
979
|
-
headSha: string;
|
|
980
|
-
outcome: "armed" | "merged" | "not-armed";
|
|
981
|
-
}
|
|
982
|
-
interface CheckoutRepository {
|
|
983
|
-
name: string;
|
|
984
|
-
owner: string;
|
|
985
|
-
}
|
|
986
|
-
export declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
|
|
987
|
-
/** The one profile shape this build accepts (ADR 0021, #318, #351, #742). */
|
|
988
|
-
declare const PROFILE_SCHEMA_VERSION = 6;
|
|
989
|
-
declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
990
|
-
$schema: z.ZodOptional<z.ZodString>;
|
|
991
|
-
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
992
|
-
hq: z.ZodOptional<z.ZodObject<{
|
|
993
|
-
enabled: z.ZodBoolean;
|
|
994
|
-
endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
|
|
995
|
-
}, z.core.$strict>>;
|
|
996
|
-
impact: z.ZodOptional<z.ZodObject<{
|
|
997
|
-
dependencyLocal: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
998
|
-
inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
999
|
-
targets: z.ZodArray<z.ZodObject<{
|
|
1000
|
-
importers: z.ZodArray<z.ZodString>;
|
|
1001
|
-
name: z.ZodString;
|
|
1002
|
-
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1003
|
-
}, z.core.$strict>>;
|
|
1004
|
-
}, z.core.$strict>>;
|
|
1005
|
-
lifecycleContract: z.ZodOptional<z.ZodObject<{
|
|
1006
|
-
command: z.ZodString;
|
|
1007
|
-
jobName: z.ZodOptional<z.ZodString>;
|
|
1008
|
-
}, z.core.$strict>>;
|
|
1009
|
-
repository: z.ZodObject<{
|
|
1010
|
-
name: z.ZodString;
|
|
1011
|
-
owner: z.ZodString;
|
|
1012
|
-
}, z.core.$strict>;
|
|
1013
|
-
requiredChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1014
|
-
name: z.ZodString;
|
|
1015
|
-
scope: z.ZodOptional<z.ZodObject<{
|
|
1016
|
-
classifications: z.ZodArray<z.ZodEnum<{
|
|
1017
|
-
"docs/process-only": "docs/process-only";
|
|
1018
|
-
"non-trivial": "non-trivial";
|
|
1019
|
-
}>>;
|
|
1020
|
-
}, z.core.$strict>>;
|
|
1021
|
-
}, z.core.$strict>>>;
|
|
1022
|
-
review: z.ZodOptional<z.ZodObject<{
|
|
1023
|
-
conditional: z.ZodArray<z.ZodObject<{
|
|
1024
|
-
paths: z.ZodArray<z.ZodString>;
|
|
1025
|
-
}, z.core.$strict>>;
|
|
1026
|
-
}, z.core.$strict>>;
|
|
1027
|
-
schemaVersion: z.ZodLiteral<6>;
|
|
1028
|
-
verification: z.ZodObject<{
|
|
1029
|
-
commands: z.ZodArray<z.ZodObject<{
|
|
1030
|
-
command: z.ZodString;
|
|
1031
|
-
description: z.ZodString;
|
|
1032
|
-
impactTarget: z.ZodOptional<z.ZodString>;
|
|
1033
|
-
name: z.ZodString;
|
|
1034
|
-
requiredCheck: z.ZodOptional<z.ZodString>;
|
|
1035
|
-
scope: z.ZodDefault<z.ZodEnum<{
|
|
1036
|
-
"docs-only": "docs-only";
|
|
1037
|
-
full: "full";
|
|
1038
|
-
trivial: "trivial";
|
|
1039
|
-
}>>;
|
|
1040
|
-
}, z.core.$strip>>;
|
|
1041
|
-
}, z.core.$strip>;
|
|
1042
|
-
}, z.core.$strict>;
|
|
1043
|
-
type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
|
|
1044
|
-
export declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
|
|
1045
|
-
interface LoadProjectProfileInput {
|
|
1046
|
-
cwd?: string;
|
|
1047
|
-
profilePath?: string;
|
|
1048
|
-
}
|
|
1049
|
-
interface LoadProjectProfileResult {
|
|
1050
|
-
path: string;
|
|
1051
|
-
profile: FactoryProjectProfile;
|
|
1052
|
-
}
|
|
1053
|
-
export declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
|
|
1054
|
-
interface CatchUpRecognition {
|
|
1055
|
-
/** The ref the candidate targets, as the recognizing command resolved it. */
|
|
1056
|
-
baseRef: string;
|
|
1057
|
-
/** The live target tip at recognition time; the head's first parent. */
|
|
1058
|
-
baseTipSha: string;
|
|
1059
|
-
/** The head's second parent: the admitted base-side content merged in. */
|
|
1060
|
-
mergedParentSha: string;
|
|
1061
|
-
/**
|
|
1062
|
-
* The tree `git merge-tree --write-tree` produced for the two parents. It
|
|
1063
|
-
* equals the head's own tree; that equality is the faithfulness proof.
|
|
1064
|
-
*/
|
|
1065
|
-
mergedTreeSha: string;
|
|
1066
|
-
/** The ref that proves the second parent is admitted content. */
|
|
1067
|
-
upstreamRef: string;
|
|
1068
|
-
}
|
|
1069
|
-
declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
|
|
1070
|
-
type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
|
|
1071
|
-
/**
|
|
1072
|
-
* The recorded stamp. `targets` satisfies the completeness invariant: every
|
|
1073
|
-
* target the profile declares is present, each with its exact basis — never
|
|
1074
|
-
* silently absent. `basis: "conservative"` means an unmodelled or unprovable
|
|
1075
|
-
* input widened every target to full impact.
|
|
1076
|
-
*/
|
|
1077
|
-
declare const impactStampSchema: z.ZodObject<{
|
|
1078
|
-
basis: z.ZodEnum<{
|
|
1079
|
-
conservative: "conservative";
|
|
1080
|
-
"target-scoped": "target-scoped";
|
|
1081
|
-
}>;
|
|
1082
|
-
inertPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1083
|
-
reasons: z.ZodArray<z.ZodString>;
|
|
1084
|
-
stampVersion: z.ZodLiteral<4>;
|
|
1085
|
-
targets: z.ZodArray<z.ZodObject<{
|
|
1086
|
-
basis: z.ZodString;
|
|
1087
|
-
impact: z.ZodEnum<{
|
|
1088
|
-
affected: "affected";
|
|
1089
|
-
"not-affected": "not-affected";
|
|
1090
|
-
}>;
|
|
1091
|
-
name: z.ZodString;
|
|
1092
|
-
subscribedPaths: z.ZodArray<z.ZodString>;
|
|
1093
|
-
}, z.core.$strip>>;
|
|
1094
|
-
unsubscribedPaths: z.ZodArray<z.ZodString>;
|
|
1095
|
-
}, z.core.$strip>;
|
|
1096
|
-
type ImpactStamp = z.infer<typeof impactStampSchema>;
|
|
1097
|
-
/**
|
|
1098
|
-
* The surfaces that consume the stamp. One classification, consumed
|
|
1099
|
-
* everywhere (#430): every surface routes through
|
|
1100
|
-
* {@link impactStampScopeDecision}, so no surface can be more trusting than
|
|
1101
|
-
* another, and no surface re-derives path rules of its own. The value only
|
|
1102
|
-
* selects the wording of the conservative floor a refusal falls back to.
|
|
1103
|
-
*/
|
|
1104
|
-
declare const IMPACT_SCOPE_SURFACES: {
|
|
1105
|
-
readonly demand: "full demand floor";
|
|
1106
|
-
readonly "preview-lifecycle": "full preview-lifecycle floor";
|
|
1107
|
-
readonly "verification-battery": "full verification-battery floor";
|
|
1108
|
-
};
|
|
1109
|
-
type ImpactScopeSurface = keyof typeof IMPACT_SCOPE_SURFACES;
|
|
1110
|
-
interface ImpactScopeDecision {
|
|
1111
|
-
reason: string;
|
|
1112
|
-
/** True ⇒ this target's work is provably unreachable and may be released. */
|
|
1113
|
-
scoped: boolean;
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* Whether a trusted stamp RELEASES one target-scoped unit of work — an
|
|
1117
|
-
* external proof demand (#542 wave 2), a verification-battery command, or a
|
|
1118
|
-
* preview (Alchemy) lifecycle stack (#430 wave 3).
|
|
1119
|
-
*
|
|
1120
|
-
* The only release path is a `target-scoped` stamp of exactly this build's
|
|
1121
|
-
* stamp version whose target entry for exactly this name is provably
|
|
1122
|
-
* `not-affected`. Every other input — no trusted stamp, an unknown stamp
|
|
1123
|
-
* version, a conservative stamp, a name the stamp does not classify, or an
|
|
1124
|
-
* `affected` verdict — keeps today's full-work floor. Work only ever gets
|
|
1125
|
-
* released, never added or satisfied: this function can withdraw a demand, it
|
|
1126
|
-
* can never certify one.
|
|
1127
|
-
*
|
|
1128
|
-
* Identity binding is the CALLER's precondition: pass only a stamp computed
|
|
1129
|
-
* for, or read from a pr:verify proof bound to, the current candidate (see
|
|
1130
|
-
* `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
|
|
1131
|
-
* `undefined` otherwise.
|
|
1132
|
-
*/
|
|
1133
|
-
export declare const impactStampScopeDecision: ({ stamp, surface, targetName }: {
|
|
1134
|
-
stamp: ImpactStamp | undefined;
|
|
1135
|
-
surface: ImpactScopeSurface;
|
|
1136
|
-
targetName: string;
|
|
1137
|
-
}) => ImpactScopeDecision;
|
|
1138
|
-
declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
|
|
1139
|
-
type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
|
|
1140
|
-
declare const requiredCheckScopeSchema: z.ZodObject<{
|
|
1141
|
-
classifications: z.ZodArray<z.ZodEnum<{
|
|
1142
|
-
"docs/process-only": "docs/process-only";
|
|
1143
|
-
"non-trivial": "non-trivial";
|
|
1144
|
-
trivial: "trivial";
|
|
1145
|
-
}>>;
|
|
1146
|
-
}, z.core.$strict>;
|
|
1147
|
-
type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
|
|
1148
|
-
interface RequiredCheckScopeContext {
|
|
1149
|
-
catchUpRecognition?: CatchUpRecognition;
|
|
1150
|
-
classification: DiffClassification | undefined;
|
|
1151
|
-
impactStamp?: ImpactStamp;
|
|
1152
|
-
}
|
|
1153
|
-
interface ScopeDecision {
|
|
1154
|
-
inScope: boolean;
|
|
1155
|
-
reason: string;
|
|
1156
|
-
}
|
|
1157
|
-
declare const requiredCheckInScope: ({ context, scope }: {
|
|
1158
|
-
context: RequiredCheckScopeContext;
|
|
1159
|
-
scope?: RequiredCheckScope;
|
|
1160
|
-
}) => ScopeDecision;
|
|
1161
|
-
interface RequiredCheck {
|
|
1162
|
-
name: string;
|
|
1163
|
-
checkType: EvidenceCheckType;
|
|
1164
|
-
scope?: RequiredCheckScope;
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* The two GitHub reads that make the base policy authoritative: the live tip of
|
|
1168
|
-
* a branch, and one file's content at an exact commit. Injectable so tests can
|
|
1169
|
-
* state what the authority says; an absent implementation is the real read, so
|
|
1170
|
-
* an unstated authority is a refusal rather than a silent pass.
|
|
1171
|
-
*/
|
|
1172
|
-
interface BaseReviewPolicyAuthority {
|
|
1173
|
-
branchTipSha: (input: {
|
|
1174
|
-
branch: string;
|
|
1175
|
-
cwd: string;
|
|
1176
|
-
repository: CheckoutRepository;
|
|
1177
|
-
}) => string;
|
|
1178
|
-
profileContentAtRef: (input: {
|
|
1179
|
-
cwd: string;
|
|
1180
|
-
profilePath: string;
|
|
1181
|
-
ref: string;
|
|
1182
|
-
repository: CheckoutRepository;
|
|
1183
|
-
}) => string;
|
|
1184
|
-
}
|
|
1185
|
-
/**
|
|
1186
|
-
* The pull request whose base ref is the authority, as the resolving stage
|
|
1187
|
-
* knows it (#922 Slice B).
|
|
1188
|
-
*
|
|
1189
|
-
* `pr:ready` is handed a PR number and reads the record; `pr:verify` and
|
|
1190
|
-
* `pr:review` run in the authoring checkout and look the PR up from the branch,
|
|
1191
|
-
* which can legitimately find nothing. `isCrossRepository` stays `unknown` for
|
|
1192
|
-
* the reason the reader below states: an unstated fork answer is not a "no".
|
|
1193
|
-
*/
|
|
1194
|
-
interface CandidatePullRequestPolicyContext {
|
|
1195
|
-
baseRefName: string;
|
|
1196
|
-
isCrossRepository: unknown;
|
|
1197
|
-
}
|
|
1198
|
-
/** What a stage found when it looked for the pull request that owns this branch. */
|
|
1199
|
-
type CandidatePullRequestLookup = {
|
|
1200
|
-
pullRequest: CandidatePullRequestPolicyContext;
|
|
1201
|
-
status: "found";
|
|
1202
|
-
} | {
|
|
1203
|
-
status: "none";
|
|
1204
|
-
} | {
|
|
1205
|
-
reason: string;
|
|
1206
|
-
status: "unavailable";
|
|
1207
|
-
};
|
|
1208
955
|
interface FactoryCliInvocation {
|
|
1209
956
|
/** Runtime arguments ending with the factory CLI entry module. */
|
|
1210
957
|
argvPrefix: string[];
|
|
@@ -1233,15 +980,604 @@ interface FollowUpAction {
|
|
|
1233
980
|
export declare const followUpFromArgv: (argv: string[]) => FollowUpAction;
|
|
1234
981
|
/** Canonical zod schema for the optional follow-up field on JSON outputs. */
|
|
1235
982
|
export declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
|
|
1236
|
-
/**
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
983
|
+
/**
|
|
984
|
+
* Ledger schema version 2 (#894): `verification` is a tagged union on
|
|
985
|
+
* `prVerify` and `externalChecks` no longer echoes `inScope`. Version 1
|
|
986
|
+
* ledgers are not read — the pre-1.0 posture keeps one shape per contract, so
|
|
987
|
+
* there is no compat reader here.
|
|
988
|
+
*/
|
|
989
|
+
declare const SCHEMA_VERSION = 2;
|
|
990
|
+
declare const READINESS_REPAIR_CODES: readonly ["undraft-pr", "await-post-undraft-checks"];
|
|
991
|
+
declare const readinessRepairSchema: z.ZodObject<{
|
|
992
|
+
action: z.ZodString;
|
|
993
|
+
code: z.ZodEnum<{
|
|
994
|
+
"await-post-undraft-checks": "await-post-undraft-checks";
|
|
995
|
+
"undraft-pr": "undraft-pr";
|
|
996
|
+
}>;
|
|
997
|
+
command: z.ZodString;
|
|
998
|
+
}, z.core.$strip>;
|
|
999
|
+
declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
1000
|
+
baseSha: z.ZodString;
|
|
1001
|
+
blockingReasons: z.ZodArray<z.ZodString>;
|
|
1002
|
+
classification: z.ZodEnum<{
|
|
1003
|
+
"docs/process-only": "docs/process-only";
|
|
1004
|
+
"non-trivial": "non-trivial";
|
|
1005
|
+
trivial: "trivial";
|
|
1006
|
+
}>;
|
|
1007
|
+
externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1008
|
+
checkType: z.ZodEnum<{
|
|
1009
|
+
review: "review";
|
|
1010
|
+
verify: "verify";
|
|
1011
|
+
}>;
|
|
1012
|
+
name: z.ZodString;
|
|
1013
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1014
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
1015
|
+
classifications: z.ZodArray<z.ZodEnum<{
|
|
1016
|
+
"docs/process-only": "docs/process-only";
|
|
1017
|
+
"non-trivial": "non-trivial";
|
|
1018
|
+
trivial: "trivial";
|
|
1019
|
+
}>>;
|
|
1020
|
+
}, z.core.$strict>>;
|
|
1021
|
+
scopeReason: z.ZodString;
|
|
1022
|
+
status: z.ZodEnum<{
|
|
1023
|
+
"out-of-scope": "out-of-scope";
|
|
1024
|
+
satisfied: "satisfied";
|
|
1025
|
+
unmet: "unmet";
|
|
1026
|
+
}>;
|
|
1027
|
+
}, z.core.$strip>>>;
|
|
1028
|
+
github: z.ZodObject<{
|
|
1029
|
+
draft: z.ZodBoolean;
|
|
1030
|
+
mergeStateStatus: z.ZodString;
|
|
1031
|
+
mergeable: z.ZodString;
|
|
1032
|
+
requiredChecks: z.ZodEnum<{
|
|
1033
|
+
failed: "failed";
|
|
1034
|
+
none: "none";
|
|
1035
|
+
passed: "passed";
|
|
1036
|
+
pending: "pending";
|
|
1037
|
+
unknown: "unknown";
|
|
1038
|
+
}>;
|
|
1039
|
+
reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1040
|
+
unresolvedReviewThreads: z.ZodNumber;
|
|
1041
|
+
}, z.core.$strip>;
|
|
1042
|
+
headSha: z.ZodString;
|
|
1043
|
+
mergeBaseSha: z.ZodOptional<z.ZodString>;
|
|
1044
|
+
patchId: z.ZodString;
|
|
1045
|
+
pr: z.ZodNumber;
|
|
1046
|
+
repairs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1047
|
+
action: z.ZodString;
|
|
1048
|
+
code: z.ZodEnum<{
|
|
1049
|
+
"await-post-undraft-checks": "await-post-undraft-checks";
|
|
1050
|
+
"undraft-pr": "undraft-pr";
|
|
1051
|
+
}>;
|
|
1052
|
+
command: z.ZodString;
|
|
1053
|
+
}, z.core.$strip>>>;
|
|
1054
|
+
reviewCycleState: z.ZodOptional<z.ZodObject<{
|
|
1055
|
+
autoBlockingFindings: z.ZodNumber;
|
|
1056
|
+
countsBySeverity: z.ZodObject<{
|
|
1057
|
+
critical: z.ZodNumber;
|
|
1058
|
+
high: z.ZodNumber;
|
|
1059
|
+
low: z.ZodNumber;
|
|
1060
|
+
medium: z.ZodNumber;
|
|
1061
|
+
unknown: z.ZodNumber;
|
|
1062
|
+
}, z.core.$strip>;
|
|
1063
|
+
highestBlockingSeverity: z.ZodOptional<z.ZodEnum<{
|
|
1064
|
+
critical: "critical";
|
|
1065
|
+
high: "high";
|
|
1066
|
+
low: "low";
|
|
1067
|
+
medium: "medium";
|
|
1068
|
+
unknown: "unknown";
|
|
1069
|
+
}>>;
|
|
1070
|
+
highestOpenSeverity: z.ZodOptional<z.ZodEnum<{
|
|
1071
|
+
critical: "critical";
|
|
1072
|
+
high: "high";
|
|
1073
|
+
low: "low";
|
|
1074
|
+
medium: "medium";
|
|
1075
|
+
unknown: "unknown";
|
|
1076
|
+
}>>;
|
|
1077
|
+
maxReviewCycles: z.ZodOptional<z.ZodNumber>;
|
|
1078
|
+
nonBlockingFindings: z.ZodNumber;
|
|
1079
|
+
openFindings: z.ZodNumber;
|
|
1080
|
+
reviewCycle: z.ZodOptional<z.ZodNumber>;
|
|
1081
|
+
staleRepeatFindings: z.ZodOptional<z.ZodNumber>;
|
|
1082
|
+
windowExhausted: z.ZodBoolean;
|
|
1083
|
+
}, z.core.$strip>>;
|
|
1084
|
+
reviewLadder: z.ZodOptional<z.ZodObject<{
|
|
1085
|
+
cycleCounts: z.ZodObject<{
|
|
1086
|
+
gate: z.ZodNumber;
|
|
1087
|
+
interior: z.ZodNumber;
|
|
1088
|
+
}, z.core.$strip>;
|
|
1089
|
+
forcedTransition: z.ZodOptional<z.ZodEnum<{
|
|
1090
|
+
"gate-cap-exhausted": "gate-cap-exhausted";
|
|
1091
|
+
"interior-cap-reached": "interior-cap-reached";
|
|
1092
|
+
}>>;
|
|
1093
|
+
nextAction: z.ZodEnum<{
|
|
1094
|
+
"accept-nonblocking-findings": "accept-nonblocking-findings";
|
|
1095
|
+
"advance-to-gate": "advance-to-gate";
|
|
1096
|
+
"escalate-to-triage": "escalate-to-triage";
|
|
1097
|
+
"ready-for-human": "ready-for-human";
|
|
1098
|
+
"run-gate-cycle": "run-gate-cycle";
|
|
1099
|
+
"run-interior-cycle": "run-interior-cycle";
|
|
1100
|
+
}>;
|
|
1101
|
+
stage: z.ZodEnum<{
|
|
1102
|
+
gate: "gate";
|
|
1103
|
+
interior: "interior";
|
|
1104
|
+
"interior-complete": "interior-complete";
|
|
1105
|
+
}>;
|
|
1106
|
+
}, z.core.$strip>>;
|
|
1107
|
+
reviewRuns: z.ZodOptional<z.ZodArray<z.ZodType<PrReviewResult, unknown, z.core.$ZodTypeInternals<PrReviewResult, unknown>>>>;
|
|
1108
|
+
reviewTerminalState: z.ZodOptional<z.ZodEnum<{
|
|
1109
|
+
"accepted-with-findings": "accepted-with-findings";
|
|
1110
|
+
blocked: "blocked";
|
|
1111
|
+
clean: "clean";
|
|
1112
|
+
}>>;
|
|
1113
|
+
reviews: z.ZodObject<{
|
|
1114
|
+
correctness: z.ZodObject<{
|
|
1115
|
+
required: z.ZodBoolean;
|
|
1116
|
+
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1117
|
+
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1118
|
+
status: z.ZodEnum<{
|
|
1119
|
+
blocked: "blocked";
|
|
1120
|
+
current: "current";
|
|
1121
|
+
missing: "missing";
|
|
1122
|
+
"not-required": "not-required";
|
|
1123
|
+
stale: "stale";
|
|
1124
|
+
}>;
|
|
1125
|
+
}, z.core.$strip>;
|
|
1126
|
+
security: z.ZodOptional<z.ZodObject<{
|
|
1127
|
+
required: z.ZodBoolean;
|
|
1128
|
+
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1129
|
+
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1130
|
+
status: z.ZodEnum<{
|
|
1131
|
+
blocked: "blocked";
|
|
1132
|
+
current: "current";
|
|
1133
|
+
missing: "missing";
|
|
1134
|
+
"not-required": "not-required";
|
|
1135
|
+
stale: "stale";
|
|
1136
|
+
}>;
|
|
1137
|
+
}, z.core.$strip>>;
|
|
1138
|
+
}, z.core.$strip>;
|
|
1139
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
1140
|
+
verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1141
|
+
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1142
|
+
prVerify: z.ZodLiteral<"missing">;
|
|
1143
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1144
|
+
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1145
|
+
prVerify: z.ZodLiteral<"stale">;
|
|
1146
|
+
verifiedHeadSha: z.ZodString;
|
|
1147
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1148
|
+
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1149
|
+
prVerify: z.ZodLiteral<"passed-via-head">;
|
|
1150
|
+
verifiedHeadSha: z.ZodString;
|
|
1151
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1152
|
+
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1153
|
+
docsOnlyVerifiedHeadSha: z.ZodString;
|
|
1154
|
+
prVerify: z.ZodLiteral<"docs-only-delta">;
|
|
1155
|
+
verifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1156
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1157
|
+
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1158
|
+
prVerify: z.ZodLiteral<"trivial-delta">;
|
|
1159
|
+
trivialVerifiedHeadSha: z.ZodString;
|
|
1160
|
+
verifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1161
|
+
}, z.core.$strict>], "prVerify">;
|
|
1162
|
+
}, z.core.$strip>;
|
|
1163
|
+
type ReadinessRepair = z.infer<typeof readinessRepairSchema>;
|
|
1164
|
+
type ReadinessStatus = "ready" | "blocked";
|
|
1165
|
+
type ManagedReadinessLedger = z.infer<typeof managedReadinessLedgerSchema>;
|
|
1166
|
+
declare function validateManagedReadinessLedger(value: unknown): ManagedReadinessLedger;
|
|
1167
|
+
interface CatchUpRecognition {
|
|
1168
|
+
/** The ref the candidate targets, as the recognizing command resolved it. */
|
|
1169
|
+
baseRef: string;
|
|
1170
|
+
/** The live target tip at recognition time; the head's first parent. */
|
|
1171
|
+
baseTipSha: string;
|
|
1172
|
+
/** The head's second parent: the admitted base-side content merged in. */
|
|
1173
|
+
mergedParentSha: string;
|
|
1174
|
+
/**
|
|
1175
|
+
* The tree `git merge-tree --write-tree` produced for the two parents. It
|
|
1176
|
+
* equals the head's own tree; that equality is the faithfulness proof.
|
|
1177
|
+
*/
|
|
1178
|
+
mergedTreeSha: string;
|
|
1179
|
+
/** The ref that proves the second parent is admitted content. */
|
|
1180
|
+
upstreamRef: string;
|
|
1181
|
+
}
|
|
1182
|
+
declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
|
|
1183
|
+
type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
|
|
1184
|
+
/**
|
|
1185
|
+
* The recorded stamp. `targets` satisfies the completeness invariant: every
|
|
1186
|
+
* target the profile declares is present, each with its exact basis — never
|
|
1187
|
+
* silently absent. `basis: "conservative"` means an unmodelled or unprovable
|
|
1188
|
+
* input widened every target to full impact.
|
|
1189
|
+
*/
|
|
1190
|
+
declare const impactStampSchema: z.ZodObject<{
|
|
1191
|
+
basis: z.ZodEnum<{
|
|
1192
|
+
conservative: "conservative";
|
|
1193
|
+
"target-scoped": "target-scoped";
|
|
1194
|
+
}>;
|
|
1195
|
+
inertPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1196
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
1197
|
+
stampVersion: z.ZodLiteral<4>;
|
|
1198
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
1199
|
+
basis: z.ZodString;
|
|
1200
|
+
impact: z.ZodEnum<{
|
|
1201
|
+
affected: "affected";
|
|
1202
|
+
"not-affected": "not-affected";
|
|
1203
|
+
}>;
|
|
1204
|
+
name: z.ZodString;
|
|
1205
|
+
subscribedPaths: z.ZodArray<z.ZodString>;
|
|
1206
|
+
}, z.core.$strip>>;
|
|
1207
|
+
unsubscribedPaths: z.ZodArray<z.ZodString>;
|
|
1208
|
+
}, z.core.$strip>;
|
|
1209
|
+
type ImpactStamp = z.infer<typeof impactStampSchema>;
|
|
1210
|
+
/**
|
|
1211
|
+
* The surfaces that consume the stamp. One classification, consumed
|
|
1212
|
+
* everywhere (#430): every surface routes through
|
|
1213
|
+
* {@link impactStampScopeDecision}, so no surface can be more trusting than
|
|
1214
|
+
* another, and no surface re-derives path rules of its own. The value only
|
|
1215
|
+
* selects the wording of the conservative floor a refusal falls back to.
|
|
1216
|
+
*/
|
|
1217
|
+
declare const IMPACT_SCOPE_SURFACES: {
|
|
1218
|
+
readonly demand: "full demand floor";
|
|
1219
|
+
readonly "preview-lifecycle": "full preview-lifecycle floor";
|
|
1220
|
+
readonly "verification-battery": "full verification-battery floor";
|
|
1221
|
+
};
|
|
1222
|
+
type ImpactScopeSurface = keyof typeof IMPACT_SCOPE_SURFACES;
|
|
1223
|
+
interface ImpactScopeDecision {
|
|
1224
|
+
reason: string;
|
|
1225
|
+
/** True ⇒ this target's work is provably unreachable and may be released. */
|
|
1226
|
+
scoped: boolean;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Whether a trusted stamp RELEASES one target-scoped unit of work — an
|
|
1230
|
+
* external proof demand (#542 wave 2), a verification-battery command, or a
|
|
1231
|
+
* preview (Alchemy) lifecycle stack (#430 wave 3).
|
|
1232
|
+
*
|
|
1233
|
+
* The only release path is a `target-scoped` stamp of exactly this build's
|
|
1234
|
+
* stamp version whose target entry for exactly this name is provably
|
|
1235
|
+
* `not-affected`. Every other input — no trusted stamp, an unknown stamp
|
|
1236
|
+
* version, a conservative stamp, a name the stamp does not classify, or an
|
|
1237
|
+
* `affected` verdict — keeps today's full-work floor. Work only ever gets
|
|
1238
|
+
* released, never added or satisfied: this function can withdraw a demand, it
|
|
1239
|
+
* can never certify one.
|
|
1240
|
+
*
|
|
1241
|
+
* Identity binding is the CALLER's precondition: pass only a stamp computed
|
|
1242
|
+
* for, or read from a pr:verify proof bound to, the current candidate (see
|
|
1243
|
+
* `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
|
|
1244
|
+
* `undefined` otherwise.
|
|
1245
|
+
*/
|
|
1246
|
+
export declare const impactStampScopeDecision: ({ stamp, surface, targetName }: {
|
|
1247
|
+
stamp: ImpactStamp | undefined;
|
|
1248
|
+
surface: ImpactScopeSurface;
|
|
1249
|
+
targetName: string;
|
|
1250
|
+
}) => ImpactScopeDecision;
|
|
1251
|
+
declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
|
|
1252
|
+
type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
|
|
1253
|
+
declare const requiredCheckScopeSchema: z.ZodObject<{
|
|
1254
|
+
classifications: z.ZodArray<z.ZodEnum<{
|
|
1255
|
+
"docs/process-only": "docs/process-only";
|
|
1256
|
+
"non-trivial": "non-trivial";
|
|
1257
|
+
trivial: "trivial";
|
|
1258
|
+
}>>;
|
|
1259
|
+
}, z.core.$strict>;
|
|
1260
|
+
type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
|
|
1261
|
+
interface RequiredCheckScopeContext {
|
|
1262
|
+
catchUpRecognition?: CatchUpRecognition;
|
|
1263
|
+
classification: DiffClassification | undefined;
|
|
1264
|
+
impactStamp?: ImpactStamp;
|
|
1265
|
+
}
|
|
1266
|
+
interface ScopeDecision {
|
|
1267
|
+
inScope: boolean;
|
|
1268
|
+
reason: string;
|
|
1269
|
+
}
|
|
1270
|
+
declare const requiredCheckInScope: ({ context, scope }: {
|
|
1271
|
+
context: RequiredCheckScopeContext;
|
|
1272
|
+
scope?: RequiredCheckScope;
|
|
1273
|
+
}) => ScopeDecision;
|
|
1274
|
+
interface RequiredCheck {
|
|
1275
|
+
name: string;
|
|
1276
|
+
checkType: EvidenceCheckType;
|
|
1277
|
+
scope?: RequiredCheckScope;
|
|
1278
|
+
}
|
|
1279
|
+
declare const resolveAuthoringSessionIds: ({ override, recorded }: {
|
|
1280
|
+
override?: string[];
|
|
1281
|
+
recorded?: string;
|
|
1282
|
+
}) => string[];
|
|
1283
|
+
declare namespace external_evidence_d_exports {
|
|
1284
|
+
export { EVIDENCE_CHECK_TYPES, EVIDENCE_DIR, EVIDENCE_ENVELOPE_SCHEMA_VERSION, EVIDENCE_REVIEW_RUNGS, EvidenceCandidateIdentity, EvidenceCheckType, EvidenceEnvelope, EvidenceEnvelopeParse, EvidenceReviewRung, IndependenceResult, LoadedEvidenceEnvelope, RequiredCheck, RequiredCheckEvaluation, RequiredCheckEvaluationInput, RequiredCheckOutcome, RequiredCheckScope, RequiredCheckScopeContext, ScopeDecision, boundFailingCheckNames, evaluateRequiredChecks, evidenceBindingFresh, evidenceEnvelopeSchema, evidenceReviewIndependence, loadEvidenceEnvelopes, parseEvidenceEnvelope, requiredCheckInScope, requiredCheckScopeSchema, resolveAuthoringSessionIds };
|
|
1285
|
+
}
|
|
1286
|
+
declare const EVIDENCE_ENVELOPE_SCHEMA_VERSION = 1;
|
|
1287
|
+
declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
|
|
1288
|
+
check: z.ZodString;
|
|
1289
|
+
checkType: z.ZodEnum<{
|
|
1290
|
+
review: "review";
|
|
1291
|
+
verify: "verify";
|
|
1292
|
+
}>;
|
|
1293
|
+
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
1294
|
+
headSha: z.ZodString;
|
|
1295
|
+
mergeBaseSha: z.ZodString;
|
|
1296
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1297
|
+
outcome: z.ZodEnum<{
|
|
1298
|
+
fail: "fail";
|
|
1299
|
+
pass: "pass";
|
|
1300
|
+
}>;
|
|
1301
|
+
patchId: z.ZodString;
|
|
1302
|
+
policyVersion: z.ZodOptional<z.ZodString>;
|
|
1303
|
+
producer: z.ZodString;
|
|
1304
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
1305
|
+
rung: z.ZodOptional<z.ZodEnum<{
|
|
1306
|
+
human: "human";
|
|
1307
|
+
"independent-model": "independent-model";
|
|
1308
|
+
oracle: "oracle";
|
|
1309
|
+
}>>;
|
|
1310
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1311
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1312
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1313
|
+
}, z.core.$loose>;
|
|
1314
|
+
declare const evidenceEnvelopeSchema: z.ZodObject<{
|
|
1315
|
+
check: z.ZodString;
|
|
1316
|
+
checkType: z.ZodEnum<{
|
|
1317
|
+
review: "review";
|
|
1318
|
+
verify: "verify";
|
|
1319
|
+
}>;
|
|
1320
|
+
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
1321
|
+
headSha: z.ZodString;
|
|
1322
|
+
mergeBaseSha: z.ZodString;
|
|
1323
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1324
|
+
outcome: z.ZodEnum<{
|
|
1325
|
+
fail: "fail";
|
|
1326
|
+
pass: "pass";
|
|
1327
|
+
}>;
|
|
1328
|
+
patchId: z.ZodString;
|
|
1329
|
+
policyVersion: z.ZodOptional<z.ZodString>;
|
|
1330
|
+
producer: z.ZodString;
|
|
1331
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
1332
|
+
rung: z.ZodOptional<z.ZodEnum<{
|
|
1333
|
+
human: "human";
|
|
1334
|
+
"independent-model": "independent-model";
|
|
1335
|
+
oracle: "oracle";
|
|
1336
|
+
}>>;
|
|
1337
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1338
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1339
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1340
|
+
}, z.core.$loose>;
|
|
1341
|
+
type EvidenceEnvelope = z.infer<typeof evidenceEnvelopeBaseSchema>;
|
|
1342
|
+
type EvidenceEnvelopeParse = {
|
|
1343
|
+
ok: true;
|
|
1344
|
+
envelope: EvidenceEnvelope;
|
|
1345
|
+
} | {
|
|
1346
|
+
ok: false;
|
|
1347
|
+
error: string;
|
|
1348
|
+
};
|
|
1349
|
+
declare const parseEvidenceEnvelope: (raw: unknown) => EvidenceEnvelopeParse;
|
|
1350
|
+
interface EvidenceCandidateIdentity {
|
|
1351
|
+
headSha: string;
|
|
1352
|
+
patchId: string;
|
|
1353
|
+
mergeBaseSha: string;
|
|
1354
|
+
}
|
|
1355
|
+
declare const evidenceBindingFresh: ({ candidate, envelope }: {
|
|
1356
|
+
candidate: EvidenceCandidateIdentity;
|
|
1357
|
+
envelope: EvidenceEnvelope;
|
|
1358
|
+
}) => boolean;
|
|
1359
|
+
interface IndependenceResult {
|
|
1360
|
+
independent: boolean;
|
|
1361
|
+
reason?: "no-session" | "unknown-authoring-identity" | "same-session";
|
|
1362
|
+
}
|
|
1363
|
+
declare const evidenceReviewIndependence: ({ authoringSessionIds, envelope }: {
|
|
1364
|
+
authoringSessionIds: string[];
|
|
1365
|
+
envelope: EvidenceEnvelope;
|
|
1366
|
+
}) => IndependenceResult;
|
|
1367
|
+
type LoadedEvidenceEnvelope = {
|
|
1368
|
+
ok: true;
|
|
1369
|
+
envelope: EvidenceEnvelope;
|
|
1370
|
+
path: string;
|
|
1371
|
+
} | {
|
|
1372
|
+
check?: string;
|
|
1373
|
+
error: string;
|
|
1374
|
+
ok: false;
|
|
1375
|
+
path: string;
|
|
1376
|
+
};
|
|
1377
|
+
/**
|
|
1378
|
+
* Every check name with a current, candidate-bound FAILING envelope on disk.
|
|
1379
|
+
*
|
|
1380
|
+
* The wave-3 scoping veto input. Callers pass the resolved set to
|
|
1381
|
+
* `planVerificationBattery` / `planPreviewLifecycle`, which stay pure — the
|
|
1382
|
+
* planners decide, they never read the filesystem.
|
|
1383
|
+
*
|
|
1384
|
+
* `checkType` is the caller's, not a guess: schema-v5 requiredChecks are
|
|
1385
|
+
* verify-only (`resolveProfileRequiredChecks`), so a scoping caller passes
|
|
1386
|
+
* `"verify"` and matches exactly the pair wave 2 evaluates.
|
|
1387
|
+
*/
|
|
1388
|
+
declare const boundFailingCheckNames: ({ candidate, checkType, envelopes }: {
|
|
1389
|
+
candidate: EvidenceCandidateIdentity;
|
|
1390
|
+
checkType: EvidenceCheckType;
|
|
1391
|
+
envelopes: LoadedEvidenceEnvelope[];
|
|
1392
|
+
}) => string[];
|
|
1393
|
+
interface RequiredCheckEvaluationInput {
|
|
1394
|
+
authoringSessionIds: string[];
|
|
1395
|
+
candidate: EvidenceCandidateIdentity;
|
|
1396
|
+
envelopes: LoadedEvidenceEnvelope[];
|
|
1397
|
+
requiredChecks: RequiredCheck[];
|
|
1398
|
+
scopeContext: RequiredCheckScopeContext;
|
|
1399
|
+
}
|
|
1400
|
+
interface RequiredCheckOutcome {
|
|
1401
|
+
name: string;
|
|
1402
|
+
checkType: EvidenceCheckType;
|
|
1403
|
+
status: "satisfied" | "unmet" | "out-of-scope";
|
|
1404
|
+
scopeReason: string;
|
|
1405
|
+
scope?: RequiredCheckScope;
|
|
1406
|
+
reason?: string;
|
|
1407
|
+
matchedPath?: string;
|
|
1408
|
+
}
|
|
1409
|
+
interface RequiredCheckEvaluation {
|
|
1410
|
+
outcomes: RequiredCheckOutcome[];
|
|
1411
|
+
blockingReasons: string[];
|
|
1412
|
+
}
|
|
1413
|
+
declare const evaluateRequiredChecks: ({ authoringSessionIds, candidate, envelopes, requiredChecks, scopeContext }: RequiredCheckEvaluationInput) => RequiredCheckEvaluation;
|
|
1414
|
+
declare const EVIDENCE_DIR = ".factory-memory/evidence";
|
|
1415
|
+
declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
|
|
1416
|
+
interface ProofDescriptor<T> {
|
|
1417
|
+
label: string;
|
|
1418
|
+
defaultPath: string;
|
|
1419
|
+
schemaVersion: number;
|
|
1420
|
+
parse: (raw: unknown) => T;
|
|
1421
|
+
}
|
|
1422
|
+
declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
|
|
1423
|
+
declare const reviewStatusSchema: z.ZodEnum<{
|
|
1424
|
+
blocked: "blocked";
|
|
1425
|
+
current: "current";
|
|
1426
|
+
missing: "missing";
|
|
1427
|
+
"not-required": "not-required";
|
|
1428
|
+
stale: "stale";
|
|
1429
|
+
}>;
|
|
1430
|
+
type ReviewStatus = z.infer<typeof reviewStatusSchema>;
|
|
1431
|
+
interface CurrentReviewIdentity {
|
|
1432
|
+
headSha: string;
|
|
1433
|
+
patchId: string;
|
|
1434
|
+
}
|
|
1435
|
+
declare const reviewStatus: ({ blocked, required, reviewedHeadSha, reviewedPatchId, headSha, patchId }: CurrentReviewIdentity & {
|
|
1436
|
+
blocked?: boolean;
|
|
1437
|
+
required: boolean;
|
|
1438
|
+
reviewedHeadSha?: string;
|
|
1439
|
+
reviewedPatchId?: string;
|
|
1440
|
+
}) => ReviewStatus;
|
|
1441
|
+
declare namespace proof_identity_d_exports {
|
|
1442
|
+
export { CurrentReviewIdentity, REVIEW_STATUS_VALUES, ReviewProofClaim, ReviewStatus, explicitFailureIdentity, isExplicitReviewFailure, isUntypedReviewProof, reviewStatus, reviewStatusSchema, selectReviewProof };
|
|
1443
|
+
}
|
|
1444
|
+
type ReviewProofClaim = {
|
|
1445
|
+
reviewedHeadSha?: string;
|
|
1446
|
+
reviewedPatchId?: string;
|
|
1447
|
+
untypedVerdict?: boolean;
|
|
1448
|
+
} | {
|
|
1449
|
+
explicitFailure: true;
|
|
1450
|
+
reviewedHeadSha?: string;
|
|
1451
|
+
reviewedPatchId?: string;
|
|
1452
|
+
untypedVerdict?: boolean;
|
|
1453
|
+
};
|
|
1454
|
+
declare const isExplicitReviewFailure: (proof: ReviewProofClaim) => proof is {
|
|
1455
|
+
explicitFailure: true;
|
|
1456
|
+
reviewedHeadSha?: string;
|
|
1457
|
+
reviewedPatchId?: string;
|
|
1458
|
+
untypedVerdict?: boolean;
|
|
1459
|
+
};
|
|
1460
|
+
declare const isUntypedReviewProof: (proof: ReviewProofClaim) => proof is {
|
|
1461
|
+
untypedVerdict: true;
|
|
1462
|
+
reviewedHeadSha?: string;
|
|
1463
|
+
reviewedPatchId?: string;
|
|
1464
|
+
};
|
|
1465
|
+
declare const explicitFailureIdentity: (proof: ReviewProofClaim) => {
|
|
1466
|
+
reviewedHeadSha?: string;
|
|
1467
|
+
reviewedPatchId?: string;
|
|
1468
|
+
};
|
|
1469
|
+
declare const selectReviewProof: ({ reviewProof }: {
|
|
1470
|
+
reviewProof: ReviewProofClaim;
|
|
1471
|
+
}) => {
|
|
1472
|
+
reviewedHeadSha?: string;
|
|
1473
|
+
reviewedPatchId?: string;
|
|
1474
|
+
untypedVerdict?: boolean;
|
|
1475
|
+
};
|
|
1476
|
+
interface ReviewCycleState {
|
|
1477
|
+
autoBlockingFindings: number;
|
|
1478
|
+
countsBySeverity: Record<ReviewFindingSeverity, number>;
|
|
1479
|
+
highestBlockingSeverity?: ReviewFindingSeverity;
|
|
1480
|
+
highestOpenSeverity?: ReviewFindingSeverity;
|
|
1481
|
+
maxReviewCycles?: number;
|
|
1482
|
+
nonBlockingFindings: number;
|
|
1483
|
+
openFindings: number;
|
|
1484
|
+
reviewCycle?: number;
|
|
1485
|
+
staleRepeatFindings?: number;
|
|
1486
|
+
windowExhausted: boolean;
|
|
1487
|
+
}
|
|
1488
|
+
declare const reviewCycleStateFor: (proof: Pick<PrReviewProof, "ladder" | "reviewCycle" | "maxReviewCycles" | "reviews">, policy?: ReviewLadderPolicy) => ReviewCycleState;
|
|
1489
|
+
type ReviewAcceptance = "accepted-after-cap" | "accepted-clean" | "accepted-through-ladder" | "blocked";
|
|
1490
|
+
declare const resolveReviewAcceptance: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewAcceptance;
|
|
1491
|
+
type ReviewTerminalState = "accepted-with-findings" | "blocked" | "clean";
|
|
1492
|
+
declare const resolveReviewTerminalStateForEpoch: (proof: PrReviewProof, review: PrReviewResult, epoch: ReviewEpochMode) => ReviewTerminalState;
|
|
1493
|
+
declare const resolveReviewTerminalState: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewTerminalState;
|
|
1494
|
+
declare const resolveReviewTerminalStateAcrossReviews: (proof: PrReviewProof, epoch: ReviewEpochMode) => ReviewTerminalState | undefined;
|
|
1495
|
+
declare const resolveReviewTerminalStateAcrossReviewsForPolicy: (proof: PrReviewProof, policy: ReviewLadderPolicy) => ReviewTerminalState | undefined;
|
|
1496
|
+
declare const reviewProofFor: (proof: PrReviewProof | undefined, kind: PrReviewKind, policy: ReviewLadderPolicy | undefined, current?: {
|
|
1497
|
+
patchId: string;
|
|
1498
|
+
}) => ReviewProofClaim;
|
|
1499
|
+
declare namespace review_proof_d_exports {
|
|
1500
|
+
export { DEFAULT_PR_REVIEW_MAX_CYCLES, DEFAULT_PR_REVIEW_PROOF_PATH, PR_REVIEW_FINAL_READINESS_NOTICE, PR_REVIEW_FINDING_PROVENANCE_VERSION, PR_REVIEW_PROOF_DESCRIPTOR, PR_REVIEW_SCHEMA_VERSION, PrReviewFinding, PrReviewKind, PrReviewLadderState, PrReviewMode, PrReviewOutcome, PrReviewProof, PrReviewResult, PrReviewStageResolution, REVIEW_SEVERITIES, ReviewAcceptance, ReviewCycleState, ReviewFindingCategory, ReviewFindingSeverity, ReviewTerminalState, prReviewFindingSchema, prReviewProofSchema, prReviewResultSchema, resolveReviewAcceptance, resolveReviewTerminalState, resolveReviewTerminalStateAcrossReviews, resolveReviewTerminalStateAcrossReviewsForPolicy, resolveReviewTerminalStateForEpoch, reviewCycleStateFor, reviewProofFor, validatePrReviewProof, validatePrReviewResult };
|
|
1501
|
+
}
|
|
1502
|
+
declare const PR_REVIEW_SCHEMA_VERSION = 3;
|
|
1503
|
+
declare const PR_REVIEW_FINDING_PROVENANCE_VERSION = 1;
|
|
1504
|
+
declare const DEFAULT_PR_REVIEW_PROOF_PATH = ".factory-memory/pr-review.json";
|
|
1505
|
+
declare const DEFAULT_PR_REVIEW_MAX_CYCLES = 5;
|
|
1506
|
+
declare const PR_REVIEW_FINAL_READINESS_NOTICE = "pr:review is a final readiness proof gate. Run it after local verification and avoid repeated full runs unless the review proof records actionable findings. Default review window: 5 cycles.";
|
|
1507
|
+
declare const prReviewFindingSchema: z.ZodType<PrReviewFinding>;
|
|
1508
|
+
declare const prReviewResultSchema: z.ZodType<PrReviewResult>;
|
|
1509
|
+
declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
|
|
1510
|
+
declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
|
|
1511
|
+
declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
|
|
1512
|
+
declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
|
|
1513
|
+
export declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
|
|
1514
|
+
/** The one profile shape this build accepts (ADR 0021, #318, #351, #742). */
|
|
1515
|
+
declare const PROFILE_SCHEMA_VERSION = 6;
|
|
1516
|
+
declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
1517
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
1518
|
+
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1519
|
+
hq: z.ZodOptional<z.ZodObject<{
|
|
1520
|
+
enabled: z.ZodBoolean;
|
|
1521
|
+
endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
|
|
1522
|
+
}, z.core.$strict>>;
|
|
1523
|
+
impact: z.ZodOptional<z.ZodObject<{
|
|
1524
|
+
dependencyLocal: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1525
|
+
inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1526
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
1527
|
+
importers: z.ZodArray<z.ZodString>;
|
|
1528
|
+
name: z.ZodString;
|
|
1529
|
+
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1530
|
+
}, z.core.$strict>>;
|
|
1531
|
+
}, z.core.$strict>>;
|
|
1532
|
+
lifecycleContract: z.ZodOptional<z.ZodObject<{
|
|
1533
|
+
command: z.ZodString;
|
|
1534
|
+
jobName: z.ZodOptional<z.ZodString>;
|
|
1535
|
+
}, z.core.$strict>>;
|
|
1536
|
+
repository: z.ZodObject<{
|
|
1537
|
+
name: z.ZodString;
|
|
1538
|
+
owner: z.ZodString;
|
|
1539
|
+
}, z.core.$strict>;
|
|
1540
|
+
requiredChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1541
|
+
name: z.ZodString;
|
|
1542
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
1543
|
+
classifications: z.ZodArray<z.ZodEnum<{
|
|
1544
|
+
"docs/process-only": "docs/process-only";
|
|
1545
|
+
"non-trivial": "non-trivial";
|
|
1546
|
+
}>>;
|
|
1547
|
+
}, z.core.$strict>>;
|
|
1548
|
+
}, z.core.$strict>>>;
|
|
1549
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
1550
|
+
conditional: z.ZodArray<z.ZodObject<{
|
|
1551
|
+
paths: z.ZodArray<z.ZodString>;
|
|
1552
|
+
}, z.core.$strict>>;
|
|
1553
|
+
}, z.core.$strict>>;
|
|
1554
|
+
schemaVersion: z.ZodLiteral<6>;
|
|
1555
|
+
verification: z.ZodObject<{
|
|
1556
|
+
commands: z.ZodArray<z.ZodObject<{
|
|
1557
|
+
command: z.ZodString;
|
|
1558
|
+
description: z.ZodString;
|
|
1559
|
+
impactTarget: z.ZodOptional<z.ZodString>;
|
|
1560
|
+
name: z.ZodString;
|
|
1561
|
+
requiredCheck: z.ZodOptional<z.ZodString>;
|
|
1562
|
+
scope: z.ZodDefault<z.ZodEnum<{
|
|
1563
|
+
"docs-only": "docs-only";
|
|
1564
|
+
full: "full";
|
|
1565
|
+
trivial: "trivial";
|
|
1566
|
+
}>>;
|
|
1567
|
+
}, z.core.$strip>>;
|
|
1568
|
+
}, z.core.$strip>;
|
|
1569
|
+
}, z.core.$strict>;
|
|
1570
|
+
type FactoryProjectProfile = z.infer<typeof factoryProjectProfileSchema>;
|
|
1571
|
+
export declare const resolveFactoryRepository: (profile?: Pick<FactoryProjectProfile, "repository"> | undefined) => string;
|
|
1572
|
+
interface LoadProjectProfileInput {
|
|
1573
|
+
cwd?: string;
|
|
1574
|
+
profilePath?: string;
|
|
1240
1575
|
}
|
|
1241
|
-
interface
|
|
1242
|
-
|
|
1243
|
-
|
|
1576
|
+
interface LoadProjectProfileResult {
|
|
1577
|
+
path: string;
|
|
1578
|
+
profile: FactoryProjectProfile;
|
|
1244
1579
|
}
|
|
1580
|
+
export declare function loadProjectProfile(input?: LoadProjectProfileInput): LoadProjectProfileResult;
|
|
1245
1581
|
/**
|
|
1246
1582
|
* The verification mode `pr:verify` resolved for a run.
|
|
1247
1583
|
*
|
|
@@ -1251,184 +1587,432 @@ interface CheckRunRelay {
|
|
|
1251
1587
|
*/
|
|
1252
1588
|
type ResolvedPrVerifyMode = "docs-only" | "trivial" | "full";
|
|
1253
1589
|
/**
|
|
1254
|
-
* The pr:verify proof versions a reader accepts: the current one only (#920
|
|
1255
|
-
* item 1). #917 narrowed the pr:ready reader the same way. A pr:verify proof
|
|
1256
|
-
* is per-candidate and short-lived — it is rewritten on every head — so no
|
|
1257
|
-
* stored v1–v3 proof can outlive the release that drops it. Pre-1.0 posture
|
|
1258
|
-
* applies: one current contract, no compat reader. A consumer on an older
|
|
1259
|
-
* factory must adopt this release before HQ ingests its pr:verify proofs.
|
|
1590
|
+
* The pr:verify proof versions a reader accepts: the current one only (#920
|
|
1591
|
+
* item 1). #917 narrowed the pr:ready reader the same way. A pr:verify proof
|
|
1592
|
+
* is per-candidate and short-lived — it is rewritten on every head — so no
|
|
1593
|
+
* stored v1–v3 proof can outlive the release that drops it. Pre-1.0 posture
|
|
1594
|
+
* applies: one current contract, no compat reader. A consumer on an older
|
|
1595
|
+
* factory must adopt this release before HQ ingests its pr:verify proofs.
|
|
1596
|
+
*/
|
|
1597
|
+
declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [4];
|
|
1598
|
+
type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
|
|
1599
|
+
interface PrVerifyCommandResult {
|
|
1600
|
+
command: string;
|
|
1601
|
+
description: string;
|
|
1602
|
+
/**
|
|
1603
|
+
* Epic #550 wave 3 (#430): the profile's declared impact target for this
|
|
1604
|
+
* command, recorded from v4 on. It is the proof's own command→target
|
|
1605
|
+
* mapping: a `notRequiredCommands` entry must name the target recorded HERE
|
|
1606
|
+
* for the same command, so a withholding cannot point at whichever released
|
|
1607
|
+
* target happens to be convenient. Absent for a command the profile does
|
|
1608
|
+
* not scope.
|
|
1609
|
+
*/
|
|
1610
|
+
impactTarget?: string;
|
|
1611
|
+
name: string;
|
|
1612
|
+
scope: "docs-only" | "trivial" | "full";
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* One failing test a verification command reported (#1035).
|
|
1616
|
+
*
|
|
1617
|
+
* The proof keeps the failing test's IDENTITY and its failure CLASS, and
|
|
1618
|
+
* nothing else. That is enough to decide retry-or-fix — a `timeout` under
|
|
1619
|
+
* machine load is a flake, an `assertion` is a real break — without rerunning
|
|
1620
|
+
* the aggregate to read a title off the console.
|
|
1621
|
+
*
|
|
1622
|
+
* It deliberately keeps no raw output tail and no error message body. This
|
|
1623
|
+
* payload is transmitted to HQ ingest, and arbitrary command output can carry
|
|
1624
|
+
* secrets (an echoed environment, a connection string inside a stack frame). A
|
|
1625
|
+
* file path, a test title, and a closed `kind` enum cannot. The cost is the
|
|
1626
|
+
* assertion diff and the stack frames: they help you FIX a failure, and the
|
|
1627
|
+
* operator still reads them from the run's own console output.
|
|
1628
|
+
*/
|
|
1629
|
+
interface PrVerifyTestFailure {
|
|
1630
|
+
/** The test file the reporter named, as the reporter wrote it. */
|
|
1631
|
+
file: string;
|
|
1632
|
+
/**
|
|
1633
|
+
* The failure class. `timeout` is the test-timeout error vitest raises at
|
|
1634
|
+
* its own ceiling; `assertion` is a failed expectation; `error` is every
|
|
1635
|
+
* other thrown failure.
|
|
1636
|
+
*/
|
|
1637
|
+
kind: "assertion" | "error" | "timeout";
|
|
1638
|
+
/** The full test title, suite names included, as the reporter wrote it. */
|
|
1639
|
+
title: string;
|
|
1640
|
+
}
|
|
1641
|
+
interface PrVerifyExecutedCommand {
|
|
1642
|
+
command: string;
|
|
1643
|
+
counts?: {
|
|
1644
|
+
testFiles?: number;
|
|
1645
|
+
tests?: number;
|
|
1646
|
+
};
|
|
1647
|
+
durationMs: number;
|
|
1648
|
+
exitCode: number;
|
|
1649
|
+
/**
|
|
1650
|
+
* The failing tests this command reported (#1035). Present only when the
|
|
1651
|
+
* command produced parseable failures, so a passing command's record is
|
|
1652
|
+
* byte-identical to the one it wrote before this field existed.
|
|
1653
|
+
*/
|
|
1654
|
+
failures?: PrVerifyTestFailure[];
|
|
1655
|
+
name: string;
|
|
1656
|
+
scope: "docs-only" | "trivial" | "full";
|
|
1657
|
+
}
|
|
1658
|
+
/** Where a verification battery ran (#1570). */
|
|
1659
|
+
declare const PR_VERIFY_RUNNER_KINDS: readonly ["ci", "cloud", "local"];
|
|
1660
|
+
/**
|
|
1661
|
+
* The machine a pr:verify battery ran on (#1570), so per-step durations in
|
|
1662
|
+
* `executedCommands` can be compared like for like: a Mac against a Mac, a
|
|
1663
|
+
* cloud agent VM against a cloud agent VM. It names the class of machine, not
|
|
1664
|
+
* the machine: no hostname, user, or path is recorded, because this proof is
|
|
1665
|
+
* sent to HQ.
|
|
1666
|
+
*/
|
|
1667
|
+
interface PrVerifyRunner {
|
|
1668
|
+
/** Node's `process.arch`, such as `arm64` or `x64`. */
|
|
1669
|
+
arch: string;
|
|
1670
|
+
/** Logical CPUs the run could see. */
|
|
1671
|
+
cpuCount: number;
|
|
1672
|
+
/**
|
|
1673
|
+
* `ci` is a hosted CI runner, `cloud` an agent's cloud VM, and `local` a
|
|
1674
|
+
* developer machine: everything that is neither.
|
|
1675
|
+
*/
|
|
1676
|
+
kind: (typeof PR_VERIFY_RUNNER_KINDS)[number];
|
|
1677
|
+
/** Node's `process.platform`, such as `darwin` or `linux`. */
|
|
1678
|
+
os: string;
|
|
1679
|
+
/**
|
|
1680
|
+
* The host that provided a `ci` or `cloud` runner when its environment
|
|
1681
|
+
* names it: `claude-code`, `cursor`, or `github-actions`. Absent for
|
|
1682
|
+
* `local` and for an unnamed CI.
|
|
1683
|
+
*/
|
|
1684
|
+
provider?: "claude-code" | "cursor" | "github-actions";
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Epic #550 wave 3 (#430): a verification command the impact stamp proved this
|
|
1688
|
+
* candidate cannot reach, so the battery did not run it.
|
|
1689
|
+
*
|
|
1690
|
+
* The completeness invariant lives in the pairing: `verificationCommands`
|
|
1691
|
+
* records every command the resolved mode selected, `executedCommands` records
|
|
1692
|
+
* what ran, and this list records the rest WITH the stamp's own basis. A
|
|
1693
|
+
* withheld stack is therefore never silently absent from the proof — it is
|
|
1694
|
+
* present, named, and explained.
|
|
1695
|
+
*/
|
|
1696
|
+
interface PrVerifyNotRequiredCommand {
|
|
1697
|
+
basis: string;
|
|
1698
|
+
impactTarget: string;
|
|
1699
|
+
name: string;
|
|
1700
|
+
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Epic #758 (#762): a consumer package a stamp-scoped selection skipped, and
|
|
1703
|
+
* why. Bound to the proof's stamp identity — refused when the proof records no
|
|
1704
|
+
* stamp. The factory does not write this list; consumers do.
|
|
1705
|
+
*/
|
|
1706
|
+
interface PrVerifyNotDemandedRecord {
|
|
1707
|
+
basis: string;
|
|
1708
|
+
name: string;
|
|
1709
|
+
}
|
|
1710
|
+
interface PrVerifyProof {
|
|
1711
|
+
schemaVersion: PrVerifySchemaVersion;
|
|
1712
|
+
authoringSession: string;
|
|
1713
|
+
base: string;
|
|
1714
|
+
/**
|
|
1715
|
+
* The commit `base` resolved to when this proof was written (#1132): the
|
|
1716
|
+
* live pull request base tip, or the freshly fetched ref. Optional and
|
|
1717
|
+
* additive; a proof written before it existed parses unchanged.
|
|
1718
|
+
*/
|
|
1719
|
+
baseSha?: string;
|
|
1720
|
+
baselineFullProofs?: {
|
|
1721
|
+
base: string;
|
|
1722
|
+
changedFiles: string[];
|
|
1723
|
+
headSha: string;
|
|
1724
|
+
profilePath: string;
|
|
1725
|
+
projectKey: string;
|
|
1726
|
+
repository: string;
|
|
1727
|
+
}[];
|
|
1728
|
+
catchUpRecognition?: CatchUpRecognition;
|
|
1729
|
+
changedFiles: string[];
|
|
1730
|
+
classification: DiffClassification;
|
|
1731
|
+
classificationReasons: string[];
|
|
1732
|
+
command: "patronage-factory pr:verify";
|
|
1733
|
+
durationMs: number;
|
|
1734
|
+
endedAt: string;
|
|
1735
|
+
executedCommands?: PrVerifyExecutedCommand[];
|
|
1736
|
+
headSha: string;
|
|
1737
|
+
impactStamp?: ImpactStamp;
|
|
1738
|
+
mode: ResolvedPrVerifyMode;
|
|
1739
|
+
mergeBaseSha?: string;
|
|
1740
|
+
notDemandedRecords?: PrVerifyNotDemandedRecord[];
|
|
1741
|
+
notRequiredCommands?: PrVerifyNotRequiredCommand[];
|
|
1742
|
+
outcome?: "aborted" | "passed";
|
|
1743
|
+
patchId?: string;
|
|
1744
|
+
/**
|
|
1745
|
+
* The review policy identity this verification run resolved (#922 Slice B).
|
|
1746
|
+
*
|
|
1747
|
+
* Verification demands no review mode of its own. It records the identity so
|
|
1748
|
+
* `pr:ready` can see whether the stage that produced this proof judged the
|
|
1749
|
+
* candidate under the same policy readiness resolves. Optional, and normally
|
|
1750
|
+
* `unresolved` on the first run of a branch: a candidate is verified before
|
|
1751
|
+
* it has a pull request, and there is no authority to read without one.
|
|
1752
|
+
*/
|
|
1753
|
+
policyResolution?: PolicyResolution;
|
|
1754
|
+
profilePath: string;
|
|
1755
|
+
projectKey: string;
|
|
1756
|
+
repository: string;
|
|
1757
|
+
/**
|
|
1758
|
+
* The machine the battery ran on (#1570). Optional and additive: a proof
|
|
1759
|
+
* written before it existed parses unchanged, and the schema version does
|
|
1760
|
+
* not move.
|
|
1761
|
+
*/
|
|
1762
|
+
runner?: PrVerifyRunner;
|
|
1763
|
+
startedAt: string;
|
|
1764
|
+
verificationCommands: PrVerifyCommandResult[];
|
|
1765
|
+
}
|
|
1766
|
+
type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
|
|
1767
|
+
export declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
|
|
1768
|
+
declare const boundaryCheckProofSchema: z.ZodObject<{
|
|
1769
|
+
blockingReasons: z.ZodArray<z.ZodString>;
|
|
1770
|
+
boundary: z.ZodOptional<z.ZodString>;
|
|
1771
|
+
command: z.ZodLiteral<"patronage-factory boundary:check">;
|
|
1772
|
+
coveredSet: z.ZodArray<z.ZodObject<{
|
|
1773
|
+
issue: z.ZodOptional<z.ZodNumber>;
|
|
1774
|
+
pr: z.ZodNumber;
|
|
1775
|
+
sha: z.ZodString;
|
|
1776
|
+
state: z.ZodEnum<{
|
|
1777
|
+
merged: "merged";
|
|
1778
|
+
open: "open";
|
|
1779
|
+
}>;
|
|
1780
|
+
wave: z.ZodString;
|
|
1781
|
+
}, z.core.$strip>>;
|
|
1782
|
+
demandedRung: z.ZodOptional<z.ZodEnum<{
|
|
1783
|
+
human: "human";
|
|
1784
|
+
"independent-model": "independent-model";
|
|
1785
|
+
oracle: "oracle";
|
|
1786
|
+
}>>;
|
|
1787
|
+
epicIssue: z.ZodNumber;
|
|
1788
|
+
manifestHash: z.ZodOptional<z.ZodObject<{
|
|
1789
|
+
algo: z.ZodLiteral<"sha256">;
|
|
1790
|
+
value: z.ZodString;
|
|
1791
|
+
}, z.core.$strip>>;
|
|
1792
|
+
notices: z.ZodArray<z.ZodString>;
|
|
1793
|
+
repo: z.ZodString;
|
|
1794
|
+
reviewProof: z.ZodOptional<z.ZodObject<{
|
|
1795
|
+
commentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
1796
|
+
commentUrl: z.ZodOptional<z.ZodString>;
|
|
1797
|
+
producer: z.ZodString;
|
|
1798
|
+
rung: z.ZodEnum<{
|
|
1799
|
+
human: "human";
|
|
1800
|
+
"independent-model": "independent-model";
|
|
1801
|
+
oracle: "oracle";
|
|
1802
|
+
}>;
|
|
1803
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
1804
|
+
specHash: z.ZodOptional<z.ZodObject<{
|
|
1805
|
+
algo: z.ZodLiteral<"sha256">;
|
|
1806
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
1807
|
+
value: z.ZodString;
|
|
1808
|
+
}, z.core.$loose>>;
|
|
1809
|
+
}, z.core.$strip>>;
|
|
1810
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
1811
|
+
specHash: z.ZodOptional<z.ZodObject<{
|
|
1812
|
+
algo: z.ZodLiteral<"sha256">;
|
|
1813
|
+
value: z.ZodString;
|
|
1814
|
+
}, z.core.$strip>>;
|
|
1815
|
+
status: z.ZodEnum<{
|
|
1816
|
+
blocked: "blocked";
|
|
1817
|
+
ready: "ready";
|
|
1818
|
+
}>;
|
|
1819
|
+
}, z.core.$strip>;
|
|
1820
|
+
type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
|
|
1821
|
+
/**
|
|
1822
|
+
* The pr:ready proof, declared once here (the published wire contract) and
|
|
1823
|
+
* re-exported by `pr-ready.ts`, which writes and reads it through
|
|
1824
|
+
* `prReadyProofSchema` below. The ledger types are type-only imports from
|
|
1825
|
+
* their owner `pr-readiness/readiness-ledger.ts`, so the declaration names the
|
|
1826
|
+
* same types the evaluator produces. The writer therefore applies the wire
|
|
1827
|
+
* schema's strictness too: an unknown key on a ledger review state fails the
|
|
1828
|
+
* write instead of being stripped.
|
|
1260
1829
|
*/
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
interface PrVerifyCommandResult {
|
|
1264
|
-
command: string;
|
|
1265
|
-
description: string;
|
|
1830
|
+
interface PrReadyProof {
|
|
1831
|
+
schemaVersion: 3;
|
|
1266
1832
|
/**
|
|
1267
|
-
*
|
|
1268
|
-
*
|
|
1269
|
-
*
|
|
1270
|
-
* for
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1833
|
+
* What GitHub actually did when this run armed native auto-merge (#477).
|
|
1834
|
+
* Also reports an already-merged no-op (#1456). Otherwise present exactly
|
|
1835
|
+
* when a ready run called the arming module (#1299): not
|
|
1836
|
+
* for an `autoMerge: false` wave, and not when a notice names why the run
|
|
1837
|
+
* did not arm. Read back from the PR rather than inferred from the
|
|
1838
|
+
* invocation, because `gh pr merge --auto` arms, merges, or does nothing
|
|
1839
|
+
* with the same exit code and the same empty output. `not-armed` means the
|
|
1840
|
+
* candidate is admitted but nothing will merge it, and `followUp` carries
|
|
1841
|
+
* the re-dispatch.
|
|
1273
1842
|
*/
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
* One failing test a verification command reported (#1035).
|
|
1280
|
-
*
|
|
1281
|
-
* The proof keeps the failing test's IDENTITY and its failure CLASS, and
|
|
1282
|
-
* nothing else. That is enough to decide retry-or-fix — a `timeout` under
|
|
1283
|
-
* machine load is a flake, an `assertion` is a real break — without rerunning
|
|
1284
|
-
* the aggregate to read a title off the console.
|
|
1285
|
-
*
|
|
1286
|
-
* It deliberately keeps no raw output tail and no error message body. This
|
|
1287
|
-
* payload is transmitted to HQ ingest, and arbitrary command output can carry
|
|
1288
|
-
* secrets (an echoed environment, a connection string inside a stack frame). A
|
|
1289
|
-
* file path, a test title, and a closed `kind` enum cannot. The cost is the
|
|
1290
|
-
* assertion diff and the stack frames: they help you FIX a failure, and the
|
|
1291
|
-
* operator still reads them from the run's own console output.
|
|
1292
|
-
*/
|
|
1293
|
-
interface PrVerifyTestFailure {
|
|
1294
|
-
/** The test file the reporter named, as the reporter wrote it. */
|
|
1295
|
-
file: string;
|
|
1843
|
+
arming?: {
|
|
1844
|
+
detail?: string;
|
|
1845
|
+
headSha: string;
|
|
1846
|
+
outcome: "armed" | "merged" | "not-armed";
|
|
1847
|
+
};
|
|
1296
1848
|
/**
|
|
1297
|
-
* The
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1849
|
+
* The authoring session readiness resolved for the review-independence
|
|
1850
|
+
* cross-check (#1037). Recorded so the branded check can print it beside the
|
|
1851
|
+
* review session, model, and producer the ledger already carries — the four
|
|
1852
|
+
* identities a human weighs at merge time. Additive and optional: proofs
|
|
1853
|
+
* written before it carry no field, so no schema version moves.
|
|
1300
1854
|
*/
|
|
1301
|
-
|
|
1302
|
-
/**
|
|
1303
|
-
|
|
1855
|
+
authoringSession?: string;
|
|
1856
|
+
/**
|
|
1857
|
+
* Why this run blocked, one entry per refusing demand (#391): `code` is the
|
|
1858
|
+
* demand key from the resolver's vocabulary, `detail` the one-sentence
|
|
1859
|
+
* refusal. Same refusals as `blockingReasons`, in the same order — the
|
|
1860
|
+
* analyzable projection of a flat string list, so a wall of blocked proofs
|
|
1861
|
+
* on one PR can be counted by cause. Absent when nothing blocked.
|
|
1862
|
+
*/
|
|
1863
|
+
blockedReasons?: BlockedReason[];
|
|
1864
|
+
blockingReasons: string[];
|
|
1865
|
+
humanBlockingReasons: string[];
|
|
1866
|
+
command: "patronage-factory pr:ready";
|
|
1867
|
+
/**
|
|
1868
|
+
* Machine-safe arg array for the obvious next action (#523): when `ready`
|
|
1869
|
+
* but arming did not take effect, a `pr:ready` re-dispatch (idempotent on
|
|
1870
|
+
* an unchanged head); otherwise the `gh pr ready` undraft repair or the
|
|
1871
|
+
* `pr:verify` re-run that the blocking reasons name (re-verify the head,
|
|
1872
|
+
* then re-run pr:ready). Same `argv` shape `factory:delegate --print`
|
|
1873
|
+
* emits. Optional and purely additive.
|
|
1874
|
+
*/
|
|
1875
|
+
followUp?: FollowUpAction;
|
|
1876
|
+
/**
|
|
1877
|
+
* `ledger.headSha` is the evaluated head SHA: the GitHub `pr.headRefOid`
|
|
1878
|
+
* captured at evaluation time (not a local git read), recorded explicitly
|
|
1879
|
+
* so merge-time identity checks are a pure comparison against the live
|
|
1880
|
+
* pushed HEAD, not a re-derivation. See the ledger schema.
|
|
1881
|
+
*/
|
|
1882
|
+
ledger: ManagedReadinessLedger;
|
|
1883
|
+
/**
|
|
1884
|
+
* Actionable facts that did not block (#477): a settling merge-freeze
|
|
1885
|
+
* generation that permitted readiness and any authorized arming with a
|
|
1886
|
+
* notice, an admitted-but-unscheduled false boundary wave, and how each
|
|
1887
|
+
* waived demand reads to a human. Absent when there are none.
|
|
1888
|
+
*/
|
|
1889
|
+
notices?: string[];
|
|
1890
|
+
/**
|
|
1891
|
+
* The policy identity readiness resolved review demand under (#922): the
|
|
1892
|
+
* base ref, its live tip, and the digests of the base, candidate, and merged
|
|
1893
|
+
* review policies. Optional on the wire and additive — this is a new record
|
|
1894
|
+
* on an unchanged contract, so no schema version moves.
|
|
1895
|
+
*/
|
|
1896
|
+
policyResolution?: PolicyResolution;
|
|
1897
|
+
/** Committed profile blob evaluated by readiness. Required for merge. */
|
|
1898
|
+
profileBlobSha?: string;
|
|
1899
|
+
/** Checkout-relative committed profile path evaluated by readiness. */
|
|
1900
|
+
profilePath?: string;
|
|
1901
|
+
repairs: ReadinessRepair[];
|
|
1902
|
+
/** Trusted checkout repository used for all GitHub reads and writes. */
|
|
1903
|
+
repository?: string;
|
|
1904
|
+
status: ReadinessStatus;
|
|
1905
|
+
/**
|
|
1906
|
+
* Demands that were in force, were NOT met, and were waived by the operator
|
|
1907
|
+
* (#354, moved here from the merge-time proof by #477). Each entry carries
|
|
1908
|
+
* the demand's refusals verbatim, so a waived demand can never read as a met
|
|
1909
|
+
* one; readiness proceeds on the recorded operator act, not on evidence.
|
|
1910
|
+
*/
|
|
1911
|
+
waivedDemands?: WaivedDemand[];
|
|
1304
1912
|
}
|
|
1305
|
-
interface
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
};
|
|
1311
|
-
durationMs: number;
|
|
1312
|
-
exitCode: number;
|
|
1913
|
+
interface BoundaryCheckGithub {
|
|
1914
|
+
fetchIssueBody: (repo: string, issue: number) => string;
|
|
1915
|
+
fetchIssueComments: (repo: string, issue: number) => GithubIssueComment[];
|
|
1916
|
+
fetchClosingPullRequests: (repo: string, issue: number) => BoundaryPullRequestRef[];
|
|
1917
|
+
fetchPullRequest?: (repo: string, pr: number) => BoundaryPullRequestRef;
|
|
1313
1918
|
/**
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
* byte-identical to the one it wrote before this field existed.
|
|
1919
|
+
* Child issue state for the close-gate (#901). Required so a stub cannot
|
|
1920
|
+
* skip the gate and look like a pass.
|
|
1317
1921
|
*/
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1922
|
+
fetchIssueState: (repo: string, issue: number) => "OPEN" | "CLOSED";
|
|
1923
|
+
/**
|
|
1924
|
+
* PRs whose bodies may contribute closing-keyword membership (#901). For
|
|
1925
|
+
* `each-to-epic`, production lists PRs targeting the integration branch.
|
|
1926
|
+
* Branch targeting never joins; only a keyword naming a declared child does.
|
|
1927
|
+
* Required so omitting the channel cannot silently drop it.
|
|
1928
|
+
*/
|
|
1929
|
+
listCandidatePullRequests: (repo: string, input: {
|
|
1930
|
+
integrationBranch?: string;
|
|
1931
|
+
}) => (BoundaryPullRequestRef & {
|
|
1932
|
+
body?: string;
|
|
1933
|
+
})[];
|
|
1321
1934
|
}
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
* The machine a pr:verify battery ran on (#1570), so per-step durations in
|
|
1326
|
-
* `executedCommands` can be compared like for like: a Mac against a Mac, a
|
|
1327
|
-
* cloud agent VM against a cloud agent VM. It names the class of machine, not
|
|
1328
|
-
* the machine: no hostname, user, or path is recorded, because this proof is
|
|
1329
|
-
* sent to HQ.
|
|
1330
|
-
*/
|
|
1331
|
-
interface PrVerifyRunner {
|
|
1332
|
-
/** Node's `process.arch`, such as `arm64` or `x64`. */
|
|
1333
|
-
arch: string;
|
|
1334
|
-
/** Logical CPUs the run could see. */
|
|
1335
|
-
cpuCount: number;
|
|
1935
|
+
interface BoundaryCheckArgs {
|
|
1936
|
+
cwd?: string;
|
|
1937
|
+
epic: number;
|
|
1336
1938
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1939
|
+
* Closeout-final mode (#853): a manifest-declared issue whose closing-PR
|
|
1940
|
+
* set is empty is a blocking reason, not a notice. Off by default so the
|
|
1941
|
+
* interior boundary review (run before the terminal release PR exists,
|
|
1942
|
+
* e.g. epic #842's own review of #844) keeps working; the epic closeout
|
|
1943
|
+
* step turns this on as the last check before factory:closeout.
|
|
1339
1944
|
*/
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1945
|
+
final?: boolean;
|
|
1946
|
+
json?: boolean;
|
|
1947
|
+
output?: string;
|
|
1948
|
+
repo?: string;
|
|
1949
|
+
}
|
|
1950
|
+
interface BoundaryCheckDependencies {
|
|
1343
1951
|
/**
|
|
1344
|
-
* The
|
|
1345
|
-
*
|
|
1346
|
-
* `local` and for an unnamed CI.
|
|
1952
|
+
* The broker's admission token on a Cursor VM (#1327), for the issue reads.
|
|
1953
|
+
* Read by {@link runBoundaryCheckWithAdmission} only.
|
|
1347
1954
|
*/
|
|
1348
|
-
|
|
1955
|
+
admission?: AdmissionCredential;
|
|
1956
|
+
github?: BoundaryCheckGithub;
|
|
1957
|
+
hq?: HqIngestDependencies;
|
|
1958
|
+
readWaivers?: (cwd: string) => DemandWaiver[];
|
|
1959
|
+
resolveRepo?: (cwd: string) => string;
|
|
1349
1960
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
* present, named, and explained.
|
|
1359
|
-
*/
|
|
1360
|
-
interface PrVerifyNotRequiredCommand {
|
|
1361
|
-
basis: string;
|
|
1362
|
-
impactTarget: string;
|
|
1961
|
+
export declare function runBoundaryCheck(args: BoundaryCheckArgs, dependencies?: BoundaryCheckDependencies): BoundaryCheckProofRecord;
|
|
1962
|
+
export declare function validateBoundaryCheckProof(value: unknown): BoundaryCheckProofRecord;
|
|
1963
|
+
interface CliOutput {
|
|
1964
|
+
stderr: Pick<NodeJS.WriteStream, "write">;
|
|
1965
|
+
stdout: Pick<NodeJS.WriteStream, "write">;
|
|
1966
|
+
}
|
|
1967
|
+
type BoundaryCheckAction = (args: BoundaryCheckArgs) => BoundaryCheckProofRecord;
|
|
1968
|
+
interface CheckoutRepository {
|
|
1363
1969
|
name: string;
|
|
1970
|
+
owner: string;
|
|
1971
|
+
}
|
|
1972
|
+
/** Every waiver recorded in this checkout; an absent or unreadable store is
|
|
1973
|
+
* no waivers, so a damaged file can only ever block, never permit. */
|
|
1974
|
+
export declare const readDemandWaivers: (cwd: string, filePath?: string) => DemandWaiver[];
|
|
1975
|
+
interface DemandWaiveArgs {
|
|
1976
|
+
cwd?: string;
|
|
1977
|
+
demand: string;
|
|
1978
|
+
json?: boolean;
|
|
1979
|
+
output?: string;
|
|
1980
|
+
pr: number;
|
|
1981
|
+
rationale: string;
|
|
1982
|
+
}
|
|
1983
|
+
interface DemandWaiveDependencies {
|
|
1984
|
+
checkoutRepository?: (cwd: string) => CheckoutRepository;
|
|
1985
|
+
env?: NodeJS.ProcessEnv;
|
|
1986
|
+
fetchAuthenticatedLogin?: (cwd: string) => string | undefined;
|
|
1987
|
+
fetchPullRequestHeadSha?: (input: {
|
|
1988
|
+
cwd: string;
|
|
1989
|
+
owner: string;
|
|
1990
|
+
pr: number;
|
|
1991
|
+
repo: string;
|
|
1992
|
+
}) => string | undefined;
|
|
1993
|
+
now?: () => Date;
|
|
1994
|
+
}
|
|
1995
|
+
export declare class DemandWaiveRefusalError extends Error {
|
|
1996
|
+
readonly refusals: string[];
|
|
1997
|
+
constructor(refusals: string[]);
|
|
1364
1998
|
}
|
|
1365
1999
|
/**
|
|
1366
|
-
*
|
|
1367
|
-
* why.
|
|
1368
|
-
*
|
|
2000
|
+
* Record one waiver. One step: the operator names the demand, the candidate,
|
|
2001
|
+
* and why. No confirmation, no second approval, no cooldown — the trust model
|
|
2002
|
+
* puts the bar at operator identity, not at ceremony aimed at the operator
|
|
2003
|
+
* (ADR 0025).
|
|
1369
2004
|
*/
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
2005
|
+
export declare const runDemandWaive: (args: DemandWaiveArgs, dependencies?: DemandWaiveDependencies) => DemandWaiver;
|
|
2006
|
+
type DemandWaiveAction = (args: DemandWaiveArgs) => DemandWaiver;
|
|
2007
|
+
/** Cloudflare Access service-token credentials for production HQ ingest. */
|
|
2008
|
+
interface CloudflareAccessServiceToken {
|
|
2009
|
+
clientId: string;
|
|
2010
|
+
clientSecret: string;
|
|
1373
2011
|
}
|
|
1374
|
-
interface
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
base: string;
|
|
1378
|
-
/**
|
|
1379
|
-
* The commit `base` resolved to when this proof was written (#1132): the
|
|
1380
|
-
* live pull request base tip, or the freshly fetched ref. Optional and
|
|
1381
|
-
* additive; a proof written before it existed parses unchanged.
|
|
1382
|
-
*/
|
|
1383
|
-
baseSha?: string;
|
|
1384
|
-
baselineFullProofs?: {
|
|
1385
|
-
base: string;
|
|
1386
|
-
changedFiles: string[];
|
|
1387
|
-
headSha: string;
|
|
1388
|
-
profilePath: string;
|
|
1389
|
-
projectKey: string;
|
|
1390
|
-
repository: string;
|
|
1391
|
-
}[];
|
|
1392
|
-
catchUpRecognition?: CatchUpRecognition;
|
|
1393
|
-
changedFiles: string[];
|
|
1394
|
-
classification: DiffClassification;
|
|
1395
|
-
classificationReasons: string[];
|
|
1396
|
-
command: "patronage-factory pr:verify";
|
|
1397
|
-
durationMs: number;
|
|
1398
|
-
endedAt: string;
|
|
1399
|
-
executedCommands?: PrVerifyExecutedCommand[];
|
|
1400
|
-
headSha: string;
|
|
1401
|
-
impactStamp?: ImpactStamp;
|
|
1402
|
-
mode: ResolvedPrVerifyMode;
|
|
1403
|
-
mergeBaseSha?: string;
|
|
1404
|
-
notDemandedRecords?: PrVerifyNotDemandedRecord[];
|
|
1405
|
-
notRequiredCommands?: PrVerifyNotRequiredCommand[];
|
|
1406
|
-
outcome?: "aborted" | "passed";
|
|
1407
|
-
patchId?: string;
|
|
1408
|
-
/**
|
|
1409
|
-
* The review policy identity this verification run resolved (#922 Slice B).
|
|
1410
|
-
*
|
|
1411
|
-
* Verification demands no review mode of its own. It records the identity so
|
|
1412
|
-
* `pr:ready` can see whether the stage that produced this proof judged the
|
|
1413
|
-
* candidate under the same policy readiness resolves. Optional, and normally
|
|
1414
|
-
* `unresolved` on the first run of a branch: a candidate is verified before
|
|
1415
|
-
* it has a pull request, and there is no authority to read without one.
|
|
1416
|
-
*/
|
|
1417
|
-
policyResolution?: PolicyResolution;
|
|
1418
|
-
profilePath: string;
|
|
1419
|
-
projectKey: string;
|
|
1420
|
-
repository: string;
|
|
1421
|
-
/**
|
|
1422
|
-
* The machine the battery ran on (#1570). Optional and additive: a proof
|
|
1423
|
-
* written before it existed parses unchanged, and the schema version does
|
|
1424
|
-
* not move.
|
|
1425
|
-
*/
|
|
1426
|
-
runner?: PrVerifyRunner;
|
|
1427
|
-
startedAt: string;
|
|
1428
|
-
verificationCommands: PrVerifyCommandResult[];
|
|
2012
|
+
interface CheckRunRelay {
|
|
2013
|
+
credentials: CloudflareAccessServiceToken;
|
|
2014
|
+
url: URL;
|
|
1429
2015
|
}
|
|
1430
|
-
type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
|
|
1431
|
-
export declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
|
|
1432
2016
|
/**
|
|
1433
2017
|
* Machine-readable binding carried on the `patronage-factory/pr-verify` check
|
|
1434
2018
|
* run (#247), alongside the human-readable prose summary.
|
|
@@ -1634,357 +2218,28 @@ declare function fetchPrVerifyProofBinding({ expectedAppId, githubApp, owner, re
|
|
|
1634
2218
|
interface ExactHeadRunSource {
|
|
1635
2219
|
appId?: () => string;
|
|
1636
2220
|
runJson?: GhJsonRunner;
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
repo: string;
|
|
1643
|
-
}
|
|
1644
|
-
export declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
|
|
1645
|
-
/**
|
|
1646
|
-
* The Factory App's slug, as GitHub serves it on the runs the writer posts.
|
|
1647
|
-
* It is not a trust predicate: an App chooses its own slug, so the reader
|
|
1648
|
-
* trusts the pinned numeric App id instead (ADR 0022, #1393).
|
|
1649
|
-
*/
|
|
1650
|
-
export declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
|
|
1651
|
-
declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1652
|
-
active: z.ZodLiteral<true>;
|
|
1653
|
-
generationId: z.ZodNumber;
|
|
1654
|
-
headSha: z.ZodString;
|
|
1655
|
-
outcome: z.ZodEnum<{
|
|
1656
|
-
active: "active";
|
|
1657
|
-
stale: "stale";
|
|
1658
|
-
}>;
|
|
1659
|
-
reason: z.ZodString;
|
|
1660
|
-
recordedAt: z.ZodISODateTime;
|
|
1661
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
1662
|
-
verification: z.ZodOptional<z.ZodObject<{
|
|
1663
|
-
jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1664
|
-
cancelled: "cancelled";
|
|
1665
|
-
failure: "failure";
|
|
1666
|
-
skipped: "skipped";
|
|
1667
|
-
success: "success";
|
|
1668
|
-
}>>;
|
|
1669
|
-
runAttempt: z.ZodNumber;
|
|
1670
|
-
runId: z.ZodNumber;
|
|
1671
|
-
}, z.core.$strip>>;
|
|
1672
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1673
|
-
active: z.ZodLiteral<false>;
|
|
1674
|
-
clearRationale: z.ZodOptional<z.ZodString>;
|
|
1675
|
-
generationId: z.ZodNumber;
|
|
1676
|
-
headSha: z.ZodString;
|
|
1677
|
-
outcome: z.ZodLiteral<"inactive">;
|
|
1678
|
-
reason: z.ZodString;
|
|
1679
|
-
recordedAt: z.ZodISODateTime;
|
|
1680
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
1681
|
-
verification: z.ZodOptional<z.ZodObject<{
|
|
1682
|
-
jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
1683
|
-
cancelled: "cancelled";
|
|
1684
|
-
failure: "failure";
|
|
1685
|
-
skipped: "skipped";
|
|
1686
|
-
success: "success";
|
|
1687
|
-
}>>;
|
|
1688
|
-
runAttempt: z.ZodNumber;
|
|
1689
|
-
runId: z.ZodNumber;
|
|
1690
|
-
}, z.core.$strip>>;
|
|
1691
|
-
}, z.core.$strip>], "active">;
|
|
1692
|
-
type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
|
|
1693
|
-
/**
|
|
1694
|
-
* The write side of this contract lives in the generated merge-target push
|
|
1695
|
-
* Verify workflow (#356, ADR 0016; #429): it is the ONLY producer of
|
|
1696
|
-
* `patronage-factory/merge-freeze` generations. Its emitted `output.text`
|
|
1697
|
-
* payload must parse under this exact reader schema, which is what the
|
|
1698
|
-
* workflow's own tests assert through this export.
|
|
1699
|
-
*/
|
|
1700
|
-
export declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
|
|
1701
|
-
interface MergeFreezeStoreInput {
|
|
1702
|
-
cwd: string;
|
|
1703
|
-
headSha: string;
|
|
1704
|
-
repository: CheckoutRepository;
|
|
1705
|
-
}
|
|
1706
|
-
interface MergeFreezeStore {
|
|
1707
|
-
read: (input: MergeFreezeStoreInput) => unknown;
|
|
1708
|
-
}
|
|
1709
|
-
/**
|
|
1710
|
-
* The run identity that proves a generation is settling because it is running.
|
|
1711
|
-
*/
|
|
1712
|
-
interface RunningMergeFreezeWitness {
|
|
1713
|
-
/** The base tip the running generation was created on. */
|
|
1714
|
-
headSha: string;
|
|
1715
|
-
/** The running `patronage-factory/merge-freeze` check-run id. */
|
|
1716
|
-
runId: number;
|
|
1717
|
-
}
|
|
1718
|
-
/** A push workflow run's status while it still owes a generation. */
|
|
1719
|
-
type PendingWorkflowRunStatus = "in_progress" | "pending" | "queued" | "requested" | "waiting";
|
|
1720
|
-
/**
|
|
1721
|
-
* The evidence that a generation is settling because it is still owed (#521).
|
|
1722
|
-
*
|
|
1723
|
-
* The witness is the freeze-writing workflow's push run on the tip, identified
|
|
1724
|
-
* through lineage (#1276): the immediate parent's settled generation records
|
|
1725
|
-
* the workflow run that wrote it, that run names its workflow, and the same
|
|
1726
|
-
* workflow's pending push run on the tip owes the tip's generation. It is the
|
|
1727
|
-
* workflow run rather than the `verify` job's check run because GitHub creates
|
|
1728
|
-
* a job's check run only when the job is dispatched, which for the `verify`
|
|
1729
|
-
* summary job is near the end of the push Verify.
|
|
1730
|
-
*/
|
|
1731
|
-
interface AwaitedMergeFreezeWitness {
|
|
1732
|
-
/** The base tip whose generation is awaited. */
|
|
1733
|
-
headSha: string;
|
|
1734
|
-
/** The immediate parent whose settled generation proves the writer runs. */
|
|
1735
|
-
parentSha: string;
|
|
1736
|
-
/** The workflow whose run wrote the parent's settled generation. */
|
|
1737
|
-
workflowId: number;
|
|
1738
|
-
/** That workflow's push run on the tip, which owes the generation. */
|
|
1739
|
-
workflowRunId: number;
|
|
1740
|
-
/** That run's status. A completed run owes nothing, so it is not settling. */
|
|
1741
|
-
workflowRunStatus: PendingWorkflowRunStatus;
|
|
1742
|
-
}
|
|
1743
|
-
/**
|
|
1744
|
-
* The two settling phases, each with the witness that proves it (#890).
|
|
1745
|
-
*
|
|
1746
|
-
* `phase` replaces an optional `running` field that made one situation two:
|
|
1747
|
-
* the field's presence, not the situation, decided how readers behaved. Each
|
|
1748
|
-
* phase now carries exactly the witness its own rule needs.
|
|
1749
|
-
*/
|
|
1750
|
-
type SettlingMergeFreezeGeneration = {
|
|
1751
|
-
kind: "settling";
|
|
1752
|
-
phase: "running-generation";
|
|
1753
|
-
reason: string;
|
|
1754
|
-
witness: RunningMergeFreezeWitness;
|
|
1755
|
-
} | {
|
|
1756
|
-
kind: "settling";
|
|
1757
|
-
phase: "awaiting-generation";
|
|
1758
|
-
reason: string;
|
|
1759
|
-
witness: AwaitedMergeFreezeWitness;
|
|
1760
|
-
};
|
|
1761
|
-
/**
|
|
1762
|
-
* The freeze generation as a readiness decision needs to see it (#477).
|
|
1763
|
-
*
|
|
1764
|
-
* `read` below collapses every situation short of a verdict into one refusal,
|
|
1765
|
-
* because merge time treats all of them as "do not merge". Readiness
|
|
1766
|
-
* distinguishes them: a settled generation is the writer's verdict, a
|
|
1767
|
-
* **settling** one is the window between a merge landing and its merge-target
|
|
1768
|
-
* Verify completing, and an **unreadable** one is ambiguous, malformed,
|
|
1769
|
-
* foreign-App, or unavailable state. Same selection, same pinned App, same
|
|
1770
|
-
* `started_at` ordering — only the reporting is finer.
|
|
1771
|
-
*/
|
|
1772
|
-
type MergeFreezeGeneration = {
|
|
1773
|
-
kind: "settled";
|
|
1774
|
-
state: MergeFreezeState;
|
|
1775
|
-
} | SettlingMergeFreezeGeneration | {
|
|
1776
|
-
kind: "unreadable";
|
|
1777
|
-
reason: string;
|
|
1778
|
-
};
|
|
1779
|
-
/** A merge-freeze reader that can also report the settle window (#477). */
|
|
1780
|
-
interface MergeFreezeAuthority extends MergeFreezeStore {
|
|
1781
|
-
readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
|
|
1782
|
-
}
|
|
1783
|
-
interface GitHubCheckRunMergeFreezeApi {
|
|
1784
|
-
list: (input: MergeFreezeStoreInput & {
|
|
1785
|
-
name: string;
|
|
1786
|
-
}) => unknown;
|
|
1787
|
-
parent?: (input: MergeFreezeStoreInput) => unknown;
|
|
1788
|
-
/** One GitHub Actions workflow run, by id (`headSha` is not consulted). */
|
|
1789
|
-
workflowRun?: (input: MergeFreezeStoreInput & {
|
|
1790
|
-
runId: number;
|
|
1791
|
-
}) => unknown;
|
|
1792
|
-
/** A workflow's push runs on `headSha`, as `{ workflow_runs }`. */
|
|
1793
|
-
workflowRuns?: (input: MergeFreezeStoreInput & {
|
|
1794
|
-
workflowId: number;
|
|
1795
|
-
}) => unknown;
|
|
1796
|
-
}
|
|
1797
|
-
export declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
|
|
1798
|
-
interface ProofDescriptor<T> {
|
|
1799
|
-
label: string;
|
|
1800
|
-
defaultPath: string;
|
|
1801
|
-
schemaVersion: number;
|
|
1802
|
-
parse: (raw: unknown) => T;
|
|
1803
|
-
}
|
|
1804
|
-
/**
|
|
1805
|
-
* Ledger schema version 2 (#894): `verification` is a tagged union on
|
|
1806
|
-
* `prVerify` and `externalChecks` no longer echoes `inScope`. Version 1
|
|
1807
|
-
* ledgers are not read — the pre-1.0 posture keeps one shape per contract, so
|
|
1808
|
-
* there is no compat reader here.
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* Spool locations this run did not drain because they sit under an earlier
|
|
2224
|
+
* key for this repository. Reported, never drained: draining an older key's
|
|
2225
|
+
* events is an operator decision, made with `--dir`.
|
|
1809
2226
|
*/
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
trivial: "trivial";
|
|
1827
|
-
}>;
|
|
1828
|
-
externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1829
|
-
checkType: z.ZodEnum<{
|
|
1830
|
-
review: "review";
|
|
1831
|
-
verify: "verify";
|
|
1832
|
-
}>;
|
|
1833
|
-
name: z.ZodString;
|
|
1834
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
1835
|
-
scope: z.ZodOptional<z.ZodObject<{
|
|
1836
|
-
classifications: z.ZodArray<z.ZodEnum<{
|
|
1837
|
-
"docs/process-only": "docs/process-only";
|
|
1838
|
-
"non-trivial": "non-trivial";
|
|
1839
|
-
trivial: "trivial";
|
|
1840
|
-
}>>;
|
|
1841
|
-
}, z.core.$strict>>;
|
|
1842
|
-
scopeReason: z.ZodString;
|
|
1843
|
-
status: z.ZodEnum<{
|
|
1844
|
-
"out-of-scope": "out-of-scope";
|
|
1845
|
-
satisfied: "satisfied";
|
|
1846
|
-
unmet: "unmet";
|
|
1847
|
-
}>;
|
|
1848
|
-
}, z.core.$strip>>>;
|
|
1849
|
-
github: z.ZodObject<{
|
|
1850
|
-
draft: z.ZodBoolean;
|
|
1851
|
-
mergeStateStatus: z.ZodString;
|
|
1852
|
-
mergeable: z.ZodString;
|
|
1853
|
-
requiredChecks: z.ZodEnum<{
|
|
1854
|
-
failed: "failed";
|
|
1855
|
-
none: "none";
|
|
1856
|
-
passed: "passed";
|
|
1857
|
-
pending: "pending";
|
|
1858
|
-
unknown: "unknown";
|
|
1859
|
-
}>;
|
|
1860
|
-
reviewDecision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1861
|
-
unresolvedReviewThreads: z.ZodNumber;
|
|
1862
|
-
}, z.core.$strip>;
|
|
1863
|
-
headSha: z.ZodString;
|
|
1864
|
-
mergeBaseSha: z.ZodOptional<z.ZodString>;
|
|
1865
|
-
patchId: z.ZodString;
|
|
1866
|
-
pr: z.ZodNumber;
|
|
1867
|
-
repairs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1868
|
-
action: z.ZodString;
|
|
1869
|
-
code: z.ZodEnum<{
|
|
1870
|
-
"await-post-undraft-checks": "await-post-undraft-checks";
|
|
1871
|
-
"undraft-pr": "undraft-pr";
|
|
1872
|
-
}>;
|
|
1873
|
-
command: z.ZodString;
|
|
1874
|
-
}, z.core.$strip>>>;
|
|
1875
|
-
reviewCycleState: z.ZodOptional<z.ZodObject<{
|
|
1876
|
-
autoBlockingFindings: z.ZodNumber;
|
|
1877
|
-
countsBySeverity: z.ZodObject<{
|
|
1878
|
-
critical: z.ZodNumber;
|
|
1879
|
-
high: z.ZodNumber;
|
|
1880
|
-
low: z.ZodNumber;
|
|
1881
|
-
medium: z.ZodNumber;
|
|
1882
|
-
unknown: z.ZodNumber;
|
|
1883
|
-
}, z.core.$strip>;
|
|
1884
|
-
highestBlockingSeverity: z.ZodOptional<z.ZodEnum<{
|
|
1885
|
-
critical: "critical";
|
|
1886
|
-
high: "high";
|
|
1887
|
-
low: "low";
|
|
1888
|
-
medium: "medium";
|
|
1889
|
-
unknown: "unknown";
|
|
1890
|
-
}>>;
|
|
1891
|
-
highestOpenSeverity: z.ZodOptional<z.ZodEnum<{
|
|
1892
|
-
critical: "critical";
|
|
1893
|
-
high: "high";
|
|
1894
|
-
low: "low";
|
|
1895
|
-
medium: "medium";
|
|
1896
|
-
unknown: "unknown";
|
|
1897
|
-
}>>;
|
|
1898
|
-
maxReviewCycles: z.ZodOptional<z.ZodNumber>;
|
|
1899
|
-
nonBlockingFindings: z.ZodNumber;
|
|
1900
|
-
openFindings: z.ZodNumber;
|
|
1901
|
-
reviewCycle: z.ZodOptional<z.ZodNumber>;
|
|
1902
|
-
staleRepeatFindings: z.ZodOptional<z.ZodNumber>;
|
|
1903
|
-
windowExhausted: z.ZodBoolean;
|
|
1904
|
-
}, z.core.$strip>>;
|
|
1905
|
-
reviewLadder: z.ZodOptional<z.ZodObject<{
|
|
1906
|
-
cycleCounts: z.ZodObject<{
|
|
1907
|
-
gate: z.ZodNumber;
|
|
1908
|
-
interior: z.ZodNumber;
|
|
1909
|
-
}, z.core.$strip>;
|
|
1910
|
-
forcedTransition: z.ZodOptional<z.ZodEnum<{
|
|
1911
|
-
"gate-cap-exhausted": "gate-cap-exhausted";
|
|
1912
|
-
"interior-cap-reached": "interior-cap-reached";
|
|
1913
|
-
}>>;
|
|
1914
|
-
nextAction: z.ZodEnum<{
|
|
1915
|
-
"accept-nonblocking-findings": "accept-nonblocking-findings";
|
|
1916
|
-
"advance-to-gate": "advance-to-gate";
|
|
1917
|
-
"escalate-to-triage": "escalate-to-triage";
|
|
1918
|
-
"ready-for-human": "ready-for-human";
|
|
1919
|
-
"run-gate-cycle": "run-gate-cycle";
|
|
1920
|
-
"run-interior-cycle": "run-interior-cycle";
|
|
1921
|
-
}>;
|
|
1922
|
-
stage: z.ZodEnum<{
|
|
1923
|
-
gate: "gate";
|
|
1924
|
-
interior: "interior";
|
|
1925
|
-
"interior-complete": "interior-complete";
|
|
1926
|
-
}>;
|
|
1927
|
-
}, z.core.$strip>>;
|
|
1928
|
-
reviewRuns: z.ZodOptional<z.ZodArray<z.ZodType<PrReviewResult, unknown, z.core.$ZodTypeInternals<PrReviewResult, unknown>>>>;
|
|
1929
|
-
reviewTerminalState: z.ZodOptional<z.ZodEnum<{
|
|
1930
|
-
"accepted-with-findings": "accepted-with-findings";
|
|
1931
|
-
blocked: "blocked";
|
|
1932
|
-
clean: "clean";
|
|
1933
|
-
}>>;
|
|
1934
|
-
reviews: z.ZodObject<{
|
|
1935
|
-
correctness: z.ZodObject<{
|
|
1936
|
-
required: z.ZodBoolean;
|
|
1937
|
-
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1938
|
-
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1939
|
-
status: z.ZodEnum<{
|
|
1940
|
-
blocked: "blocked";
|
|
1941
|
-
current: "current";
|
|
1942
|
-
missing: "missing";
|
|
1943
|
-
"not-required": "not-required";
|
|
1944
|
-
stale: "stale";
|
|
1945
|
-
}>;
|
|
1946
|
-
}, z.core.$strip>;
|
|
1947
|
-
security: z.ZodOptional<z.ZodObject<{
|
|
1948
|
-
required: z.ZodBoolean;
|
|
1949
|
-
reviewedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1950
|
-
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1951
|
-
status: z.ZodEnum<{
|
|
1952
|
-
blocked: "blocked";
|
|
1953
|
-
current: "current";
|
|
1954
|
-
missing: "missing";
|
|
1955
|
-
"not-required": "not-required";
|
|
1956
|
-
stale: "stale";
|
|
1957
|
-
}>;
|
|
1958
|
-
}, z.core.$strip>>;
|
|
1959
|
-
}, z.core.$strip>;
|
|
1960
|
-
schemaVersion: z.ZodLiteral<2>;
|
|
1961
|
-
verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1962
|
-
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1963
|
-
prVerify: z.ZodLiteral<"missing">;
|
|
1964
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1965
|
-
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1966
|
-
prVerify: z.ZodLiteral<"stale">;
|
|
1967
|
-
verifiedHeadSha: z.ZodString;
|
|
1968
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1969
|
-
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1970
|
-
prVerify: z.ZodLiteral<"passed-via-head">;
|
|
1971
|
-
verifiedHeadSha: z.ZodString;
|
|
1972
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1973
|
-
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1974
|
-
docsOnlyVerifiedHeadSha: z.ZodString;
|
|
1975
|
-
prVerify: z.ZodLiteral<"docs-only-delta">;
|
|
1976
|
-
verifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1977
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
1978
|
-
command: z.ZodLiteral<"patronage-factory pr:verify">;
|
|
1979
|
-
prVerify: z.ZodLiteral<"trivial-delta">;
|
|
1980
|
-
trivialVerifiedHeadSha: z.ZodString;
|
|
1981
|
-
verifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1982
|
-
}, z.core.$strict>], "prVerify">;
|
|
1983
|
-
}, z.core.$strip>;
|
|
1984
|
-
type ReadinessRepair = z.infer<typeof readinessRepairSchema>;
|
|
1985
|
-
type ReadinessStatus = "ready" | "blocked";
|
|
1986
|
-
type ManagedReadinessLedger = z.infer<typeof managedReadinessLedgerSchema>;
|
|
1987
|
-
declare function validateManagedReadinessLedger(value: unknown): ManagedReadinessLedger;
|
|
2227
|
+
interface HqFlushOrphans {
|
|
2228
|
+
orphans: HqSpoolOrphan[];
|
|
2229
|
+
}
|
|
2230
|
+
type HqFlushResult = (HqFlushOrphans & {
|
|
2231
|
+
reason: string;
|
|
2232
|
+
/**
|
|
2233
|
+
* Events still spooled when the command gave up. Non-zero means the
|
|
2234
|
+
* skip retained work: the exit status says so, and no caller may read
|
|
2235
|
+
* the skip as "there was nothing to do".
|
|
2236
|
+
*/
|
|
2237
|
+
retained: number;
|
|
2238
|
+
status: "skipped";
|
|
2239
|
+
}) | (HqFlushOrphans & HqSpoolFlushSummary & {
|
|
2240
|
+
endpoint: string;
|
|
2241
|
+
status: "flushed";
|
|
2242
|
+
});
|
|
1988
2243
|
declare namespace status_check_rollup_d_exports {
|
|
1989
2244
|
export { CheckState, HOSTED_VERIFY_CHECK_NAME, HOSTED_VERIFY_DRAFT_CHECK_NAME, StatusCheckRollup, admissionCheckExclusion, admissionCheckSetDescription, fetchRequiredStatusCheckContexts, hostedVerifyCheckState, isCancelledPrStatusHudCheck, isDraftHostedVerifyCheck, isExcludedFromAdmissionChecks, isFactoryReadyCheck, isHostedVerifyCheck, isRequiredStatusCheck, isSupersededHostedVerifyCheck, pendingCheckNames, requiredStatusCheckContexts, statusCheckState, unsettledNonRequiredCheckNames };
|
|
1990
2245
|
}
|
|
@@ -2154,1133 +2409,889 @@ declare const fetchRequiredStatusCheckContexts: (fetchRules: () => unknown, fetc
|
|
|
2154
2409
|
* whether the narrowing took effect or the read fell back to every run.
|
|
2155
2410
|
*/
|
|
2156
2411
|
declare const admissionCheckSetDescription: (requiredContexts?: readonly string[]) => string;
|
|
2412
|
+
declare const ARMING_OUTCOMES: readonly ["armed", "merged", "not-armed"];
|
|
2413
|
+
type ArmingOutcome = (typeof ARMING_OUTCOMES)[number];
|
|
2157
2414
|
/**
|
|
2158
|
-
*
|
|
2159
|
-
*
|
|
2415
|
+
* How GitHub merges the candidate. `pr:ready` chooses `merge` for a
|
|
2416
|
+
* recognized faithful catch-up merge (ADR 0028), because a squash drops the
|
|
2417
|
+
* second parent and the target loses the merged base as an ancestor (#829).
|
|
2418
|
+
* Every other candidate is squashed.
|
|
2160
2419
|
*/
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
method: "DELETE" | "GET" | "PATCH" | "POST";
|
|
2420
|
+
type AutoMergeMethod = "merge" | "squash";
|
|
2421
|
+
interface ArmAutoMergeInput {
|
|
2422
|
+
cwd: string;
|
|
2423
|
+
/** The validated PR head this arming is a compare-and-set against. */
|
|
2424
|
+
headSha: string;
|
|
2425
|
+
mergeMethod: AutoMergeMethod;
|
|
2168
2426
|
owner: string;
|
|
2169
|
-
|
|
2427
|
+
pr: number;
|
|
2170
2428
|
repo: string;
|
|
2171
2429
|
}
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2430
|
+
/**
|
|
2431
|
+
* What the PR actually did, read back after the call — never inferred from the
|
|
2432
|
+
* exit code. `not-armed` is a failure: the candidate is admitted but nothing
|
|
2433
|
+
* will merge it, so it carries the detail and `pr:ready` emits a re-dispatch.
|
|
2434
|
+
*/
|
|
2435
|
+
interface ArmAutoMergeOutcome {
|
|
2436
|
+
/** Why the arming did not take effect, or what the invocation reported. */
|
|
2437
|
+
detail?: string;
|
|
2438
|
+
headSha: string;
|
|
2439
|
+
outcome: ArmingOutcome;
|
|
2440
|
+
}
|
|
2441
|
+
/**
|
|
2442
|
+
* The two GitHub reads that make the base policy authoritative: the live tip of
|
|
2443
|
+
* a branch, and one file's content at an exact commit. Injectable so tests can
|
|
2444
|
+
* state what the authority says; an absent implementation is the real read, so
|
|
2445
|
+
* an unstated authority is a refusal rather than a silent pass.
|
|
2446
|
+
*/
|
|
2447
|
+
interface BaseReviewPolicyAuthority {
|
|
2448
|
+
branchTipSha: (input: {
|
|
2449
|
+
branch: string;
|
|
2450
|
+
cwd: string;
|
|
2451
|
+
repository: CheckoutRepository;
|
|
2452
|
+
}) => string;
|
|
2453
|
+
profileContentAtRef: (input: {
|
|
2454
|
+
cwd: string;
|
|
2455
|
+
profilePath: string;
|
|
2456
|
+
ref: string;
|
|
2457
|
+
repository: CheckoutRepository;
|
|
2458
|
+
}) => string;
|
|
2459
|
+
}
|
|
2460
|
+
/**
|
|
2461
|
+
* The pull request whose base ref is the authority, as the resolving stage
|
|
2462
|
+
* knows it (#922 Slice B).
|
|
2463
|
+
*
|
|
2464
|
+
* `pr:ready` is handed a PR number and reads the record; `pr:verify` and
|
|
2465
|
+
* `pr:review` run in the authoring checkout and look the PR up from the branch,
|
|
2466
|
+
* which can legitimately find nothing. `isCrossRepository` stays `unknown` for
|
|
2467
|
+
* the reason the reader below states: an unstated fork answer is not a "no".
|
|
2468
|
+
*/
|
|
2469
|
+
interface CandidatePullRequestPolicyContext {
|
|
2470
|
+
baseRefName: string;
|
|
2471
|
+
isCrossRepository: unknown;
|
|
2176
2472
|
}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2473
|
+
/** What a stage found when it looked for the pull request that owns this branch. */
|
|
2474
|
+
type CandidatePullRequestLookup = {
|
|
2475
|
+
pullRequest: CandidatePullRequestPolicyContext;
|
|
2476
|
+
status: "found";
|
|
2477
|
+
} | {
|
|
2478
|
+
status: "none";
|
|
2479
|
+
} | {
|
|
2480
|
+
reason: string;
|
|
2481
|
+
status: "unavailable";
|
|
2482
|
+
};
|
|
2483
|
+
interface HoldPullRequestInput {
|
|
2484
|
+
cwd: string;
|
|
2181
2485
|
owner: string;
|
|
2182
2486
|
pr: number;
|
|
2183
2487
|
repo: string;
|
|
2184
2488
|
}
|
|
2185
|
-
|
|
2186
|
-
request?: (input: FactoryAppRequest) => Promise<FactoryAppExchange>;
|
|
2187
|
-
requestJson?: (input: FactoryAppRequest) => Promise<unknown>;
|
|
2188
|
-
}
|
|
2189
|
-
interface UpsertFactoryPrStatusCommentResult {
|
|
2190
|
-
action: "created" | "updated";
|
|
2191
|
-
commentId: number;
|
|
2192
|
-
url: string;
|
|
2193
|
-
}
|
|
2194
|
-
declare function upsertFactoryPrStatusComment(input: UpsertFactoryPrStatusCommentInput, dependencies?: UpsertFactoryPrStatusCommentDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
2195
|
-
declare namespace verification_proof_d_exports {
|
|
2196
|
-
export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyNotDemandedRecord, PrVerifyNotRequiredCommand, PrVerifyProof, PrVerifySchemaVersion, PrVerifyTestFailure, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, trustedCatchUpRecognition, trustedImpactStamp, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
|
|
2197
|
-
}
|
|
2198
|
-
interface VerifiedHeadShas {
|
|
2199
|
-
docsOnlyVerifiedHeadShas: string[];
|
|
2200
|
-
trivialVerifiedHeadShas: string[];
|
|
2201
|
-
verifiedHeadShas: string[];
|
|
2202
|
-
}
|
|
2203
|
-
type VerificationHeadShas = {
|
|
2204
|
-
explicitFailure: true;
|
|
2205
|
-
} | VerifiedHeadShas;
|
|
2206
|
-
declare function readPrVerifyProof(filePath: string): PrVerifyProof;
|
|
2207
|
-
declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
|
|
2208
|
-
declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
|
|
2209
|
-
declare const verifyProofIdentityMatches: ({ currentIdentity, proof }: {
|
|
2210
|
-
currentIdentity?: {
|
|
2211
|
-
patchId: string;
|
|
2212
|
-
mergeBaseSha?: string;
|
|
2213
|
-
};
|
|
2214
|
-
proof?: PrVerifyProof;
|
|
2215
|
-
}) => boolean;
|
|
2489
|
+
export declare const MERGE_FREEZE_CHECK_NAME = "patronage-factory/merge-freeze";
|
|
2216
2490
|
/**
|
|
2217
|
-
*
|
|
2218
|
-
*
|
|
2219
|
-
*
|
|
2220
|
-
* candidate (the same identities the proof already binds). Everything else —
|
|
2221
|
-
* no proof, an aborted run, a stale head, a moved patch id, a pre-stamp proof
|
|
2222
|
-
* — returns `undefined`, and the consumer keeps today's full-demand floor.
|
|
2223
|
-
*
|
|
2224
|
-
* Deliberately stricter than verify-once applicability (which tolerates a
|
|
2225
|
-
* head-only or patch-id-only match): a stamp narrows external demands, so it
|
|
2226
|
-
* is trusted only on an exact double binding, fail closed.
|
|
2491
|
+
* The Factory App's slug, as GitHub serves it on the runs the writer posts.
|
|
2492
|
+
* It is not a trust predicate: an App chooses its own slug, so the reader
|
|
2493
|
+
* trusts the pinned numeric App id instead (ADR 0022, #1393).
|
|
2227
2494
|
*/
|
|
2228
|
-
declare const
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2495
|
+
export declare const MERGE_FREEZE_APP_SLUG = "patronage-factory";
|
|
2496
|
+
declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2497
|
+
active: z.ZodLiteral<true>;
|
|
2498
|
+
generationId: z.ZodNumber;
|
|
2499
|
+
headSha: z.ZodString;
|
|
2500
|
+
outcome: z.ZodEnum<{
|
|
2501
|
+
active: "active";
|
|
2502
|
+
stale: "stale";
|
|
2503
|
+
}>;
|
|
2504
|
+
reason: z.ZodString;
|
|
2505
|
+
recordedAt: z.ZodISODateTime;
|
|
2506
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2507
|
+
verification: z.ZodOptional<z.ZodObject<{
|
|
2508
|
+
jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
2509
|
+
cancelled: "cancelled";
|
|
2510
|
+
failure: "failure";
|
|
2511
|
+
skipped: "skipped";
|
|
2512
|
+
success: "success";
|
|
2513
|
+
}>>;
|
|
2514
|
+
runAttempt: z.ZodNumber;
|
|
2515
|
+
runId: z.ZodNumber;
|
|
2516
|
+
}, z.core.$strip>>;
|
|
2517
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2518
|
+
active: z.ZodLiteral<false>;
|
|
2519
|
+
clearRationale: z.ZodOptional<z.ZodString>;
|
|
2520
|
+
generationId: z.ZodNumber;
|
|
2521
|
+
headSha: z.ZodString;
|
|
2522
|
+
outcome: z.ZodLiteral<"inactive">;
|
|
2523
|
+
reason: z.ZodString;
|
|
2524
|
+
recordedAt: z.ZodISODateTime;
|
|
2525
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2526
|
+
verification: z.ZodOptional<z.ZodObject<{
|
|
2527
|
+
jobs: z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
2528
|
+
cancelled: "cancelled";
|
|
2529
|
+
failure: "failure";
|
|
2530
|
+
skipped: "skipped";
|
|
2531
|
+
success: "success";
|
|
2532
|
+
}>>;
|
|
2533
|
+
runAttempt: z.ZodNumber;
|
|
2534
|
+
runId: z.ZodNumber;
|
|
2535
|
+
}, z.core.$strip>>;
|
|
2536
|
+
}, z.core.$strip>], "active">;
|
|
2537
|
+
type MergeFreezeState = z.infer<typeof mergeFreezeStateSchema>;
|
|
2235
2538
|
/**
|
|
2236
|
-
*
|
|
2237
|
-
*
|
|
2238
|
-
* `
|
|
2239
|
-
*
|
|
2240
|
-
*
|
|
2241
|
-
* the same fail-closed answer (`undefined`) on every other state.
|
|
2539
|
+
* The write side of this contract lives in the generated merge-target push
|
|
2540
|
+
* Verify workflow (#356, ADR 0016; #429): it is the ONLY producer of
|
|
2541
|
+
* `patronage-factory/merge-freeze` generations. Its emitted `output.text`
|
|
2542
|
+
* payload must parse under this exact reader schema, which is what the
|
|
2543
|
+
* workflow's own tests assert through this export.
|
|
2242
2544
|
*/
|
|
2243
|
-
declare
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
patchId: string;
|
|
2247
|
-
};
|
|
2248
|
-
proof: PrVerifyProof | undefined;
|
|
2249
|
-
}) => CatchUpRecognition | undefined;
|
|
2250
|
-
declare const prVerifyFullHeadShasForDiff: ({ docsOnlyDeltaAcceptedSince, files, proof }: {
|
|
2251
|
-
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2252
|
-
files: string[];
|
|
2253
|
-
proof: PrVerifyProof;
|
|
2254
|
-
}) => string[];
|
|
2255
|
-
type VerificationProofState = {
|
|
2256
|
-
kind: "typed-aborted";
|
|
2257
|
-
proof: PrVerifyProof;
|
|
2258
|
-
} | {
|
|
2259
|
-
kind: "typed-missing";
|
|
2260
|
-
path: string;
|
|
2261
|
-
reason: "enoent" | "invalid";
|
|
2262
|
-
message?: string;
|
|
2263
|
-
} | {
|
|
2264
|
-
kind: "typed";
|
|
2265
|
-
headShas: VerifiedHeadShas;
|
|
2266
|
-
proof: PrVerifyProof;
|
|
2267
|
-
} | {
|
|
2268
|
-
kind: "typed-diff-mismatch";
|
|
2269
|
-
mode: ResolvedPrVerifyMode;
|
|
2270
|
-
};
|
|
2271
|
-
declare const verificationProofStateFor: ({ proof, proofMatchesCurrentDiff, proofPath }: {
|
|
2272
|
-
proof?: PrVerifyProof;
|
|
2273
|
-
proofMatchesCurrentDiff?: boolean;
|
|
2274
|
-
proofPath?: string;
|
|
2275
|
-
}) => VerificationProofState;
|
|
2276
|
-
declare const verificationProofApplicabilityFor: ({ docsOnlyDeltaAcceptedSince, explicitProof, files, headSha, currentIdentity, proof, proofPath, proofReadError }: {
|
|
2277
|
-
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2278
|
-
explicitProof: boolean;
|
|
2279
|
-
files: string[];
|
|
2280
|
-
headSha: string;
|
|
2281
|
-
currentIdentity?: {
|
|
2282
|
-
patchId: string;
|
|
2283
|
-
mergeBaseSha?: string;
|
|
2284
|
-
};
|
|
2285
|
-
proof?: PrVerifyProof;
|
|
2286
|
-
proofPath?: string;
|
|
2287
|
-
proofReadError?: unknown;
|
|
2288
|
-
}) => {
|
|
2289
|
-
fullVerifiedHeadShas: never[];
|
|
2290
|
-
verificationProof: VerificationProofState;
|
|
2291
|
-
} | {
|
|
2292
|
-
fullVerifiedHeadShas: string[];
|
|
2293
|
-
verificationProof: {
|
|
2294
|
-
headShas: VerifiedHeadShas;
|
|
2295
|
-
kind: "typed";
|
|
2296
|
-
proof: PrVerifyProof;
|
|
2297
|
-
};
|
|
2298
|
-
};
|
|
2299
|
-
declare const resolveVerifyProofApplicability: ({ proofPath, explicitProof, docsOnlyDeltaAcceptedSince, files, headSha, currentVerifyIdentityForBase, preread }: {
|
|
2300
|
-
proofPath: string;
|
|
2301
|
-
explicitProof: boolean;
|
|
2302
|
-
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2303
|
-
files: string[];
|
|
2545
|
+
export declare function validateMergeFreezeState(value: unknown): MergeFreezeState;
|
|
2546
|
+
interface MergeFreezeStoreInput {
|
|
2547
|
+
cwd: string;
|
|
2304
2548
|
headSha: string;
|
|
2305
|
-
|
|
2306
|
-
patchId: string;
|
|
2307
|
-
mergeBaseSha?: string;
|
|
2308
|
-
};
|
|
2309
|
-
preread?: {
|
|
2310
|
-
proof?: PrVerifyProof;
|
|
2311
|
-
error?: unknown;
|
|
2312
|
-
};
|
|
2313
|
-
}) => {
|
|
2314
|
-
fullVerifiedHeadShas: never[];
|
|
2315
|
-
verificationProof: VerificationProofState;
|
|
2316
|
-
} | {
|
|
2317
|
-
fullVerifiedHeadShas: string[];
|
|
2318
|
-
verificationProof: {
|
|
2319
|
-
headShas: VerifiedHeadShas;
|
|
2320
|
-
kind: "typed";
|
|
2321
|
-
proof: PrVerifyProof;
|
|
2322
|
-
};
|
|
2323
|
-
};
|
|
2324
|
-
declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
|
|
2325
|
-
declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
|
|
2326
|
-
type PreviewDisposition = "deploy" | "not-required";
|
|
2327
|
-
interface PreviewTargetPlan {
|
|
2328
|
-
basis: string;
|
|
2329
|
-
disposition: PreviewDisposition;
|
|
2330
|
-
name: string;
|
|
2549
|
+
repository: CheckoutRepository;
|
|
2331
2550
|
}
|
|
2332
|
-
interface
|
|
2333
|
-
|
|
2334
|
-
deploy: string[];
|
|
2335
|
-
/** The withheld stacks, in declaration order. */
|
|
2336
|
-
notRequired: PreviewTargetPlan[];
|
|
2337
|
-
/** Whether a trusted, identity-bound stamp was available at all. */
|
|
2338
|
-
stampTrusted: boolean;
|
|
2339
|
-
/** Every declared preview target with its disposition, in declaration order. */
|
|
2340
|
-
targets: PreviewTargetPlan[];
|
|
2551
|
+
interface MergeFreezeStore {
|
|
2552
|
+
read: (input: MergeFreezeStoreInput) => unknown;
|
|
2341
2553
|
}
|
|
2342
|
-
/** Validate a serialized plan without deriving or changing its dispositions. */
|
|
2343
|
-
export declare const validatePreviewLifecyclePlan: (value: unknown) => PreviewLifecyclePlan;
|
|
2344
2554
|
/**
|
|
2345
|
-
*
|
|
2346
|
-
|
|
2347
|
-
|
|
2555
|
+
* The run identity that proves a generation is settling because it is running.
|
|
2556
|
+
*/
|
|
2557
|
+
interface RunningMergeFreezeWitness {
|
|
2558
|
+
/** The base tip the running generation was created on. */
|
|
2559
|
+
headSha: string;
|
|
2560
|
+
/** The running `patronage-factory/merge-freeze` check-run id. */
|
|
2561
|
+
runId: number;
|
|
2562
|
+
}
|
|
2563
|
+
/** A push workflow run's status while it still owes a generation. */
|
|
2564
|
+
type PendingWorkflowRunStatus = "in_progress" | "pending" | "queued" | "requested" | "waiting";
|
|
2565
|
+
/**
|
|
2566
|
+
* The evidence that a generation is settling because it is still owed (#521).
|
|
2567
|
+
*
|
|
2568
|
+
* The witness is the freeze-writing workflow's push run on the tip, identified
|
|
2569
|
+
* through lineage (#1276): the immediate parent's settled generation records
|
|
2570
|
+
* the workflow run that wrote it, that run names its workflow, and the same
|
|
2571
|
+
* workflow's pending push run on the tip owes the tip's generation. It is the
|
|
2572
|
+
* workflow run rather than the `verify` job's check run because GitHub creates
|
|
2573
|
+
* a job's check run only when the job is dispatched, which for the `verify`
|
|
2574
|
+
* summary job is near the end of the push Verify.
|
|
2348
2575
|
*/
|
|
2349
|
-
interface
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2576
|
+
interface AwaitedMergeFreezeWitness {
|
|
2577
|
+
/** The base tip whose generation is awaited. */
|
|
2578
|
+
headSha: string;
|
|
2579
|
+
/** The immediate parent whose settled generation proves the writer runs. */
|
|
2580
|
+
parentSha: string;
|
|
2581
|
+
/** The workflow whose run wrote the parent's settled generation. */
|
|
2582
|
+
workflowId: number;
|
|
2583
|
+
/** That workflow's push run on the tip, which owes the generation. */
|
|
2584
|
+
workflowRunId: number;
|
|
2585
|
+
/** That run's status. A completed run owes nothing, so it is not settling. */
|
|
2586
|
+
workflowRunStatus: PendingWorkflowRunStatus;
|
|
2358
2587
|
}
|
|
2359
2588
|
/**
|
|
2360
|
-
* The
|
|
2361
|
-
* checks — i.e. targets whose proof is produced externally, which is exactly
|
|
2362
|
-
* what a preview producer is.
|
|
2589
|
+
* The two settling phases, each with the witness that proves it (#890).
|
|
2363
2590
|
*
|
|
2364
|
-
*
|
|
2365
|
-
*
|
|
2366
|
-
*
|
|
2367
|
-
* can never be skipped while its proof stays demanded.
|
|
2591
|
+
* `phase` replaces an optional `running` field that made one situation two:
|
|
2592
|
+
* the field's presence, not the situation, decided how readers behaved. Each
|
|
2593
|
+
* phase now carries exactly the witness its own rule needs.
|
|
2368
2594
|
*/
|
|
2369
|
-
|
|
2595
|
+
type SettlingMergeFreezeGeneration = {
|
|
2596
|
+
kind: "settling";
|
|
2597
|
+
phase: "running-generation";
|
|
2598
|
+
reason: string;
|
|
2599
|
+
witness: RunningMergeFreezeWitness;
|
|
2600
|
+
} | {
|
|
2601
|
+
kind: "settling";
|
|
2602
|
+
phase: "awaiting-generation";
|
|
2603
|
+
reason: string;
|
|
2604
|
+
witness: AwaitedMergeFreezeWitness;
|
|
2605
|
+
};
|
|
2370
2606
|
/**
|
|
2371
|
-
*
|
|
2607
|
+
* The freeze generation as a readiness decision needs to see it (#477).
|
|
2372
2608
|
*
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2378
|
-
*
|
|
2379
|
-
* `
|
|
2609
|
+
* `read` below collapses every situation short of a verdict into one refusal,
|
|
2610
|
+
* because merge time treats all of them as "do not merge". Readiness
|
|
2611
|
+
* distinguishes them: a settled generation is the writer's verdict, a
|
|
2612
|
+
* **settling** one is the window between a merge landing and its merge-target
|
|
2613
|
+
* Verify completing, and an **unreadable** one is ambiguous, malformed,
|
|
2614
|
+
* foreign-App, or unavailable state. Same selection, same pinned App, same
|
|
2615
|
+
* `started_at` ordering — only the reporting is finer.
|
|
2380
2616
|
*/
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
* applies, and for the same reason: a withheld stack is a stack that can
|
|
2392
|
-
* never re-emit the envelope its standing demand needs. Callers hold the
|
|
2393
|
-
* checkout context, so they resolve the set with `boundFailingCheckNames`
|
|
2394
|
-
* and pass it in; this module stays pure.
|
|
2395
|
-
*
|
|
2396
|
-
* REQUIRED, with no default, on purpose: a defaulted `[]` reads the same
|
|
2397
|
-
* whether the caller inspected the envelopes or never looked, and this seam
|
|
2398
|
-
* exists precisely for EXTERNAL preview producers — the callers most likely
|
|
2399
|
-
* to skip the lookup. Pass the result of `boundFailingCheckNames`; pass `[]`
|
|
2400
|
-
* only to mean "inspected the envelopes and found no bound failure".
|
|
2401
|
-
*
|
|
2402
|
-
* Deliberately visible to `api:check` as a breaking signature change
|
|
2403
|
-
* (pre-1.0, no external callers yet).
|
|
2404
|
-
*/
|
|
2405
|
-
vetoedTargets: readonly string[];
|
|
2406
|
-
}) => PreviewLifecyclePlan;
|
|
2407
|
-
type FactoryPrStatusCheckName = "patronage-factory/merge-freeze" | "patronage-factory/pr-ready" | "patronage-factory/pr-verify";
|
|
2408
|
-
interface CompletedFactoryCheckSnapshot {
|
|
2409
|
-
readonly completedAt: string;
|
|
2410
|
-
readonly conclusion: string;
|
|
2411
|
-
readonly detailsUrl?: string;
|
|
2412
|
-
readonly headSha: string;
|
|
2413
|
-
readonly name: FactoryPrStatusCheckName;
|
|
2414
|
-
/**
|
|
2415
|
-
* Merge freeze only (#1501): the cancellation-only generations, newest
|
|
2416
|
-
* first, that the freeze selection read past to reach this snapshot's
|
|
2417
|
-
* generation (#1158). Absent when the newest generation stands.
|
|
2418
|
-
*/
|
|
2419
|
-
readonly readPastRunIds?: readonly number[];
|
|
2420
|
-
/**
|
|
2421
|
-
* Merge freeze only (#1503): why readiness refuses to read the freeze at
|
|
2422
|
-
* this tip, when it does. The row then presents that refusal, never the
|
|
2423
|
-
* run's own conclusion.
|
|
2424
|
-
*/
|
|
2425
|
-
readonly refusal?: string;
|
|
2426
|
-
}
|
|
2427
|
-
interface FailedPreviewSnapshot {
|
|
2428
|
-
readonly completedAt: string;
|
|
2429
|
-
readonly conclusion: string;
|
|
2430
|
-
readonly detailsUrl?: string;
|
|
2431
|
-
readonly headSha: string;
|
|
2432
|
-
readonly name: string;
|
|
2433
|
-
}
|
|
2434
|
-
interface FactoryPrStatusSources {
|
|
2435
|
-
/** Live PR base ref name observed with the sources. Identity, not a SHA. */
|
|
2436
|
-
readonly baseRefName?: string;
|
|
2437
|
-
readonly baseSha: string;
|
|
2438
|
-
readonly checks: Readonly<Partial<Record<FactoryPrStatusCheckName, CompletedFactoryCheckSnapshot>>>;
|
|
2439
|
-
readonly previewFailures?: Readonly<Partial<Record<string, FailedPreviewSnapshot>>>;
|
|
2440
|
-
readonly previewRegistrations: readonly PreviewProofRegistration[];
|
|
2441
|
-
}
|
|
2442
|
-
interface RenderFactoryPrStatusHudInput extends FactoryPrStatusSources {
|
|
2443
|
-
readonly headSha: string;
|
|
2444
|
-
readonly plan: PreviewLifecyclePlan;
|
|
2445
|
-
readonly planHeadSha: string;
|
|
2446
|
-
readonly pr: number;
|
|
2447
|
-
/** ISO instant at which the presentation sources were observed. */
|
|
2448
|
-
readonly renderedAt: string;
|
|
2449
|
-
}
|
|
2450
|
-
interface PresentFactoryPrStatusHudInput {
|
|
2451
|
-
readonly headSha: string;
|
|
2452
|
-
readonly owner: string;
|
|
2453
|
-
readonly plan: PreviewLifecyclePlan;
|
|
2454
|
-
readonly planHeadSha: string;
|
|
2455
|
-
readonly pr: number;
|
|
2456
|
-
readonly renderedAt?: string;
|
|
2457
|
-
readonly repo: string;
|
|
2458
|
-
}
|
|
2459
|
-
interface PresentFactoryPrStatusHudDependencies {
|
|
2460
|
-
/**
|
|
2461
|
-
* Read only `previewProofInventory.list` registrations and completed,
|
|
2462
|
-
* Factory-App-owned check snapshots. PR comment bodies are not an evidence
|
|
2463
|
-
* source and are deliberately absent from this contract.
|
|
2464
|
-
*/
|
|
2465
|
-
readonly readSources: (input: {
|
|
2466
|
-
headSha: string;
|
|
2467
|
-
owner: string;
|
|
2468
|
-
pr: number;
|
|
2469
|
-
previewTargets?: readonly string[];
|
|
2470
|
-
repo: string;
|
|
2471
|
-
}) => Promise<FactoryPrStatusSources>;
|
|
2472
|
-
/**
|
|
2473
|
-
* Recheck the pulls identity immediately before mutating the sticky HUD.
|
|
2474
|
-
* Happy path reads `/pulls/:n` only; git-ref is fetched to decorate a
|
|
2475
|
-
* head-moved error, not as a second identity endpoint.
|
|
2476
|
-
*/
|
|
2477
|
-
readonly assertCurrentIdentity: (input: {
|
|
2478
|
-
baseRefName?: string;
|
|
2479
|
-
/** Retained for rendering/callers; identity compares base ref name. */
|
|
2480
|
-
baseSha?: string;
|
|
2481
|
-
headSha: string;
|
|
2482
|
-
owner: string;
|
|
2483
|
-
pr: number;
|
|
2484
|
-
repo: string;
|
|
2485
|
-
}) => Promise<void>;
|
|
2486
|
-
readonly upsert?: typeof upsertFactoryPrStatusComment;
|
|
2487
|
-
}
|
|
2488
|
-
interface ReadFactoryPrStatusSourcesInput {
|
|
2489
|
-
readonly headSha: string;
|
|
2490
|
-
/**
|
|
2491
|
-
* Contents-read token for `previewProofInventory.list` and the live
|
|
2492
|
-
* `git/ref/heads/<base>` tip. Both need `contents: read`; the Factory App
|
|
2493
|
-
* token has none, so pass a workflow `GITHUB_TOKEN` (#825, #908). The
|
|
2494
|
-
* inventory list falls back to `token`. The base tip has no HTTP fallback:
|
|
2495
|
-
* without this token it is read through `gh`.
|
|
2496
|
-
*/
|
|
2497
|
-
readonly inventoryToken?: string;
|
|
2498
|
-
readonly owner: string;
|
|
2499
|
-
readonly pr: number;
|
|
2500
|
-
/**
|
|
2501
|
-
* Demanded preview stack names from the lifecycle plan. Used only to look up
|
|
2502
|
-
* a completed unsuccessful check run when inventory has no registration.
|
|
2503
|
-
*/
|
|
2504
|
-
readonly previewTargets?: readonly string[];
|
|
2505
|
-
/**
|
|
2506
|
-
* Token for the `/pulls/:n` identity read only. Defaults to `token`. On a
|
|
2507
|
-
* Cursor VM `token` is the broker's checks token, which cannot read pulls,
|
|
2508
|
-
* so this is the broker's admission token (#1327).
|
|
2509
|
-
*/
|
|
2510
|
-
readonly pullToken?: string;
|
|
2511
|
-
readonly repo: string;
|
|
2512
|
-
/** Factory App installation token, normally minted by the presentation job. */
|
|
2513
|
-
readonly token: string;
|
|
2514
|
-
}
|
|
2515
|
-
interface ReadFactoryPrStatusSourcesDependencies {
|
|
2516
|
-
readonly fetch?: typeof fetch;
|
|
2517
|
-
/**
|
|
2518
|
-
* Local base-tip reader used when no `inventoryToken` exists. Defaults to
|
|
2519
|
-
* the `gh`-backed reader `pr:ready` already uses.
|
|
2520
|
-
*/
|
|
2521
|
-
readonly fetchBranchTipSha?: typeof fetchGitHubBranchTipSha;
|
|
2522
|
-
readonly listPreviewRegistrations?: (input: {
|
|
2523
|
-
owner: string;
|
|
2524
|
-
pr: number;
|
|
2525
|
-
repo: string;
|
|
2526
|
-
token: string;
|
|
2527
|
-
}) => Promise<readonly PreviewProofRegistration[]>;
|
|
2528
|
-
readonly timeoutMs?: number;
|
|
2529
|
-
}
|
|
2530
|
-
export declare function renderFactoryPrStatusHud(input: RenderFactoryPrStatusHudInput): string;
|
|
2531
|
-
export declare function presentFactoryPrStatusHud(input: PresentFactoryPrStatusHudInput, dependencies: PresentFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
2532
|
-
export declare function assertFactoryPrStatusIdentity(input: ReadFactoryPrStatusSourcesInput & {
|
|
2533
|
-
readonly baseRefName?: string;
|
|
2534
|
-
/** Retained for rendering/callers; identity compares base ref name. */
|
|
2535
|
-
readonly baseSha?: string;
|
|
2536
|
-
}, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<void>;
|
|
2537
|
-
export declare function readFactoryPrStatusSources(input: ReadFactoryPrStatusSourcesInput, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<FactoryPrStatusSources>;
|
|
2538
|
-
interface PlanFactoryPrStatusHudInput {
|
|
2539
|
-
readonly cwd: string;
|
|
2540
|
-
readonly headSha: string;
|
|
2541
|
-
readonly mergeBaseSha?: string;
|
|
2542
|
-
readonly patchId?: string;
|
|
2543
|
-
readonly profilePath?: string;
|
|
2617
|
+
type MergeFreezeGeneration = {
|
|
2618
|
+
kind: "settled";
|
|
2619
|
+
state: MergeFreezeState;
|
|
2620
|
+
} | SettlingMergeFreezeGeneration | {
|
|
2621
|
+
kind: "unreadable";
|
|
2622
|
+
reason: string;
|
|
2623
|
+
};
|
|
2624
|
+
/** A merge-freeze reader that can also report the settle window (#477). */
|
|
2625
|
+
interface MergeFreezeAuthority extends MergeFreezeStore {
|
|
2626
|
+
readGeneration: (input: MergeFreezeStoreInput) => MergeFreezeGeneration;
|
|
2544
2627
|
}
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
*/
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
*/
|
|
2559
|
-
readonly inventoryToken?: string;
|
|
2560
|
-
readonly mergeBaseSha?: string;
|
|
2561
|
-
readonly owner: string;
|
|
2562
|
-
readonly patchId?: string;
|
|
2563
|
-
readonly pr: number;
|
|
2564
|
-
readonly profilePath?: string;
|
|
2565
|
-
readonly repo: string;
|
|
2566
|
-
readonly token?: string;
|
|
2628
|
+
interface GitHubCheckRunMergeFreezeApi {
|
|
2629
|
+
list: (input: MergeFreezeStoreInput & {
|
|
2630
|
+
name: string;
|
|
2631
|
+
}) => unknown;
|
|
2632
|
+
parent?: (input: MergeFreezeStoreInput) => unknown;
|
|
2633
|
+
/** One GitHub Actions workflow run, by id (`headSha` is not consulted). */
|
|
2634
|
+
workflowRun?: (input: MergeFreezeStoreInput & {
|
|
2635
|
+
runId: number;
|
|
2636
|
+
}) => unknown;
|
|
2637
|
+
/** A workflow's push runs on `headSha`, as `{ workflow_runs }`. */
|
|
2638
|
+
workflowRuns?: (input: MergeFreezeStoreInput & {
|
|
2639
|
+
workflowId: number;
|
|
2640
|
+
}) => unknown;
|
|
2567
2641
|
}
|
|
2642
|
+
export declare function createGitHubCheckRunMergeFreezeStore(api: GitHubCheckRunMergeFreezeApi): MergeFreezeAuthority;
|
|
2568
2643
|
/**
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2644
|
+
* Read a branch tip from GitHub rather than a checkout's cached remote ref.
|
|
2645
|
+
* `gh` is injectable so a test can hand the real read a fake GitHub.
|
|
2571
2646
|
*/
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2647
|
+
declare const fetchGitHubBranchTipSha: (repository: CheckoutRepository, branch: string, cwd: string, gh?: <T>(args: string[], cwd: string) => T) => string;
|
|
2648
|
+
/** An asynchronous `gh` JSON read. Injected so a test can hand the reads a fake GitHub. */
|
|
2649
|
+
type GhBoundedJsonReader = (args: string[], cwd: string) => Promise<unknown>;
|
|
2650
|
+
interface FactoryAppRequest {
|
|
2651
|
+
body?: unknown;
|
|
2652
|
+
headers?: Readonly<Record<string, string>>;
|
|
2653
|
+
method: "DELETE" | "GET" | "PATCH" | "POST";
|
|
2654
|
+
owner: string;
|
|
2655
|
+
path: string;
|
|
2656
|
+
repo: string;
|
|
2578
2657
|
}
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
* its check so the table is not stuck at first-write.
|
|
2584
|
-
*/
|
|
2585
|
-
export declare function refreshFactoryPrStatusHudSafely(input: RefreshFactoryPrStatusHudInput, onNotice?: (message: string) => void): Promise<void>;
|
|
2586
|
-
interface PrReadyArgs extends LoadProjectProfileInput {
|
|
2587
|
-
authoringSessionIds?: string[];
|
|
2588
|
-
base: string;
|
|
2589
|
-
epic?: number;
|
|
2590
|
-
hold?: boolean;
|
|
2591
|
-
json?: boolean;
|
|
2592
|
-
output?: string;
|
|
2593
|
-
report?: boolean;
|
|
2594
|
-
pr: number;
|
|
2595
|
-
reviewProof?: string;
|
|
2596
|
-
throwWhenBlocked?: boolean;
|
|
2597
|
-
verifyProof?: string;
|
|
2658
|
+
interface FactoryAppExchange<T = unknown> {
|
|
2659
|
+
readonly etag?: string;
|
|
2660
|
+
readonly json: T;
|
|
2661
|
+
readonly status: number;
|
|
2598
2662
|
}
|
|
2599
|
-
interface
|
|
2600
|
-
/**
|
|
2601
|
-
* GitHub's live auto-merge enablement, or `null` when nothing is scheduled.
|
|
2602
|
-
*
|
|
2603
|
-
* Required, not optional (#515 review). `gh pr view --json autoMergeRequest`
|
|
2604
|
-
* always returns the key — explicitly `null` when nothing is scheduled — and
|
|
2605
|
-
* errors loudly on a field name it does not know, so there is no shape where
|
|
2606
|
-
* the real CLI omits it. But `fetchPullRequest` is injectable, and an
|
|
2607
|
-
* implementation that left the field out would silently disable the
|
|
2608
|
-
* `boundary-wave` refusal that stops an epicless run from greening a
|
|
2609
|
-
* candidate GitHub is already scheduled to merge. Requiring it makes the
|
|
2610
|
-
* compiler enforce what `gh` already promises.
|
|
2611
|
-
*/
|
|
2612
|
-
autoMergeRequest: {
|
|
2613
|
-
enabledAt?: string;
|
|
2614
|
-
} | null;
|
|
2615
|
-
baseRefName: string;
|
|
2616
|
-
baseRefOid: string;
|
|
2663
|
+
interface UpsertFactoryPrStatusCommentInput {
|
|
2617
2664
|
body: string;
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
} | null;
|
|
2632
|
-
mergeStateStatus: string;
|
|
2633
|
-
mergeable: string;
|
|
2634
|
-
number: number;
|
|
2635
|
-
reviewDecision: string | null;
|
|
2636
|
-
/**
|
|
2637
|
-
* The status-check contexts the base branch's rulesets require (#1580).
|
|
2638
|
-
* Absent means not known, and every hosted run on the head is judged, as
|
|
2639
|
-
* before #1580.
|
|
2640
|
-
*/
|
|
2641
|
-
requiredCheckContexts?: string[];
|
|
2642
|
-
state: "OPEN" | "CLOSED" | "MERGED";
|
|
2643
|
-
statusCheckRollup?: StatusCheckRollup[];
|
|
2644
|
-
title: string;
|
|
2645
|
-
unresolvedReviewThreads: number;
|
|
2665
|
+
/** ISO instant at which this presentation was observed. */
|
|
2666
|
+
observedAt?: string;
|
|
2667
|
+
owner: string;
|
|
2668
|
+
pr: number;
|
|
2669
|
+
repo: string;
|
|
2670
|
+
}
|
|
2671
|
+
interface UpsertFactoryPrStatusCommentDependencies {
|
|
2672
|
+
request?: (input: FactoryAppRequest) => Promise<FactoryAppExchange>;
|
|
2673
|
+
requestJson?: (input: FactoryAppRequest) => Promise<unknown>;
|
|
2674
|
+
}
|
|
2675
|
+
interface UpsertFactoryPrStatusCommentResult {
|
|
2676
|
+
action: "created" | "updated";
|
|
2677
|
+
commentId: number;
|
|
2646
2678
|
url: string;
|
|
2647
2679
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2680
|
+
declare function upsertFactoryPrStatusComment(input: UpsertFactoryPrStatusCommentInput, dependencies?: UpsertFactoryPrStatusCommentDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
2681
|
+
declare namespace verification_proof_d_exports {
|
|
2682
|
+
export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyNotDemandedRecord, PrVerifyNotRequiredCommand, PrVerifyProof, PrVerifySchemaVersion, PrVerifyTestFailure, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, trustedCatchUpRecognition, trustedImpactStamp, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
|
|
2683
|
+
}
|
|
2684
|
+
interface VerifiedHeadShas {
|
|
2685
|
+
docsOnlyVerifiedHeadShas: string[];
|
|
2686
|
+
trivialVerifiedHeadShas: string[];
|
|
2687
|
+
verifiedHeadShas: string[];
|
|
2688
|
+
}
|
|
2689
|
+
type VerificationHeadShas = {
|
|
2690
|
+
explicitFailure: true;
|
|
2691
|
+
} | VerifiedHeadShas;
|
|
2692
|
+
declare function readPrVerifyProof(filePath: string): PrVerifyProof;
|
|
2693
|
+
declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
|
|
2694
|
+
declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
|
|
2695
|
+
declare const verifyProofIdentityMatches: ({ currentIdentity, proof }: {
|
|
2696
|
+
currentIdentity?: {
|
|
2697
|
+
patchId: string;
|
|
2698
|
+
mergeBaseSha?: string;
|
|
2699
|
+
};
|
|
2700
|
+
proof?: PrVerifyProof;
|
|
2701
|
+
}) => boolean;
|
|
2702
|
+
/**
|
|
2703
|
+
* Wave-2 consumption (#542): the recorded impact stamp, released for demand
|
|
2704
|
+
* resolution ONLY when it is identity-bound to the current candidate — the
|
|
2705
|
+
* proof passed, and its recorded headSha AND patchId both name exactly this
|
|
2706
|
+
* candidate (the same identities the proof already binds). Everything else —
|
|
2707
|
+
* no proof, an aborted run, a stale head, a moved patch id, a pre-stamp proof
|
|
2708
|
+
* — returns `undefined`, and the consumer keeps today's full-demand floor.
|
|
2709
|
+
*
|
|
2710
|
+
* Deliberately stricter than verify-once applicability (which tolerates a
|
|
2711
|
+
* head-only or patch-id-only match): a stamp narrows external demands, so it
|
|
2712
|
+
* is trusted only on an exact double binding, fail closed.
|
|
2713
|
+
*/
|
|
2714
|
+
declare const trustedImpactStamp: ({ candidate, proof }: {
|
|
2715
|
+
candidate: {
|
|
2663
2716
|
headSha: string;
|
|
2664
|
-
|
|
2717
|
+
patchId: string;
|
|
2718
|
+
};
|
|
2719
|
+
proof: PrVerifyProof | undefined;
|
|
2720
|
+
}) => ImpactStamp | undefined;
|
|
2721
|
+
/**
|
|
2722
|
+
* #833: the recorded catch-up recognition, consumed ONLY when it is
|
|
2723
|
+
* identity-bound to the current candidate under exactly the rules
|
|
2724
|
+
* `trustedImpactStamp` applies — the proof passed, and its recorded
|
|
2725
|
+
* headSha AND patchId both name this candidate. The recognition withdraws
|
|
2726
|
+
* review and preview demands, so it earns the same strict double binding and
|
|
2727
|
+
* the same fail-closed answer (`undefined`) on every other state.
|
|
2728
|
+
*/
|
|
2729
|
+
declare const trustedCatchUpRecognition: ({ candidate, proof }: {
|
|
2730
|
+
candidate: {
|
|
2731
|
+
headSha: string;
|
|
2732
|
+
patchId: string;
|
|
2733
|
+
};
|
|
2734
|
+
proof: PrVerifyProof | undefined;
|
|
2735
|
+
}) => CatchUpRecognition | undefined;
|
|
2736
|
+
declare const prVerifyFullHeadShasForDiff: ({ docsOnlyDeltaAcceptedSince, files, proof }: {
|
|
2737
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2738
|
+
files: string[];
|
|
2739
|
+
proof: PrVerifyProof;
|
|
2740
|
+
}) => string[];
|
|
2741
|
+
type VerificationProofState = {
|
|
2742
|
+
kind: "typed-aborted";
|
|
2743
|
+
proof: PrVerifyProof;
|
|
2744
|
+
} | {
|
|
2745
|
+
kind: "typed-missing";
|
|
2746
|
+
path: string;
|
|
2747
|
+
reason: "enoent" | "invalid";
|
|
2748
|
+
message?: string;
|
|
2749
|
+
} | {
|
|
2750
|
+
kind: "typed";
|
|
2751
|
+
headShas: VerifiedHeadShas;
|
|
2752
|
+
proof: PrVerifyProof;
|
|
2753
|
+
} | {
|
|
2754
|
+
kind: "typed-diff-mismatch";
|
|
2755
|
+
mode: ResolvedPrVerifyMode;
|
|
2756
|
+
};
|
|
2757
|
+
declare const verificationProofStateFor: ({ proof, proofMatchesCurrentDiff, proofPath }: {
|
|
2758
|
+
proof?: PrVerifyProof;
|
|
2759
|
+
proofMatchesCurrentDiff?: boolean;
|
|
2760
|
+
proofPath?: string;
|
|
2761
|
+
}) => VerificationProofState;
|
|
2762
|
+
declare const verificationProofApplicabilityFor: ({ docsOnlyDeltaAcceptedSince, explicitProof, files, headSha, currentIdentity, proof, proofPath, proofReadError }: {
|
|
2763
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2764
|
+
explicitProof: boolean;
|
|
2765
|
+
files: string[];
|
|
2766
|
+
headSha: string;
|
|
2767
|
+
currentIdentity?: {
|
|
2768
|
+
patchId: string;
|
|
2769
|
+
mergeBaseSha?: string;
|
|
2770
|
+
};
|
|
2771
|
+
proof?: PrVerifyProof;
|
|
2772
|
+
proofPath?: string;
|
|
2773
|
+
proofReadError?: unknown;
|
|
2774
|
+
}) => {
|
|
2775
|
+
fullVerifiedHeadShas: never[];
|
|
2776
|
+
verificationProof: VerificationProofState;
|
|
2777
|
+
} | {
|
|
2778
|
+
fullVerifiedHeadShas: string[];
|
|
2779
|
+
verificationProof: {
|
|
2780
|
+
headShas: VerifiedHeadShas;
|
|
2781
|
+
kind: "typed";
|
|
2782
|
+
proof: PrVerifyProof;
|
|
2783
|
+
};
|
|
2784
|
+
};
|
|
2785
|
+
declare const resolveVerifyProofApplicability: ({ proofPath, explicitProof, docsOnlyDeltaAcceptedSince, files, headSha, currentVerifyIdentityForBase, preread }: {
|
|
2786
|
+
proofPath: string;
|
|
2787
|
+
explicitProof: boolean;
|
|
2788
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2789
|
+
files: string[];
|
|
2790
|
+
headSha: string;
|
|
2791
|
+
currentVerifyIdentityForBase?: (base: string) => {
|
|
2792
|
+
patchId: string;
|
|
2793
|
+
mergeBaseSha?: string;
|
|
2794
|
+
};
|
|
2795
|
+
preread?: {
|
|
2796
|
+
proof?: PrVerifyProof;
|
|
2797
|
+
error?: unknown;
|
|
2798
|
+
};
|
|
2799
|
+
}) => {
|
|
2800
|
+
fullVerifiedHeadShas: never[];
|
|
2801
|
+
verificationProof: VerificationProofState;
|
|
2802
|
+
} | {
|
|
2803
|
+
fullVerifiedHeadShas: string[];
|
|
2804
|
+
verificationProof: {
|
|
2805
|
+
headShas: VerifiedHeadShas;
|
|
2806
|
+
kind: "typed";
|
|
2807
|
+
proof: PrVerifyProof;
|
|
2665
2808
|
};
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
/**
|
|
2675
|
-
* Why this run blocked, one entry per refusing demand (#391): `code` is the
|
|
2676
|
-
* demand key from the resolver's vocabulary, `detail` the one-sentence
|
|
2677
|
-
* refusal. Same refusals as `blockingReasons`, in the same order — the
|
|
2678
|
-
* analyzable projection of a flat string list, so a wall of blocked proofs
|
|
2679
|
-
* on one PR can be counted by cause. Absent when nothing blocked.
|
|
2680
|
-
*/
|
|
2681
|
-
blockedReasons?: BlockedReason[];
|
|
2682
|
-
blockingReasons: string[];
|
|
2683
|
-
humanBlockingReasons: string[];
|
|
2684
|
-
command: "patronage-factory pr:ready";
|
|
2685
|
-
/**
|
|
2686
|
-
* Machine-safe arg array for the obvious next action (#523): when `ready`
|
|
2687
|
-
* but arming did not take effect, a `pr:ready` re-dispatch (idempotent on
|
|
2688
|
-
* an unchanged head); otherwise the `gh pr ready` undraft repair or the
|
|
2689
|
-
* `pr:verify` re-run that the blocking reasons name (re-verify the head,
|
|
2690
|
-
* then re-run pr:ready). Same `argv` shape `factory:delegate --print`
|
|
2691
|
-
* emits. Optional and purely additive.
|
|
2692
|
-
*/
|
|
2693
|
-
followUp?: FollowUpAction;
|
|
2694
|
-
/**
|
|
2695
|
-
* `ledger.headSha` is the evaluated head SHA: the GitHub `pr.headRefOid`
|
|
2696
|
-
* captured at evaluation time (not a local git read), recorded explicitly
|
|
2697
|
-
* so merge-time identity checks are a pure comparison against the live
|
|
2698
|
-
* pushed HEAD, not a re-derivation. See the ledger schema.
|
|
2699
|
-
*/
|
|
2700
|
-
ledger: ManagedReadinessLedger;
|
|
2701
|
-
/**
|
|
2702
|
-
* Actionable facts that did not block (#477): a settling merge-freeze
|
|
2703
|
-
* generation that permitted readiness and any authorized arming with a
|
|
2704
|
-
* notice, an admitted-but-unscheduled false boundary wave, and how each
|
|
2705
|
-
* waived demand reads to a human. Absent when there are none.
|
|
2706
|
-
*/
|
|
2707
|
-
notices?: string[];
|
|
2708
|
-
/**
|
|
2709
|
-
* The policy identity readiness resolved review demand under (#922): the
|
|
2710
|
-
* base ref, its live tip, and the digests of the base, candidate, and merged
|
|
2711
|
-
* review policies. Optional on the wire and additive — this is a new record
|
|
2712
|
-
* on an unchanged contract, so no schema version moves.
|
|
2713
|
-
*/
|
|
2714
|
-
policyResolution?: PolicyResolution;
|
|
2715
|
-
/** Committed profile blob evaluated by readiness. Required for merge. */
|
|
2716
|
-
profileBlobSha?: string;
|
|
2717
|
-
/** Checkout-relative committed profile path evaluated by readiness. */
|
|
2718
|
-
profilePath?: string;
|
|
2719
|
-
repairs: ReadinessRepair[];
|
|
2720
|
-
/** Trusted checkout repository used for all GitHub reads and writes. */
|
|
2721
|
-
repository?: string;
|
|
2722
|
-
status: ReadinessStatus;
|
|
2723
|
-
/**
|
|
2724
|
-
* Demands that were in force, were NOT met, and were waived by the operator
|
|
2725
|
-
* (#354, moved here from the merge-time proof by #477). Each entry carries
|
|
2726
|
-
* the demand's refusals verbatim, so a waived demand can never read as a met
|
|
2727
|
-
* one; readiness proceeds on the recorded operator act, not on evidence.
|
|
2728
|
-
*/
|
|
2729
|
-
waivedDemands?: WaivedDemand[];
|
|
2809
|
+
};
|
|
2810
|
+
declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
|
|
2811
|
+
declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
|
|
2812
|
+
type PreviewDisposition = "deploy" | "not-required";
|
|
2813
|
+
interface PreviewTargetPlan {
|
|
2814
|
+
basis: string;
|
|
2815
|
+
disposition: PreviewDisposition;
|
|
2816
|
+
name: string;
|
|
2730
2817
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2818
|
+
interface PreviewLifecyclePlan {
|
|
2819
|
+
/** The declared preview stacks to deploy, in declaration order. */
|
|
2820
|
+
deploy: string[];
|
|
2821
|
+
/** The withheld stacks, in declaration order. */
|
|
2822
|
+
notRequired: PreviewTargetPlan[];
|
|
2823
|
+
/** Whether a trusted, identity-bound stamp was available at all. */
|
|
2824
|
+
stampTrusted: boolean;
|
|
2825
|
+
/** Every declared preview target with its disposition, in declaration order. */
|
|
2826
|
+
targets: PreviewTargetPlan[];
|
|
2736
2827
|
}
|
|
2737
|
-
/**
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2828
|
+
/** Validate a serialized plan without deriving or changing its dispositions. */
|
|
2829
|
+
export declare const validatePreviewLifecyclePlan: (value: unknown) => PreviewLifecyclePlan;
|
|
2830
|
+
/**
|
|
2831
|
+
* Structural subset of the profile: the impact declarations plus the external
|
|
2832
|
+
* demand list. Structural rather than a `Pick` so this module does not import
|
|
2833
|
+
* `profile.ts`.
|
|
2834
|
+
*/
|
|
2835
|
+
interface PreviewLifecycleProfile {
|
|
2836
|
+
impact?: {
|
|
2837
|
+
targets: {
|
|
2838
|
+
name: string;
|
|
2839
|
+
}[];
|
|
2840
|
+
};
|
|
2841
|
+
requiredChecks?: {
|
|
2842
|
+
name: string;
|
|
2748
2843
|
}[];
|
|
2749
|
-
/**
|
|
2750
|
-
* GitHub has more closing references than the one page `pr:ready` reads,
|
|
2751
|
-
* so `closingIssues` is not the whole set.
|
|
2752
|
-
*/
|
|
2753
|
-
closingIssuesIncomplete: boolean;
|
|
2754
|
-
labels: string[];
|
|
2755
2844
|
}
|
|
2756
2845
|
/**
|
|
2757
|
-
* The
|
|
2758
|
-
*
|
|
2759
|
-
*
|
|
2846
|
+
* The declared preview stacks: impact targets that are ALSO declared required
|
|
2847
|
+
* checks — i.e. targets whose proof is produced externally, which is exactly
|
|
2848
|
+
* what a preview producer is.
|
|
2849
|
+
*
|
|
2850
|
+
* Deriving the list from the two existing declarations rather than adding a
|
|
2851
|
+
* third is what makes lifecycle and demand unable to disagree: the stacks this
|
|
2852
|
+
* plan can withhold are precisely the demands wave 2 can release, so a stack
|
|
2853
|
+
* can never be skipped while its proof stays demanded.
|
|
2760
2854
|
*/
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
readPullRequest: (input: {
|
|
2778
|
-
owner: string;
|
|
2779
|
-
pr: number;
|
|
2780
|
-
repo: string;
|
|
2781
|
-
}) => PullRequestArmingFacts | Promise<PullRequestArmingFacts>;
|
|
2782
|
-
}
|
|
2783
|
-
interface PrReadyDependencies {
|
|
2784
|
-
/**
|
|
2785
|
-
* The broker's admission token on a Cursor VM (#1327), for issue reads the
|
|
2786
|
-
* VM's own `gh` credential cannot make. Defaults to the process-wide
|
|
2787
|
-
* credential, which mints nothing off a Cursor managed runtime.
|
|
2788
|
-
*/
|
|
2789
|
-
admission?: AdmissionCredential;
|
|
2790
|
-
/**
|
|
2791
|
-
* Arms GitHub native auto-merge for an admitted candidate (#477, #1299).
|
|
2792
|
-
* Defaults to the real `gh pr merge --auto` call plus the read-back that
|
|
2793
|
-
* says what actually happened.
|
|
2794
|
-
*/
|
|
2795
|
-
armAutoMerge?: (input: ArmAutoMergeInput) => ArmAutoMergeOutcome;
|
|
2796
|
-
/**
|
|
2797
|
-
* The GitHub reads behind the reasons not to arm (#1299). Defaults to the
|
|
2798
|
-
* real GraphQL reads.
|
|
2799
|
-
*/
|
|
2800
|
-
armingPolicy?: ArmingPolicyReads;
|
|
2801
|
-
/** Applies `factory:hold` for `--hold` (#1513). Defaults to the REST call. */
|
|
2802
|
-
holdPullRequest?: (input: HoldPullRequestInput) => Promise<void> | void;
|
|
2803
|
-
/**
|
|
2804
|
-
* Reads the authoritative base review policy (#922): the profile committed at
|
|
2805
|
-
* the live tip of the PR's own base ref. Defaults to the real GitHub reads,
|
|
2806
|
-
* so an unstated authority refuses rather than falling back to candidate
|
|
2807
|
-
* policy — unreadable authority is never absent authority.
|
|
2808
|
-
*/
|
|
2809
|
-
basePolicy?: BaseReviewPolicyAuthority;
|
|
2810
|
-
/**
|
|
2811
|
-
* #1323: where the exact-head rules read GitHub's App runs for `pr-verify`
|
|
2812
|
-
* and `pr-review` at one head. `pr:ready` refuses when any App run of
|
|
2813
|
-
* either gate at the PR head is not a completed pass (rule 4); `pr:publish`,
|
|
2814
|
-
* which inherits this, posts a gate's proof only when its head has no run
|
|
2815
|
-
* for that gate (rule 2). Defaults to the user config's App id, else the
|
|
2816
|
-
* pinned factory App id, and the real `gh api` read, since readiness is a
|
|
2817
|
-
* control and an absent dependency must not mean an unread veto.
|
|
2818
|
-
*/
|
|
2819
|
-
exactHeadRuns?: ExactHeadRunSource;
|
|
2820
|
-
github?: {
|
|
2821
|
-
fetchClosingPullRequests?: (input: {
|
|
2822
|
-
issue: number;
|
|
2823
|
-
owner: string;
|
|
2824
|
-
repo: string;
|
|
2825
|
-
}) => {
|
|
2826
|
-
number: number;
|
|
2827
|
-
}[];
|
|
2828
|
-
fetchIssueBody?: (input: {
|
|
2829
|
-
issue: number;
|
|
2830
|
-
owner: string;
|
|
2831
|
-
repo: string;
|
|
2832
|
-
}) => string;
|
|
2833
|
-
fetchPullRequest: (input: {
|
|
2834
|
-
owner: string;
|
|
2835
|
-
repo: string;
|
|
2836
|
-
pr: number;
|
|
2837
|
-
extraEnv?: Readonly<Record<string, string>>;
|
|
2838
|
-
}) => GitHubPullRequest;
|
|
2855
|
+
export declare const previewLifecycleTargets: (profile: PreviewLifecycleProfile) => string[];
|
|
2856
|
+
/**
|
|
2857
|
+
* Plan the preview lifecycle for one candidate.
|
|
2858
|
+
*
|
|
2859
|
+
* Trust is resolved here through the SAME identity gate demand release uses
|
|
2860
|
+
* (`trustedImpactStamp`): the proof must have passed and must bind both the
|
|
2861
|
+
* candidate's headSha and its patchId. A stale, aborted, absent, or
|
|
2862
|
+
* differently-bound proof yields no stamp, and every declared stack is planned
|
|
2863
|
+
* for deploy. Total over its INPUTS — no proof, stamp, or profile can make it
|
|
2864
|
+
* throw. A malformed CALL is the deliberate exception: omitting
|
|
2865
|
+
* `vetoedTargets` is API misuse, not data doubt, and throws.
|
|
2866
|
+
*/
|
|
2867
|
+
export declare const planPreviewLifecycle: ({ candidate, profile, proof, vetoedTargets }: {
|
|
2868
|
+
candidate: {
|
|
2869
|
+
headSha: string;
|
|
2870
|
+
patchId: string;
|
|
2839
2871
|
};
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
/**
|
|
2843
|
-
* The authoritative merge-freeze reader (#477). Defaults to the pinned-App
|
|
2844
|
-
* GitHub check-run authority — readiness is a control, so an absent
|
|
2845
|
-
* dependency must not mean an unread freeze.
|
|
2846
|
-
*/
|
|
2847
|
-
mergeFreeze?: Pick<MergeFreezeAuthority, "readGeneration">;
|
|
2872
|
+
profile: PreviewLifecycleProfile;
|
|
2873
|
+
proof: PrVerifyProof | undefined;
|
|
2848
2874
|
/**
|
|
2849
|
-
*
|
|
2850
|
-
*
|
|
2851
|
-
*
|
|
2875
|
+
* Stack names with a current, candidate-bound FAILING envelope. Scoping is
|
|
2876
|
+
* withheld for these whatever the stamp says — the same veto demand release
|
|
2877
|
+
* applies, and for the same reason: a withheld stack is a stack that can
|
|
2878
|
+
* never re-emit the envelope its standing demand needs. Callers hold the
|
|
2879
|
+
* checkout context, so they resolve the set with `boundFailingCheckNames`
|
|
2880
|
+
* and pass it in; this module stays pure.
|
|
2852
2881
|
*
|
|
2853
|
-
*
|
|
2854
|
-
*
|
|
2855
|
-
*
|
|
2856
|
-
*
|
|
2857
|
-
*
|
|
2882
|
+
* REQUIRED, with no default, on purpose: a defaulted `[]` reads the same
|
|
2883
|
+
* whether the caller inspected the envelopes or never looked, and this seam
|
|
2884
|
+
* exists precisely for EXTERNAL preview producers — the callers most likely
|
|
2885
|
+
* to skip the lookup. Pass the result of `boundFailingCheckNames`; pass `[]`
|
|
2886
|
+
* only to mean "inspected the envelopes and found no bound failure".
|
|
2887
|
+
*
|
|
2888
|
+
* Deliberately visible to `api:check` as a breaking signature change
|
|
2889
|
+
* (pre-1.0, no external callers yet).
|
|
2858
2890
|
*/
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2891
|
+
vetoedTargets: readonly string[];
|
|
2892
|
+
}) => PreviewLifecyclePlan;
|
|
2893
|
+
type FactoryPrStatusCheckName = "patronage-factory/merge-freeze" | "patronage-factory/pr-ready" | "patronage-factory/pr-verify";
|
|
2894
|
+
interface CompletedFactoryCheckSnapshot {
|
|
2895
|
+
readonly completedAt: string;
|
|
2896
|
+
readonly conclusion: string;
|
|
2897
|
+
readonly detailsUrl?: string;
|
|
2898
|
+
readonly headSha: string;
|
|
2899
|
+
readonly name: FactoryPrStatusCheckName;
|
|
2862
2900
|
/**
|
|
2863
|
-
*
|
|
2864
|
-
*
|
|
2865
|
-
*
|
|
2901
|
+
* Merge freeze only (#1501): the cancellation-only generations, newest
|
|
2902
|
+
* first, that the freeze selection read past to reach this snapshot's
|
|
2903
|
+
* generation (#1158). Absent when the newest generation stands.
|
|
2866
2904
|
*/
|
|
2867
|
-
|
|
2868
|
-
/** Injectable delay for the UNKNOWN-mergeable brief poll (tests). */
|
|
2869
|
-
sleep?: (ms: number) => Promise<void>;
|
|
2870
|
-
}
|
|
2871
|
-
interface PrReadyGitDependencies {
|
|
2872
|
-
canResolveCommit: (cwd: string, sha: string) => boolean;
|
|
2873
|
-
changedFiles: (cwd: string, base: string, headSha?: string) => string[];
|
|
2874
|
-
checkoutRepository: (cwd: string) => CheckoutRepository;
|
|
2905
|
+
readonly readPastRunIds?: readonly number[];
|
|
2875
2906
|
/**
|
|
2876
|
-
*
|
|
2877
|
-
*
|
|
2878
|
-
*
|
|
2907
|
+
* Merge freeze only (#1503): why readiness refuses to read the freeze at
|
|
2908
|
+
* this tip, when it does. The row then presents that refusal, never the
|
|
2909
|
+
* run's own conclusion.
|
|
2879
2910
|
*/
|
|
2880
|
-
|
|
2881
|
-
currentHeadSha: (cwd: string) => string;
|
|
2882
|
-
mergeBaseSha: (cwd: string, base: string) => string;
|
|
2883
|
-
/** `repositoryRelativePath` is repository-relative, never cwd-relative. */
|
|
2884
|
-
objectIdAtRef: (cwd: string, ref: string, repositoryRelativePath: string) => string | undefined;
|
|
2885
|
-
resolveCommitSha: (cwd: string, ref: string) => string | undefined;
|
|
2886
|
-
showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
2887
|
-
stablePatchId: (cwd: string, base: string) => string;
|
|
2911
|
+
readonly refusal?: string;
|
|
2888
2912
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
}) => string[];
|
|
2896
|
-
declare namespace external_evidence_d_exports {
|
|
2897
|
-
export { EVIDENCE_CHECK_TYPES, EVIDENCE_DIR, EVIDENCE_ENVELOPE_SCHEMA_VERSION, EVIDENCE_REVIEW_RUNGS, EvidenceCandidateIdentity, EvidenceCheckType, EvidenceEnvelope, EvidenceEnvelopeParse, EvidenceReviewRung, IndependenceResult, LoadedEvidenceEnvelope, RequiredCheck, RequiredCheckEvaluation, RequiredCheckEvaluationInput, RequiredCheckOutcome, RequiredCheckScope, RequiredCheckScopeContext, ScopeDecision, boundFailingCheckNames, evaluateRequiredChecks, evidenceBindingFresh, evidenceEnvelopeSchema, evidenceReviewIndependence, loadEvidenceEnvelopes, parseEvidenceEnvelope, requiredCheckInScope, requiredCheckScopeSchema, resolveAuthoringSessionIds };
|
|
2913
|
+
interface FailedPreviewSnapshot {
|
|
2914
|
+
readonly completedAt: string;
|
|
2915
|
+
readonly conclusion: string;
|
|
2916
|
+
readonly detailsUrl?: string;
|
|
2917
|
+
readonly headSha: string;
|
|
2918
|
+
readonly name: string;
|
|
2898
2919
|
}
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
2907
|
-
headSha: z.ZodString;
|
|
2908
|
-
mergeBaseSha: z.ZodString;
|
|
2909
|
-
model: z.ZodOptional<z.ZodString>;
|
|
2910
|
-
outcome: z.ZodEnum<{
|
|
2911
|
-
fail: "fail";
|
|
2912
|
-
pass: "pass";
|
|
2913
|
-
}>;
|
|
2914
|
-
patchId: z.ZodString;
|
|
2915
|
-
policyVersion: z.ZodOptional<z.ZodString>;
|
|
2916
|
-
producer: z.ZodString;
|
|
2917
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
2918
|
-
rung: z.ZodOptional<z.ZodEnum<{
|
|
2919
|
-
human: "human";
|
|
2920
|
-
"independent-model": "independent-model";
|
|
2921
|
-
oracle: "oracle";
|
|
2922
|
-
}>>;
|
|
2923
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
2924
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
2925
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
2926
|
-
}, z.core.$loose>;
|
|
2927
|
-
declare const evidenceEnvelopeSchema: z.ZodObject<{
|
|
2928
|
-
check: z.ZodString;
|
|
2929
|
-
checkType: z.ZodEnum<{
|
|
2930
|
-
review: "review";
|
|
2931
|
-
verify: "verify";
|
|
2932
|
-
}>;
|
|
2933
|
-
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
2934
|
-
headSha: z.ZodString;
|
|
2935
|
-
mergeBaseSha: z.ZodString;
|
|
2936
|
-
model: z.ZodOptional<z.ZodString>;
|
|
2937
|
-
outcome: z.ZodEnum<{
|
|
2938
|
-
fail: "fail";
|
|
2939
|
-
pass: "pass";
|
|
2940
|
-
}>;
|
|
2941
|
-
patchId: z.ZodString;
|
|
2942
|
-
policyVersion: z.ZodOptional<z.ZodString>;
|
|
2943
|
-
producer: z.ZodString;
|
|
2944
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
2945
|
-
rung: z.ZodOptional<z.ZodEnum<{
|
|
2946
|
-
human: "human";
|
|
2947
|
-
"independent-model": "independent-model";
|
|
2948
|
-
oracle: "oracle";
|
|
2949
|
-
}>>;
|
|
2950
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
2951
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
2952
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
2953
|
-
}, z.core.$loose>;
|
|
2954
|
-
type EvidenceEnvelope = z.infer<typeof evidenceEnvelopeBaseSchema>;
|
|
2955
|
-
type EvidenceEnvelopeParse = {
|
|
2956
|
-
ok: true;
|
|
2957
|
-
envelope: EvidenceEnvelope;
|
|
2958
|
-
} | {
|
|
2959
|
-
ok: false;
|
|
2960
|
-
error: string;
|
|
2961
|
-
};
|
|
2962
|
-
declare const parseEvidenceEnvelope: (raw: unknown) => EvidenceEnvelopeParse;
|
|
2963
|
-
interface EvidenceCandidateIdentity {
|
|
2964
|
-
headSha: string;
|
|
2965
|
-
patchId: string;
|
|
2966
|
-
mergeBaseSha: string;
|
|
2920
|
+
interface FactoryPrStatusSources {
|
|
2921
|
+
/** Live PR base ref name observed with the sources. Identity, not a SHA. */
|
|
2922
|
+
readonly baseRefName?: string;
|
|
2923
|
+
readonly baseSha: string;
|
|
2924
|
+
readonly checks: Readonly<Partial<Record<FactoryPrStatusCheckName, CompletedFactoryCheckSnapshot>>>;
|
|
2925
|
+
readonly previewFailures?: Readonly<Partial<Record<string, FailedPreviewSnapshot>>>;
|
|
2926
|
+
readonly previewRegistrations: readonly PreviewProofRegistration[];
|
|
2967
2927
|
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2928
|
+
interface RenderFactoryPrStatusHudInput extends FactoryPrStatusSources {
|
|
2929
|
+
readonly headSha: string;
|
|
2930
|
+
readonly plan: PreviewLifecyclePlan;
|
|
2931
|
+
readonly planHeadSha: string;
|
|
2932
|
+
readonly pr: number;
|
|
2933
|
+
/** ISO instant at which the presentation sources were observed. */
|
|
2934
|
+
readonly renderedAt: string;
|
|
2975
2935
|
}
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
} | {
|
|
2985
|
-
check?: string;
|
|
2986
|
-
error: string;
|
|
2987
|
-
ok: false;
|
|
2988
|
-
path: string;
|
|
2989
|
-
};
|
|
2990
|
-
/**
|
|
2991
|
-
* Every check name with a current, candidate-bound FAILING envelope on disk.
|
|
2992
|
-
*
|
|
2993
|
-
* The wave-3 scoping veto input. Callers pass the resolved set to
|
|
2994
|
-
* `planVerificationBattery` / `planPreviewLifecycle`, which stay pure — the
|
|
2995
|
-
* planners decide, they never read the filesystem.
|
|
2996
|
-
*
|
|
2997
|
-
* `checkType` is the caller's, not a guess: schema-v5 requiredChecks are
|
|
2998
|
-
* verify-only (`resolveProfileRequiredChecks`), so a scoping caller passes
|
|
2999
|
-
* `"verify"` and matches exactly the pair wave 2 evaluates.
|
|
3000
|
-
*/
|
|
3001
|
-
declare const boundFailingCheckNames: ({ candidate, checkType, envelopes }: {
|
|
3002
|
-
candidate: EvidenceCandidateIdentity;
|
|
3003
|
-
checkType: EvidenceCheckType;
|
|
3004
|
-
envelopes: LoadedEvidenceEnvelope[];
|
|
3005
|
-
}) => string[];
|
|
3006
|
-
interface RequiredCheckEvaluationInput {
|
|
3007
|
-
authoringSessionIds: string[];
|
|
3008
|
-
candidate: EvidenceCandidateIdentity;
|
|
3009
|
-
envelopes: LoadedEvidenceEnvelope[];
|
|
3010
|
-
requiredChecks: RequiredCheck[];
|
|
3011
|
-
scopeContext: RequiredCheckScopeContext;
|
|
2936
|
+
interface PresentFactoryPrStatusHudInput {
|
|
2937
|
+
readonly headSha: string;
|
|
2938
|
+
readonly owner: string;
|
|
2939
|
+
readonly plan: PreviewLifecyclePlan;
|
|
2940
|
+
readonly planHeadSha: string;
|
|
2941
|
+
readonly pr: number;
|
|
2942
|
+
readonly renderedAt?: string;
|
|
2943
|
+
readonly repo: string;
|
|
3012
2944
|
}
|
|
3013
|
-
interface
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
2945
|
+
interface PresentFactoryPrStatusHudDependencies {
|
|
2946
|
+
/**
|
|
2947
|
+
* Read only `previewProofInventory.list` registrations and completed,
|
|
2948
|
+
* Factory-App-owned check snapshots. PR comment bodies are not an evidence
|
|
2949
|
+
* source and are deliberately absent from this contract.
|
|
2950
|
+
*/
|
|
2951
|
+
readonly readSources: (input: {
|
|
2952
|
+
headSha: string;
|
|
2953
|
+
owner: string;
|
|
2954
|
+
pr: number;
|
|
2955
|
+
previewTargets?: readonly string[];
|
|
2956
|
+
repo: string;
|
|
2957
|
+
}) => Promise<FactoryPrStatusSources>;
|
|
2958
|
+
/**
|
|
2959
|
+
* Recheck the pulls identity immediately before mutating the sticky HUD.
|
|
2960
|
+
* Happy path reads `/pulls/:n` only; git-ref is fetched to decorate a
|
|
2961
|
+
* head-moved error, not as a second identity endpoint.
|
|
2962
|
+
*/
|
|
2963
|
+
readonly assertCurrentIdentity: (input: {
|
|
2964
|
+
baseRefName?: string;
|
|
2965
|
+
/** Retained for rendering/callers; identity compares base ref name. */
|
|
2966
|
+
baseSha?: string;
|
|
2967
|
+
headSha: string;
|
|
2968
|
+
owner: string;
|
|
2969
|
+
pr: number;
|
|
2970
|
+
repo: string;
|
|
2971
|
+
}) => Promise<void>;
|
|
2972
|
+
readonly upsert?: typeof upsertFactoryPrStatusComment;
|
|
2973
|
+
}
|
|
2974
|
+
interface ReadFactoryPrStatusSourcesInput {
|
|
2975
|
+
readonly headSha: string;
|
|
2976
|
+
/**
|
|
2977
|
+
* Contents-read token for `previewProofInventory.list` and the live
|
|
2978
|
+
* `git/ref/heads/<base>` tip. Both need `contents: read`; the Factory App
|
|
2979
|
+
* token has none, so pass a workflow `GITHUB_TOKEN` (#825, #908). The
|
|
2980
|
+
* inventory list falls back to `token`. The base tip has no HTTP fallback:
|
|
2981
|
+
* without this token it is read through `gh`.
|
|
2982
|
+
*/
|
|
2983
|
+
readonly inventoryToken?: string;
|
|
2984
|
+
readonly owner: string;
|
|
2985
|
+
readonly pr: number;
|
|
2986
|
+
/**
|
|
2987
|
+
* Demanded preview stack names from the lifecycle plan. Used only to look up
|
|
2988
|
+
* a completed unsuccessful check run when inventory has no registration.
|
|
2989
|
+
*/
|
|
2990
|
+
readonly previewTargets?: readonly string[];
|
|
2991
|
+
/**
|
|
2992
|
+
* Token for the `/pulls/:n` identity read only. Defaults to `token`. On a
|
|
2993
|
+
* Cursor VM `token` is the broker's checks token, which cannot read pulls,
|
|
2994
|
+
* so this is the broker's admission token (#1327).
|
|
2995
|
+
*/
|
|
2996
|
+
readonly pullToken?: string;
|
|
2997
|
+
readonly repo: string;
|
|
2998
|
+
/** Factory App installation token, normally minted by the presentation job. */
|
|
2999
|
+
readonly token: string;
|
|
3021
3000
|
}
|
|
3022
|
-
interface
|
|
3023
|
-
|
|
3024
|
-
|
|
3001
|
+
interface ReadFactoryPrStatusSourcesDependencies {
|
|
3002
|
+
readonly fetch?: typeof fetch;
|
|
3003
|
+
/**
|
|
3004
|
+
* Local base-tip reader used when no `inventoryToken` exists. Defaults to
|
|
3005
|
+
* the `gh`-backed reader `pr:ready` already uses.
|
|
3006
|
+
*/
|
|
3007
|
+
readonly fetchBranchTipSha?: typeof fetchGitHubBranchTipSha;
|
|
3008
|
+
readonly listPreviewRegistrations?: (input: {
|
|
3009
|
+
owner: string;
|
|
3010
|
+
pr: number;
|
|
3011
|
+
repo: string;
|
|
3012
|
+
token: string;
|
|
3013
|
+
}) => Promise<readonly PreviewProofRegistration[]>;
|
|
3014
|
+
readonly timeoutMs?: number;
|
|
3025
3015
|
}
|
|
3026
|
-
declare
|
|
3027
|
-
declare
|
|
3028
|
-
declare
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
patchId: string;
|
|
3016
|
+
export declare function renderFactoryPrStatusHud(input: RenderFactoryPrStatusHudInput): string;
|
|
3017
|
+
export declare function presentFactoryPrStatusHud(input: PresentFactoryPrStatusHudInput, dependencies: PresentFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
3018
|
+
export declare function assertFactoryPrStatusIdentity(input: ReadFactoryPrStatusSourcesInput & {
|
|
3019
|
+
readonly baseRefName?: string;
|
|
3020
|
+
/** Retained for rendering/callers; identity compares base ref name. */
|
|
3021
|
+
readonly baseSha?: string;
|
|
3022
|
+
}, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<void>;
|
|
3023
|
+
export declare function readFactoryPrStatusSources(input: ReadFactoryPrStatusSourcesInput, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<FactoryPrStatusSources>;
|
|
3024
|
+
interface PlanFactoryPrStatusHudInput {
|
|
3025
|
+
readonly cwd: string;
|
|
3026
|
+
readonly headSha: string;
|
|
3027
|
+
readonly mergeBaseSha?: string;
|
|
3028
|
+
readonly patchId?: string;
|
|
3029
|
+
readonly profilePath?: string;
|
|
3041
3030
|
}
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
declare
|
|
3049
|
-
|
|
3031
|
+
/**
|
|
3032
|
+
* Consume `planPreviewLifecycle` for the current checkout. No second plan is
|
|
3033
|
+
* invented: dispositions are Ready/Skipped from `deploy` vs `not-required`.
|
|
3034
|
+
* Candidate identity is never copied from the proof. Absent independent
|
|
3035
|
+
* identity or an unbound verify proof is the planner's conservative path.
|
|
3036
|
+
*/
|
|
3037
|
+
export declare function planFactoryPrStatusHud(input: PlanFactoryPrStatusHudInput): PreviewLifecyclePlan;
|
|
3038
|
+
interface RefreshFactoryPrStatusHudInput {
|
|
3039
|
+
readonly cwd: string;
|
|
3040
|
+
readonly headSha: string;
|
|
3041
|
+
/**
|
|
3042
|
+
* Workflow `GITHUB_TOKEN` with `contents: read` for the live git-ref and
|
|
3043
|
+
* preview inventory. The Factory App token cannot read those (#825, #908).
|
|
3044
|
+
*/
|
|
3045
|
+
readonly inventoryToken?: string;
|
|
3046
|
+
readonly mergeBaseSha?: string;
|
|
3047
|
+
readonly owner: string;
|
|
3048
|
+
readonly patchId?: string;
|
|
3049
|
+
readonly pr: number;
|
|
3050
|
+
readonly profilePath?: string;
|
|
3051
|
+
readonly repo: string;
|
|
3052
|
+
readonly token?: string;
|
|
3050
3053
|
}
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
declare const isExplicitReviewFailure: (proof: ReviewProofClaim) => proof is {
|
|
3062
|
-
explicitFailure: true;
|
|
3063
|
-
reviewedHeadSha?: string;
|
|
3064
|
-
reviewedPatchId?: string;
|
|
3065
|
-
untypedVerdict?: boolean;
|
|
3066
|
-
};
|
|
3067
|
-
declare const isUntypedReviewProof: (proof: ReviewProofClaim) => proof is {
|
|
3068
|
-
untypedVerdict: true;
|
|
3069
|
-
reviewedHeadSha?: string;
|
|
3070
|
-
reviewedPatchId?: string;
|
|
3071
|
-
};
|
|
3072
|
-
declare const explicitFailureIdentity: (proof: ReviewProofClaim) => {
|
|
3073
|
-
reviewedHeadSha?: string;
|
|
3074
|
-
reviewedPatchId?: string;
|
|
3075
|
-
};
|
|
3076
|
-
declare const selectReviewProof: ({ reviewProof }: {
|
|
3077
|
-
reviewProof: ReviewProofClaim;
|
|
3078
|
-
}) => {
|
|
3079
|
-
reviewedHeadSha?: string;
|
|
3080
|
-
reviewedPatchId?: string;
|
|
3081
|
-
untypedVerdict?: boolean;
|
|
3082
|
-
};
|
|
3083
|
-
interface ReviewCycleState {
|
|
3084
|
-
autoBlockingFindings: number;
|
|
3085
|
-
countsBySeverity: Record<ReviewFindingSeverity, number>;
|
|
3086
|
-
highestBlockingSeverity?: ReviewFindingSeverity;
|
|
3087
|
-
highestOpenSeverity?: ReviewFindingSeverity;
|
|
3088
|
-
maxReviewCycles?: number;
|
|
3089
|
-
nonBlockingFindings: number;
|
|
3090
|
-
openFindings: number;
|
|
3091
|
-
reviewCycle?: number;
|
|
3092
|
-
staleRepeatFindings?: number;
|
|
3093
|
-
windowExhausted: boolean;
|
|
3054
|
+
/**
|
|
3055
|
+
* Where a local HUD refresh gets its credentials. Defaults to the process
|
|
3056
|
+
* environment, the user config, the real broker, and `fetch`.
|
|
3057
|
+
*/
|
|
3058
|
+
interface RefreshFactoryPrStatusHudDependencies {
|
|
3059
|
+
/** The broker's admission token on a Cursor VM, for the pull read (#1327). */
|
|
3060
|
+
readonly admission?: AdmissionCredential;
|
|
3061
|
+
/** The checks-scope broker mint on a Cursor VM, unchanged (#949). */
|
|
3062
|
+
readonly factoryApp?: FactoryAppAccessDependencies;
|
|
3063
|
+
readonly fetch?: typeof fetch;
|
|
3094
3064
|
}
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
declare
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3065
|
+
/** Plan from the checkout and present the App-owned HUD. */
|
|
3066
|
+
export declare function refreshFactoryPrStatusHud(input: RefreshFactoryPrStatusHudInput, dependencies?: RefreshFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
3067
|
+
/**
|
|
3068
|
+
* Presentation must not fail an admission gate. Used after pr:ready publishes
|
|
3069
|
+
* its check so the table is not stuck at first-write.
|
|
3070
|
+
*/
|
|
3071
|
+
export declare function refreshFactoryPrStatusHudSafely(input: RefreshFactoryPrStatusHudInput, onNotice?: (message: string) => void): Promise<void>;
|
|
3072
|
+
interface PrReadyArgs extends LoadProjectProfileInput {
|
|
3073
|
+
authoringSessionIds?: string[];
|
|
3074
|
+
base: string;
|
|
3075
|
+
epic?: number;
|
|
3076
|
+
hold?: boolean;
|
|
3077
|
+
json?: boolean;
|
|
3078
|
+
output?: string;
|
|
3079
|
+
report?: boolean;
|
|
3080
|
+
pr: number;
|
|
3081
|
+
reviewProof?: string;
|
|
3082
|
+
throwWhenBlocked?: boolean;
|
|
3083
|
+
verifyProof?: string;
|
|
3108
3084
|
}
|
|
3109
|
-
|
|
3110
|
-
declare const PR_REVIEW_FINDING_PROVENANCE_VERSION = 1;
|
|
3111
|
-
declare const DEFAULT_PR_REVIEW_PROOF_PATH = ".factory-memory/pr-review.json";
|
|
3112
|
-
declare const DEFAULT_PR_REVIEW_MAX_CYCLES = 5;
|
|
3113
|
-
declare const PR_REVIEW_FINAL_READINESS_NOTICE = "pr:review is a final readiness proof gate. Run it after local verification and avoid repeated full runs unless the review proof records actionable findings. Default review window: 5 cycles.";
|
|
3114
|
-
declare const prReviewFindingSchema: z.ZodType<PrReviewFinding>;
|
|
3115
|
-
declare const prReviewResultSchema: z.ZodType<PrReviewResult>;
|
|
3116
|
-
declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
|
|
3117
|
-
declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
|
|
3118
|
-
declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
|
|
3119
|
-
declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
|
|
3120
|
-
declare const boundaryCheckProofSchema: z.ZodObject<{
|
|
3121
|
-
blockingReasons: z.ZodArray<z.ZodString>;
|
|
3122
|
-
boundary: z.ZodOptional<z.ZodString>;
|
|
3123
|
-
command: z.ZodLiteral<"patronage-factory boundary:check">;
|
|
3124
|
-
coveredSet: z.ZodArray<z.ZodObject<{
|
|
3125
|
-
issue: z.ZodOptional<z.ZodNumber>;
|
|
3126
|
-
pr: z.ZodNumber;
|
|
3127
|
-
sha: z.ZodString;
|
|
3128
|
-
state: z.ZodEnum<{
|
|
3129
|
-
merged: "merged";
|
|
3130
|
-
open: "open";
|
|
3131
|
-
}>;
|
|
3132
|
-
wave: z.ZodString;
|
|
3133
|
-
}, z.core.$strip>>;
|
|
3134
|
-
demandedRung: z.ZodOptional<z.ZodEnum<{
|
|
3135
|
-
human: "human";
|
|
3136
|
-
"independent-model": "independent-model";
|
|
3137
|
-
oracle: "oracle";
|
|
3138
|
-
}>>;
|
|
3139
|
-
epicIssue: z.ZodNumber;
|
|
3140
|
-
manifestHash: z.ZodOptional<z.ZodObject<{
|
|
3141
|
-
algo: z.ZodLiteral<"sha256">;
|
|
3142
|
-
value: z.ZodString;
|
|
3143
|
-
}, z.core.$strip>>;
|
|
3144
|
-
notices: z.ZodArray<z.ZodString>;
|
|
3145
|
-
repo: z.ZodString;
|
|
3146
|
-
reviewProof: z.ZodOptional<z.ZodObject<{
|
|
3147
|
-
commentId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
3148
|
-
commentUrl: z.ZodOptional<z.ZodString>;
|
|
3149
|
-
producer: z.ZodString;
|
|
3150
|
-
rung: z.ZodEnum<{
|
|
3151
|
-
human: "human";
|
|
3152
|
-
"independent-model": "independent-model";
|
|
3153
|
-
oracle: "oracle";
|
|
3154
|
-
}>;
|
|
3155
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
3156
|
-
specHash: z.ZodOptional<z.ZodObject<{
|
|
3157
|
-
algo: z.ZodLiteral<"sha256">;
|
|
3158
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
3159
|
-
value: z.ZodString;
|
|
3160
|
-
}, z.core.$loose>>;
|
|
3161
|
-
}, z.core.$strip>>;
|
|
3162
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
3163
|
-
specHash: z.ZodOptional<z.ZodObject<{
|
|
3164
|
-
algo: z.ZodLiteral<"sha256">;
|
|
3165
|
-
value: z.ZodString;
|
|
3166
|
-
}, z.core.$strip>>;
|
|
3167
|
-
status: z.ZodEnum<{
|
|
3168
|
-
blocked: "blocked";
|
|
3169
|
-
ready: "ready";
|
|
3170
|
-
}>;
|
|
3171
|
-
}, z.core.$strip>;
|
|
3172
|
-
type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
|
|
3173
|
-
interface BoundaryCheckGithub {
|
|
3174
|
-
fetchIssueBody: (repo: string, issue: number) => string;
|
|
3175
|
-
fetchIssueComments: (repo: string, issue: number) => GithubIssueComment[];
|
|
3176
|
-
fetchClosingPullRequests: (repo: string, issue: number) => BoundaryPullRequestRef[];
|
|
3177
|
-
fetchPullRequest?: (repo: string, pr: number) => BoundaryPullRequestRef;
|
|
3085
|
+
interface GitHubPullRequest {
|
|
3178
3086
|
/**
|
|
3179
|
-
*
|
|
3180
|
-
*
|
|
3087
|
+
* GitHub's live auto-merge enablement, or `null` when nothing is scheduled.
|
|
3088
|
+
*
|
|
3089
|
+
* Required, not optional (#515 review). `gh pr view --json autoMergeRequest`
|
|
3090
|
+
* always returns the key — explicitly `null` when nothing is scheduled — and
|
|
3091
|
+
* errors loudly on a field name it does not know, so there is no shape where
|
|
3092
|
+
* the real CLI omits it. But `fetchPullRequest` is injectable, and an
|
|
3093
|
+
* implementation that left the field out would silently disable the
|
|
3094
|
+
* `boundary-wave` refusal that stops an epicless run from greening a
|
|
3095
|
+
* candidate GitHub is already scheduled to merge. Requiring it makes the
|
|
3096
|
+
* compiler enforce what `gh` already promises.
|
|
3097
|
+
*/
|
|
3098
|
+
autoMergeRequest: {
|
|
3099
|
+
enabledAt?: string;
|
|
3100
|
+
} | null;
|
|
3101
|
+
baseRefName: string;
|
|
3102
|
+
baseRefOid: string;
|
|
3103
|
+
body: string;
|
|
3104
|
+
headRefName?: string;
|
|
3105
|
+
headRefOid: string;
|
|
3106
|
+
/**
|
|
3107
|
+
* Whether the head branch lives in a different repository from the base
|
|
3108
|
+
* (#922). Required, not optional, for the reason `autoMergeRequest` is: the
|
|
3109
|
+
* trusted checkout names ONE repository, and for a fork PR that is not the
|
|
3110
|
+
* base repository. An implementation that omitted the field would silently
|
|
3111
|
+
* resolve base policy from whichever repository the checkout points at.
|
|
3181
3112
|
*/
|
|
3182
|
-
|
|
3113
|
+
isCrossRepository: boolean;
|
|
3114
|
+
isDraft: boolean;
|
|
3115
|
+
mergeCommit: {
|
|
3116
|
+
oid: string;
|
|
3117
|
+
} | null;
|
|
3118
|
+
mergeStateStatus: string;
|
|
3119
|
+
mergeable: string;
|
|
3120
|
+
number: number;
|
|
3121
|
+
reviewDecision: string | null;
|
|
3183
3122
|
/**
|
|
3184
|
-
*
|
|
3185
|
-
*
|
|
3186
|
-
*
|
|
3187
|
-
* Required so omitting the channel cannot silently drop it.
|
|
3123
|
+
* The status-check contexts the base branch's rulesets require (#1580).
|
|
3124
|
+
* Absent means not known, and every hosted run on the head is judged, as
|
|
3125
|
+
* before #1580.
|
|
3188
3126
|
*/
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3127
|
+
requiredCheckContexts?: string[];
|
|
3128
|
+
state: "OPEN" | "CLOSED" | "MERGED";
|
|
3129
|
+
statusCheckRollup?: StatusCheckRollup[];
|
|
3130
|
+
title: string;
|
|
3131
|
+
unresolvedReviewThreads: number;
|
|
3132
|
+
url: string;
|
|
3194
3133
|
}
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3134
|
+
/** An issue's sub-issue parent, as the membership rule reads it (#1299). */
|
|
3135
|
+
interface IssueParent {
|
|
3136
|
+
labels: string[];
|
|
3137
|
+
number: number;
|
|
3138
|
+
state: string;
|
|
3139
|
+
}
|
|
3140
|
+
/** What `pr:ready` reads about one pull request before it arms (#1299). */
|
|
3141
|
+
interface PullRequestArmingFacts {
|
|
3142
|
+
/** GitHub's per-repository "Allow auto-merge" setting. */
|
|
3143
|
+
autoMergeAllowed: boolean;
|
|
3198
3144
|
/**
|
|
3199
|
-
*
|
|
3200
|
-
*
|
|
3201
|
-
* interior boundary review (run before the terminal release PR exists,
|
|
3202
|
-
* e.g. epic #842's own review of #844) keeps working; the epic closeout
|
|
3203
|
-
* step turns this on as the last check before factory:closeout.
|
|
3145
|
+
* GitHub's closing references for the pull request to issues in its own
|
|
3146
|
+
* repository, with their parents.
|
|
3204
3147
|
*/
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
}
|
|
3210
|
-
interface BoundaryCheckDependencies {
|
|
3148
|
+
closingIssues: {
|
|
3149
|
+
number: number;
|
|
3150
|
+
parent: IssueParent | null;
|
|
3151
|
+
}[];
|
|
3211
3152
|
/**
|
|
3212
|
-
*
|
|
3213
|
-
*
|
|
3153
|
+
* GitHub has more closing references than the one page `pr:ready` reads,
|
|
3154
|
+
* so `closingIssues` is not the whole set.
|
|
3214
3155
|
*/
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
hq?: HqIngestDependencies;
|
|
3218
|
-
readWaivers?: (cwd: string) => DemandWaiver[];
|
|
3219
|
-
resolveRepo?: (cwd: string) => string;
|
|
3220
|
-
}
|
|
3221
|
-
export declare function runBoundaryCheck(args: BoundaryCheckArgs, dependencies?: BoundaryCheckDependencies): BoundaryCheckProofRecord;
|
|
3222
|
-
export declare function validateBoundaryCheckProof(value: unknown): BoundaryCheckProofRecord;
|
|
3223
|
-
interface CliOutput {
|
|
3224
|
-
stderr: Pick<NodeJS.WriteStream, "write">;
|
|
3225
|
-
stdout: Pick<NodeJS.WriteStream, "write">;
|
|
3226
|
-
}
|
|
3227
|
-
type BoundaryCheckAction = (args: BoundaryCheckArgs) => BoundaryCheckProofRecord;
|
|
3228
|
-
/** Every waiver recorded in this checkout; an absent or unreadable store is
|
|
3229
|
-
* no waivers, so a damaged file can only ever block, never permit. */
|
|
3230
|
-
export declare const readDemandWaivers: (cwd: string, filePath?: string) => DemandWaiver[];
|
|
3231
|
-
interface DemandWaiveArgs {
|
|
3232
|
-
cwd?: string;
|
|
3233
|
-
demand: string;
|
|
3234
|
-
json?: boolean;
|
|
3235
|
-
output?: string;
|
|
3236
|
-
pr: number;
|
|
3237
|
-
rationale: string;
|
|
3156
|
+
closingIssuesIncomplete: boolean;
|
|
3157
|
+
labels: string[];
|
|
3238
3158
|
}
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3159
|
+
/**
|
|
3160
|
+
* The GitHub reads behind the reasons not to arm an admitted candidate
|
|
3161
|
+
* (#1299). A read throws when GitHub cannot answer; `pr:ready` then does not
|
|
3162
|
+
* arm, and its notice says which read failed.
|
|
3163
|
+
*/
|
|
3164
|
+
interface ArmingPolicyReads {
|
|
3165
|
+
/**
|
|
3166
|
+
* One issue's sub-issue parent, or `null` when it has none. An issue read,
|
|
3167
|
+
* so on a Cursor VM the real one runs on the admission token (#1327).
|
|
3168
|
+
*/
|
|
3169
|
+
readIssueParent: (input: {
|
|
3170
|
+
issue: number;
|
|
3171
|
+
owner: string;
|
|
3172
|
+
repo: string;
|
|
3173
|
+
}) => IssueParent | null | Promise<IssueParent | null>;
|
|
3174
|
+
/**
|
|
3175
|
+
* The repository's auto-merge setting and this pull request's labels and
|
|
3176
|
+
* closing issues. The closing issues are issue data, which the VM's own
|
|
3177
|
+
* `gh` credential reads back as none rather than refusing, so on a Cursor
|
|
3178
|
+
* VM the real one also runs on the admission token (#1327).
|
|
3179
|
+
*/
|
|
3180
|
+
readPullRequest: (input: {
|
|
3245
3181
|
owner: string;
|
|
3246
3182
|
pr: number;
|
|
3247
3183
|
repo: string;
|
|
3248
|
-
}) =>
|
|
3249
|
-
now?: () => Date;
|
|
3250
|
-
}
|
|
3251
|
-
export declare class DemandWaiveRefusalError extends Error {
|
|
3252
|
-
readonly refusals: string[];
|
|
3253
|
-
constructor(refusals: string[]);
|
|
3184
|
+
}) => PullRequestArmingFacts | Promise<PullRequestArmingFacts>;
|
|
3254
3185
|
}
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3186
|
+
interface PrReadyDependencies {
|
|
3187
|
+
/**
|
|
3188
|
+
* The broker's admission token on a Cursor VM (#1327), for issue reads the
|
|
3189
|
+
* VM's own `gh` credential cannot make. Defaults to the process-wide
|
|
3190
|
+
* credential, which mints nothing off a Cursor managed runtime.
|
|
3191
|
+
*/
|
|
3192
|
+
admission?: AdmissionCredential;
|
|
3193
|
+
/**
|
|
3194
|
+
* Arms GitHub native auto-merge for an admitted candidate (#477, #1299).
|
|
3195
|
+
* Defaults to the real `gh pr merge --auto` call plus the read-back that
|
|
3196
|
+
* says what actually happened.
|
|
3197
|
+
*/
|
|
3198
|
+
armAutoMerge?: (input: ArmAutoMergeInput) => ArmAutoMergeOutcome;
|
|
3199
|
+
/**
|
|
3200
|
+
* The GitHub reads behind the reasons not to arm (#1299). Defaults to the
|
|
3201
|
+
* real GraphQL reads.
|
|
3202
|
+
*/
|
|
3203
|
+
armingPolicy?: ArmingPolicyReads;
|
|
3204
|
+
/** Applies `factory:hold` for `--hold` (#1513). Defaults to the REST call. */
|
|
3205
|
+
holdPullRequest?: (input: HoldPullRequestInput) => Promise<void> | void;
|
|
3206
|
+
/**
|
|
3207
|
+
* Reads the authoritative base review policy (#922): the profile committed at
|
|
3208
|
+
* the live tip of the PR's own base ref. Defaults to the real GitHub reads,
|
|
3209
|
+
* so an unstated authority refuses rather than falling back to candidate
|
|
3210
|
+
* policy — unreadable authority is never absent authority.
|
|
3211
|
+
*/
|
|
3212
|
+
basePolicy?: BaseReviewPolicyAuthority;
|
|
3213
|
+
/**
|
|
3214
|
+
* #1323: where the exact-head rules read GitHub's App runs for `pr-verify`
|
|
3215
|
+
* and `pr-review` at one head. `pr:ready` refuses when any App run of
|
|
3216
|
+
* either gate at the PR head is not a completed pass (rule 4); `pr:publish`,
|
|
3217
|
+
* which inherits this, posts a gate's proof only when its head has no run
|
|
3218
|
+
* for that gate (rule 2). Defaults to the user config's App id, else the
|
|
3219
|
+
* pinned factory App id, and the real `gh api` read, since readiness is a
|
|
3220
|
+
* control and an absent dependency must not mean an unread veto.
|
|
3221
|
+
*/
|
|
3222
|
+
exactHeadRuns?: ExactHeadRunSource;
|
|
3223
|
+
github?: {
|
|
3224
|
+
fetchClosingPullRequests?: (input: {
|
|
3225
|
+
issue: number;
|
|
3226
|
+
owner: string;
|
|
3227
|
+
repo: string;
|
|
3228
|
+
}) => {
|
|
3229
|
+
number: number;
|
|
3230
|
+
}[];
|
|
3231
|
+
fetchIssueBody?: (input: {
|
|
3232
|
+
issue: number;
|
|
3233
|
+
owner: string;
|
|
3234
|
+
repo: string;
|
|
3235
|
+
}) => string;
|
|
3236
|
+
fetchPullRequest: (input: {
|
|
3237
|
+
owner: string;
|
|
3238
|
+
repo: string;
|
|
3239
|
+
pr: number;
|
|
3240
|
+
extraEnv?: Readonly<Record<string, string>>;
|
|
3241
|
+
}) => GitHubPullRequest;
|
|
3242
|
+
};
|
|
3243
|
+
git?: PrReadyGitDependencies;
|
|
3244
|
+
hq?: HqIngestDependencies;
|
|
3245
|
+
/**
|
|
3246
|
+
* The authoritative merge-freeze reader (#477). Defaults to the pinned-App
|
|
3247
|
+
* GitHub check-run authority — readiness is a control, so an absent
|
|
3248
|
+
* dependency must not mean an unread freeze.
|
|
3249
|
+
*/
|
|
3250
|
+
mergeFreeze?: Pick<MergeFreezeAuthority, "readGeneration">;
|
|
3251
|
+
/**
|
|
3252
|
+
* Awaited publication of the branded check, which is a source-pinned
|
|
3253
|
+
* required check rather than a mirror (#477). Returns true only when the
|
|
3254
|
+
* App-owned run landed. Defaults to `ensureFactoryCheckRunPublished`.
|
|
3255
|
+
*
|
|
3256
|
+
* `pr:ready` has no other publication seam, and this one cannot express a
|
|
3257
|
+
* non-terminal run (#526): `status` is omitted from the input, so every run
|
|
3258
|
+
* readiness creates is completed with a conclusion. A `pr:ready` invocation
|
|
3259
|
+
* therefore cannot leave a run holding the source-pinned required check
|
|
3260
|
+
* open, which is a permanent block on the pull request (#524).
|
|
3261
|
+
*/
|
|
3262
|
+
publishFinalCheckRun?: (input: Omit<PublishFactoryCheckInput, "status"> & {
|
|
3263
|
+
conclusion: "failure" | "success";
|
|
3264
|
+
}) => Promise<boolean> | boolean;
|
|
3265
|
+
/**
|
|
3266
|
+
* Re-present the App-owned HUD after this run's ready check is published
|
|
3267
|
+
* so the table is not stuck at first-write. Defaults to a safe refresh
|
|
3268
|
+
* that never fails the gate.
|
|
3269
|
+
*/
|
|
3270
|
+
presentStatusHud?: (input: RefreshFactoryPrStatusHudInput) => Promise<void> | void;
|
|
3271
|
+
/** Injectable delay for the UNKNOWN-mergeable brief poll (tests). */
|
|
3272
|
+
sleep?: (ms: number) => Promise<void>;
|
|
3270
3273
|
}
|
|
3271
|
-
|
|
3272
|
-
|
|
3274
|
+
interface PrReadyGitDependencies {
|
|
3275
|
+
canResolveCommit: (cwd: string, sha: string) => boolean;
|
|
3276
|
+
changedFiles: (cwd: string, base: string, headSha?: string) => string[];
|
|
3277
|
+
checkoutRepository: (cwd: string) => CheckoutRepository;
|
|
3273
3278
|
/**
|
|
3274
|
-
*
|
|
3275
|
-
*
|
|
3276
|
-
*
|
|
3279
|
+
* Bring `refs/heads/<baseRefName>` into the checkout so the live tip
|
|
3280
|
+
* `pr.baseRefOid` can resolve. Optional so fixtures that already resolve
|
|
3281
|
+
* every SHA can omit it.
|
|
3277
3282
|
*/
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3283
|
+
fetchOriginRef?: (cwd: string, refName: string) => void;
|
|
3284
|
+
currentHeadSha: (cwd: string) => string;
|
|
3285
|
+
mergeBaseSha: (cwd: string, base: string) => string;
|
|
3286
|
+
/** `repositoryRelativePath` is repository-relative, never cwd-relative. */
|
|
3287
|
+
objectIdAtRef: (cwd: string, ref: string, repositoryRelativePath: string) => string | undefined;
|
|
3288
|
+
resolveCommitSha: (cwd: string, ref: string) => string | undefined;
|
|
3289
|
+
showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
3290
|
+
stablePatchId: (cwd: string, base: string) => string;
|
|
3291
|
+
}
|
|
3292
|
+
export declare function validatePrReadyProof(value: unknown): PrReadyProof;
|
|
3293
|
+
export declare function readPrReadyProof(filePath: string): PrReadyProof;
|
|
3294
|
+
export declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
|
|
3284
3295
|
interface LivePullRequestBase {
|
|
3285
3296
|
baseRefName: string;
|
|
3286
3297
|
/** Left unvalidated: the base-policy reader is its one consumer (#922). */
|