@patronage/software-factory 1.0.0-alpha.2 → 1.0.0-alpha.20
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/CONTEXT.md +10 -0
- package/README.md +8 -2
- package/dist/index.d.ts +1192 -1235
- package/dist/index.js +7371 -6615
- package/dist/schemas.d.ts +214 -836
- package/dist/schemas.js +116 -430
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,98 @@
|
|
|
1
1
|
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
4
|
+
import { PreviewProofRegistration } from "@patronage/factory-ci";
|
|
5
5
|
|
|
6
|
+
//#region src/review-rungs.d.ts
|
|
7
|
+
declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
|
|
8
|
+
type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
|
|
9
|
+
declare namespace boundary_manifest_d_exports {
|
|
10
|
+
export { BOUNDARY_CLOSEOUT_DEFAULT_RUNG, BOUNDARY_MANIFEST_SCHEMA_VERSION, BoundaryManifest, BoundaryManifestExtraction, BoundaryManifestParse, FACTORY_BOUNDARY_FENCE_LANG, boundaryManifestSchema, closeoutRungFor, extractBoundaryManifestBlock, manifestContentHash, parseBoundaryManifest, rungMeetsMinimum, specContentHash };
|
|
11
|
+
}
|
|
12
|
+
declare const FACTORY_BOUNDARY_FENCE_LANG = "factory-boundary";
|
|
13
|
+
declare const BOUNDARY_MANIFEST_SCHEMA_VERSION = 1;
|
|
14
|
+
declare const BOUNDARY_CLOSEOUT_DEFAULT_RUNG: EvidenceReviewRung;
|
|
15
|
+
declare const rungMeetsMinimum: (rung: EvidenceReviewRung, minimum: EvidenceReviewRung) => boolean;
|
|
16
|
+
declare const boundaryManifestBaseSchema: z.ZodObject<{
|
|
17
|
+
boundary: z.ZodString;
|
|
18
|
+
closeout: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
review: z.ZodEnum<{
|
|
20
|
+
oracle: "oracle";
|
|
21
|
+
"independent-model": "independent-model";
|
|
22
|
+
human: "human";
|
|
23
|
+
}>;
|
|
24
|
+
}, z.core.$loose>>;
|
|
25
|
+
declaredBy: z.ZodString;
|
|
26
|
+
integrationBranch: z.ZodOptional<z.ZodString>;
|
|
27
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
28
|
+
topology: z.ZodEnum<{
|
|
29
|
+
flagged: "flagged";
|
|
30
|
+
"each-to-main": "each-to-main";
|
|
31
|
+
stacked: "stacked";
|
|
32
|
+
"each-to-epic": "each-to-epic";
|
|
33
|
+
}>;
|
|
34
|
+
waves: z.ZodArray<z.ZodObject<{
|
|
35
|
+
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
issues: z.ZodArray<z.ZodNumber>;
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
review: z.ZodEnum<{
|
|
39
|
+
oracle: "oracle";
|
|
40
|
+
"independent-model": "independent-model";
|
|
41
|
+
human: "human";
|
|
42
|
+
}>;
|
|
43
|
+
}, z.core.$loose>>;
|
|
44
|
+
}, z.core.$loose>;
|
|
45
|
+
declare const boundaryManifestSchema: z.ZodObject<{
|
|
46
|
+
boundary: z.ZodString;
|
|
47
|
+
closeout: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
review: z.ZodEnum<{
|
|
49
|
+
oracle: "oracle";
|
|
50
|
+
"independent-model": "independent-model";
|
|
51
|
+
human: "human";
|
|
52
|
+
}>;
|
|
53
|
+
}, z.core.$loose>>;
|
|
54
|
+
declaredBy: z.ZodString;
|
|
55
|
+
integrationBranch: z.ZodOptional<z.ZodString>;
|
|
56
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
57
|
+
topology: z.ZodEnum<{
|
|
58
|
+
flagged: "flagged";
|
|
59
|
+
"each-to-main": "each-to-main";
|
|
60
|
+
stacked: "stacked";
|
|
61
|
+
"each-to-epic": "each-to-epic";
|
|
62
|
+
}>;
|
|
63
|
+
waves: z.ZodArray<z.ZodObject<{
|
|
64
|
+
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
issues: z.ZodArray<z.ZodNumber>;
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
review: z.ZodEnum<{
|
|
68
|
+
oracle: "oracle";
|
|
69
|
+
"independent-model": "independent-model";
|
|
70
|
+
human: "human";
|
|
71
|
+
}>;
|
|
72
|
+
}, z.core.$loose>>;
|
|
73
|
+
}, z.core.$loose>;
|
|
74
|
+
type BoundaryManifest = z.infer<typeof boundaryManifestBaseSchema>;
|
|
75
|
+
type BoundaryManifestExtraction = {
|
|
76
|
+
ok: true;
|
|
77
|
+
blockText: string;
|
|
78
|
+
} | {
|
|
79
|
+
ok: false;
|
|
80
|
+
error: string;
|
|
81
|
+
};
|
|
82
|
+
declare const extractBoundaryManifestBlock: (issueBody: string) => BoundaryManifestExtraction;
|
|
83
|
+
declare const manifestContentHash: (blockText: string) => string;
|
|
84
|
+
declare const specContentHash: (issueBody: string) => string;
|
|
85
|
+
type BoundaryManifestParse = {
|
|
86
|
+
ok: true;
|
|
87
|
+
manifest: BoundaryManifest;
|
|
88
|
+
manifestHash: string;
|
|
89
|
+
} | {
|
|
90
|
+
ok: false;
|
|
91
|
+
error: string;
|
|
92
|
+
};
|
|
93
|
+
declare const parseBoundaryManifest: (issueBody: string) => BoundaryManifestParse;
|
|
94
|
+
declare const closeoutRungFor: (manifest: BoundaryManifest) => EvidenceReviewRung;
|
|
95
|
+
//#endregion
|
|
6
96
|
//#region src/github-issue-comments.d.ts
|
|
7
97
|
interface GithubIssueCommentApi {
|
|
8
98
|
body: string;
|
|
@@ -127,6 +217,22 @@ declare const selectBoundaryReviewProof: (comments: GithubIssueComment[], bounda
|
|
|
127
217
|
declare const boundaryReviewProofAuthorsSeen: (comments: GithubIssueComment[], boundary: string) => string[];
|
|
128
218
|
declare const undispositionedBlockingFindings: (proof: BoundaryReviewProof) => string[];
|
|
129
219
|
//#endregion
|
|
220
|
+
//#region src/boundary-membership-graph.d.ts
|
|
221
|
+
/** The boundary-manifest wave demand that applies to one pull request. */
|
|
222
|
+
interface WaveReviewDemand {
|
|
223
|
+
autoMerge: boolean;
|
|
224
|
+
review: EvidenceReviewRung;
|
|
225
|
+
wave: string;
|
|
226
|
+
}
|
|
227
|
+
interface BoundaryPullRequestRef {
|
|
228
|
+
baseRefName?: string;
|
|
229
|
+
headRefOid?: string;
|
|
230
|
+
headRefName?: string;
|
|
231
|
+
mergeCommitOid?: string;
|
|
232
|
+
number: number;
|
|
233
|
+
state: "OPEN" | "CLOSED" | "MERGED";
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
130
236
|
//#region src/hq-ingest-sink.d.ts
|
|
131
237
|
interface HqIngestDependencies {
|
|
132
238
|
/**
|
|
@@ -145,8 +251,6 @@ interface HqIngestDependencies {
|
|
|
145
251
|
* `timeoutMs`: see the note there.
|
|
146
252
|
*/
|
|
147
253
|
journalFlushBudgetMs?: number;
|
|
148
|
-
/** @deprecated Legacy sidecars are now streamed directly; retained for API compatibility. */
|
|
149
|
-
sidecarReclaimMs?: number;
|
|
150
254
|
/**
|
|
151
255
|
* Setup budget for callers that own the process lifetime — honored AS GIVEN,
|
|
152
256
|
* above the `DEFAULT_HQ_INGEST_TIMEOUT_MS` ceiling that clamps `timeoutMs`.
|
|
@@ -182,14 +286,17 @@ interface HqSpoolEntryOutcome {
|
|
|
182
286
|
detail?: string;
|
|
183
287
|
eventId: string;
|
|
184
288
|
kind: string;
|
|
289
|
+
/**
|
|
290
|
+
* `true` when HQ refused the content as schema-invalid (HTTP 422, #739).
|
|
291
|
+
* The same bytes get the same verdict on every retry under the current
|
|
292
|
+
* ingest schema, so retrying without a schema change cannot succeed.
|
|
293
|
+
* Distinct from `undeliverable`: an HQ schema fix can still admit these
|
|
294
|
+
* bytes, so eviction is an operator decision (`hq:flush --evict-permanent`),
|
|
295
|
+
* never automatic.
|
|
296
|
+
*/
|
|
297
|
+
permanent?: boolean;
|
|
185
298
|
spool: string;
|
|
186
299
|
/**
|
|
187
|
-
* `migrated` belongs to the legacy JSONL journal only: the row was moved
|
|
188
|
-
* into the current spool without being delivered. The spool pass that runs
|
|
189
|
-
* after it in the same drain supersedes that line with a real outcome when
|
|
190
|
-
* it gets to the row; a `migrated` line that survives the run means the row
|
|
191
|
-
* is still waiting.
|
|
192
|
-
*
|
|
193
300
|
* `undeliverable` is the one terminal verdict (#445). Every other status
|
|
194
301
|
* describes a moment: HQ was unreachable, HQ refused this content today, the
|
|
195
302
|
* row moved. Retrying is meaningful for all of them. A wrong-origin entry is
|
|
@@ -198,15 +305,20 @@ interface HqSpoolEntryOutcome {
|
|
|
198
305
|
* run. Leaving it spooled asks the operator to retry something that provably
|
|
199
306
|
* cannot succeed, and the count it inflates is the one doctor goes red on.
|
|
200
307
|
*/
|
|
201
|
-
status: "delivered" | "duplicate" | "
|
|
308
|
+
status: "delivered" | "duplicate" | "rejected" | "undeliverable" | "unreachable";
|
|
202
309
|
}
|
|
203
310
|
interface HqSpoolFlushInput {
|
|
204
311
|
clientId: string;
|
|
205
312
|
clientSecret: string;
|
|
206
|
-
/** Repository root whose legacy `.factory-memory` spool is also drained. */
|
|
207
|
-
cwd: string;
|
|
208
313
|
/** The profile's HQ origin; entries recorded against another are refused. */
|
|
209
314
|
endpoint: string;
|
|
315
|
+
/**
|
|
316
|
+
* Disposition schema-permanent rejections (HTTP 422) in place with the
|
|
317
|
+
* `.undeliverable` suffix instead of retaining them (#739). Operator
|
|
318
|
+
* opt-in: a later HQ schema fix can still admit the same bytes, so the
|
|
319
|
+
* drain never evicts on its own.
|
|
320
|
+
*/
|
|
321
|
+
evictPermanentRejections?: boolean;
|
|
210
322
|
/** Operator-named spool directories; replaces the default two locations. */
|
|
211
323
|
explicitDirectories?: string[];
|
|
212
324
|
repository: HqSpoolRepository;
|
|
@@ -239,13 +351,13 @@ interface HqSpoolFlushSummary {
|
|
|
239
351
|
interface HqSpoolWorkCount {
|
|
240
352
|
/**
|
|
241
353
|
* The earliest moment learned across pending spool files (their own write
|
|
242
|
-
* time)
|
|
354
|
+
* time). Absent only when
|
|
243
355
|
* `pending` is `0`, or when every timestamp source was unreadable within
|
|
244
356
|
* budget — an estimate for doctor's remediation message (#394), never a
|
|
245
357
|
* precise audit trail.
|
|
246
358
|
*/
|
|
247
359
|
oldestQueuedAt?: string;
|
|
248
|
-
/** Spooled events
|
|
360
|
+
/** Spooled events waiting in the locations below. */
|
|
249
361
|
pending: number;
|
|
250
362
|
/** Locations that exist and hold spooled work. */
|
|
251
363
|
spools: string[];
|
|
@@ -266,7 +378,7 @@ interface HqSpoolWorkCount {
|
|
|
266
378
|
* same locations `flushHqSpool` drains are inspected here, read-only: no
|
|
267
379
|
* directory is created, nothing is secured, and nothing is delivered.
|
|
268
380
|
*/
|
|
269
|
-
declare function countHqSpoolWork(input: Pick<HqSpoolFlushInput, "
|
|
381
|
+
declare function countHqSpoolWork(input: Pick<HqSpoolFlushInput, "explicitDirectories" | "repository">, dependencies?: {
|
|
270
382
|
budgetMs?: number;
|
|
271
383
|
env?: NodeJS.ProcessEnv;
|
|
272
384
|
}): Promise<HqSpoolWorkCount>;
|
|
@@ -275,7 +387,7 @@ interface HqSpoolOrphan {
|
|
|
275
387
|
/** The `hq-retry-spool` directory itself, ready to pass to `--dir`. */
|
|
276
388
|
directory: string;
|
|
277
389
|
oldestQueuedAt?: string;
|
|
278
|
-
/** Spooled events
|
|
390
|
+
/** Spooled events waiting there. */
|
|
279
391
|
pending: number;
|
|
280
392
|
/**
|
|
281
393
|
* The location exists but could not be listed. As everywhere else in this
|
|
@@ -522,10 +634,82 @@ declare const FollowUpActionSchema: z.ZodType<FollowUpAction>;
|
|
|
522
634
|
declare const DIFF_CLASSIFICATIONS: readonly ["docs/process-only", "trivial", "non-trivial"];
|
|
523
635
|
type DiffClassification = (typeof DIFF_CLASSIFICATIONS)[number];
|
|
524
636
|
//#endregion
|
|
637
|
+
//#region src/impact-stamp.d.ts
|
|
638
|
+
/**
|
|
639
|
+
* The recorded stamp. `targets` satisfies the completeness invariant: every
|
|
640
|
+
* target the profile declares is present, each with its exact basis — never
|
|
641
|
+
* silently absent. `basis: "conservative"` means an unmodelled or unprovable
|
|
642
|
+
* input widened every target to full impact.
|
|
643
|
+
*/
|
|
644
|
+
declare const impactStampSchema: z.ZodObject<{
|
|
645
|
+
basis: z.ZodEnum<{
|
|
646
|
+
"target-scoped": "target-scoped";
|
|
647
|
+
conservative: "conservative";
|
|
648
|
+
}>;
|
|
649
|
+
inertPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
650
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
651
|
+
stampVersion: z.ZodLiteral<3>;
|
|
652
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
653
|
+
basis: z.ZodString;
|
|
654
|
+
impact: z.ZodEnum<{
|
|
655
|
+
affected: "affected";
|
|
656
|
+
"not-affected": "not-affected";
|
|
657
|
+
}>;
|
|
658
|
+
name: z.ZodString;
|
|
659
|
+
}, z.core.$strip>>;
|
|
660
|
+
unsubscribedPaths: z.ZodArray<z.ZodString>;
|
|
661
|
+
}, z.core.$strip>;
|
|
662
|
+
type ImpactStamp = z.infer<typeof impactStampSchema>;
|
|
663
|
+
/**
|
|
664
|
+
* The surfaces that consume the stamp. One classification, consumed
|
|
665
|
+
* everywhere (#430): every surface routes through
|
|
666
|
+
* {@link impactStampScopeDecision}, so no surface can be more trusting than
|
|
667
|
+
* another, and no surface re-derives path rules of its own. The value only
|
|
668
|
+
* selects the wording of the conservative floor a refusal falls back to.
|
|
669
|
+
*/
|
|
670
|
+
declare const IMPACT_SCOPE_SURFACES: {
|
|
671
|
+
readonly demand: "full demand floor";
|
|
672
|
+
readonly "preview-lifecycle": "full preview-lifecycle floor";
|
|
673
|
+
readonly "verification-battery": "full verification-battery floor";
|
|
674
|
+
};
|
|
675
|
+
type ImpactScopeSurface = keyof typeof IMPACT_SCOPE_SURFACES;
|
|
676
|
+
interface ImpactScopeDecision {
|
|
677
|
+
reason: string;
|
|
678
|
+
/** True ⇒ this target's work is provably unreachable and may be released. */
|
|
679
|
+
scoped: boolean;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Whether a trusted stamp RELEASES one target-scoped unit of work — an
|
|
683
|
+
* external proof demand (#542 wave 2), a verification-battery command, or a
|
|
684
|
+
* preview (Alchemy) lifecycle stack (#430 wave 3).
|
|
685
|
+
*
|
|
686
|
+
* The only release path is a `target-scoped` stamp of exactly this build's
|
|
687
|
+
* stamp version whose target entry for exactly this name is provably
|
|
688
|
+
* `not-affected`. Every other input — no trusted stamp, an unknown stamp
|
|
689
|
+
* version, a conservative stamp, a name the stamp does not classify, or an
|
|
690
|
+
* `affected` verdict — keeps today's full-work floor. Work only ever gets
|
|
691
|
+
* released, never added or satisfied: this function can withdraw a demand, it
|
|
692
|
+
* can never certify one.
|
|
693
|
+
*
|
|
694
|
+
* Identity binding is the CALLER's precondition: pass only a stamp computed
|
|
695
|
+
* for, or read from a pr:verify proof bound to, the current candidate (see
|
|
696
|
+
* `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
|
|
697
|
+
* `undefined` otherwise.
|
|
698
|
+
*/
|
|
699
|
+
declare const impactStampScopeDecision: ({
|
|
700
|
+
stamp,
|
|
701
|
+
surface,
|
|
702
|
+
targetName
|
|
703
|
+
}: {
|
|
704
|
+
stamp: ImpactStamp | undefined;
|
|
705
|
+
surface: ImpactScopeSurface;
|
|
706
|
+
targetName: string;
|
|
707
|
+
}) => ImpactScopeDecision;
|
|
708
|
+
//#endregion
|
|
525
709
|
//#region src/profile.d.ts
|
|
526
710
|
declare const DEFAULT_FACTORY_REPOSITORY = "unknown/unknown";
|
|
527
|
-
/** The one profile shape this build accepts (ADR 0023, #318, #351). */
|
|
528
|
-
declare const PROFILE_SCHEMA_VERSION =
|
|
711
|
+
/** The one profile shape this build accepts (ADR 0023, #318, #351, #742). */
|
|
712
|
+
declare const PROFILE_SCHEMA_VERSION = 6;
|
|
529
713
|
declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
530
714
|
$schema: z.ZodOptional<z.ZodString>;
|
|
531
715
|
extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -534,18 +718,17 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
|
534
718
|
endpoint: z.ZodIntersection<z.ZodString, z.ZodString>;
|
|
535
719
|
}, z.core.$strict>>;
|
|
536
720
|
impact: z.ZodOptional<z.ZodObject<{
|
|
721
|
+
inert: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
537
722
|
targets: z.ZodArray<z.ZodObject<{
|
|
538
723
|
importers: z.ZodArray<z.ZodString>;
|
|
539
724
|
name: z.ZodString;
|
|
540
725
|
paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
541
726
|
}, z.core.$strict>>;
|
|
542
727
|
}, z.core.$strict>>;
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}, z.core.$strict>;
|
|
548
|
-
}, z.core.$strict>;
|
|
728
|
+
lifecycleContract: z.ZodOptional<z.ZodObject<{
|
|
729
|
+
command: z.ZodString;
|
|
730
|
+
jobName: z.ZodOptional<z.ZodString>;
|
|
731
|
+
}, z.core.$strict>>;
|
|
549
732
|
repository: z.ZodObject<{
|
|
550
733
|
name: z.ZodString;
|
|
551
734
|
owner: z.ZodString;
|
|
@@ -554,7 +737,6 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
|
554
737
|
name: z.ZodString;
|
|
555
738
|
scope: z.ZodOptional<z.ZodObject<{
|
|
556
739
|
classifications: z.ZodArray<z.ZodEnum<{
|
|
557
|
-
trivial: "trivial";
|
|
558
740
|
"docs/process-only": "docs/process-only";
|
|
559
741
|
"non-trivial": "non-trivial";
|
|
560
742
|
}>>;
|
|
@@ -565,7 +747,7 @@ declare const factoryProjectProfileSchema: z.ZodObject<{
|
|
|
565
747
|
paths: z.ZodArray<z.ZodString>;
|
|
566
748
|
}, z.core.$strict>>;
|
|
567
749
|
}, z.core.$strict>>;
|
|
568
|
-
schemaVersion: z.ZodLiteral<
|
|
750
|
+
schemaVersion: z.ZodLiteral<6>;
|
|
569
751
|
verification: z.ZodObject<{
|
|
570
752
|
commands: z.ZodArray<z.ZodObject<{
|
|
571
753
|
command: z.ZodString;
|
|
@@ -658,9 +840,7 @@ interface LoadUserConfigResult {
|
|
|
658
840
|
//#endregion
|
|
659
841
|
//#region src/github-check-runs.d.ts
|
|
660
842
|
declare const FACTORY_CHECK_NAMES: {
|
|
661
|
-
readonly boundary: "patronage-factory/boundary";
|
|
662
843
|
readonly "pr-ready": "patronage-factory/pr-ready";
|
|
663
|
-
readonly "pr-review": "patronage-factory/pr-review";
|
|
664
844
|
readonly "pr-verify": "patronage-factory/pr-verify";
|
|
665
845
|
};
|
|
666
846
|
type FactoryCheckGate = keyof typeof FACTORY_CHECK_NAMES;
|
|
@@ -675,12 +855,6 @@ interface PublishFactoryCheckInput {
|
|
|
675
855
|
* `hqLaneRefBaseUrlFromProfile` — the same source as the HQ gate sink.
|
|
676
856
|
*/
|
|
677
857
|
hqLaneBaseUrl?: string;
|
|
678
|
-
/**
|
|
679
|
-
* Explicit issue/PR number for the HQ lane ref, used when the check run is not
|
|
680
|
-
* PR-scoped (e.g. an epic boundary check keyed by its epic issue). Falls back
|
|
681
|
-
* to `pr`, then to the checkout's PR, when omitted.
|
|
682
|
-
*/
|
|
683
|
-
laneRefNumber?: number;
|
|
684
858
|
owner: string;
|
|
685
859
|
pr?: number;
|
|
686
860
|
proof: unknown;
|
|
@@ -753,8 +927,8 @@ declare const mergeFreezeStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
753
927
|
generationId: z.ZodNumber;
|
|
754
928
|
headSha: z.ZodString;
|
|
755
929
|
outcome: z.ZodEnum<{
|
|
756
|
-
stale: "stale";
|
|
757
930
|
active: "active";
|
|
931
|
+
stale: "stale";
|
|
758
932
|
}>;
|
|
759
933
|
reason: z.ZodString;
|
|
760
934
|
recordedAt: z.ZodISODateTime;
|
|
@@ -879,10 +1053,6 @@ interface ReviewLadderPolicy {
|
|
|
879
1053
|
}
|
|
880
1054
|
declare const resolveReviewLadderPolicy: () => ReviewLadderPolicy;
|
|
881
1055
|
//#endregion
|
|
882
|
-
//#region src/review-rungs.d.ts
|
|
883
|
-
declare const EVIDENCE_REVIEW_RUNGS: readonly ["independent-model", "oracle", "human"];
|
|
884
|
-
type EvidenceReviewRung = (typeof EVIDENCE_REVIEW_RUNGS)[number];
|
|
885
|
-
//#endregion
|
|
886
1056
|
//#region src/review-ladder-ledger.d.ts
|
|
887
1057
|
type LadderCycleStage = "interior" | "gate";
|
|
888
1058
|
interface LadderCycleRef {
|
|
@@ -1134,8 +1304,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1134
1304
|
baseSha: z.ZodString;
|
|
1135
1305
|
blockingReasons: z.ZodArray<z.ZodString>;
|
|
1136
1306
|
classification: z.ZodEnum<{
|
|
1137
|
-
trivial: "trivial";
|
|
1138
1307
|
"docs/process-only": "docs/process-only";
|
|
1308
|
+
trivial: "trivial";
|
|
1139
1309
|
"non-trivial": "non-trivial";
|
|
1140
1310
|
}>;
|
|
1141
1311
|
externalChecks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1148,8 +1318,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1148
1318
|
reason: z.ZodOptional<z.ZodString>;
|
|
1149
1319
|
scope: z.ZodOptional<z.ZodObject<{
|
|
1150
1320
|
classifications: z.ZodArray<z.ZodEnum<{
|
|
1151
|
-
trivial: "trivial";
|
|
1152
1321
|
"docs/process-only": "docs/process-only";
|
|
1322
|
+
trivial: "trivial";
|
|
1153
1323
|
"non-trivial": "non-trivial";
|
|
1154
1324
|
}>>;
|
|
1155
1325
|
}, z.core.$strict>>;
|
|
@@ -1252,9 +1422,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1252
1422
|
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1253
1423
|
status: z.ZodEnum<{
|
|
1254
1424
|
"not-required": "not-required";
|
|
1425
|
+
stale: "stale";
|
|
1255
1426
|
blocked: "blocked";
|
|
1256
1427
|
current: "current";
|
|
1257
|
-
stale: "stale";
|
|
1258
1428
|
missing: "missing";
|
|
1259
1429
|
}>;
|
|
1260
1430
|
}, z.core.$strip>;
|
|
@@ -1264,9 +1434,9 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1264
1434
|
reviewedPatchId: z.ZodOptional<z.ZodString>;
|
|
1265
1435
|
status: z.ZodEnum<{
|
|
1266
1436
|
"not-required": "not-required";
|
|
1437
|
+
stale: "stale";
|
|
1267
1438
|
blocked: "blocked";
|
|
1268
1439
|
current: "current";
|
|
1269
|
-
stale: "stale";
|
|
1270
1440
|
missing: "missing";
|
|
1271
1441
|
}>;
|
|
1272
1442
|
}, z.core.$strip>>;
|
|
@@ -1277,8 +1447,8 @@ declare const managedReadinessLedgerSchema: z.ZodObject<{
|
|
|
1277
1447
|
docsOnlyDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
1278
1448
|
docsOnlyVerifiedHeadSha: z.ZodOptional<z.ZodString>;
|
|
1279
1449
|
prVerify: z.ZodEnum<{
|
|
1280
|
-
passed: "passed";
|
|
1281
1450
|
stale: "stale";
|
|
1451
|
+
passed: "passed";
|
|
1282
1452
|
missing: "missing";
|
|
1283
1453
|
}>;
|
|
1284
1454
|
trivialDeltaAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1340,944 +1510,973 @@ declare const isHostedVerifyCheck: (check: StatusCheckRollup) => boolean;
|
|
|
1340
1510
|
declare const hostedVerifyCheckState: (rollup: StatusCheckRollup[] | undefined) => CheckState;
|
|
1341
1511
|
declare const statusCheckState: (rollup: StatusCheckRollup[] | undefined, exclude?: (check: StatusCheckRollup) => boolean) => CheckState;
|
|
1342
1512
|
//#endregion
|
|
1343
|
-
//#region src/
|
|
1344
|
-
interface
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
pr: number;
|
|
1352
|
-
reviewProof?: string;
|
|
1353
|
-
throwWhenBlocked?: boolean;
|
|
1354
|
-
verifyProof?: string;
|
|
1513
|
+
//#region src/github-app-client.d.ts
|
|
1514
|
+
interface FactoryAppRequest {
|
|
1515
|
+
body?: unknown;
|
|
1516
|
+
headers?: Readonly<Record<string, string>>;
|
|
1517
|
+
method: "DELETE" | "GET" | "PATCH" | "POST";
|
|
1518
|
+
owner: string;
|
|
1519
|
+
path: string;
|
|
1520
|
+
repo: string;
|
|
1355
1521
|
}
|
|
1356
|
-
interface
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
* implementation that left the field out would silently disable the
|
|
1365
|
-
* `boundary-wave` refusal that stops an epicless run from greening a
|
|
1366
|
-
* candidate GitHub is already scheduled to merge. Requiring it makes the
|
|
1367
|
-
* compiler enforce what `gh` already promises.
|
|
1368
|
-
*/
|
|
1369
|
-
autoMergeRequest: {
|
|
1370
|
-
enabledAt?: string;
|
|
1371
|
-
} | null;
|
|
1372
|
-
baseRefName: string;
|
|
1373
|
-
baseRefOid: string;
|
|
1522
|
+
interface FactoryAppExchange<T = unknown> {
|
|
1523
|
+
readonly etag?: string;
|
|
1524
|
+
readonly json: T;
|
|
1525
|
+
readonly status: number;
|
|
1526
|
+
}
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region src/github-pr-status-comment.d.ts
|
|
1529
|
+
interface UpsertFactoryPrStatusCommentInput {
|
|
1374
1530
|
body: string;
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1531
|
+
/** ISO instant at which this presentation was observed. */
|
|
1532
|
+
observedAt?: string;
|
|
1533
|
+
owner: string;
|
|
1534
|
+
pr: number;
|
|
1535
|
+
repo: string;
|
|
1536
|
+
}
|
|
1537
|
+
interface UpsertFactoryPrStatusCommentDependencies {
|
|
1538
|
+
request?: (input: FactoryAppRequest) => Promise<FactoryAppExchange>;
|
|
1539
|
+
requestJson?: (input: FactoryAppRequest) => Promise<unknown>;
|
|
1540
|
+
}
|
|
1541
|
+
interface UpsertFactoryPrStatusCommentResult {
|
|
1542
|
+
action: "created" | "updated";
|
|
1543
|
+
commentId: number;
|
|
1384
1544
|
url: string;
|
|
1385
1545
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1546
|
+
declare function upsertFactoryPrStatusComment(input: UpsertFactoryPrStatusCommentInput, dependencies?: UpsertFactoryPrStatusCommentDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/pr-verify-proof-contract.d.ts
|
|
1549
|
+
declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [1, 2, 3, 4];
|
|
1550
|
+
type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
|
|
1551
|
+
interface PrVerifyCommandResult {
|
|
1552
|
+
command: string;
|
|
1553
|
+
description: string;
|
|
1388
1554
|
/**
|
|
1389
|
-
*
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
*/
|
|
1396
|
-
arming?: {
|
|
1397
|
-
detail?: string;
|
|
1398
|
-
headSha: string;
|
|
1399
|
-
outcome: "armed" | "merged" | "not-armed";
|
|
1400
|
-
};
|
|
1401
|
-
/**
|
|
1402
|
-
* Why this run blocked, one entry per refusing demand (#391): `code` is the
|
|
1403
|
-
* demand key from the resolver's vocabulary, `detail` the one-sentence
|
|
1404
|
-
* refusal. Same refusals as `blockingReasons`, in the same order — the
|
|
1405
|
-
* analyzable projection of a flat string list, so a wall of blocked proofs
|
|
1406
|
-
* on one PR can be counted by cause. Absent when nothing blocked.
|
|
1407
|
-
*/
|
|
1408
|
-
blockedReasons?: BlockedReason[];
|
|
1409
|
-
blockingReasons: string[];
|
|
1410
|
-
humanBlockingReasons: string[];
|
|
1411
|
-
command: "patronage-factory pr:ready";
|
|
1412
|
-
/**
|
|
1413
|
-
* Machine-safe arg array for the obvious next action (#523): when `ready`
|
|
1414
|
-
* but arming did not take effect, a `pr:ready` re-dispatch (idempotent on
|
|
1415
|
-
* an unchanged head); otherwise the `gh pr ready` undraft repair or the
|
|
1416
|
-
* `pr:verify` re-run that the blocking reasons name (re-verify the head,
|
|
1417
|
-
* then re-run pr:ready). Same `argv` shape `factory:delegate --print`
|
|
1418
|
-
* emits. Optional and purely additive.
|
|
1419
|
-
*/
|
|
1420
|
-
followUp?: FollowUpAction;
|
|
1421
|
-
/**
|
|
1422
|
-
* `ledger.headSha` is the evaluated head SHA: the GitHub `pr.headRefOid`
|
|
1423
|
-
* captured at evaluation time (not a local git read), recorded explicitly
|
|
1424
|
-
* so merge-time identity checks are a pure comparison against the live
|
|
1425
|
-
* pushed HEAD, not a re-derivation. See the ledger schema.
|
|
1426
|
-
*/
|
|
1427
|
-
ledger: ManagedReadinessLedger;
|
|
1428
|
-
/**
|
|
1429
|
-
* Actionable facts that did not block (#477): a settling merge-freeze
|
|
1430
|
-
* generation that permitted readiness and any authorized arming with a
|
|
1431
|
-
* notice, an admitted-but-unscheduled false boundary wave, and how each
|
|
1432
|
-
* waived demand reads to a human. Absent when there are none.
|
|
1433
|
-
*/
|
|
1434
|
-
notices?: string[];
|
|
1435
|
-
/** Committed profile blob evaluated by readiness. Required for merge. */
|
|
1436
|
-
profileBlobSha?: string;
|
|
1437
|
-
/** Checkout-relative committed profile path evaluated by readiness. */
|
|
1438
|
-
profilePath?: string;
|
|
1439
|
-
repairs: ReadinessRepair[];
|
|
1440
|
-
/** Trusted checkout repository used for all GitHub reads and writes. */
|
|
1441
|
-
repository?: string;
|
|
1442
|
-
status: ReadinessStatus;
|
|
1443
|
-
/**
|
|
1444
|
-
* Demands that were in force, were NOT met, and were waived by the operator
|
|
1445
|
-
* (#354, moved here from the merge-time proof by #477). Each entry carries
|
|
1446
|
-
* the demand's refusals verbatim, so a waived demand can never read as a met
|
|
1447
|
-
* one; readiness proceeds on the recorded operator act, not on evidence.
|
|
1555
|
+
* Epic #550 wave 3 (#430): the profile's declared impact target for this
|
|
1556
|
+
* command, recorded from v4 on. It is the proof's own command→target
|
|
1557
|
+
* mapping: a `notRequiredCommands` entry must name the target recorded HERE
|
|
1558
|
+
* for the same command, so a withholding cannot point at whichever released
|
|
1559
|
+
* target happens to be convenient. Absent for a command the profile does
|
|
1560
|
+
* not scope, and for v1–v3 proofs, which predate the field.
|
|
1448
1561
|
*/
|
|
1449
|
-
|
|
1562
|
+
impactTarget?: string;
|
|
1563
|
+
name: string;
|
|
1564
|
+
scope: "always" | "docs-only" | "trivial" | "full";
|
|
1450
1565
|
}
|
|
1451
|
-
interface
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
*/
|
|
1457
|
-
armAutoMerge?: (input: ArmAutoMergeInput) => ArmAutoMergeOutcome;
|
|
1458
|
-
github?: {
|
|
1459
|
-
fetchClosingPullRequests?: (input: {
|
|
1460
|
-
issue: number;
|
|
1461
|
-
owner: string;
|
|
1462
|
-
repo: string;
|
|
1463
|
-
}) => {
|
|
1464
|
-
number: number;
|
|
1465
|
-
}[];
|
|
1466
|
-
fetchIssueBody?: (input: {
|
|
1467
|
-
issue: number;
|
|
1468
|
-
owner: string;
|
|
1469
|
-
repo: string;
|
|
1470
|
-
}) => string;
|
|
1471
|
-
fetchPullRequest: (input: {
|
|
1472
|
-
owner: string;
|
|
1473
|
-
repo: string;
|
|
1474
|
-
pr: number;
|
|
1475
|
-
}) => GitHubPullRequest;
|
|
1566
|
+
interface PrVerifyExecutedCommand {
|
|
1567
|
+
command: string;
|
|
1568
|
+
counts?: {
|
|
1569
|
+
testFiles?: number;
|
|
1570
|
+
tests?: number;
|
|
1476
1571
|
};
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
* GitHub check-run authority — readiness is a control, so an absent
|
|
1482
|
-
* dependency must not mean an unread freeze.
|
|
1483
|
-
*/
|
|
1484
|
-
mergeFreeze?: Pick<MergeFreezeAuthority, "readGeneration">;
|
|
1485
|
-
/**
|
|
1486
|
-
* Awaited publication of the branded check, which is a source-pinned
|
|
1487
|
-
* required check rather than a mirror (#477). Returns true only when the
|
|
1488
|
-
* App-owned run landed. Defaults to `ensureFactoryCheckRunPublished`.
|
|
1489
|
-
*
|
|
1490
|
-
* `pr:ready` has no other publication seam, and this one cannot express a
|
|
1491
|
-
* non-terminal run (#526): `status` is omitted from the input, so every run
|
|
1492
|
-
* readiness creates is completed with a conclusion. A `pr:ready` invocation
|
|
1493
|
-
* therefore cannot leave a run holding the source-pinned required check
|
|
1494
|
-
* open, which is a permanent block on the pull request (#524).
|
|
1495
|
-
*/
|
|
1496
|
-
publishFinalCheckRun?: (input: Omit<PublishFactoryCheckInput, "status"> & {
|
|
1497
|
-
conclusion: "failure" | "success";
|
|
1498
|
-
}) => Promise<boolean> | boolean;
|
|
1499
|
-
/** Injectable delay for the UNKNOWN-mergeable brief poll (tests). */
|
|
1500
|
-
sleep?: (ms: number) => Promise<void>;
|
|
1501
|
-
}
|
|
1502
|
-
interface PrReadyGitDependencies {
|
|
1503
|
-
canResolveCommit: (cwd: string, sha: string) => boolean;
|
|
1504
|
-
changedFiles: (cwd: string, base: string, headSha?: string) => string[];
|
|
1505
|
-
checkoutRepository: (cwd: string) => CheckoutRepository;
|
|
1506
|
-
currentHeadSha: (cwd: string) => string;
|
|
1507
|
-
mergeBaseSha: (cwd: string, base: string) => string;
|
|
1508
|
-
objectIdAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
1509
|
-
resolveCommitSha: (cwd: string, ref: string) => string | undefined;
|
|
1510
|
-
showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
1511
|
-
stablePatchId: (cwd: string, base: string) => string;
|
|
1572
|
+
durationMs: number;
|
|
1573
|
+
exitCode: number;
|
|
1574
|
+
name: string;
|
|
1575
|
+
scope: "always" | "docs-only" | "trivial" | "full";
|
|
1512
1576
|
}
|
|
1513
|
-
declare function validatePrReadyProof(value: unknown): PrReadyProof;
|
|
1514
|
-
declare function readPrReadyProof(filePath: string): PrReadyProof;
|
|
1515
|
-
declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
|
|
1516
|
-
//#endregion
|
|
1517
|
-
//#region src/impact-stamp.d.ts
|
|
1518
|
-
/**
|
|
1519
|
-
* The recorded stamp. `targets` satisfies the completeness invariant: every
|
|
1520
|
-
* target the profile declares is present, each with its exact basis — never
|
|
1521
|
-
* silently absent. `basis: "conservative"` means an unmodelled or unprovable
|
|
1522
|
-
* input widened every target to full impact.
|
|
1523
|
-
*/
|
|
1524
|
-
declare const impactStampSchema: z.ZodObject<{
|
|
1525
|
-
basis: z.ZodEnum<{
|
|
1526
|
-
"target-scoped": "target-scoped";
|
|
1527
|
-
conservative: "conservative";
|
|
1528
|
-
}>;
|
|
1529
|
-
reasons: z.ZodArray<z.ZodString>;
|
|
1530
|
-
stampVersion: z.ZodLiteral<2>;
|
|
1531
|
-
targets: z.ZodArray<z.ZodObject<{
|
|
1532
|
-
basis: z.ZodString;
|
|
1533
|
-
impact: z.ZodEnum<{
|
|
1534
|
-
affected: "affected";
|
|
1535
|
-
"not-affected": "not-affected";
|
|
1536
|
-
}>;
|
|
1537
|
-
name: z.ZodString;
|
|
1538
|
-
}, z.core.$strip>>;
|
|
1539
|
-
}, z.core.$strip>;
|
|
1540
|
-
type ImpactStamp = z.infer<typeof impactStampSchema>;
|
|
1541
1577
|
/**
|
|
1542
|
-
*
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1578
|
+
* Epic #550 wave 3 (#430): a verification command the impact stamp proved this
|
|
1579
|
+
* candidate cannot reach, so the battery did not run it.
|
|
1580
|
+
*
|
|
1581
|
+
* The completeness invariant lives in the pairing: `verificationCommands`
|
|
1582
|
+
* records every command the resolved mode selected, `executedCommands` records
|
|
1583
|
+
* what ran, and this list records the rest WITH the stamp's own basis. A
|
|
1584
|
+
* withheld stack is therefore never silently absent from the proof — it is
|
|
1585
|
+
* present, named, and explained.
|
|
1547
1586
|
*/
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
};
|
|
1553
|
-
type ImpactScopeSurface = keyof typeof IMPACT_SCOPE_SURFACES;
|
|
1554
|
-
interface ImpactScopeDecision {
|
|
1555
|
-
reason: string;
|
|
1556
|
-
/** True ⇒ this target's work is provably unreachable and may be released. */
|
|
1557
|
-
scoped: boolean;
|
|
1587
|
+
interface PrVerifyNotRequiredCommand {
|
|
1588
|
+
basis: string;
|
|
1589
|
+
impactTarget: string;
|
|
1590
|
+
name: string;
|
|
1558
1591
|
}
|
|
1559
1592
|
/**
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
*
|
|
1564
|
-
* The only release path is a `target-scoped` stamp of exactly this build's
|
|
1565
|
-
* stamp version whose target entry for exactly this name is provably
|
|
1566
|
-
* `not-affected`. Every other input — no trusted stamp, an unknown stamp
|
|
1567
|
-
* version, a conservative stamp, a name the stamp does not classify, or an
|
|
1568
|
-
* `affected` verdict — keeps today's full-work floor. Work only ever gets
|
|
1569
|
-
* released, never added or satisfied: this function can withdraw a demand, it
|
|
1570
|
-
* can never certify one.
|
|
1571
|
-
*
|
|
1572
|
-
* Identity binding is the CALLER's precondition: pass only a stamp computed
|
|
1573
|
-
* for, or read from a pr:verify proof bound to, the current candidate (see
|
|
1574
|
-
* `trustedImpactStamp` in `pr-readiness/verification-proof.ts`); pass
|
|
1575
|
-
* `undefined` otherwise.
|
|
1593
|
+
* Epic #758 (#762): a consumer package a stamp-scoped selection skipped, and
|
|
1594
|
+
* why. Bound to the proof's stamp identity — the field is v4-only (the same
|
|
1595
|
+
* window that can carry `impactStamp`) and refused when the proof records no
|
|
1596
|
+
* stamp. The factory does not write this list; consumers do.
|
|
1576
1597
|
*/
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
surface,
|
|
1580
|
-
targetName
|
|
1581
|
-
}: {
|
|
1582
|
-
stamp: ImpactStamp | undefined;
|
|
1583
|
-
surface: ImpactScopeSurface;
|
|
1584
|
-
targetName: string;
|
|
1585
|
-
}) => ImpactScopeDecision;
|
|
1586
|
-
//#endregion
|
|
1587
|
-
//#region src/required-check-policy.d.ts
|
|
1588
|
-
declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
|
|
1589
|
-
type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
|
|
1590
|
-
declare const requiredCheckScopeSchema: z.ZodObject<{
|
|
1591
|
-
classifications: z.ZodArray<z.ZodEnum<{
|
|
1592
|
-
trivial: "trivial";
|
|
1593
|
-
"docs/process-only": "docs/process-only";
|
|
1594
|
-
"non-trivial": "non-trivial";
|
|
1595
|
-
}>>;
|
|
1596
|
-
}, z.core.$strict>;
|
|
1597
|
-
type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
|
|
1598
|
-
interface RequiredCheckScopeContext {
|
|
1599
|
-
classification: DiffClassification | undefined;
|
|
1600
|
-
impactStamp?: ImpactStamp;
|
|
1601
|
-
}
|
|
1602
|
-
interface ScopeDecision {
|
|
1603
|
-
inScope: boolean;
|
|
1604
|
-
reason: string;
|
|
1605
|
-
}
|
|
1606
|
-
declare const requiredCheckInScope: ({
|
|
1607
|
-
context,
|
|
1608
|
-
scope
|
|
1609
|
-
}: {
|
|
1610
|
-
context: RequiredCheckScopeContext;
|
|
1611
|
-
scope?: RequiredCheckScope;
|
|
1612
|
-
}) => ScopeDecision;
|
|
1613
|
-
interface RequiredCheck {
|
|
1598
|
+
interface PrVerifyNotDemandedRecord {
|
|
1599
|
+
basis: string;
|
|
1614
1600
|
name: string;
|
|
1615
|
-
checkType: EvidenceCheckType;
|
|
1616
|
-
scope?: RequiredCheckScope;
|
|
1617
1601
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
1638
|
-
headSha: z.ZodString;
|
|
1639
|
-
mergeBaseSha: z.ZodString;
|
|
1640
|
-
model: z.ZodOptional<z.ZodString>;
|
|
1641
|
-
outcome: z.ZodEnum<{
|
|
1642
|
-
pass: "pass";
|
|
1643
|
-
fail: "fail";
|
|
1644
|
-
}>;
|
|
1645
|
-
patchId: z.ZodString;
|
|
1646
|
-
policyVersion: z.ZodOptional<z.ZodString>;
|
|
1647
|
-
producer: z.ZodString;
|
|
1648
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
1649
|
-
rung: z.ZodOptional<z.ZodEnum<{
|
|
1650
|
-
oracle: "oracle";
|
|
1651
|
-
"independent-model": "independent-model";
|
|
1652
|
-
human: "human";
|
|
1653
|
-
}>>;
|
|
1654
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
1655
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
1656
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1657
|
-
}, z.core.$loose>;
|
|
1658
|
-
declare const evidenceEnvelopeSchema: z.ZodObject<{
|
|
1659
|
-
check: z.ZodString;
|
|
1660
|
-
checkType: z.ZodEnum<{
|
|
1661
|
-
review: "review";
|
|
1662
|
-
verify: "verify";
|
|
1663
|
-
}>;
|
|
1664
|
-
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
1665
|
-
headSha: z.ZodString;
|
|
1666
|
-
mergeBaseSha: z.ZodString;
|
|
1667
|
-
model: z.ZodOptional<z.ZodString>;
|
|
1668
|
-
outcome: z.ZodEnum<{
|
|
1669
|
-
pass: "pass";
|
|
1670
|
-
fail: "fail";
|
|
1671
|
-
}>;
|
|
1672
|
-
patchId: z.ZodString;
|
|
1673
|
-
policyVersion: z.ZodOptional<z.ZodString>;
|
|
1674
|
-
producer: z.ZodString;
|
|
1675
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
1676
|
-
rung: z.ZodOptional<z.ZodEnum<{
|
|
1677
|
-
oracle: "oracle";
|
|
1678
|
-
"independent-model": "independent-model";
|
|
1679
|
-
human: "human";
|
|
1680
|
-
}>>;
|
|
1681
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
1682
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
1683
|
-
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
1684
|
-
}, z.core.$loose>;
|
|
1685
|
-
type EvidenceEnvelope = z.infer<typeof evidenceEnvelopeBaseSchema>;
|
|
1686
|
-
type EvidenceEnvelopeParse = {
|
|
1687
|
-
ok: true;
|
|
1688
|
-
envelope: EvidenceEnvelope;
|
|
1689
|
-
} | {
|
|
1690
|
-
ok: false;
|
|
1691
|
-
error: string;
|
|
1692
|
-
};
|
|
1693
|
-
declare const parseEvidenceEnvelope: (raw: unknown) => EvidenceEnvelopeParse;
|
|
1694
|
-
interface EvidenceCandidateIdentity {
|
|
1602
|
+
interface PrVerifyProof {
|
|
1603
|
+
schemaVersion: PrVerifySchemaVersion;
|
|
1604
|
+
authoringSession?: string;
|
|
1605
|
+
base: string;
|
|
1606
|
+
baselineFullProofs?: {
|
|
1607
|
+
base: string;
|
|
1608
|
+
changedFiles: string[];
|
|
1609
|
+
headSha: string;
|
|
1610
|
+
profilePath: string;
|
|
1611
|
+
projectKey: string;
|
|
1612
|
+
repository: string;
|
|
1613
|
+
}[];
|
|
1614
|
+
changedFiles: string[];
|
|
1615
|
+
classification: DiffClassification;
|
|
1616
|
+
classificationReasons: string[];
|
|
1617
|
+
command: "patronage-factory pr:verify";
|
|
1618
|
+
durationMs: number;
|
|
1619
|
+
endedAt: string;
|
|
1620
|
+
executedCommands?: PrVerifyExecutedCommand[];
|
|
1695
1621
|
headSha: string;
|
|
1696
|
-
|
|
1697
|
-
|
|
1622
|
+
impactStamp?: ImpactStamp;
|
|
1623
|
+
mode: ResolvedPrVerifyMode;
|
|
1624
|
+
mergeBaseSha?: string;
|
|
1625
|
+
notDemandedRecords?: PrVerifyNotDemandedRecord[];
|
|
1626
|
+
notRequiredCommands?: PrVerifyNotRequiredCommand[];
|
|
1627
|
+
outcome?: "aborted" | "passed";
|
|
1628
|
+
patchId?: string;
|
|
1629
|
+
profilePath: string;
|
|
1630
|
+
projectKey: string;
|
|
1631
|
+
repository: string;
|
|
1632
|
+
startedAt: string;
|
|
1633
|
+
verificationCommands: PrVerifyCommandResult[];
|
|
1698
1634
|
}
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
candidate: EvidenceCandidateIdentity;
|
|
1704
|
-
envelope: EvidenceEnvelope;
|
|
1705
|
-
}) => boolean;
|
|
1706
|
-
interface IndependenceResult {
|
|
1707
|
-
independent: boolean;
|
|
1708
|
-
reason?: "no-session" | "unknown-authoring-identity" | "same-session";
|
|
1635
|
+
type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
|
|
1636
|
+
declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
|
|
1637
|
+
declare namespace verification_proof_d_exports {
|
|
1638
|
+
export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyNotDemandedRecord, PrVerifyNotRequiredCommand, PrVerifyProof, PrVerifySchemaVersion, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, trustedImpactStamp, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
|
|
1709
1639
|
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1640
|
+
interface VerifiedHeadShas {
|
|
1641
|
+
docsOnlyVerifiedHeadShas: string[];
|
|
1642
|
+
trivialVerifiedHeadShas: string[];
|
|
1643
|
+
verifiedHeadShas: string[];
|
|
1644
|
+
}
|
|
1645
|
+
type VerificationHeadShas = {
|
|
1646
|
+
explicitFailure: true;
|
|
1647
|
+
} | VerifiedHeadShas;
|
|
1648
|
+
declare function readPrVerifyProof(filePath: string): PrVerifyProof;
|
|
1649
|
+
declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
|
|
1650
|
+
declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
|
|
1651
|
+
declare const verifyProofIdentityMatches: ({
|
|
1652
|
+
currentIdentity,
|
|
1653
|
+
proof
|
|
1713
1654
|
}: {
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
path: string;
|
|
1721
|
-
} | {
|
|
1722
|
-
check?: string;
|
|
1723
|
-
error: string;
|
|
1724
|
-
ok: false;
|
|
1725
|
-
path: string;
|
|
1726
|
-
};
|
|
1655
|
+
currentIdentity?: {
|
|
1656
|
+
patchId: string;
|
|
1657
|
+
mergeBaseSha?: string;
|
|
1658
|
+
};
|
|
1659
|
+
proof?: PrVerifyProof;
|
|
1660
|
+
}) => boolean;
|
|
1727
1661
|
/**
|
|
1728
|
-
*
|
|
1729
|
-
*
|
|
1730
|
-
*
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1662
|
+
* Wave-2 consumption (#542): the recorded impact stamp, released for demand
|
|
1663
|
+
* resolution ONLY when it is identity-bound to the current candidate — the
|
|
1664
|
+
* proof passed, and its recorded headSha AND patchId both name exactly this
|
|
1665
|
+
* candidate (the same identities the proof already binds). Everything else —
|
|
1666
|
+
* no proof, an aborted run, a stale head, a moved patch id, a pre-stamp proof
|
|
1667
|
+
* — returns `undefined`, and the consumer keeps today's full-demand floor.
|
|
1733
1668
|
*
|
|
1734
|
-
*
|
|
1735
|
-
*
|
|
1736
|
-
*
|
|
1669
|
+
* Deliberately stricter than verify-once applicability (which tolerates a
|
|
1670
|
+
* head-only or patch-id-only match): a stamp narrows external demands, so it
|
|
1671
|
+
* is trusted only on an exact double binding, fail closed.
|
|
1737
1672
|
*/
|
|
1738
|
-
declare const
|
|
1673
|
+
declare const trustedImpactStamp: ({
|
|
1739
1674
|
candidate,
|
|
1740
|
-
|
|
1741
|
-
envelopes
|
|
1675
|
+
proof
|
|
1742
1676
|
}: {
|
|
1743
|
-
candidate:
|
|
1744
|
-
|
|
1745
|
-
|
|
1677
|
+
candidate: {
|
|
1678
|
+
headSha: string;
|
|
1679
|
+
patchId: string;
|
|
1680
|
+
};
|
|
1681
|
+
proof: PrVerifyProof | undefined;
|
|
1682
|
+
}) => ImpactStamp | undefined;
|
|
1683
|
+
declare const prVerifyFullHeadShasForDiff: ({
|
|
1684
|
+
docsOnlyDeltaAcceptedSince,
|
|
1685
|
+
files,
|
|
1686
|
+
proof
|
|
1687
|
+
}: {
|
|
1688
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
1689
|
+
files: string[];
|
|
1690
|
+
proof: PrVerifyProof;
|
|
1746
1691
|
}) => string[];
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
envelopes: LoadedEvidenceEnvelope[];
|
|
1751
|
-
requiredChecks: RequiredCheck[];
|
|
1752
|
-
scopeContext: RequiredCheckScopeContext;
|
|
1753
|
-
}
|
|
1754
|
-
interface RequiredCheckOutcome {
|
|
1755
|
-
name: string;
|
|
1756
|
-
checkType: EvidenceCheckType;
|
|
1757
|
-
status: "satisfied" | "unmet" | "out-of-scope";
|
|
1758
|
-
inScope: boolean;
|
|
1759
|
-
scopeReason: string;
|
|
1760
|
-
scope?: RequiredCheckScope;
|
|
1761
|
-
reason?: string;
|
|
1762
|
-
matchedPath?: string;
|
|
1763
|
-
}
|
|
1764
|
-
interface RequiredCheckEvaluation {
|
|
1765
|
-
outcomes: RequiredCheckOutcome[];
|
|
1766
|
-
blockingReasons: string[];
|
|
1767
|
-
}
|
|
1768
|
-
declare const evaluateRequiredChecks: ({
|
|
1769
|
-
authoringSessionIds,
|
|
1770
|
-
candidate,
|
|
1771
|
-
envelopes,
|
|
1772
|
-
requiredChecks,
|
|
1773
|
-
scopeContext
|
|
1774
|
-
}: RequiredCheckEvaluationInput) => RequiredCheckEvaluation;
|
|
1775
|
-
declare const EVIDENCE_DIR = ".factory-memory/evidence";
|
|
1776
|
-
declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
|
|
1777
|
-
//#endregion
|
|
1778
|
-
//#region src/review-proof-applicability.d.ts
|
|
1779
|
-
declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
|
|
1780
|
-
declare const reviewStatusSchema: z.ZodEnum<{
|
|
1781
|
-
"not-required": "not-required";
|
|
1782
|
-
blocked: "blocked";
|
|
1783
|
-
current: "current";
|
|
1784
|
-
stale: "stale";
|
|
1785
|
-
missing: "missing";
|
|
1786
|
-
}>;
|
|
1787
|
-
type ReviewStatus = z.infer<typeof reviewStatusSchema>;
|
|
1788
|
-
interface CurrentReviewIdentity {
|
|
1789
|
-
headSha: string;
|
|
1790
|
-
patchId: string;
|
|
1791
|
-
}
|
|
1792
|
-
declare const reviewStatus: ({
|
|
1793
|
-
blocked,
|
|
1794
|
-
required,
|
|
1795
|
-
reviewedHeadSha,
|
|
1796
|
-
reviewedPatchId,
|
|
1797
|
-
headSha,
|
|
1798
|
-
patchId
|
|
1799
|
-
}: CurrentReviewIdentity & {
|
|
1800
|
-
blocked?: boolean;
|
|
1801
|
-
required: boolean;
|
|
1802
|
-
reviewedHeadSha?: string;
|
|
1803
|
-
reviewedPatchId?: string;
|
|
1804
|
-
}) => ReviewStatus;
|
|
1805
|
-
declare namespace proof_identity_d_exports {
|
|
1806
|
-
export { CurrentReviewIdentity, REVIEW_STATUS_VALUES, ReviewProofClaim, ReviewStatus, explicitFailureIdentity, isExplicitReviewFailure, isUntypedReviewProof, reviewStatus, reviewStatusSchema, selectReviewProof };
|
|
1807
|
-
}
|
|
1808
|
-
type ReviewProofClaim = {
|
|
1809
|
-
reviewedHeadSha?: string;
|
|
1810
|
-
reviewedPatchId?: string;
|
|
1811
|
-
untypedVerdict?: boolean;
|
|
1692
|
+
type VerificationProofState = {
|
|
1693
|
+
kind: "typed-aborted";
|
|
1694
|
+
proof: PrVerifyProof;
|
|
1812
1695
|
} | {
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
declare const isUntypedReviewProof: (proof: ReviewProofClaim) => proof is {
|
|
1825
|
-
untypedVerdict: true;
|
|
1826
|
-
reviewedHeadSha?: string;
|
|
1827
|
-
reviewedPatchId?: string;
|
|
1828
|
-
};
|
|
1829
|
-
declare const explicitFailureIdentity: (proof: ReviewProofClaim) => {
|
|
1830
|
-
reviewedHeadSha?: string;
|
|
1831
|
-
reviewedPatchId?: string;
|
|
1696
|
+
kind: "typed-missing";
|
|
1697
|
+
path: string;
|
|
1698
|
+
reason: "enoent" | "invalid";
|
|
1699
|
+
message?: string;
|
|
1700
|
+
} | {
|
|
1701
|
+
kind: "typed";
|
|
1702
|
+
headShas: VerifiedHeadShas;
|
|
1703
|
+
proof: PrVerifyProof;
|
|
1704
|
+
} | {
|
|
1705
|
+
kind: "typed-diff-mismatch";
|
|
1706
|
+
mode: ResolvedPrVerifyMode;
|
|
1832
1707
|
};
|
|
1833
|
-
declare const
|
|
1834
|
-
|
|
1708
|
+
declare const verificationProofStateFor: ({
|
|
1709
|
+
proof,
|
|
1710
|
+
proofMatchesCurrentDiff,
|
|
1711
|
+
proofPath
|
|
1835
1712
|
}: {
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
autoBlockingFindings: number;
|
|
1846
|
-
countsBySeverity: Record<ReviewFindingSeverity, number>;
|
|
1847
|
-
highestBlockingSeverity?: ReviewFindingSeverity;
|
|
1848
|
-
highestOpenSeverity?: ReviewFindingSeverity;
|
|
1849
|
-
maxReviewCycles?: number;
|
|
1850
|
-
nonBlockingFindings: number;
|
|
1851
|
-
openFindings: number;
|
|
1852
|
-
reviewCycle?: number;
|
|
1853
|
-
staleRepeatFindings?: number;
|
|
1854
|
-
windowExhausted: boolean;
|
|
1855
|
-
}
|
|
1856
|
-
declare const reviewCycleStateFor: (proof: Pick<PrReviewProof, "ladder" | "reviewCycle" | "maxReviewCycles" | "reviews">, policy?: ReviewLadderPolicy, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewCycleState;
|
|
1857
|
-
type ReviewAcceptance = "accepted-after-cap" | "accepted-clean" | "accepted-through-ladder" | "blocked";
|
|
1858
|
-
declare const resolveReviewAcceptance: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewAcceptance;
|
|
1859
|
-
type ReviewTerminalState = "accepted-with-findings" | "blocked" | "clean";
|
|
1860
|
-
declare const resolveReviewTerminalStateForEpoch: (proof: PrReviewProof, review: PrReviewResult, epoch: ReviewEpochMode, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewTerminalState;
|
|
1861
|
-
declare const resolveReviewTerminalState: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewTerminalState;
|
|
1862
|
-
declare const resolveReviewTerminalStateAcrossReviews: (proof: PrReviewProof, epoch: ReviewEpochMode, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewTerminalState | undefined;
|
|
1863
|
-
declare const resolveReviewTerminalStateAcrossReviewsForPolicy: (proof: PrReviewProof, policy: ReviewLadderPolicy) => ReviewTerminalState | undefined;
|
|
1864
|
-
declare const reviewProofFor: (proof: PrReviewProof | undefined, kind: PrReviewKind, policy: ReviewLadderPolicy | undefined, current?: {
|
|
1865
|
-
patchId: string;
|
|
1866
|
-
}) => ReviewProofClaim;
|
|
1867
|
-
declare namespace review_proof_d_exports {
|
|
1868
|
-
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, readPrReviewProof, resolveReviewAcceptance, resolveReviewTerminalState, resolveReviewTerminalStateAcrossReviews, resolveReviewTerminalStateAcrossReviewsForPolicy, resolveReviewTerminalStateForEpoch, reviewCycleStateFor, reviewProofFor, validatePrReviewProof, validatePrReviewResult };
|
|
1869
|
-
}
|
|
1870
|
-
declare const PR_REVIEW_SCHEMA_VERSION = 2;
|
|
1871
|
-
declare const PR_REVIEW_FINDING_PROVENANCE_VERSION = 1;
|
|
1872
|
-
declare const DEFAULT_PR_REVIEW_PROOF_PATH = ".factory-memory/pr-review.json";
|
|
1873
|
-
declare const DEFAULT_PR_REVIEW_MAX_CYCLES = 5;
|
|
1874
|
-
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.";
|
|
1875
|
-
declare const prReviewFindingSchema: z.ZodType<PrReviewFinding>;
|
|
1876
|
-
declare const prReviewResultSchema: z.ZodType<PrReviewResult>;
|
|
1877
|
-
declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
|
|
1878
|
-
declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
|
|
1879
|
-
declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
|
|
1880
|
-
declare const readPrReviewProof: (filePath: string) => PrReviewProof;
|
|
1881
|
-
declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
|
|
1882
|
-
declare namespace verification_proof_d_exports {
|
|
1883
|
-
export { PrVerifyBaselineFullProof, PrVerifyCommandResult, PrVerifyExecutedCommand, PrVerifyNotRequiredCommand, PrVerifyProof, PrVerifySchemaVersion, ResolvedPrVerifyMode, SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS, VerificationHeadShas, VerificationProofState, VerifiedHeadShas, prVerifyFullHeadShasForDiff, prVerifyProofHeadShas, readPrVerifyProof, resolveVerifyProofApplicability, trustedImpactStamp, validatePrVerifyProof, verificationProofApplicabilityFor, verificationProofBlockingReason, verificationProofForReadiness, verificationProofStateFor, verifyProofIdentityMatches, verifyProofPassed };
|
|
1884
|
-
}
|
|
1885
|
-
interface VerifiedHeadShas {
|
|
1886
|
-
docsOnlyVerifiedHeadShas: string[];
|
|
1887
|
-
trivialVerifiedHeadShas: string[];
|
|
1888
|
-
verifiedHeadShas: string[];
|
|
1889
|
-
}
|
|
1890
|
-
type VerificationHeadShas = {
|
|
1891
|
-
explicitFailure: true;
|
|
1892
|
-
} | VerifiedHeadShas;
|
|
1893
|
-
declare const SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS: readonly [1, 2, 3, 4];
|
|
1894
|
-
type PrVerifySchemaVersion = (typeof SUPPORTED_PR_VERIFY_SCHEMA_VERSIONS)[number];
|
|
1895
|
-
interface PrVerifyCommandResult {
|
|
1896
|
-
command: string;
|
|
1897
|
-
description: string;
|
|
1898
|
-
/**
|
|
1899
|
-
* Epic #550 wave 3 (#430): the profile's declared impact target for this
|
|
1900
|
-
* command, recorded from v4 on. It is the proof's own command→target
|
|
1901
|
-
* mapping: a `notRequiredCommands` entry must name the target recorded HERE
|
|
1902
|
-
* for the same command, so a withholding cannot point at whichever released
|
|
1903
|
-
* target happens to be convenient. Absent for a command the profile does
|
|
1904
|
-
* not scope, and for v1–v3 proofs, which predate the field.
|
|
1905
|
-
*/
|
|
1906
|
-
impactTarget?: string;
|
|
1907
|
-
name: string;
|
|
1908
|
-
scope: "always" | "docs-only" | "trivial" | "full";
|
|
1909
|
-
}
|
|
1910
|
-
interface PrVerifyExecutedCommand {
|
|
1911
|
-
command: string;
|
|
1912
|
-
counts?: {
|
|
1913
|
-
testFiles?: number;
|
|
1914
|
-
tests?: number;
|
|
1915
|
-
};
|
|
1916
|
-
durationMs: number;
|
|
1917
|
-
exitCode: number;
|
|
1918
|
-
name: string;
|
|
1919
|
-
scope: "always" | "docs-only" | "trivial" | "full";
|
|
1920
|
-
}
|
|
1921
|
-
/**
|
|
1922
|
-
* Epic #550 wave 3 (#430): a verification command the impact stamp proved this
|
|
1923
|
-
* candidate cannot reach, so the battery did not run it.
|
|
1924
|
-
*
|
|
1925
|
-
* The completeness invariant lives in the pairing: `verificationCommands`
|
|
1926
|
-
* records every command the resolved mode selected, `executedCommands` records
|
|
1927
|
-
* what ran, and this list records the rest WITH the stamp's own basis. A
|
|
1928
|
-
* withheld stack is therefore never silently absent from the proof — it is
|
|
1929
|
-
* present, named, and explained.
|
|
1930
|
-
*/
|
|
1931
|
-
interface PrVerifyNotRequiredCommand {
|
|
1932
|
-
basis: string;
|
|
1933
|
-
impactTarget: string;
|
|
1934
|
-
name: string;
|
|
1935
|
-
}
|
|
1936
|
-
interface PrVerifyProof {
|
|
1937
|
-
schemaVersion: PrVerifySchemaVersion;
|
|
1938
|
-
authoringSession?: string;
|
|
1939
|
-
base: string;
|
|
1940
|
-
baselineFullProofs?: {
|
|
1941
|
-
base: string;
|
|
1942
|
-
changedFiles: string[];
|
|
1943
|
-
headSha: string;
|
|
1944
|
-
profilePath: string;
|
|
1945
|
-
projectKey: string;
|
|
1946
|
-
repository: string;
|
|
1947
|
-
}[];
|
|
1948
|
-
changedFiles: string[];
|
|
1949
|
-
classification: DiffClassification;
|
|
1950
|
-
classificationReasons: string[];
|
|
1951
|
-
command: "patronage-factory pr:verify";
|
|
1952
|
-
durationMs: number;
|
|
1953
|
-
endedAt: string;
|
|
1954
|
-
executedCommands?: PrVerifyExecutedCommand[];
|
|
1955
|
-
headSha: string;
|
|
1956
|
-
impactStamp?: ImpactStamp;
|
|
1957
|
-
mode: ResolvedPrVerifyMode;
|
|
1958
|
-
mergeBaseSha?: string;
|
|
1959
|
-
notRequiredCommands?: PrVerifyNotRequiredCommand[];
|
|
1960
|
-
outcome?: "aborted" | "passed";
|
|
1961
|
-
patchId?: string;
|
|
1962
|
-
profilePath: string;
|
|
1963
|
-
projectKey: string;
|
|
1964
|
-
repository: string;
|
|
1965
|
-
startedAt: string;
|
|
1966
|
-
verificationCommands: PrVerifyCommandResult[];
|
|
1967
|
-
}
|
|
1968
|
-
type PrVerifyBaselineFullProof = NonNullable<PrVerifyProof["baselineFullProofs"]>[number];
|
|
1969
|
-
declare function validatePrVerifyProof(value: unknown): PrVerifyProof;
|
|
1970
|
-
declare function readPrVerifyProof(filePath: string): PrVerifyProof;
|
|
1971
|
-
declare const verifyProofPassed: (proof: PrVerifyProof) => boolean;
|
|
1972
|
-
declare const prVerifyProofHeadShas: (proof: PrVerifyProof | undefined, creditedHeadSha?: string) => VerifiedHeadShas;
|
|
1973
|
-
declare const verifyProofIdentityMatches: ({
|
|
1713
|
+
proof?: PrVerifyProof;
|
|
1714
|
+
proofMatchesCurrentDiff?: boolean;
|
|
1715
|
+
proofPath?: string;
|
|
1716
|
+
}) => VerificationProofState;
|
|
1717
|
+
declare const verificationProofApplicabilityFor: ({
|
|
1718
|
+
docsOnlyDeltaAcceptedSince,
|
|
1719
|
+
explicitProof,
|
|
1720
|
+
files,
|
|
1721
|
+
headSha,
|
|
1974
1722
|
currentIdentity,
|
|
1975
|
-
proof
|
|
1723
|
+
proof,
|
|
1724
|
+
proofPath,
|
|
1725
|
+
proofReadError
|
|
1976
1726
|
}: {
|
|
1727
|
+
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
1728
|
+
explicitProof: boolean;
|
|
1729
|
+
files: string[];
|
|
1730
|
+
headSha: string;
|
|
1977
1731
|
currentIdentity?: {
|
|
1978
1732
|
patchId: string;
|
|
1979
1733
|
mergeBaseSha?: string;
|
|
1980
1734
|
};
|
|
1981
1735
|
proof?: PrVerifyProof;
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
* is trusted only on an exact double binding, fail closed.
|
|
1994
|
-
*/
|
|
1995
|
-
declare const trustedImpactStamp: ({
|
|
1996
|
-
candidate,
|
|
1997
|
-
proof
|
|
1998
|
-
}: {
|
|
1999
|
-
candidate: {
|
|
2000
|
-
headSha: string;
|
|
2001
|
-
patchId: string;
|
|
1736
|
+
proofPath?: string;
|
|
1737
|
+
proofReadError?: unknown;
|
|
1738
|
+
}) => {
|
|
1739
|
+
fullVerifiedHeadShas: never[];
|
|
1740
|
+
verificationProof: VerificationProofState;
|
|
1741
|
+
} | {
|
|
1742
|
+
fullVerifiedHeadShas: string[];
|
|
1743
|
+
verificationProof: {
|
|
1744
|
+
headShas: VerifiedHeadShas;
|
|
1745
|
+
kind: "typed";
|
|
1746
|
+
proof: PrVerifyProof;
|
|
2002
1747
|
};
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
1748
|
+
};
|
|
1749
|
+
declare const resolveVerifyProofApplicability: ({
|
|
1750
|
+
proofPath,
|
|
1751
|
+
explicitProof,
|
|
2006
1752
|
docsOnlyDeltaAcceptedSince,
|
|
2007
1753
|
files,
|
|
2008
|
-
|
|
1754
|
+
headSha,
|
|
1755
|
+
currentVerifyIdentityForBase,
|
|
1756
|
+
preread
|
|
2009
1757
|
}: {
|
|
1758
|
+
proofPath: string;
|
|
1759
|
+
explicitProof: boolean;
|
|
2010
1760
|
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2011
1761
|
files: string[];
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
1762
|
+
headSha: string;
|
|
1763
|
+
currentVerifyIdentityForBase?: (base: string) => {
|
|
1764
|
+
patchId: string;
|
|
1765
|
+
mergeBaseSha?: string;
|
|
1766
|
+
};
|
|
1767
|
+
preread?: {
|
|
1768
|
+
proof?: PrVerifyProof;
|
|
1769
|
+
error?: unknown;
|
|
1770
|
+
};
|
|
1771
|
+
}) => {
|
|
1772
|
+
fullVerifiedHeadShas: never[];
|
|
1773
|
+
verificationProof: VerificationProofState;
|
|
2022
1774
|
} | {
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
1775
|
+
fullVerifiedHeadShas: string[];
|
|
1776
|
+
verificationProof: {
|
|
1777
|
+
headShas: VerifiedHeadShas;
|
|
1778
|
+
kind: "typed";
|
|
1779
|
+
proof: PrVerifyProof;
|
|
1780
|
+
};
|
|
1781
|
+
};
|
|
1782
|
+
declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
|
|
1783
|
+
declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
|
|
1784
|
+
//#endregion
|
|
1785
|
+
//#region src/preview-lifecycle.d.ts
|
|
1786
|
+
type PreviewDisposition = "deploy" | "not-required";
|
|
1787
|
+
interface PreviewTargetPlan {
|
|
1788
|
+
basis: string;
|
|
1789
|
+
disposition: PreviewDisposition;
|
|
1790
|
+
name: string;
|
|
1791
|
+
}
|
|
1792
|
+
interface PreviewLifecyclePlan {
|
|
1793
|
+
/** The declared preview stacks to deploy, in declaration order. */
|
|
1794
|
+
deploy: string[];
|
|
1795
|
+
/** The withheld stacks, in declaration order. */
|
|
1796
|
+
notRequired: PreviewTargetPlan[];
|
|
1797
|
+
/** Whether a trusted, identity-bound stamp was available at all. */
|
|
1798
|
+
stampTrusted: boolean;
|
|
1799
|
+
/** Every declared preview target with its disposition, in declaration order. */
|
|
1800
|
+
targets: PreviewTargetPlan[];
|
|
1801
|
+
}
|
|
1802
|
+
/** Validate a serialized plan without deriving or changing its dispositions. */
|
|
1803
|
+
declare const validatePreviewLifecyclePlan: (value: unknown) => PreviewLifecyclePlan;
|
|
1804
|
+
/**
|
|
1805
|
+
* Structural subset of the profile: the impact declarations plus the external
|
|
1806
|
+
* demand list. Structural rather than a `Pick` so this module does not import
|
|
1807
|
+
* `profile.ts`.
|
|
1808
|
+
*/
|
|
1809
|
+
interface PreviewLifecycleProfile {
|
|
1810
|
+
impact?: {
|
|
1811
|
+
targets: {
|
|
1812
|
+
name: string;
|
|
1813
|
+
}[];
|
|
1814
|
+
};
|
|
1815
|
+
requiredChecks?: {
|
|
1816
|
+
name: string;
|
|
1817
|
+
}[];
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* The declared preview stacks: impact targets that are ALSO declared required
|
|
1821
|
+
* checks — i.e. targets whose proof is produced externally, which is exactly
|
|
1822
|
+
* what a preview producer is.
|
|
1823
|
+
*
|
|
1824
|
+
* Deriving the list from the two existing declarations rather than adding a
|
|
1825
|
+
* third is what makes lifecycle and demand unable to disagree: the stacks this
|
|
1826
|
+
* plan can withhold are precisely the demands wave 2 can release, so a stack
|
|
1827
|
+
* can never be skipped while its proof stays demanded.
|
|
1828
|
+
*/
|
|
1829
|
+
declare const previewLifecycleTargets: (profile: PreviewLifecycleProfile) => string[];
|
|
1830
|
+
/**
|
|
1831
|
+
* Plan the preview lifecycle for one candidate.
|
|
1832
|
+
*
|
|
1833
|
+
* Trust is resolved here through the SAME identity gate demand release uses
|
|
1834
|
+
* (`trustedImpactStamp`): the proof must have passed and must bind both the
|
|
1835
|
+
* candidate's headSha and its patchId. A stale, aborted, absent, or
|
|
1836
|
+
* differently-bound proof yields no stamp, and every declared stack is planned
|
|
1837
|
+
* for deploy. Total over its INPUTS — no proof, stamp, or profile can make it
|
|
1838
|
+
* throw. A malformed CALL is the deliberate exception: omitting
|
|
1839
|
+
* `vetoedTargets` is API misuse, not data doubt, and throws.
|
|
1840
|
+
*/
|
|
1841
|
+
declare const planPreviewLifecycle: ({
|
|
1842
|
+
candidate,
|
|
1843
|
+
profile,
|
|
1844
|
+
proof,
|
|
1845
|
+
vetoedTargets
|
|
1846
|
+
}: {
|
|
1847
|
+
candidate: {
|
|
1848
|
+
headSha: string;
|
|
1849
|
+
patchId: string;
|
|
1850
|
+
};
|
|
1851
|
+
profile: PreviewLifecycleProfile;
|
|
1852
|
+
proof: PrVerifyProof | undefined;
|
|
1853
|
+
/**
|
|
1854
|
+
* Stack names with a current, candidate-bound FAILING envelope. Scoping is
|
|
1855
|
+
* withheld for these whatever the stamp says — the same veto demand release
|
|
1856
|
+
* applies, and for the same reason: a withheld stack is a stack that can
|
|
1857
|
+
* never re-emit the envelope its standing demand needs. Callers hold the
|
|
1858
|
+
* checkout context, so they resolve the set with `boundFailingCheckNames`
|
|
1859
|
+
* and pass it in; this module stays pure.
|
|
1860
|
+
*
|
|
1861
|
+
* REQUIRED, with no default, on purpose: a defaulted `[]` reads the same
|
|
1862
|
+
* whether the caller inspected the envelopes or never looked, and this seam
|
|
1863
|
+
* exists precisely for EXTERNAL preview producers — the callers most likely
|
|
1864
|
+
* to skip the lookup. Pass the result of `boundFailingCheckNames`; pass `[]`
|
|
1865
|
+
* only to mean "inspected the envelopes and found no bound failure".
|
|
1866
|
+
*
|
|
1867
|
+
* Deliberately visible to `api:check` as a breaking signature change
|
|
1868
|
+
* (pre-1.0, no external callers yet).
|
|
1869
|
+
*/
|
|
1870
|
+
vetoedTargets: readonly string[];
|
|
1871
|
+
}) => PreviewLifecyclePlan;
|
|
1872
|
+
//#endregion
|
|
1873
|
+
//#region src/pr-status-hud.d.ts
|
|
1874
|
+
type FactoryPrStatusCheckName = "patronage-factory/merge-freeze" | "patronage-factory/pr-ready" | "patronage-factory/pr-verify";
|
|
1875
|
+
interface CompletedFactoryCheckSnapshot {
|
|
1876
|
+
readonly completedAt: string;
|
|
1877
|
+
readonly conclusion: string;
|
|
1878
|
+
readonly detailsUrl?: string;
|
|
1879
|
+
readonly headSha: string;
|
|
1880
|
+
readonly name: FactoryPrStatusCheckName;
|
|
1881
|
+
}
|
|
1882
|
+
interface FailedPreviewSnapshot {
|
|
1883
|
+
readonly completedAt: string;
|
|
1884
|
+
readonly conclusion: string;
|
|
1885
|
+
readonly detailsUrl?: string;
|
|
1886
|
+
readonly headSha: string;
|
|
1887
|
+
readonly name: string;
|
|
1888
|
+
}
|
|
1889
|
+
interface FactoryPrStatusSources {
|
|
1890
|
+
readonly baseSha: string;
|
|
1891
|
+
readonly checks: Readonly<Partial<Record<FactoryPrStatusCheckName, CompletedFactoryCheckSnapshot>>>;
|
|
1892
|
+
readonly previewFailures?: Readonly<Partial<Record<string, FailedPreviewSnapshot>>>;
|
|
1893
|
+
readonly previewRegistrations: readonly PreviewProofRegistration[];
|
|
1894
|
+
}
|
|
1895
|
+
interface RenderFactoryPrStatusHudInput extends FactoryPrStatusSources {
|
|
1896
|
+
readonly headSha: string;
|
|
1897
|
+
readonly plan: PreviewLifecyclePlan;
|
|
1898
|
+
readonly planHeadSha: string;
|
|
1899
|
+
readonly pr: number;
|
|
1900
|
+
/** ISO instant at which the presentation sources were observed. */
|
|
1901
|
+
readonly renderedAt: string;
|
|
1902
|
+
}
|
|
1903
|
+
interface PresentFactoryPrStatusHudInput {
|
|
1904
|
+
readonly headSha: string;
|
|
1905
|
+
readonly owner: string;
|
|
1906
|
+
readonly plan: PreviewLifecyclePlan;
|
|
1907
|
+
readonly planHeadSha: string;
|
|
1908
|
+
readonly pr: number;
|
|
1909
|
+
readonly renderedAt?: string;
|
|
1910
|
+
readonly repo: string;
|
|
1911
|
+
}
|
|
1912
|
+
interface PresentFactoryPrStatusHudDependencies {
|
|
1913
|
+
/**
|
|
1914
|
+
* Read only `previewProofInventory.list` registrations and completed,
|
|
1915
|
+
* Factory-App-owned check snapshots. PR comment bodies are not an evidence
|
|
1916
|
+
* source and are deliberately absent from this contract.
|
|
1917
|
+
*/
|
|
1918
|
+
readonly readSources: (input: {
|
|
1919
|
+
headSha: string;
|
|
1920
|
+
owner: string;
|
|
1921
|
+
pr: number;
|
|
1922
|
+
previewTargets?: readonly string[];
|
|
1923
|
+
repo: string;
|
|
1924
|
+
}) => Promise<FactoryPrStatusSources>;
|
|
1925
|
+
/** Recheck both PR endpoints immediately before mutating the sticky HUD. */
|
|
1926
|
+
readonly assertCurrentIdentity: (input: {
|
|
1927
|
+
baseSha: string;
|
|
1928
|
+
headSha: string;
|
|
1929
|
+
owner: string;
|
|
1930
|
+
pr: number;
|
|
1931
|
+
repo: string;
|
|
1932
|
+
}) => Promise<void>;
|
|
1933
|
+
readonly upsert?: typeof upsertFactoryPrStatusComment;
|
|
1934
|
+
}
|
|
1935
|
+
interface ReadFactoryPrStatusSourcesInput {
|
|
1936
|
+
readonly headSha: string;
|
|
1937
|
+
/**
|
|
1938
|
+
* Read token for `previewProofInventory.list`. The list walks the
|
|
1939
|
+
* force-push timeline, which needs commit (contents) read; the Factory App
|
|
1940
|
+
* token has no contents permission, so pass a workflow `GITHUB_TOKEN`
|
|
1941
|
+
* (#825). Falls back to `token`.
|
|
1942
|
+
*/
|
|
1943
|
+
readonly inventoryToken?: string;
|
|
1944
|
+
readonly owner: string;
|
|
1945
|
+
readonly pr: number;
|
|
1946
|
+
/**
|
|
1947
|
+
* Demanded preview stack names from the lifecycle plan. Used only to look up
|
|
1948
|
+
* a completed unsuccessful check run when inventory has no registration.
|
|
1949
|
+
*/
|
|
1950
|
+
readonly previewTargets?: readonly string[];
|
|
1951
|
+
readonly repo: string;
|
|
1952
|
+
/** Factory App installation token, normally minted by the presentation job. */
|
|
1953
|
+
readonly token: string;
|
|
1954
|
+
}
|
|
1955
|
+
interface ReadFactoryPrStatusSourcesDependencies {
|
|
1956
|
+
readonly fetch?: typeof fetch;
|
|
1957
|
+
readonly listPreviewRegistrations?: (input: {
|
|
1958
|
+
owner: string;
|
|
1959
|
+
pr: number;
|
|
1960
|
+
repo: string;
|
|
1961
|
+
token: string;
|
|
1962
|
+
}) => Promise<readonly PreviewProofRegistration[]>;
|
|
1963
|
+
readonly timeoutMs?: number;
|
|
1964
|
+
}
|
|
1965
|
+
declare function renderFactoryPrStatusHud(input: RenderFactoryPrStatusHudInput): string;
|
|
1966
|
+
declare function presentFactoryPrStatusHud(input: PresentFactoryPrStatusHudInput, dependencies: PresentFactoryPrStatusHudDependencies): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
1967
|
+
declare function assertFactoryPrStatusIdentity(input: ReadFactoryPrStatusSourcesInput & {
|
|
1968
|
+
readonly baseSha: string;
|
|
1969
|
+
}, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<void>;
|
|
1970
|
+
declare function readFactoryPrStatusSources(input: ReadFactoryPrStatusSourcesInput, dependencies?: ReadFactoryPrStatusSourcesDependencies): Promise<FactoryPrStatusSources>;
|
|
1971
|
+
interface PlanFactoryPrStatusHudInput {
|
|
1972
|
+
readonly cwd: string;
|
|
1973
|
+
readonly headSha: string;
|
|
1974
|
+
readonly mergeBaseSha?: string;
|
|
1975
|
+
readonly patchId?: string;
|
|
1976
|
+
readonly profilePath?: string;
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Consume `planPreviewLifecycle` for the current checkout. No second plan is
|
|
1980
|
+
* invented: dispositions are Ready/Skipped from `deploy` vs `not-required`.
|
|
1981
|
+
* Candidate identity is never copied from the proof. Absent independent
|
|
1982
|
+
* identity or an unbound verify proof is the planner's conservative path.
|
|
1983
|
+
*/
|
|
1984
|
+
declare function planFactoryPrStatusHud(input: PlanFactoryPrStatusHudInput): PreviewLifecyclePlan;
|
|
1985
|
+
interface RefreshFactoryPrStatusHudInput {
|
|
1986
|
+
readonly cwd: string;
|
|
1987
|
+
readonly headSha: string;
|
|
1988
|
+
readonly mergeBaseSha?: string;
|
|
1989
|
+
readonly owner: string;
|
|
1990
|
+
readonly patchId?: string;
|
|
1991
|
+
readonly pr: number;
|
|
1992
|
+
readonly profilePath?: string;
|
|
1993
|
+
readonly repo: string;
|
|
1994
|
+
readonly token?: string;
|
|
1995
|
+
}
|
|
1996
|
+
/** Plan from the checkout and present the App-owned HUD. */
|
|
1997
|
+
declare function refreshFactoryPrStatusHud(input: RefreshFactoryPrStatusHudInput): Promise<UpsertFactoryPrStatusCommentResult>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Presentation must not fail an admission gate. Used after pr:ready publishes
|
|
2000
|
+
* its check so the table is not stuck at first-write.
|
|
2001
|
+
*/
|
|
2002
|
+
declare function refreshFactoryPrStatusHudSafely(input: RefreshFactoryPrStatusHudInput, onNotice?: (message: string) => void): Promise<void>;
|
|
2003
|
+
//#endregion
|
|
2004
|
+
//#region src/pr-ready.d.ts
|
|
2005
|
+
interface PrReadyArgs extends LoadProjectProfileInput {
|
|
2006
|
+
authoringSessionIds?: string[];
|
|
2007
|
+
base: string;
|
|
2008
|
+
epic?: number;
|
|
2009
|
+
json?: boolean;
|
|
2010
|
+
output?: string;
|
|
2011
|
+
report?: boolean;
|
|
2012
|
+
pr: number;
|
|
2013
|
+
reviewProof?: string;
|
|
2014
|
+
throwWhenBlocked?: boolean;
|
|
2015
|
+
verifyProof?: string;
|
|
2016
|
+
}
|
|
2017
|
+
interface GitHubPullRequest {
|
|
2018
|
+
/**
|
|
2019
|
+
* GitHub's live auto-merge enablement, or `null` when nothing is scheduled.
|
|
2020
|
+
*
|
|
2021
|
+
* Required, not optional (#515 review). `gh pr view --json autoMergeRequest`
|
|
2022
|
+
* always returns the key — explicitly `null` when nothing is scheduled — and
|
|
2023
|
+
* errors loudly on a field name it does not know, so there is no shape where
|
|
2024
|
+
* the real CLI omits it. But `fetchPullRequest` is injectable, and an
|
|
2025
|
+
* implementation that left the field out would silently disable the
|
|
2026
|
+
* `boundary-wave` refusal that stops an epicless run from greening a
|
|
2027
|
+
* candidate GitHub is already scheduled to merge. Requiring it makes the
|
|
2028
|
+
* compiler enforce what `gh` already promises.
|
|
2029
|
+
*/
|
|
2030
|
+
autoMergeRequest: {
|
|
2031
|
+
enabledAt?: string;
|
|
2032
|
+
} | null;
|
|
2033
|
+
baseRefName: string;
|
|
2034
|
+
baseRefOid: string;
|
|
2035
|
+
body: string;
|
|
2036
|
+
headRefName?: string;
|
|
2037
|
+
headRefOid: string;
|
|
2038
|
+
isDraft: boolean;
|
|
2039
|
+
mergeStateStatus: string;
|
|
2040
|
+
mergeable: string;
|
|
2041
|
+
number: number;
|
|
2042
|
+
reviewDecision: string | null;
|
|
2043
|
+
statusCheckRollup?: StatusCheckRollup[];
|
|
2044
|
+
title: string;
|
|
2045
|
+
unresolvedReviewThreads: number;
|
|
2046
|
+
url: string;
|
|
2047
|
+
}
|
|
2048
|
+
interface PrReadyProof {
|
|
2049
|
+
schemaVersion: 3;
|
|
2050
|
+
/**
|
|
2051
|
+
* What GitHub actually did when this run armed native auto-merge (#477).
|
|
2052
|
+
* Present exactly when a ready wave authorizes machine merge and arming ran;
|
|
2053
|
+
* read back from the PR rather than inferred from the invocation, because `gh pr merge
|
|
2054
|
+
* --auto` arms, merges, or does nothing with the same exit code and the same
|
|
2055
|
+
* empty output. `not-armed` means the candidate is admitted but nothing will
|
|
2056
|
+
* merge it, and `followUp` carries the re-dispatch.
|
|
2057
|
+
*/
|
|
2058
|
+
arming?: {
|
|
2059
|
+
detail?: string;
|
|
2060
|
+
headSha: string;
|
|
2061
|
+
outcome: "armed" | "merged" | "not-armed";
|
|
2062
|
+
};
|
|
2063
|
+
/**
|
|
2064
|
+
* Why this run blocked, one entry per refusing demand (#391): `code` is the
|
|
2065
|
+
* demand key from the resolver's vocabulary, `detail` the one-sentence
|
|
2066
|
+
* refusal. Same refusals as `blockingReasons`, in the same order — the
|
|
2067
|
+
* analyzable projection of a flat string list, so a wall of blocked proofs
|
|
2068
|
+
* on one PR can be counted by cause. Absent when nothing blocked.
|
|
2069
|
+
*/
|
|
2070
|
+
blockedReasons?: BlockedReason[];
|
|
2071
|
+
blockingReasons: string[];
|
|
2072
|
+
humanBlockingReasons: string[];
|
|
2073
|
+
command: "patronage-factory pr:ready";
|
|
2074
|
+
/**
|
|
2075
|
+
* Machine-safe arg array for the obvious next action (#523): when `ready`
|
|
2076
|
+
* but arming did not take effect, a `pr:ready` re-dispatch (idempotent on
|
|
2077
|
+
* an unchanged head); otherwise the `gh pr ready` undraft repair or the
|
|
2078
|
+
* `pr:verify` re-run that the blocking reasons name (re-verify the head,
|
|
2079
|
+
* then re-run pr:ready). Same `argv` shape `factory:delegate --print`
|
|
2080
|
+
* emits. Optional and purely additive.
|
|
2081
|
+
*/
|
|
2082
|
+
followUp?: FollowUpAction;
|
|
2083
|
+
/**
|
|
2084
|
+
* `ledger.headSha` is the evaluated head SHA: the GitHub `pr.headRefOid`
|
|
2085
|
+
* captured at evaluation time (not a local git read), recorded explicitly
|
|
2086
|
+
* so merge-time identity checks are a pure comparison against the live
|
|
2087
|
+
* pushed HEAD, not a re-derivation. See the ledger schema.
|
|
2088
|
+
*/
|
|
2089
|
+
ledger: ManagedReadinessLedger;
|
|
2090
|
+
/**
|
|
2091
|
+
* Actionable facts that did not block (#477): a settling merge-freeze
|
|
2092
|
+
* generation that permitted readiness and any authorized arming with a
|
|
2093
|
+
* notice, an admitted-but-unscheduled false boundary wave, and how each
|
|
2094
|
+
* waived demand reads to a human. Absent when there are none.
|
|
2095
|
+
*/
|
|
2096
|
+
notices?: string[];
|
|
2097
|
+
/** Committed profile blob evaluated by readiness. Required for merge. */
|
|
2098
|
+
profileBlobSha?: string;
|
|
2099
|
+
/** Checkout-relative committed profile path evaluated by readiness. */
|
|
2100
|
+
profilePath?: string;
|
|
2101
|
+
repairs: ReadinessRepair[];
|
|
2102
|
+
/** Trusted checkout repository used for all GitHub reads and writes. */
|
|
2103
|
+
repository?: string;
|
|
2104
|
+
status: ReadinessStatus;
|
|
2105
|
+
/**
|
|
2106
|
+
* Demands that were in force, were NOT met, and were waived by the operator
|
|
2107
|
+
* (#354, moved here from the merge-time proof by #477). Each entry carries
|
|
2108
|
+
* the demand's refusals verbatim, so a waived demand can never read as a met
|
|
2109
|
+
* one; readiness proceeds on the recorded operator act, not on evidence.
|
|
2110
|
+
*/
|
|
2111
|
+
waivedDemands?: WaivedDemand[];
|
|
2112
|
+
}
|
|
2113
|
+
interface PrReadyDependencies {
|
|
2114
|
+
/**
|
|
2115
|
+
* Arms GitHub native auto-merge only for a passing boundary wave that
|
|
2116
|
+
* authorizes machine merge (#477). Defaults to the real `gh pr merge --auto`
|
|
2117
|
+
* call plus the read-back that says what actually happened.
|
|
2118
|
+
*/
|
|
2119
|
+
armAutoMerge?: (input: ArmAutoMergeInput) => ArmAutoMergeOutcome;
|
|
2120
|
+
github?: {
|
|
2121
|
+
fetchClosingPullRequests?: (input: {
|
|
2122
|
+
issue: number;
|
|
2123
|
+
owner: string;
|
|
2124
|
+
repo: string;
|
|
2125
|
+
}) => {
|
|
2126
|
+
number: number;
|
|
2127
|
+
}[];
|
|
2128
|
+
fetchIssueBody?: (input: {
|
|
2129
|
+
issue: number;
|
|
2130
|
+
owner: string;
|
|
2131
|
+
repo: string;
|
|
2132
|
+
}) => string;
|
|
2133
|
+
fetchPullRequest: (input: {
|
|
2134
|
+
owner: string;
|
|
2135
|
+
repo: string;
|
|
2136
|
+
pr: number;
|
|
2137
|
+
}) => GitHubPullRequest;
|
|
2138
|
+
};
|
|
2139
|
+
git?: PrReadyGitDependencies;
|
|
2140
|
+
hq?: HqIngestDependencies;
|
|
2141
|
+
/**
|
|
2142
|
+
* The authoritative merge-freeze reader (#477). Defaults to the pinned-App
|
|
2143
|
+
* GitHub check-run authority — readiness is a control, so an absent
|
|
2144
|
+
* dependency must not mean an unread freeze.
|
|
2145
|
+
*/
|
|
2146
|
+
mergeFreeze?: Pick<MergeFreezeAuthority, "readGeneration">;
|
|
2147
|
+
/**
|
|
2148
|
+
* Awaited publication of the branded check, which is a source-pinned
|
|
2149
|
+
* required check rather than a mirror (#477). Returns true only when the
|
|
2150
|
+
* App-owned run landed. Defaults to `ensureFactoryCheckRunPublished`.
|
|
2151
|
+
*
|
|
2152
|
+
* `pr:ready` has no other publication seam, and this one cannot express a
|
|
2153
|
+
* non-terminal run (#526): `status` is omitted from the input, so every run
|
|
2154
|
+
* readiness creates is completed with a conclusion. A `pr:ready` invocation
|
|
2155
|
+
* therefore cannot leave a run holding the source-pinned required check
|
|
2156
|
+
* open, which is a permanent block on the pull request (#524).
|
|
2157
|
+
*/
|
|
2158
|
+
publishFinalCheckRun?: (input: Omit<PublishFactoryCheckInput, "status"> & {
|
|
2159
|
+
conclusion: "failure" | "success";
|
|
2160
|
+
}) => Promise<boolean> | boolean;
|
|
2161
|
+
/**
|
|
2162
|
+
* Re-present the App-owned HUD after this run's ready check is published
|
|
2163
|
+
* so the table is not stuck at first-write. Defaults to a safe refresh
|
|
2164
|
+
* that never fails the gate.
|
|
2165
|
+
*/
|
|
2166
|
+
presentStatusHud?: (input: RefreshFactoryPrStatusHudInput) => Promise<void> | void;
|
|
2167
|
+
/** Injectable delay for the UNKNOWN-mergeable brief poll (tests). */
|
|
2168
|
+
sleep?: (ms: number) => Promise<void>;
|
|
2169
|
+
}
|
|
2170
|
+
interface PrReadyGitDependencies {
|
|
2171
|
+
canResolveCommit: (cwd: string, sha: string) => boolean;
|
|
2172
|
+
changedFiles: (cwd: string, base: string, headSha?: string) => string[];
|
|
2173
|
+
checkoutRepository: (cwd: string) => CheckoutRepository;
|
|
2174
|
+
currentHeadSha: (cwd: string) => string;
|
|
2175
|
+
mergeBaseSha: (cwd: string, base: string) => string;
|
|
2176
|
+
objectIdAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
2177
|
+
resolveCommitSha: (cwd: string, ref: string) => string | undefined;
|
|
2178
|
+
showFileAtRef: (cwd: string, ref: string, absolutePath: string) => string | undefined;
|
|
2179
|
+
stablePatchId: (cwd: string, base: string) => string;
|
|
2180
|
+
}
|
|
2181
|
+
declare function validatePrReadyProof(value: unknown): PrReadyProof;
|
|
2182
|
+
declare function readPrReadyProof(filePath: string): PrReadyProof;
|
|
2183
|
+
declare function runPrReady(args: PrReadyArgs, dependencies?: PrReadyDependencies): Promise<PrReadyProof>;
|
|
2184
|
+
//#endregion
|
|
2185
|
+
//#region src/required-check-policy.d.ts
|
|
2186
|
+
declare const EVIDENCE_CHECK_TYPES: readonly ["review", "verify"];
|
|
2187
|
+
type EvidenceCheckType = (typeof EVIDENCE_CHECK_TYPES)[number];
|
|
2188
|
+
declare const requiredCheckScopeSchema: z.ZodObject<{
|
|
2189
|
+
classifications: z.ZodArray<z.ZodEnum<{
|
|
2190
|
+
"docs/process-only": "docs/process-only";
|
|
2191
|
+
trivial: "trivial";
|
|
2192
|
+
"non-trivial": "non-trivial";
|
|
2193
|
+
}>>;
|
|
2194
|
+
}, z.core.$strict>;
|
|
2195
|
+
type RequiredCheckScope = z.infer<typeof requiredCheckScopeSchema>;
|
|
2196
|
+
interface RequiredCheckScopeContext {
|
|
2197
|
+
classification: DiffClassification | undefined;
|
|
2198
|
+
impactStamp?: ImpactStamp;
|
|
2199
|
+
}
|
|
2200
|
+
interface ScopeDecision {
|
|
2201
|
+
inScope: boolean;
|
|
2202
|
+
reason: string;
|
|
2203
|
+
}
|
|
2204
|
+
declare const requiredCheckInScope: ({
|
|
2205
|
+
context,
|
|
2206
|
+
scope
|
|
2207
|
+
}: {
|
|
2208
|
+
context: RequiredCheckScopeContext;
|
|
2209
|
+
scope?: RequiredCheckScope;
|
|
2210
|
+
}) => ScopeDecision;
|
|
2211
|
+
interface RequiredCheck {
|
|
2212
|
+
name: string;
|
|
2213
|
+
checkType: EvidenceCheckType;
|
|
2214
|
+
scope?: RequiredCheckScope;
|
|
2215
|
+
}
|
|
2216
|
+
//#endregion
|
|
2217
|
+
//#region src/factory-session.d.ts
|
|
2218
|
+
declare const resolveAuthoringSessionIds: ({
|
|
2219
|
+
override,
|
|
2220
|
+
recorded
|
|
2221
|
+
}: {
|
|
2222
|
+
override?: string[];
|
|
2223
|
+
recorded?: string;
|
|
2224
|
+
}) => string[];
|
|
2225
|
+
declare namespace external_evidence_d_exports {
|
|
2226
|
+
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 };
|
|
2227
|
+
}
|
|
2228
|
+
declare const EVIDENCE_ENVELOPE_SCHEMA_VERSION = 1;
|
|
2229
|
+
declare const evidenceEnvelopeBaseSchema: z.ZodObject<{
|
|
2230
|
+
check: z.ZodString;
|
|
2231
|
+
checkType: z.ZodEnum<{
|
|
2232
|
+
review: "review";
|
|
2233
|
+
verify: "verify";
|
|
2234
|
+
}>;
|
|
2235
|
+
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
2236
|
+
headSha: z.ZodString;
|
|
2237
|
+
mergeBaseSha: z.ZodString;
|
|
2238
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2239
|
+
outcome: z.ZodEnum<{
|
|
2240
|
+
pass: "pass";
|
|
2241
|
+
fail: "fail";
|
|
2242
|
+
}>;
|
|
2243
|
+
patchId: z.ZodString;
|
|
2244
|
+
policyVersion: z.ZodOptional<z.ZodString>;
|
|
2245
|
+
producer: z.ZodString;
|
|
2246
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
2247
|
+
rung: z.ZodOptional<z.ZodEnum<{
|
|
2248
|
+
oracle: "oracle";
|
|
2249
|
+
"independent-model": "independent-model";
|
|
2250
|
+
human: "human";
|
|
2251
|
+
}>>;
|
|
2252
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2253
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2254
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
2255
|
+
}, z.core.$loose>;
|
|
2256
|
+
declare const evidenceEnvelopeSchema: z.ZodObject<{
|
|
2257
|
+
check: z.ZodString;
|
|
2258
|
+
checkType: z.ZodEnum<{
|
|
2259
|
+
review: "review";
|
|
2260
|
+
verify: "verify";
|
|
2261
|
+
}>;
|
|
2262
|
+
findingsPointer: z.ZodOptional<z.ZodString>;
|
|
2263
|
+
headSha: z.ZodString;
|
|
2264
|
+
mergeBaseSha: z.ZodString;
|
|
2265
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2266
|
+
outcome: z.ZodEnum<{
|
|
2267
|
+
pass: "pass";
|
|
2268
|
+
fail: "fail";
|
|
2269
|
+
}>;
|
|
2270
|
+
patchId: z.ZodString;
|
|
2271
|
+
policyVersion: z.ZodOptional<z.ZodString>;
|
|
2272
|
+
producer: z.ZodString;
|
|
2273
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
2274
|
+
rung: z.ZodOptional<z.ZodEnum<{
|
|
2275
|
+
oracle: "oracle";
|
|
2276
|
+
"independent-model": "independent-model";
|
|
2277
|
+
human: "human";
|
|
2278
|
+
}>>;
|
|
2279
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2280
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2281
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
2282
|
+
}, z.core.$loose>;
|
|
2283
|
+
type EvidenceEnvelope = z.infer<typeof evidenceEnvelopeBaseSchema>;
|
|
2284
|
+
type EvidenceEnvelopeParse = {
|
|
2285
|
+
ok: true;
|
|
2286
|
+
envelope: EvidenceEnvelope;
|
|
2026
2287
|
} | {
|
|
2027
|
-
|
|
2028
|
-
|
|
2288
|
+
ok: false;
|
|
2289
|
+
error: string;
|
|
2029
2290
|
};
|
|
2030
|
-
declare const
|
|
2031
|
-
|
|
2032
|
-
proofMatchesCurrentDiff,
|
|
2033
|
-
proofPath
|
|
2034
|
-
}: {
|
|
2035
|
-
proof?: PrVerifyProof;
|
|
2036
|
-
proofMatchesCurrentDiff?: boolean;
|
|
2037
|
-
proofPath?: string;
|
|
2038
|
-
}) => VerificationProofState;
|
|
2039
|
-
declare const verificationProofApplicabilityFor: ({
|
|
2040
|
-
docsOnlyDeltaAcceptedSince,
|
|
2041
|
-
explicitProof,
|
|
2042
|
-
files,
|
|
2043
|
-
headSha,
|
|
2044
|
-
currentIdentity,
|
|
2045
|
-
proof,
|
|
2046
|
-
proofPath,
|
|
2047
|
-
proofReadError
|
|
2048
|
-
}: {
|
|
2049
|
-
docsOnlyDeltaAcceptedSince?: (baselineHeadSha: string) => boolean;
|
|
2050
|
-
explicitProof: boolean;
|
|
2051
|
-
files: string[];
|
|
2291
|
+
declare const parseEvidenceEnvelope: (raw: unknown) => EvidenceEnvelopeParse;
|
|
2292
|
+
interface EvidenceCandidateIdentity {
|
|
2052
2293
|
headSha: string;
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
proofReadError?: unknown;
|
|
2060
|
-
}) => {
|
|
2061
|
-
fullVerifiedHeadShas: never[];
|
|
2062
|
-
verificationProof: VerificationProofState;
|
|
2063
|
-
} | {
|
|
2064
|
-
fullVerifiedHeadShas: string[];
|
|
2065
|
-
verificationProof: {
|
|
2066
|
-
headShas: VerifiedHeadShas;
|
|
2067
|
-
kind: "typed";
|
|
2068
|
-
proof: PrVerifyProof;
|
|
2069
|
-
};
|
|
2070
|
-
};
|
|
2071
|
-
declare const resolveVerifyProofApplicability: ({
|
|
2072
|
-
proofPath,
|
|
2073
|
-
explicitProof,
|
|
2074
|
-
docsOnlyDeltaAcceptedSince,
|
|
2075
|
-
files,
|
|
2076
|
-
headSha,
|
|
2077
|
-
currentVerifyIdentityForBase,
|
|
2078
|
-
preread
|
|
2294
|
+
patchId: string;
|
|
2295
|
+
mergeBaseSha: string;
|
|
2296
|
+
}
|
|
2297
|
+
declare const evidenceBindingFresh: ({
|
|
2298
|
+
candidate,
|
|
2299
|
+
envelope
|
|
2079
2300
|
}: {
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
}) =>
|
|
2094
|
-
|
|
2095
|
-
|
|
2301
|
+
candidate: EvidenceCandidateIdentity;
|
|
2302
|
+
envelope: EvidenceEnvelope;
|
|
2303
|
+
}) => boolean;
|
|
2304
|
+
interface IndependenceResult {
|
|
2305
|
+
independent: boolean;
|
|
2306
|
+
reason?: "no-session" | "unknown-authoring-identity" | "same-session";
|
|
2307
|
+
}
|
|
2308
|
+
declare const evidenceReviewIndependence: ({
|
|
2309
|
+
authoringSessionIds,
|
|
2310
|
+
envelope
|
|
2311
|
+
}: {
|
|
2312
|
+
authoringSessionIds: string[];
|
|
2313
|
+
envelope: EvidenceEnvelope;
|
|
2314
|
+
}) => IndependenceResult;
|
|
2315
|
+
type LoadedEvidenceEnvelope = {
|
|
2316
|
+
ok: true;
|
|
2317
|
+
envelope: EvidenceEnvelope;
|
|
2318
|
+
path: string;
|
|
2096
2319
|
} | {
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
proof: PrVerifyProof;
|
|
2102
|
-
};
|
|
2320
|
+
check?: string;
|
|
2321
|
+
error: string;
|
|
2322
|
+
ok: false;
|
|
2323
|
+
path: string;
|
|
2103
2324
|
};
|
|
2104
|
-
declare const verificationProofForReadiness: (state: VerificationProofState) => VerificationHeadShas;
|
|
2105
|
-
declare const verificationProofBlockingReason: (state: VerificationProofState) => string | undefined;
|
|
2106
|
-
//#endregion
|
|
2107
|
-
//#region src/retro-envelope.d.ts
|
|
2108
2325
|
/**
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
2111
|
-
* One envelope per lane, built at `factory:closeout` and delivered through the
|
|
2112
|
-
* typed gate-sink as the `retro-envelope` ingest kind. Re-derived in TypeScript
|
|
2113
|
-
* from the `spike/telemetry-layer2` S5 scratch schema (reference-only, never
|
|
2114
|
-
* merged). This module is the single source of truth for the v1 wire shape
|
|
2115
|
-
* and its bounds ({@link RETRO_ENVELOPE_WIRE_BOUNDS}) — producer and consumer
|
|
2116
|
-
* alike. HQ imports these exports directly from the Worker-safe
|
|
2117
|
-
* `@patronage/software-factory/schemas` subpath
|
|
2118
|
-
* (`software-factory-hq/src/contracts/retro-schemas.ts`) instead of
|
|
2119
|
-
* maintaining a parallel hand-written copy, so there is exactly one wire
|
|
2120
|
-
* contract and no drift-detection machinery is needed (issue #350; formerly
|
|
2121
|
-
* a hand-written twin plus a 767-line parity test, #46).
|
|
2122
|
-
*
|
|
2123
|
-
* DESIGN INVARIANT: cross-family token sums must be UNREPRESENTABLE.
|
|
2124
|
-
*
|
|
2125
|
-
* The two model families use different tokenizers, prices, and accounting
|
|
2126
|
-
* conventions, so any token total that spans Claude and GPT is a lie:
|
|
2127
|
-
*
|
|
2128
|
-
* 1. There is no combined/total token field anywhere in the envelope.
|
|
2129
|
-
* 2. `tokenFamilies` is strict — its only keys are `claude` and `gpt`; data
|
|
2130
|
-
* cannot smuggle in a third "all"/"combined" slot.
|
|
2131
|
-
* 3. The family BLOCKS are structurally different shapes with DIFFERENT keys
|
|
2132
|
-
* (claude is a single flat block keyed on freshInput/cacheReadInput/
|
|
2133
|
-
* cacheCreationInput; gpt is `{ roles: [...] }`). The exclusive input-tier
|
|
2134
|
-
* COUNTS share no key name across families. The residual names shared
|
|
2135
|
-
* between the claude block and a gpt ROLE entry are pinned to exactly
|
|
2136
|
-
* {costUsd, model, output} (PR #32 advisory): `costUsd` is deliberate —
|
|
2137
|
-
* USD is the one cross-family summable unit (rule 4); `model` is an
|
|
2138
|
-
* unsummable label; `output` is the same name at DIFFERENT depths (lane
|
|
2139
|
-
* block vs per-role entry), frozen by a tripwire test in
|
|
2140
|
-
* `retro-envelope.test.ts` so the overlap cannot grow. Renaming `output`
|
|
2141
|
-
* is a schemaVersion-2 wire change, deliberately not spent in v1.
|
|
2142
|
-
* 4. Cost is per-family USD and nullable. Combined totals are allowed in USD
|
|
2143
|
-
* only, and only as a projection-time sum of per-family USD.
|
|
2326
|
+
* Every check name with a current, candidate-bound FAILING envelope on disk.
|
|
2144
2327
|
*
|
|
2145
|
-
*
|
|
2146
|
-
*
|
|
2147
|
-
*
|
|
2148
|
-
* already includes `cachedInput`, so `freshInputDerived` (inclusive − cached)
|
|
2149
|
-
* is the only value safe to feed a per-token pricer.
|
|
2328
|
+
* The wave-3 scoping veto input. Callers pass the resolved set to
|
|
2329
|
+
* `planVerificationBattery` / `planPreviewLifecycle`, which stay pure — the
|
|
2330
|
+
* planners decide, they never read the filesystem.
|
|
2150
2331
|
*
|
|
2151
|
-
*
|
|
2152
|
-
* `
|
|
2153
|
-
*
|
|
2154
|
-
* its operator-visible data gaps and is a replayable advisory HQ event, so it
|
|
2155
|
-
* never substitutes unavailable usage with zero. The wire shape (field names,
|
|
2156
|
-
* types, structure) stays byte-parity with HQ v1.
|
|
2157
|
-
*/
|
|
2158
|
-
declare const RETRO_ENVELOPE_SCHEMA_VERSION = 1;
|
|
2159
|
-
declare const retroEnvelopeV1Schema: z.ZodObject<{
|
|
2160
|
-
agentRunId: z.ZodString;
|
|
2161
|
-
archiveRef: z.ZodOptional<z.ZodString>;
|
|
2162
|
-
cycles: z.ZodObject<{
|
|
2163
|
-
gateRunsToFirstGreen: z.ZodNumber;
|
|
2164
|
-
reviewerFixRounds: z.ZodNumber;
|
|
2165
|
-
thermoFixRounds: z.ZodNumber;
|
|
2166
|
-
}, z.core.$strict>;
|
|
2167
|
-
dataGaps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2168
|
-
gates: z.ZodArray<z.ZodObject<{
|
|
2169
|
-
cycle: z.ZodNumber;
|
|
2170
|
-
duration: z.ZodNumber;
|
|
2171
|
-
gate: z.ZodString;
|
|
2172
|
-
outcome: z.ZodEnum<{
|
|
2173
|
-
pass: "pass";
|
|
2174
|
-
fail: "fail";
|
|
2175
|
-
skip: "skip";
|
|
2176
|
-
}>;
|
|
2177
|
-
startedAt: z.ZodISODateTime;
|
|
2178
|
-
}, z.core.$strict>>;
|
|
2179
|
-
generatedAt: z.ZodISODateTime;
|
|
2180
|
-
interventions: z.ZodObject<{
|
|
2181
|
-
count: z.ZodNumber;
|
|
2182
|
-
}, z.core.$strict>;
|
|
2183
|
-
joinKeys: z.ZodObject<{
|
|
2184
|
-
claudeSessionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2185
|
-
codexThreadIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2186
|
-
}, z.core.$strict>;
|
|
2187
|
-
kind: z.ZodLiteral<"retro-envelope">;
|
|
2188
|
-
outcome: z.ZodOptional<z.ZodObject<{
|
|
2189
|
-
status: z.ZodEnum<{
|
|
2190
|
-
success: "success";
|
|
2191
|
-
fail: "fail";
|
|
2192
|
-
blocked: "blocked";
|
|
2193
|
-
"ship-with-followups": "ship-with-followups";
|
|
2194
|
-
}>;
|
|
2195
|
-
verdict: z.ZodOptional<z.ZodString>;
|
|
2196
|
-
}, z.core.$strict>>;
|
|
2197
|
-
phases: z.ZodArray<z.ZodObject<{
|
|
2198
|
-
at: z.ZodISODateTime;
|
|
2199
|
-
deltaSec: z.ZodOptional<z.ZodNumber>;
|
|
2200
|
-
name: z.ZodString;
|
|
2201
|
-
}, z.core.$strict>>;
|
|
2202
|
-
refs: z.ZodObject<{
|
|
2203
|
-
branch: z.ZodOptional<z.ZodString>;
|
|
2204
|
-
epic: z.ZodOptional<z.ZodString>;
|
|
2205
|
-
headSha: z.ZodOptional<z.ZodString>;
|
|
2206
|
-
issue: z.ZodOptional<z.ZodString>;
|
|
2207
|
-
prNumber: z.ZodOptional<z.ZodNumber>;
|
|
2208
|
-
}, z.core.$strict>;
|
|
2209
|
-
repo: z.ZodObject<{
|
|
2210
|
-
name: z.ZodString;
|
|
2211
|
-
owner: z.ZodString;
|
|
2212
|
-
}, z.core.$strict>;
|
|
2213
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
2214
|
-
tokenFamilies: z.ZodObject<{
|
|
2215
|
-
claude: z.ZodOptional<z.ZodObject<{
|
|
2216
|
-
cacheCreationInput: z.ZodNumber;
|
|
2217
|
-
cacheReadInput: z.ZodNumber;
|
|
2218
|
-
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
2219
|
-
family: z.ZodLiteral<"claude">;
|
|
2220
|
-
freshInput: z.ZodNumber;
|
|
2221
|
-
model: z.ZodString;
|
|
2222
|
-
output: z.ZodNumber;
|
|
2223
|
-
requests: z.ZodNumber;
|
|
2224
|
-
}, z.core.$strict>>;
|
|
2225
|
-
gpt: z.ZodOptional<z.ZodObject<{
|
|
2226
|
-
family: z.ZodLiteral<"gpt">;
|
|
2227
|
-
roles: z.ZodArray<z.ZodObject<{
|
|
2228
|
-
cachedInput: z.ZodNumber;
|
|
2229
|
-
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
2230
|
-
freshInputDerived: z.ZodNumber;
|
|
2231
|
-
inputInclusiveOfCache: z.ZodNumber;
|
|
2232
|
-
model: z.ZodString;
|
|
2233
|
-
output: z.ZodNumber;
|
|
2234
|
-
reasoningOutput: z.ZodNumber;
|
|
2235
|
-
role: z.ZodString;
|
|
2236
|
-
threadId: z.ZodOptional<z.ZodString>;
|
|
2237
|
-
}, z.core.$strict>>;
|
|
2238
|
-
}, z.core.$strict>>;
|
|
2239
|
-
}, z.core.$strict>;
|
|
2240
|
-
wallClock: z.ZodObject<{
|
|
2241
|
-
endTs: z.ZodISODateTime;
|
|
2242
|
-
startTs: z.ZodISODateTime;
|
|
2243
|
-
totalSec: z.ZodNumber;
|
|
2244
|
-
}, z.core.$strict>;
|
|
2245
|
-
}, z.core.$strict>;
|
|
2246
|
-
type RetroEnvelope = z.infer<typeof retroEnvelopeV1Schema>;
|
|
2247
|
-
/**
|
|
2248
|
-
* Versioned payload validators, keyed by schema major. Unknown majors never
|
|
2249
|
-
* reach these — {@link parseRetroEnvelope} returns them raw and marked
|
|
2250
|
-
* degraded, mirroring HQ's ingest skew posture (stored raw, never dropped).
|
|
2332
|
+
* `checkType` is the caller's, not a guess: schema-v5 requiredChecks are
|
|
2333
|
+
* verify-only (`resolveProfileRequiredChecks`), so a scoping caller passes
|
|
2334
|
+
* `"verify"` and matches exactly the pair wave 2 evaluates.
|
|
2251
2335
|
*/
|
|
2252
|
-
declare const
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2336
|
+
declare const boundFailingCheckNames: ({
|
|
2337
|
+
candidate,
|
|
2338
|
+
checkType,
|
|
2339
|
+
envelopes
|
|
2340
|
+
}: {
|
|
2341
|
+
candidate: EvidenceCandidateIdentity;
|
|
2342
|
+
checkType: EvidenceCheckType;
|
|
2343
|
+
envelopes: LoadedEvidenceEnvelope[];
|
|
2344
|
+
}) => string[];
|
|
2345
|
+
interface RequiredCheckEvaluationInput {
|
|
2346
|
+
authoringSessionIds: string[];
|
|
2347
|
+
candidate: EvidenceCandidateIdentity;
|
|
2348
|
+
envelopes: LoadedEvidenceEnvelope[];
|
|
2349
|
+
requiredChecks: RequiredCheck[];
|
|
2350
|
+
scopeContext: RequiredCheckScopeContext;
|
|
2351
|
+
}
|
|
2352
|
+
interface RequiredCheckOutcome {
|
|
2353
|
+
name: string;
|
|
2354
|
+
checkType: EvidenceCheckType;
|
|
2355
|
+
status: "satisfied" | "unmet" | "out-of-scope";
|
|
2356
|
+
inScope: boolean;
|
|
2357
|
+
scopeReason: string;
|
|
2358
|
+
scope?: RequiredCheckScope;
|
|
2359
|
+
reason?: string;
|
|
2360
|
+
matchedPath?: string;
|
|
2361
|
+
}
|
|
2362
|
+
interface RequiredCheckEvaluation {
|
|
2363
|
+
outcomes: RequiredCheckOutcome[];
|
|
2364
|
+
blockingReasons: string[];
|
|
2365
|
+
}
|
|
2366
|
+
declare const evaluateRequiredChecks: ({
|
|
2367
|
+
authoringSessionIds,
|
|
2368
|
+
candidate,
|
|
2369
|
+
envelopes,
|
|
2370
|
+
requiredChecks,
|
|
2371
|
+
scopeContext
|
|
2372
|
+
}: RequiredCheckEvaluationInput) => RequiredCheckEvaluation;
|
|
2373
|
+
declare const EVIDENCE_DIR = ".factory-memory/evidence";
|
|
2374
|
+
declare const loadEvidenceEnvelopes: (cwd: string) => LoadedEvidenceEnvelope[];
|
|
2375
|
+
//#endregion
|
|
2376
|
+
//#region src/review-proof-applicability.d.ts
|
|
2377
|
+
declare const REVIEW_STATUS_VALUES: readonly ["not-required", "current", "stale", "missing", "blocked"];
|
|
2378
|
+
declare const reviewStatusSchema: z.ZodEnum<{
|
|
2379
|
+
"not-required": "not-required";
|
|
2380
|
+
stale: "stale";
|
|
2381
|
+
blocked: "blocked";
|
|
2382
|
+
current: "current";
|
|
2383
|
+
missing: "missing";
|
|
2384
|
+
}>;
|
|
2385
|
+
type ReviewStatus = z.infer<typeof reviewStatusSchema>;
|
|
2386
|
+
interface CurrentReviewIdentity {
|
|
2387
|
+
headSha: string;
|
|
2388
|
+
patchId: string;
|
|
2389
|
+
}
|
|
2390
|
+
declare const reviewStatus: ({
|
|
2391
|
+
blocked,
|
|
2392
|
+
required,
|
|
2393
|
+
reviewedHeadSha,
|
|
2394
|
+
reviewedPatchId,
|
|
2395
|
+
headSha,
|
|
2396
|
+
patchId
|
|
2397
|
+
}: CurrentReviewIdentity & {
|
|
2398
|
+
blocked?: boolean;
|
|
2399
|
+
required: boolean;
|
|
2400
|
+
reviewedHeadSha?: string;
|
|
2401
|
+
reviewedPatchId?: string;
|
|
2402
|
+
}) => ReviewStatus;
|
|
2403
|
+
declare namespace proof_identity_d_exports {
|
|
2404
|
+
export { CurrentReviewIdentity, REVIEW_STATUS_VALUES, ReviewProofClaim, ReviewStatus, explicitFailureIdentity, isExplicitReviewFailure, isUntypedReviewProof, reviewStatus, reviewStatusSchema, selectReviewProof };
|
|
2405
|
+
}
|
|
2406
|
+
type ReviewProofClaim = {
|
|
2407
|
+
reviewedHeadSha?: string;
|
|
2408
|
+
reviewedPatchId?: string;
|
|
2409
|
+
untypedVerdict?: boolean;
|
|
2260
2410
|
} | {
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2411
|
+
explicitFailure: true;
|
|
2412
|
+
reviewedHeadSha?: string;
|
|
2413
|
+
reviewedPatchId?: string;
|
|
2414
|
+
untypedVerdict?: boolean;
|
|
2415
|
+
};
|
|
2416
|
+
declare const isExplicitReviewFailure: (proof: ReviewProofClaim) => proof is {
|
|
2417
|
+
explicitFailure: true;
|
|
2418
|
+
reviewedHeadSha?: string;
|
|
2419
|
+
reviewedPatchId?: string;
|
|
2420
|
+
untypedVerdict?: boolean;
|
|
2421
|
+
};
|
|
2422
|
+
declare const isUntypedReviewProof: (proof: ReviewProofClaim) => proof is {
|
|
2423
|
+
untypedVerdict: true;
|
|
2424
|
+
reviewedHeadSha?: string;
|
|
2425
|
+
reviewedPatchId?: string;
|
|
2426
|
+
};
|
|
2427
|
+
declare const explicitFailureIdentity: (proof: ReviewProofClaim) => {
|
|
2428
|
+
reviewedHeadSha?: string;
|
|
2429
|
+
reviewedPatchId?: string;
|
|
2430
|
+
};
|
|
2431
|
+
declare const selectReviewProof: ({
|
|
2432
|
+
reviewProof
|
|
2433
|
+
}: {
|
|
2434
|
+
reviewProof: ReviewProofClaim;
|
|
2435
|
+
}) => {
|
|
2436
|
+
reviewedHeadSha?: string;
|
|
2437
|
+
reviewedPatchId?: string;
|
|
2438
|
+
untypedVerdict?: boolean;
|
|
2264
2439
|
};
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2440
|
+
//#endregion
|
|
2441
|
+
//#region src/pr-readiness/review-epoch.d.ts
|
|
2442
|
+
interface ReviewCycleState {
|
|
2443
|
+
autoBlockingFindings: number;
|
|
2444
|
+
countsBySeverity: Record<ReviewFindingSeverity, number>;
|
|
2445
|
+
highestBlockingSeverity?: ReviewFindingSeverity;
|
|
2446
|
+
highestOpenSeverity?: ReviewFindingSeverity;
|
|
2447
|
+
maxReviewCycles?: number;
|
|
2448
|
+
nonBlockingFindings: number;
|
|
2449
|
+
openFindings: number;
|
|
2450
|
+
reviewCycle?: number;
|
|
2451
|
+
staleRepeatFindings?: number;
|
|
2452
|
+
windowExhausted: boolean;
|
|
2453
|
+
}
|
|
2454
|
+
declare const reviewCycleStateFor: (proof: Pick<PrReviewProof, "ladder" | "reviewCycle" | "maxReviewCycles" | "reviews">, policy?: ReviewLadderPolicy, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewCycleState;
|
|
2455
|
+
type ReviewAcceptance = "accepted-after-cap" | "accepted-clean" | "accepted-through-ladder" | "blocked";
|
|
2456
|
+
declare const resolveReviewAcceptance: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewAcceptance;
|
|
2457
|
+
type ReviewTerminalState = "accepted-with-findings" | "blocked" | "clean";
|
|
2458
|
+
declare const resolveReviewTerminalStateForEpoch: (proof: PrReviewProof, review: PrReviewResult, epoch: ReviewEpochMode, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewTerminalState;
|
|
2459
|
+
declare const resolveReviewTerminalState: (proof: PrReviewProof, review: PrReviewResult, policy: ReviewLadderPolicy | undefined) => ReviewTerminalState;
|
|
2460
|
+
declare const resolveReviewTerminalStateAcrossReviews: (proof: PrReviewProof, epoch: ReviewEpochMode, adjudicatedLedger?: FindingLedgerEntry[]) => ReviewTerminalState | undefined;
|
|
2461
|
+
declare const resolveReviewTerminalStateAcrossReviewsForPolicy: (proof: PrReviewProof, policy: ReviewLadderPolicy) => ReviewTerminalState | undefined;
|
|
2462
|
+
declare const reviewProofFor: (proof: PrReviewProof | undefined, kind: PrReviewKind, policy: ReviewLadderPolicy | undefined, current?: {
|
|
2463
|
+
patchId: string;
|
|
2464
|
+
}) => ReviewProofClaim;
|
|
2465
|
+
declare namespace review_proof_d_exports {
|
|
2466
|
+
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, readPrReviewProof, resolveReviewAcceptance, resolveReviewTerminalState, resolveReviewTerminalStateAcrossReviews, resolveReviewTerminalStateAcrossReviewsForPolicy, resolveReviewTerminalStateForEpoch, reviewCycleStateFor, reviewProofFor, validatePrReviewProof, validatePrReviewResult };
|
|
2467
|
+
}
|
|
2468
|
+
declare const PR_REVIEW_SCHEMA_VERSION = 2;
|
|
2469
|
+
declare const PR_REVIEW_FINDING_PROVENANCE_VERSION = 1;
|
|
2470
|
+
declare const DEFAULT_PR_REVIEW_PROOF_PATH = ".factory-memory/pr-review.json";
|
|
2471
|
+
declare const DEFAULT_PR_REVIEW_MAX_CYCLES = 5;
|
|
2472
|
+
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.";
|
|
2473
|
+
declare const prReviewFindingSchema: z.ZodType<PrReviewFinding>;
|
|
2474
|
+
declare const prReviewResultSchema: z.ZodType<PrReviewResult>;
|
|
2475
|
+
declare const prReviewProofSchema: z.ZodType<PrReviewProof>;
|
|
2476
|
+
declare const validatePrReviewResult: (value: unknown) => PrReviewResult;
|
|
2477
|
+
declare const validatePrReviewProof: (value: unknown) => PrReviewProof;
|
|
2478
|
+
declare const readPrReviewProof: (filePath: string) => PrReviewProof;
|
|
2479
|
+
declare const PR_REVIEW_PROOF_DESCRIPTOR: ProofDescriptor<PrReviewProof>;
|
|
2281
2480
|
//#endregion
|
|
2282
2481
|
//#region src/schemas.d.ts
|
|
2283
2482
|
declare const boundaryCheckProofSchema: z.ZodObject<{
|
|
@@ -2328,24 +2527,18 @@ declare const boundaryCheckProofSchema: z.ZodObject<{
|
|
|
2328
2527
|
value: z.ZodString;
|
|
2329
2528
|
}, z.core.$strip>>;
|
|
2330
2529
|
status: z.ZodEnum<{
|
|
2331
|
-
blocked: "blocked";
|
|
2332
2530
|
ready: "ready";
|
|
2531
|
+
blocked: "blocked";
|
|
2333
2532
|
}>;
|
|
2334
2533
|
}, z.core.$strip>;
|
|
2335
2534
|
type BoundaryCheckProofRecord = z.infer<typeof boundaryCheckProofSchema>;
|
|
2336
2535
|
//#endregion
|
|
2337
2536
|
//#region src/boundary-check.d.ts
|
|
2338
|
-
interface BoundaryPullRequestRef {
|
|
2339
|
-
headRefOid?: string;
|
|
2340
|
-
mergeCommitOid?: string;
|
|
2341
|
-
number: number;
|
|
2342
|
-
state: "OPEN" | "CLOSED" | "MERGED";
|
|
2343
|
-
}
|
|
2344
2537
|
interface BoundaryCheckGithub {
|
|
2345
2538
|
fetchIssueBody: (repo: string, issue: number) => string;
|
|
2346
2539
|
fetchIssueComments: (repo: string, issue: number) => GithubIssueComment[];
|
|
2347
2540
|
fetchClosingPullRequests: (repo: string, issue: number) => BoundaryPullRequestRef[];
|
|
2348
|
-
fetchPullRequest
|
|
2541
|
+
fetchPullRequest?: (repo: string, pr: number) => BoundaryPullRequestRef;
|
|
2349
2542
|
}
|
|
2350
2543
|
interface BoundaryCheckArgs {
|
|
2351
2544
|
cwd?: string;
|
|
@@ -2362,7 +2555,7 @@ interface BoundaryCheckDependencies {
|
|
|
2362
2555
|
declare function runBoundaryCheck(args: BoundaryCheckArgs, dependencies?: BoundaryCheckDependencies): BoundaryCheckProofRecord;
|
|
2363
2556
|
declare function validateBoundaryCheckProof(value: unknown): BoundaryCheckProofRecord;
|
|
2364
2557
|
//#endregion
|
|
2365
|
-
//#region src/
|
|
2558
|
+
//#region src/cli-output.d.ts
|
|
2366
2559
|
interface CliOutput {
|
|
2367
2560
|
stderr: Pick<NodeJS.WriteStream, "write">;
|
|
2368
2561
|
stdout: Pick<NodeJS.WriteStream, "write">;
|
|
@@ -2410,32 +2603,6 @@ declare const runDemandWaive: (args: DemandWaiveArgs, dependencies?: DemandWaive
|
|
|
2410
2603
|
//#region src/commands/demand-waive.d.ts
|
|
2411
2604
|
type DemandWaiveAction = (args: DemandWaiveArgs) => DemandWaiver;
|
|
2412
2605
|
//#endregion
|
|
2413
|
-
//#region src/hq-credentials.d.ts
|
|
2414
|
-
/**
|
|
2415
|
-
* Why a reference did not resolve. Each value names a different remedy, and
|
|
2416
|
-
* none of them can be inferred from a value-or-nothing result:
|
|
2417
|
-
*
|
|
2418
|
-
* - `resolver-missing` — no secret-manager binary on PATH.
|
|
2419
|
-
* - `resolver-blocked` — a binary exists but this session may not execute it
|
|
2420
|
-
* (a sandbox denying exec). The command belongs outside the sandbox.
|
|
2421
|
-
* - `resolver-timeout` — the probe expired: a desktop agent waiting on an
|
|
2422
|
-
* approval nobody can give here.
|
|
2423
|
-
* - `resolver-refused` — the binary ran and produced no value. Its store is
|
|
2424
|
-
* unreachable from this session (a sandbox with no keychain access) or the
|
|
2425
|
-
* reference is not readable. These two stay one status on purpose: telling
|
|
2426
|
-
* them apart would mean reading resolver output.
|
|
2427
|
-
*/
|
|
2428
|
-
type SecretResolutionFailure = "resolver-blocked" | "resolver-missing" | "resolver-refused" | "resolver-timeout";
|
|
2429
|
-
/** A structured resolution outcome. The value travels only when resolved. */
|
|
2430
|
-
type SecretResolution = {
|
|
2431
|
-
status: "resolved";
|
|
2432
|
-
value: string;
|
|
2433
|
-
} | {
|
|
2434
|
-
status: SecretResolutionFailure;
|
|
2435
|
-
};
|
|
2436
|
-
/** Resolves a secret reference. Injected so tests stay offline. */
|
|
2437
|
-
type SecretReferenceResolver = (reference: string) => SecretResolution;
|
|
2438
|
-
//#endregion
|
|
2439
2606
|
//#region src/hq-flush.d.ts
|
|
2440
2607
|
/**
|
|
2441
2608
|
* Spool locations this run did not drain because they sit under an earlier
|
|
@@ -2480,7 +2647,6 @@ interface PrReviewGitDependencies {
|
|
|
2480
2647
|
interface PrReviewDependencies {
|
|
2481
2648
|
git?: PrReviewGitDependencies;
|
|
2482
2649
|
hq?: HqIngestDependencies;
|
|
2483
|
-
publishCheckRun?: (input: PublishFactoryCheckInput) => void;
|
|
2484
2650
|
}
|
|
2485
2651
|
declare function runPrReview(args: PrReviewArgs, dependencies?: PrReviewDependencies): Promise<PrReviewProof>;
|
|
2486
2652
|
//#endregion
|
|
@@ -2493,7 +2659,7 @@ interface CleanInstallResolutionDependencies {
|
|
|
2493
2659
|
}
|
|
2494
2660
|
//#endregion
|
|
2495
2661
|
//#region src/pr-verify.d.ts
|
|
2496
|
-
type PrVerifyMode = "auto" | "docs-only" | "
|
|
2662
|
+
type PrVerifyMode = "auto" | "docs-only" | "full";
|
|
2497
2663
|
interface VerificationCommandOutcome {
|
|
2498
2664
|
counts?: {
|
|
2499
2665
|
testFiles?: number;
|
|
@@ -2702,6 +2868,28 @@ type PrReadyAction = (args: PrReadyArgs) => Promise<unknown>;
|
|
|
2702
2868
|
//#region src/commands/pr-review.d.ts
|
|
2703
2869
|
type PrReviewAction = (args: PrReviewArgs) => Promise<unknown>;
|
|
2704
2870
|
//#endregion
|
|
2871
|
+
//#region src/pr-status-hud-command.d.ts
|
|
2872
|
+
interface PrStatusHudArgs {
|
|
2873
|
+
readonly cwd: string;
|
|
2874
|
+
readonly headSha: string;
|
|
2875
|
+
/**
|
|
2876
|
+
* Read token for the preview-proof inventory list. The App token cannot
|
|
2877
|
+
* read the force-push timeline (no contents permission), so the workflow
|
|
2878
|
+
* `GITHUB_TOKEN` serves that read (#825).
|
|
2879
|
+
*/
|
|
2880
|
+
readonly inventoryToken?: string;
|
|
2881
|
+
readonly owner: string;
|
|
2882
|
+
readonly planPath?: string;
|
|
2883
|
+
readonly pr: number;
|
|
2884
|
+
readonly repo: string;
|
|
2885
|
+
readonly token: string;
|
|
2886
|
+
}
|
|
2887
|
+
type PrStatusHudAction = (args: PrStatusHudArgs) => Promise<{
|
|
2888
|
+
action: string;
|
|
2889
|
+
commentId: number;
|
|
2890
|
+
url: string;
|
|
2891
|
+
}>;
|
|
2892
|
+
//#endregion
|
|
2705
2893
|
//#region src/packages/trace/implementation/core.d.ts
|
|
2706
2894
|
declare const FactoryTraceEnvelopeCoreSchema: z.ZodObject<{
|
|
2707
2895
|
createdAt: z.ZodString;
|
|
@@ -3699,74 +3887,6 @@ declare const scanFactoryTraceDiagnostics: ({
|
|
|
3699
3887
|
repoRoot,
|
|
3700
3888
|
to
|
|
3701
3889
|
}: ScanFactoryTraceDiagnosticsOptions) => FactoryTraceDiagnostic[];
|
|
3702
|
-
//#endregion
|
|
3703
|
-
//#region src/interior-telemetry/gate-timing.d.ts
|
|
3704
|
-
declare const GATE_TIMING_SCHEMA_VERSION = 1;
|
|
3705
|
-
type FactoryGateName = "boundary:check" | "factory:closeout" | "pr:ready" | "pr:review" | "pr:verify";
|
|
3706
|
-
type GateTimingOutcome = "fail" | "pass";
|
|
3707
|
-
interface GateTimingRecord {
|
|
3708
|
-
agentRunId: string;
|
|
3709
|
-
cycle: number;
|
|
3710
|
-
durationMs: number;
|
|
3711
|
-
gate: FactoryGateName;
|
|
3712
|
-
outcome: GateTimingOutcome;
|
|
3713
|
-
schemaVersion: typeof GATE_TIMING_SCHEMA_VERSION;
|
|
3714
|
-
startedAt: string;
|
|
3715
|
-
startOffsetMs: number;
|
|
3716
|
-
}
|
|
3717
|
-
//#endregion
|
|
3718
|
-
//#region src/retro-envelope-builder.d.ts
|
|
3719
|
-
/**
|
|
3720
|
-
* Folds a lane's gate-timing ledger (`.factory-memory/gate-timing/<id>.jsonl`,
|
|
3721
|
-
* wave-1 PR #33) into a versioned retro envelope at `factory:closeout`.
|
|
3722
|
-
*
|
|
3723
|
-
* STRUCTURAL INVARIANT (#677 repeat-class rule; PR #35 review cycles 1-2):
|
|
3724
|
-
* telemetry CONTENT can never fail the closeout build gate. Every value that
|
|
3725
|
-
* reaches the envelope passes through one sanitization seam that makes the
|
|
3726
|
-
* output valid BY CONSTRUCTION:
|
|
3727
|
-
*
|
|
3728
|
-
* - strings are clamped to their wire bounds (truncated, with a data gap when
|
|
3729
|
-
* truncation lost information);
|
|
3730
|
-
* - numbers must be finite and within plausibility bounds BEFORE any derived
|
|
3731
|
-
* arithmetic; an absurd value (1e16 ms duration, year-9999 timestamp) SKIPS
|
|
3732
|
-
* its record with a data gap rather than clamping, because clamping would
|
|
3733
|
-
* assert a measurement that never happened;
|
|
3734
|
-
* - arrays are bounded to their schema maxima (gates[] keeps the most recent);
|
|
3735
|
-
* - derived computations (wall clock, cycles) consume only sanitized inputs,
|
|
3736
|
-
* so no ledger content can push them outside Date/Number safe ranges.
|
|
3737
|
-
*
|
|
3738
|
-
* Terminal backstop: the assembled candidate goes through a final schema
|
|
3739
|
-
* parse; if that still fails, a minimal-valid envelope (clamped identity,
|
|
3740
|
-
* empty gates, a data gap naming the failure) is built and returned instead.
|
|
3741
|
-
* `buildRetroEnvelope` therefore never throws for content — the closeout gate
|
|
3742
|
-
* can only fail on filesystem errors when persisting.
|
|
3743
|
-
*/
|
|
3744
|
-
interface BuildRetroEnvelopeInput {
|
|
3745
|
-
agentRunId: string;
|
|
3746
|
-
/** Optional pointer (key/URL) to #8's durable proof archive — never payload. */
|
|
3747
|
-
archiveRef?: string;
|
|
3748
|
-
dataGaps?: string[];
|
|
3749
|
-
generatedAt: Date;
|
|
3750
|
-
interventions?: number;
|
|
3751
|
-
/** Per-family session identities the lane already records. */
|
|
3752
|
-
joinKeys?: {
|
|
3753
|
-
claudeSessionIds?: string[];
|
|
3754
|
-
codexThreadIds?: string[];
|
|
3755
|
-
};
|
|
3756
|
-
/** The lane's gate-timing ledger records, in append order. */
|
|
3757
|
-
ledger: GateTimingRecord[];
|
|
3758
|
-
outcome?: RetroEnvelope["outcome"];
|
|
3759
|
-
phases?: RetroEnvelope["phases"];
|
|
3760
|
-
refs: RetroEnvelope["refs"];
|
|
3761
|
-
repo: RetroEnvelope["repo"];
|
|
3762
|
-
/**
|
|
3763
|
-
* Token families. They may be absent when native session data is unavailable
|
|
3764
|
-
* (valid does not imply available telemetry). When present they satisfy the
|
|
3765
|
-
* family invariants.
|
|
3766
|
-
*/
|
|
3767
|
-
tokenFamilies?: RetroEnvelope["tokenFamilies"];
|
|
3768
|
-
}
|
|
3769
|
-
declare const buildRetroEnvelope: (input: BuildRetroEnvelopeInput) => RetroEnvelope;
|
|
3770
3890
|
declare namespace comment_provenance_d_exports {
|
|
3771
3891
|
export { SHA_MATCH_MIN_LENGTH, isBotLogin, sameHeadSha };
|
|
3772
3892
|
}
|
|
@@ -3776,18 +3896,12 @@ declare const sameHeadSha: (left: string, right: string) => boolean;
|
|
|
3776
3896
|
//#endregion
|
|
3777
3897
|
//#region src/doctor-hq-checks.d.ts
|
|
3778
3898
|
/**
|
|
3779
|
-
*
|
|
3780
|
-
* epic #389 wave 2)
|
|
3781
|
-
*
|
|
3782
|
-
* Both consume #414's structured credential resolution rather than inventing
|
|
3783
|
-
* a second classification: a sandboxed session that cannot reach the
|
|
3784
|
-
* keychain is reported as "cannot resolve credentials here", never as
|
|
3785
|
-
* "credentials are wrong" or a silent pass. Both name `psf hq:flush` and
|
|
3786
|
-
* `psf pr:publish` as the commands that need a trusted local session.
|
|
3899
|
+
* The `doctor` check that makes silent HQ delivery failure loud (#394,
|
|
3900
|
+
* epic #389 wave 2): the local spool is empty, and no stranded evidence is
|
|
3901
|
+
* waiting under the spool root.
|
|
3787
3902
|
*
|
|
3788
|
-
* Advisory stays advisory:
|
|
3789
|
-
*
|
|
3790
|
-
* remote check a skip with a printed reason, never a silent pass.
|
|
3903
|
+
* Advisory stays advisory: this check can block nothing but doctor's own exit
|
|
3904
|
+
* status (epic #389 design decision 4).
|
|
3791
3905
|
*/
|
|
3792
3906
|
type DoctorCheckStatus = "error" | "ok" | "warning";
|
|
3793
3907
|
interface DoctorCheck {
|
|
@@ -3799,12 +3913,6 @@ interface HqSpoolCheckDependencies {
|
|
|
3799
3913
|
countSpool?: typeof countHqSpoolWork;
|
|
3800
3914
|
sweepOrphans?: typeof sweepHqSpoolOrphans;
|
|
3801
3915
|
}
|
|
3802
|
-
interface HqRetroReadbackCheckDependencies {
|
|
3803
|
-
fetch?: typeof fetch;
|
|
3804
|
-
readFile?: typeof readFile;
|
|
3805
|
-
resolve?: SecretReferenceResolver;
|
|
3806
|
-
timeoutMs?: number;
|
|
3807
|
-
}
|
|
3808
3916
|
//#endregion
|
|
3809
3917
|
//#region src/doctor.d.ts
|
|
3810
3918
|
interface DoctorReport {
|
|
@@ -3823,8 +3931,6 @@ interface DoctorProjectProfileInput extends LoadProjectProfileInput {
|
|
|
3823
3931
|
base?: string;
|
|
3824
3932
|
env?: NodeJS.ProcessEnv;
|
|
3825
3933
|
/** Test seam for the local HQ spool check (#394); production never sets this. */
|
|
3826
|
-
hqRetroReadbackDependencies?: HqRetroReadbackCheckDependencies;
|
|
3827
|
-
/** Test seam for the remote HQ retro-envelope read-back check (#394). */
|
|
3828
3934
|
hqSpoolDependencies?: HqSpoolCheckDependencies;
|
|
3829
3935
|
/**
|
|
3830
3936
|
* Append the read-only admission checklist (#292): every requirement this
|
|
@@ -3913,98 +4019,6 @@ declare const renderPrBodySections: ({
|
|
|
3913
4019
|
reviewProof?: PrReviewProof;
|
|
3914
4020
|
verifyProof?: PrVerifyProof;
|
|
3915
4021
|
}) => string;
|
|
3916
|
-
declare namespace boundary_manifest_d_exports {
|
|
3917
|
-
export { BOUNDARY_CLOSEOUT_DEFAULT_RUNG, BOUNDARY_MANIFEST_SCHEMA_VERSION, BoundaryManifest, BoundaryManifestExtraction, BoundaryManifestParse, FACTORY_BOUNDARY_FENCE_LANG, boundaryManifestSchema, closeoutRungFor, extractBoundaryManifestBlock, manifestContentHash, parseBoundaryManifest, rungMeetsMinimum, specContentHash };
|
|
3918
|
-
}
|
|
3919
|
-
declare const FACTORY_BOUNDARY_FENCE_LANG = "factory-boundary";
|
|
3920
|
-
declare const BOUNDARY_MANIFEST_SCHEMA_VERSION = 1;
|
|
3921
|
-
declare const BOUNDARY_CLOSEOUT_DEFAULT_RUNG: EvidenceReviewRung;
|
|
3922
|
-
declare const rungMeetsMinimum: (rung: EvidenceReviewRung, minimum: EvidenceReviewRung) => boolean;
|
|
3923
|
-
declare const boundaryManifestBaseSchema: z.ZodObject<{
|
|
3924
|
-
boundary: z.ZodString;
|
|
3925
|
-
closeout: z.ZodOptional<z.ZodObject<{
|
|
3926
|
-
review: z.ZodEnum<{
|
|
3927
|
-
oracle: "oracle";
|
|
3928
|
-
"independent-model": "independent-model";
|
|
3929
|
-
human: "human";
|
|
3930
|
-
}>;
|
|
3931
|
-
}, z.core.$loose>>;
|
|
3932
|
-
declaredBy: z.ZodString;
|
|
3933
|
-
prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3934
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
3935
|
-
topology: z.ZodEnum<{
|
|
3936
|
-
flagged: "flagged";
|
|
3937
|
-
"each-to-main": "each-to-main";
|
|
3938
|
-
stacked: "stacked";
|
|
3939
|
-
}>;
|
|
3940
|
-
waves: z.ZodArray<z.ZodObject<{
|
|
3941
|
-
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
3942
|
-
issues: z.ZodArray<z.ZodNumber>;
|
|
3943
|
-
name: z.ZodString;
|
|
3944
|
-
review: z.ZodEnum<{
|
|
3945
|
-
oracle: "oracle";
|
|
3946
|
-
"independent-model": "independent-model";
|
|
3947
|
-
human: "human";
|
|
3948
|
-
}>;
|
|
3949
|
-
}, z.core.$loose>>;
|
|
3950
|
-
}, z.core.$loose>;
|
|
3951
|
-
declare const boundaryManifestSchema: z.ZodObject<{
|
|
3952
|
-
boundary: z.ZodString;
|
|
3953
|
-
closeout: z.ZodOptional<z.ZodObject<{
|
|
3954
|
-
review: z.ZodEnum<{
|
|
3955
|
-
oracle: "oracle";
|
|
3956
|
-
"independent-model": "independent-model";
|
|
3957
|
-
human: "human";
|
|
3958
|
-
}>;
|
|
3959
|
-
}, z.core.$loose>>;
|
|
3960
|
-
declaredBy: z.ZodString;
|
|
3961
|
-
prs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
3962
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
3963
|
-
topology: z.ZodEnum<{
|
|
3964
|
-
flagged: "flagged";
|
|
3965
|
-
"each-to-main": "each-to-main";
|
|
3966
|
-
stacked: "stacked";
|
|
3967
|
-
}>;
|
|
3968
|
-
waves: z.ZodArray<z.ZodObject<{
|
|
3969
|
-
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
3970
|
-
issues: z.ZodArray<z.ZodNumber>;
|
|
3971
|
-
name: z.ZodString;
|
|
3972
|
-
review: z.ZodEnum<{
|
|
3973
|
-
oracle: "oracle";
|
|
3974
|
-
"independent-model": "independent-model";
|
|
3975
|
-
human: "human";
|
|
3976
|
-
}>;
|
|
3977
|
-
}, z.core.$loose>>;
|
|
3978
|
-
}, z.core.$loose>;
|
|
3979
|
-
type BoundaryManifest = z.infer<typeof boundaryManifestBaseSchema>;
|
|
3980
|
-
type BoundaryManifestExtraction = {
|
|
3981
|
-
ok: true;
|
|
3982
|
-
blockText: string;
|
|
3983
|
-
} | {
|
|
3984
|
-
ok: false;
|
|
3985
|
-
error: string;
|
|
3986
|
-
};
|
|
3987
|
-
declare const extractBoundaryManifestBlock: (issueBody: string) => BoundaryManifestExtraction;
|
|
3988
|
-
declare const manifestContentHash: (blockText: string) => string;
|
|
3989
|
-
declare const specContentHash: (issueBody: string) => string;
|
|
3990
|
-
type BoundaryManifestParse = {
|
|
3991
|
-
ok: true;
|
|
3992
|
-
manifest: BoundaryManifest;
|
|
3993
|
-
manifestHash: string;
|
|
3994
|
-
} | {
|
|
3995
|
-
ok: false;
|
|
3996
|
-
error: string;
|
|
3997
|
-
};
|
|
3998
|
-
declare const parseBoundaryManifest: (issueBody: string) => BoundaryManifestParse;
|
|
3999
|
-
declare const closeoutRungFor: (manifest: BoundaryManifest) => EvidenceReviewRung;
|
|
4000
|
-
//#endregion
|
|
4001
|
-
//#region src/demand-resolution.d.ts
|
|
4002
|
-
/** The boundary-manifest wave demand that applies to one pull request. */
|
|
4003
|
-
interface WaveReviewDemand {
|
|
4004
|
-
autoMerge: boolean;
|
|
4005
|
-
review: EvidenceReviewRung;
|
|
4006
|
-
wave: string;
|
|
4007
|
-
}
|
|
4008
4022
|
declare namespace readiness_evaluation_d_exports {
|
|
4009
4023
|
export { CORRECTNESS_UNTYPED_REVIEW_BLOCKER_REASON, DRAFT_BLOCKER_REASON, EvaluationInput, ManagedReadinessLedger, PENDING_CHECKS_BLOCKER_REASON_PREFIX, READINESS_REPAIR_CODES, ReadinessRepair, ReadinessStatus, SCHEMA_VERSION, SECURITY_UNTYPED_REVIEW_BLOCKER_REASON, evaluateReadiness, managedReadinessLedgerSchema, readinessExitCode, readinessRepairSchema, validateManagedReadinessLedger };
|
|
4010
4024
|
}
|
|
@@ -4056,7 +4070,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
|
|
|
4056
4070
|
ledger: {
|
|
4057
4071
|
baseSha: string;
|
|
4058
4072
|
blockingReasons: string[];
|
|
4059
|
-
classification: "
|
|
4073
|
+
classification: "docs/process-only" | "trivial" | "non-trivial";
|
|
4060
4074
|
github: {
|
|
4061
4075
|
draft: boolean;
|
|
4062
4076
|
mergeStateStatus: string;
|
|
@@ -4076,13 +4090,13 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
|
|
|
4076
4090
|
reviews: {
|
|
4077
4091
|
correctness: {
|
|
4078
4092
|
required: boolean;
|
|
4079
|
-
status: "not-required" | "
|
|
4093
|
+
status: "not-required" | "stale" | "blocked" | "current" | "missing";
|
|
4080
4094
|
reviewedHeadSha?: string | undefined;
|
|
4081
4095
|
reviewedPatchId?: string | undefined;
|
|
4082
4096
|
};
|
|
4083
4097
|
security?: {
|
|
4084
4098
|
required: boolean;
|
|
4085
|
-
status: "not-required" | "
|
|
4099
|
+
status: "not-required" | "stale" | "blocked" | "current" | "missing";
|
|
4086
4100
|
reviewedHeadSha?: string | undefined;
|
|
4087
4101
|
reviewedPatchId?: string | undefined;
|
|
4088
4102
|
} | undefined;
|
|
@@ -4090,7 +4104,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
|
|
|
4090
4104
|
schemaVersion: 1;
|
|
4091
4105
|
verification: {
|
|
4092
4106
|
command: "patronage-factory pr:verify";
|
|
4093
|
-
prVerify: "
|
|
4107
|
+
prVerify: "stale" | "passed" | "missing";
|
|
4094
4108
|
docsOnlyDeltaAccepted?: boolean | undefined;
|
|
4095
4109
|
docsOnlyVerifiedHeadSha?: string | undefined;
|
|
4096
4110
|
trivialDeltaAccepted?: boolean | undefined;
|
|
@@ -4105,7 +4119,7 @@ declare const evaluateReadiness: (input: EvaluationInput) => {
|
|
|
4105
4119
|
status: "satisfied" | "unmet" | "out-of-scope";
|
|
4106
4120
|
reason?: string | undefined;
|
|
4107
4121
|
scope?: {
|
|
4108
|
-
classifications: ("
|
|
4122
|
+
classifications: ("docs/process-only" | "trivial" | "non-trivial")[];
|
|
4109
4123
|
} | undefined;
|
|
4110
4124
|
}[] | undefined;
|
|
4111
4125
|
mergeBaseSha?: string | undefined;
|
|
@@ -4458,6 +4472,34 @@ declare const appendReviewLadderStageTraceEvent: ({
|
|
|
4458
4472
|
}) => AppendFactoryTraceEventResult;
|
|
4459
4473
|
declare const tryAppendReviewLadderStageTraceEvent: (input: Parameters<typeof appendReviewLadderStageTraceEvent>[0]) => ReviewLadderStageTraceWriteResult;
|
|
4460
4474
|
//#endregion
|
|
4475
|
+
//#region src/verification-run-context.d.ts
|
|
4476
|
+
declare const FACTORY_BASE_REF_ENV = "FACTORY_BASE_REF";
|
|
4477
|
+
declare const FACTORY_CHANGED_FILES_ENV = "FACTORY_CHANGED_FILES";
|
|
4478
|
+
declare const FACTORY_CHANGED_FILES_FILE_ENV = "FACTORY_CHANGED_FILES_FILE";
|
|
4479
|
+
declare const EMPTY_TREE_OBJECT_HASH = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
4480
|
+
declare const DEFAULT_ROOT_SHARED_GLOBS: string[];
|
|
4481
|
+
interface VerificationRunContextInput {
|
|
4482
|
+
baseRef: string;
|
|
4483
|
+
changedFiles: string[];
|
|
4484
|
+
fullSuiteBaseRef?: string;
|
|
4485
|
+
rootSharedGlobs?: string[];
|
|
4486
|
+
inlineLimitBytes?: number;
|
|
4487
|
+
tmpDir?: string;
|
|
4488
|
+
}
|
|
4489
|
+
interface VerificationEnv {
|
|
4490
|
+
env: Record<string, string>;
|
|
4491
|
+
cleanup: () => void;
|
|
4492
|
+
}
|
|
4493
|
+
interface VerificationRunContext {
|
|
4494
|
+
readonly baseRef: string;
|
|
4495
|
+
readonly changedFiles: string[];
|
|
4496
|
+
readonly forcesFullSuite: boolean;
|
|
4497
|
+
readonly fullSuiteReasons: string[];
|
|
4498
|
+
buildEnv: () => VerificationEnv;
|
|
4499
|
+
runSummaryLines: () => string[];
|
|
4500
|
+
}
|
|
4501
|
+
declare function createVerificationRunContext(input: VerificationRunContextInput): VerificationRunContext;
|
|
4502
|
+
//#endregion
|
|
4461
4503
|
//#region src/verification-battery.d.ts
|
|
4462
4504
|
type BatteryDisposition = "executed" | "not-required";
|
|
4463
4505
|
/**
|
|
@@ -4535,92 +4577,6 @@ declare const planVerificationBattery: <Command extends BatteryCandidateCommand>
|
|
|
4535
4577
|
/** Console lines naming every withheld command and why. Never silent. */
|
|
4536
4578
|
declare const batteryScopeSummaryLines: (plan: VerificationBatteryPlan<BatteryCandidateCommand>) => string[];
|
|
4537
4579
|
//#endregion
|
|
4538
|
-
//#region src/preview-lifecycle.d.ts
|
|
4539
|
-
type PreviewDisposition = "deploy" | "not-required";
|
|
4540
|
-
interface PreviewTargetPlan {
|
|
4541
|
-
basis: string;
|
|
4542
|
-
disposition: PreviewDisposition;
|
|
4543
|
-
name: string;
|
|
4544
|
-
}
|
|
4545
|
-
interface PreviewLifecyclePlan {
|
|
4546
|
-
/** The declared preview stacks to deploy, in declaration order. */
|
|
4547
|
-
deploy: string[];
|
|
4548
|
-
/** The withheld stacks, in declaration order. */
|
|
4549
|
-
notRequired: PreviewTargetPlan[];
|
|
4550
|
-
/** Whether a trusted, identity-bound stamp was available at all. */
|
|
4551
|
-
stampTrusted: boolean;
|
|
4552
|
-
/** Every declared preview target with its disposition, in declaration order. */
|
|
4553
|
-
targets: PreviewTargetPlan[];
|
|
4554
|
-
}
|
|
4555
|
-
/**
|
|
4556
|
-
* Structural subset of the profile: the impact declarations plus the external
|
|
4557
|
-
* demand list. Structural rather than a `Pick` so this module does not import
|
|
4558
|
-
* `profile.ts`.
|
|
4559
|
-
*/
|
|
4560
|
-
interface PreviewLifecycleProfile {
|
|
4561
|
-
impact?: {
|
|
4562
|
-
targets: {
|
|
4563
|
-
name: string;
|
|
4564
|
-
}[];
|
|
4565
|
-
};
|
|
4566
|
-
requiredChecks?: {
|
|
4567
|
-
name: string;
|
|
4568
|
-
}[];
|
|
4569
|
-
}
|
|
4570
|
-
/**
|
|
4571
|
-
* The declared preview stacks: impact targets that are ALSO declared required
|
|
4572
|
-
* checks — i.e. targets whose proof is produced externally, which is exactly
|
|
4573
|
-
* what a preview producer is.
|
|
4574
|
-
*
|
|
4575
|
-
* Deriving the list from the two existing declarations rather than adding a
|
|
4576
|
-
* third is what makes lifecycle and demand unable to disagree: the stacks this
|
|
4577
|
-
* plan can withhold are precisely the demands wave 2 can release, so a stack
|
|
4578
|
-
* can never be skipped while its proof stays demanded.
|
|
4579
|
-
*/
|
|
4580
|
-
declare const previewLifecycleTargets: (profile: PreviewLifecycleProfile) => string[];
|
|
4581
|
-
/**
|
|
4582
|
-
* Plan the preview lifecycle for one candidate.
|
|
4583
|
-
*
|
|
4584
|
-
* Trust is resolved here through the SAME identity gate demand release uses
|
|
4585
|
-
* (`trustedImpactStamp`): the proof must have passed and must bind both the
|
|
4586
|
-
* candidate's headSha and its patchId. A stale, aborted, absent, or
|
|
4587
|
-
* differently-bound proof yields no stamp, and every declared stack is planned
|
|
4588
|
-
* for deploy. Total over its INPUTS — no proof, stamp, or profile can make it
|
|
4589
|
-
* throw. A malformed CALL is the deliberate exception: omitting
|
|
4590
|
-
* `vetoedTargets` is API misuse, not data doubt, and throws.
|
|
4591
|
-
*/
|
|
4592
|
-
declare const planPreviewLifecycle: ({
|
|
4593
|
-
candidate,
|
|
4594
|
-
profile,
|
|
4595
|
-
proof,
|
|
4596
|
-
vetoedTargets
|
|
4597
|
-
}: {
|
|
4598
|
-
candidate: {
|
|
4599
|
-
headSha: string;
|
|
4600
|
-
patchId: string;
|
|
4601
|
-
};
|
|
4602
|
-
profile: PreviewLifecycleProfile;
|
|
4603
|
-
proof: PrVerifyProof | undefined;
|
|
4604
|
-
/**
|
|
4605
|
-
* Stack names with a current, candidate-bound FAILING envelope. Scoping is
|
|
4606
|
-
* withheld for these whatever the stamp says — the same veto demand release
|
|
4607
|
-
* applies, and for the same reason: a withheld stack is a stack that can
|
|
4608
|
-
* never re-emit the envelope its standing demand needs. Callers hold the
|
|
4609
|
-
* checkout context, so they resolve the set with `boundFailingCheckNames`
|
|
4610
|
-
* and pass it in; this module stays pure.
|
|
4611
|
-
*
|
|
4612
|
-
* REQUIRED, with no default, on purpose: a defaulted `[]` reads the same
|
|
4613
|
-
* whether the caller inspected the envelopes or never looked, and this seam
|
|
4614
|
-
* exists precisely for EXTERNAL preview producers — the callers most likely
|
|
4615
|
-
* to skip the lookup. Pass the result of `boundFailingCheckNames`; pass `[]`
|
|
4616
|
-
* only to mean "inspected the envelopes and found no bound failure".
|
|
4617
|
-
*
|
|
4618
|
-
* Deliberately visible to `api:check` as a breaking signature change
|
|
4619
|
-
* (pre-1.0, no external callers yet).
|
|
4620
|
-
*/
|
|
4621
|
-
vetoedTargets: readonly string[];
|
|
4622
|
-
}) => PreviewLifecyclePlan;
|
|
4623
|
-
//#endregion
|
|
4624
4580
|
//#region src/worker-checkout-guard.d.ts
|
|
4625
4581
|
type CheckoutDirsProbe = (cwd: string) => {
|
|
4626
4582
|
gitCommonDir: string;
|
|
@@ -4647,6 +4603,7 @@ interface CreateProgramOptions {
|
|
|
4647
4603
|
prPublish?: PrPublishAction;
|
|
4648
4604
|
prReady?: PrReadyAction;
|
|
4649
4605
|
prReview?: PrReviewAction;
|
|
4606
|
+
prStatusHud?: PrStatusHudAction;
|
|
4650
4607
|
};
|
|
4651
4608
|
factoryCliInvocation?: FactoryCliInvocation;
|
|
4652
4609
|
output?: CliOutput;
|
|
@@ -4654,4 +4611,4 @@ interface CreateProgramOptions {
|
|
|
4654
4611
|
declare function createProgram(options?: CreateProgramOptions): Command;
|
|
4655
4612
|
declare function run(argv?: string[]): Promise<void>;
|
|
4656
4613
|
//#endregion
|
|
4657
|
-
export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type
|
|
4614
|
+
export { type AppendFactoryTraceEventResult, type AssembledReviewPrompt, type BatteryCommandDisposition, type BatteryDisposition, type BoundaryCheckArgs, type BoundaryCheckDependencies, type BoundaryCheckProofRecord, type BuildEpicStructureEventInput, type CloudflareAccessServiceToken, type CompletedFactoryCheckSnapshot, CreateProgramOptions, DEFAULT_DEMAND_WAIVER_PATH, DEFAULT_FACTORY_REPOSITORY, DEFAULT_ROOT_SHARED_GLOBS, type DagDocument, type DemandWaiveArgs, type DemandWaiveDependencies, DemandWaiveRefusalError, type DemandWaiver, type DemandWaiverStore, EMPTY_TREE_OBJECT_HASH, EPIC_STRUCTURE_NODE_STATUSES, EPIC_STRUCTURE_SCHEMA_VERSION, type EpicStructureEvent, type EpicStructureGraphPayload, type EpicStructureNodeStatus, EpicStructureValidationError, type EvidenceEmitArgs, type EvidenceEmitDependencies, type EvidenceEmitResult, FACTORY_BASE_REF_ENV, FACTORY_CHANGED_FILES_ENV, FACTORY_CHANGED_FILES_FILE_ENV, type FactoryCliInvocation, FactoryCliInvocationSchema, type FactoryPrStatusCheckName, type FactoryPrStatusSources, type FactoryProjectProfile, type FactoryTraceDiagnostic, type FactoryTraceEnvelope, type FactoryTraceEvent, type FindingDisposition, type FindingLedgerEntry, type FollowUpAction, FollowUpActionSchema, type ImpactScopeDecision, type ImpactScopeSurface, type IssueReviewFocus, type LadderDispositionDeclaration, MERGE_FREEZE_APP_SLUG, MERGE_FREEZE_CHECK_NAME, type MergeFreezeState, type PlanFactoryPrStatusHudInput, type PrPublishArgs, type PrPublishDependencies, PrPublishFollowUpError, type PrPublishFollowUpOutcome, type PrPublishHandoff, type PrPublishResult, type PrReadyArgs, type PrReadyProof, type PresentFactoryPrStatusHudDependencies, type PresentFactoryPrStatusHudInput, type PreviewDisposition, type PreviewLifecyclePlan, type PreviewTargetPlan, type PublishEpicStructureArgs, type PublishEpicStructureResult, type PublishFollowUpPlan, REVIEW_FOCUS_SECTION, type ReadFactoryPrStatusSourcesDependencies, type ReadFactoryPrStatusSourcesInput, type RefreshFactoryPrStatusHudInput, type RenderFactoryPrStatusHudInput, type ReviewGateNotRequiredProof, type ReviewGateTraceIdentity, type ReviewLadderCycle, type ReviewLadderEvaluation, type ReviewLadderPolicy, type ReviewLadderStageEvent, type ReviewLadderTraceIdentity, type ReviewPromptSection, type ReviewPromptSectionProvenance, type ScanFactoryTraceDiagnosticsOptions, type ScanFactoryTraceOptions, type ScanFactoryTraceResult, type ScopedOutCommand, type TraceMirrorDiagnostic, type TraceSink, type TraceWriteResult, type TraceWriteSinks, type VerificationBatteryPlan, type VerificationReuse, type VerificationRunContext, type VerificationRunContextInput, type WaivedDemand, WorkerCheckoutGuardError, type WorkerCloseoutLessonsTraceEvent, appendReviewLadderStageTraceEvent, appendWithTraceSinks, applyDemandWaiver, assembleReviewPrompt, assertFactoryPrStatusIdentity, assertWorkerCheckoutAllowed, authorizeDemandWaiver, batteryScopeSummaryLines, blockingLadderFindings, boundary_manifest_d_exports as boundaryManifest, boundary_review_proof_d_exports as boundaryReviewProof, buildEpicStructureEvent, buildEpicStructurePayload, buildEvidenceEnvelope, buildReviewGateNotRequiredTraceEvent, buildReviewLadderStageTraceEvent, comment_provenance_d_exports as commentProvenance, createLocalJsonlTraceSink, createProgram, createVerificationRunContext, doctorProjectProfile, epicStructureEventId, evaluateReviewLadder, evidenceEnvelopeFilename, findingKey, followUpFromArgv, impactStampScopeDecision, inferFixedInThreadDispositions, isProductionHqUrl, loadProjectProfile, normalizeIssueComments, openLadderFindings, planFactoryPrStatusHud, planPreviewLifecycle, planPublishFollowUp, planVerificationBattery, readiness_evaluation_d_exports as prReadinessEvaluation, external_evidence_d_exports as prReadinessExternalEvidence, pr_body_renderer_d_exports as prReadinessPrBodyRenderer, proof_identity_d_exports as prReadinessProofIdentity, review_proof_d_exports as prReadinessReviewProof, status_check_rollup_d_exports as prReadinessStatusChecks, verification_proof_d_exports as prReadinessVerificationProof, presentFactoryPrStatusHud, previewLifecycleTargets, publishEpicStructure, readDemandWaivers, readFactoryPrStatusSources, readPrReadyProof, readPrReviewProof, refreshFactoryPrStatusHud, refreshFactoryPrStatusHudSafely, renderFactoryPrStatusHud, resolveFactoryRepository, resolveFindingBlocking, resolveReviewFindingCategory, resolveReviewFindingSeverity, resolveReviewLadderPolicy, resolveTraceWriteSinks, reviewCycleStateFor, reviewFocusFromIssueBody, reviewPromptSectionSchema, reviewPromptSectionsSchema, run, runBoundaryCheck, runDemandWaive, runEvidenceEmit, runPrPublish, runPrReady, runPrReview, runPrVerify, scanFactoryTraceDiagnostics, scanFactoryTraceEvents, selectWaiversForCandidate, staleRepeatLadderFindings, toFactoryTraceEnvelope, tryAppendReviewGateNotRequiredTraceEvent, tryAppendReviewLadderStageTraceEvent, validateBoundaryCheckProof, validateDagDocument, validateDemandWaiverStore, validateFactoryTraceEvent, validateMergeFreezeState, validatePrReadyProof, validatePrReviewProof, validatePrVerifyProof, validatePreviewLifecyclePlan, waivedDemandNotice, waivedDemandSchema, worktree_scratch_files_d_exports as worktreeScratchFiles };
|