opencode-swarm 7.162.0 → 7.162.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/background/pr-review-contract.d.ts +1 -24
- package/dist/cli/authorization-vstrh7ra.js +23 -0
- package/dist/cli/{coder-settlement-s8cskxk7.js → coder-settlement-zrda71k0.js} +9 -9
- package/dist/cli/{config-doctor-636h188h.js → config-doctor-gjw4hdvt.js} +2 -2
- package/dist/cli/{core-h3hsczyq.js → core-q5j5a7fh.js} +1 -1
- package/dist/cli/{curation-policy-ayq5kmnf.js → curation-policy-nv31cr6t.js} +5 -5
- package/dist/cli/{curator-llm-factory-g65xmh8f.js → curator-llm-factory-8d6kqsj1.js} +32 -30
- package/dist/cli/{curator-p0dwpn2x.js → curator-njskp28b.js} +32 -30
- package/dist/cli/{evidence-summary-service-hvbqyb4g.js → evidence-summary-service-5rry81jm.js} +12 -12
- package/dist/cli/{gate-evidence-dhgmnsh0.js → gate-evidence-b6k9wng8.js} +5 -5
- package/dist/cli/{guardrail-explain-s0dzn8c6.js → guardrail-explain-5yw549sm.js} +33 -31
- package/dist/cli/{guardrail-log-qc7rfhv2.js → guardrail-log-nrnx87ac.js} +7 -7
- package/dist/cli/{guardrail-reset-cxkf5h0x.js → guardrail-reset-zm5an5bw.js} +32 -30
- package/dist/cli/{hive-promoter-ppbrv8m1.js → hive-promoter-zzgnfhxr.js} +32 -30
- package/dist/cli/{index-vcv9m2q5.js → index-0myjf1y2.js} +2 -2
- package/dist/cli/{index-jw7z3gem.js → index-1eqbnwm6.js} +1 -1
- package/dist/cli/{index-q87ht62k.js → index-3b762978.js} +5 -2
- package/dist/cli/{index-r7rn6e5f.js → index-3fs3p6ck.js} +5 -5
- package/dist/cli/{index-4wmpv2kn.js → index-3gym3fjj.js} +6 -6
- package/dist/cli/{index-7z9gyts0.js → index-3nsewz46.js} +1 -1
- package/dist/cli/{index-77syzssw.js → index-5a8nk165.js} +4 -4
- package/dist/cli/{index-db520vnn.js → index-63s6t3z4.js} +1 -1
- package/dist/cli/{index-8vwe2qjh.js → index-7322jr05.js} +8 -8
- package/dist/cli/{index-z4n60b0a.js → index-9cvfa8p8.js} +1 -1
- package/dist/cli/{index-80pmq6q2.js → index-9m1ze4z4.js} +1 -1
- package/dist/cli/{index-qw893zqp.js → index-a1bh2e4f.js} +6 -6
- package/dist/cli/{index-6w468bjy.js → index-bgzdwkpe.js} +1 -1
- package/dist/cli/{index-tnj464kq.js → index-cjjcey0h.js} +1 -1
- package/dist/cli/{index-tjaawnws.js → index-f18bqg18.js} +5 -3
- package/dist/cli/{index-9wrmzsnk.js → index-fckfgptr.js} +1 -1
- package/dist/cli/{index-3gwkmq53.js → index-gss86tj3.js} +2 -2
- package/dist/cli/{index-vkaqrrsc.js → index-gwbxeh8j.js} +14 -643
- package/dist/cli/{index-1mbwgw4p.js → index-hq1gdz0g.js} +2 -2
- package/dist/cli/{index-0h63swrc.js → index-j1gq4qm8.js} +5 -5
- package/dist/cli/{index-mfewnd7j.js → index-m24pv3f4.js} +4 -4
- package/dist/cli/{index-5wq0dd30.js → index-m516tpxe.js} +2 -2
- package/dist/cli/index-mmngnxev.js +883 -0
- package/dist/cli/{index-acnwj4pc.js → index-nbfpnb0w.js} +1 -1
- package/dist/cli/{index-kk9yk7an.js → index-rkr19fdv.js} +1 -1
- package/dist/cli/{index-1wapt173.js → index-ttdjphep.js} +3 -3
- package/dist/cli/{index-ydbd41sv.js → index-v0t8z5ab.js} +1 -1
- package/dist/cli/{index-2ze7yqm8.js → index-vcen0ne4.js} +1 -1
- package/dist/cli/{index-bdmg6yvj.js → index-w1sfjffe.js} +2 -2
- package/dist/cli/index-w7ekntej.js +643 -0
- package/dist/cli/{index-pde4zn7j.js → index-wvfgkms6.js} +1 -1
- package/dist/cli/{index-25xvw7hq.js → index-xsv6zv7n.js} +34 -32
- package/dist/cli/{index-2rhs7j4r.js → index-xtjvg1wx.js} +2149 -2619
- package/dist/cli/{index-qn4w0gar.js → index-y3fgbx8g.js} +1 -1
- package/dist/cli/{index-sjkxrf06.js → index-z74stz9p.js} +4 -4
- package/dist/cli/index.js +32 -30
- package/dist/cli/{knowledge-escalator-nyeg4ndw.js → knowledge-escalator-8y3adkn0.js} +11 -11
- package/dist/cli/{knowledge-events-z7smbnff.js → knowledge-events-mnexhwe2.js} +9 -9
- package/dist/cli/{knowledge-link-0byjmj0w.js → knowledge-link-jr8rqr39.js} +4 -4
- package/dist/cli/{knowledge-store-p14t72y5.js → knowledge-store-cp42ccd1.js} +5 -5
- package/dist/cli/{knowledge-validator-jg6zhx9s.js → knowledge-validator-hwp1t6x3.js} +7 -7
- package/dist/cli/{pending-delegations-0111ywd2.js → pending-delegations-jj5vaq9q.js} +5 -4
- package/dist/cli/{pr-subscriptions-4e64sbwg.js → pr-subscriptions-mm6kyyv0.js} +4 -4
- package/dist/cli/{runner-rddddxmq.js → runner-d402vnq3.js} +5 -5
- package/dist/cli/{scan-cursor-wjad4yd7.js → scan-cursor-d75dh3hv.js} +6 -6
- package/dist/cli/{schema-9ebqj7mv.js → schema-djm1bhb8.js} +1 -1
- package/dist/cli/{scope-persistence-j5hz4mnd.js → scope-persistence-g0yc6dfa.js} +8 -8
- package/dist/cli/{skill-generator-x6b05jz6.js → skill-generator-9ppgxz4j.js} +13 -13
- package/dist/cli/{worktree-collision-ownership-g5n5xbqy.js → worktree-collision-ownership-061zmyyp.js} +6 -5
- package/dist/cli/{worktree-isolation-ha70bwes.js → worktree-isolation-vk82698z.js} +32 -30
- package/dist/hooks/pr-workflow-gate.d.ts +20 -245
- package/dist/index.js +374 -374
- package/dist/{hooks/pr-review-reentry-authorization.d.ts → pr-review/authorization.d.ts} +32 -10
- package/dist/{hooks/pr-review-resilience-circuit.d.ts → pr-review/circuit.d.ts} +60 -3
- package/dist/pr-review/completion.d.ts +373 -0
- package/dist/pr-review/critic-routing.d.ts +37 -0
- package/dist/pr-review/guardrails.d.ts +67 -0
- package/dist/pr-review/legacy-transcript-adapter.d.ts +276 -0
- package/dist/pr-review/persistence.d.ts +107 -0
- package/dist/pr-review/reducer.d.ts +54 -0
- package/dist/pr-review/types.d.ts +225 -0
- package/package.json +1 -1
- package/dist/cli/pr-review-reentry-authorization-b7ceja9y.js +0 -301
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* PR-review authorization boundary (issues #2383, #2385).
|
|
3
|
+
*
|
|
4
|
+
* Correlated one-use reviewer re-entry authorization, moved behind the
|
|
5
|
+
* `src/pr-review/` boundary (issue #2385). This module replaces prompt-text
|
|
6
|
+
* inspection (`MODE: PR_REVIEW`) as the ONLY way a direct Task dispatch of
|
|
7
|
+
* `reviewer`/`test_engineer` may bypass the generic Stage-A task-workflow
|
|
8
|
+
* requirement. The PR workflow controller issues an authorization bound to
|
|
9
|
+
* the exact active session, workflow, run, base/head SHA, worktree revision
|
|
10
|
+
* digest, role, and gate generation; the Task delegation gate consumes it
|
|
11
|
+
* atomically, exactly once. Stale, cross-session, wrong-role, replayed,
|
|
12
|
+
* expired, or revision-drifted requests fail closed to the normal gating
|
|
13
|
+
* path.
|
|
4
14
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* delegation gate consumes it atomically, exactly once. Stale, cross-session,
|
|
11
|
-
* wrong-role, replayed, expired, or revision-drifted requests fail closed to
|
|
12
|
-
* the normal gating path.
|
|
15
|
+
* Binding verification: the CURRENT gate binding (head/revision/generation)
|
|
16
|
+
* is supplied by the owning gate through a bound reader
|
|
17
|
+
* (`bindPrReviewReentryBindingReader`) — the boundary must not import the
|
|
18
|
+
* orchestration gate back. The gate binds its
|
|
19
|
+
* `readPrReviewReentryBindingContext` at module init.
|
|
13
20
|
*
|
|
14
21
|
* Persistence: `.swarm/pr-review/reentry-authorizations/<session-stem>.json`,
|
|
15
22
|
* guarded by a `proper-lockfile` lock (the same dependency the candidate
|
|
16
23
|
* sidecar store uses). Bounded: at most MAX_ACTIVE_AUTHORIZATIONS unconsumed
|
|
17
24
|
* authorizations per session; expired/unconsumed records are pruned on write.
|
|
18
25
|
*/
|
|
26
|
+
import { z } from 'zod';
|
|
19
27
|
export type PrReviewReentryRole = 'reviewer' | 'test_engineer';
|
|
20
28
|
export interface PrReviewReentryAuthorizationRecord {
|
|
21
29
|
schemaVersion: 1;
|
|
@@ -32,6 +40,20 @@ export interface PrReviewReentryAuthorizationRecord {
|
|
|
32
40
|
consumedAt?: string;
|
|
33
41
|
consumedCallId?: string;
|
|
34
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* The CURRENT active-workflow binding an authorization must match at issue
|
|
45
|
+
* AND at consume time. Supplied by the owning gate (which reads state through
|
|
46
|
+
* the persistence boundary) via `bindPrReviewReentryBindingReader`.
|
|
47
|
+
*/
|
|
48
|
+
export interface PrReviewReentryBindingContext {
|
|
49
|
+
prHeadSha: string;
|
|
50
|
+
revisionDigest: string;
|
|
51
|
+
generation: number;
|
|
52
|
+
workflowInstanceId?: string;
|
|
53
|
+
runId?: string;
|
|
54
|
+
}
|
|
55
|
+
export type PrReviewReentryBindingReader = (directory: string, sessionID: string) => Promise<PrReviewReentryBindingContext | null>;
|
|
56
|
+
export declare function bindPrReviewReentryBindingReader(reader: PrReviewReentryBindingReader): void;
|
|
35
57
|
declare const AuthorizationFileSchema: z.ZodObject<{
|
|
36
58
|
schemaVersion: z.ZodLiteral<1>;
|
|
37
59
|
sessionId: z.ZodString;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PR-review resilience circuit — typed, recoverable, versioned (
|
|
2
|
+
* PR-review resilience circuit — typed, recoverable, versioned (issues
|
|
3
|
+
* #2382, #2385).
|
|
3
4
|
*
|
|
4
5
|
* Pure state machine + typed-signal classification for the PR_REVIEW
|
|
5
6
|
* resilience circuit. No I/O: the owning gate (`pr-workflow-gate.ts`) reads
|
|
@@ -17,9 +18,17 @@
|
|
|
17
18
|
* waterline) or back to OPEN (new interval). Legacy unversioned records
|
|
18
19
|
* migrate once to a nonblocking v2 CLOSED record with an evidence waterline;
|
|
19
20
|
* malformed records fail open.
|
|
21
|
+
*
|
|
22
|
+
* Issue #2385 additionally makes this module the ONLY authority that may
|
|
23
|
+
* construct or transition circuit records: policy snapshot resolution, the
|
|
24
|
+
* re-enable reset, and the rolled-back-probe transition live here (previously
|
|
25
|
+
* inline record constructions in the gate). The parallel-rule guardrail
|
|
26
|
+
* (`src/pr-review/guardrails.ts`) enforces that no circuit record is built
|
|
27
|
+
* outside `src/pr-review/`.
|
|
20
28
|
*/
|
|
21
29
|
import { z } from 'zod';
|
|
22
30
|
import type { BackgroundDelegationRecord } from '../background/pending-delegations.js';
|
|
31
|
+
import { type PrReviewResilienceConfig } from '../config/schema.js';
|
|
23
32
|
/** Bounded contributor ledger. Mirrors `MAX_WORKFLOW_BATCHES (128) × 6` base dimensions. */
|
|
24
33
|
export declare const PR_REVIEW_CIRCUIT_CONTRIBUTOR_LIMIT = 768;
|
|
25
34
|
export type PrReviewCircuitIgnoredReason = 'observer_deadline' | 'client_unavailable' | 'parser' | 'validation' | 'policy' | 'filesystem' | 'git' | 'cancellation' | 'stale_observation' | 'unknown';
|
|
@@ -67,6 +76,20 @@ export interface PrReviewCircuitLegacyRecord {
|
|
|
67
76
|
}>;
|
|
68
77
|
openedAt: string;
|
|
69
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* The persisted circuit union: a v2 record or a legacy unversioned record
|
|
81
|
+
* awaiting migration.
|
|
82
|
+
*/
|
|
83
|
+
export type PrReviewCircuitRecord = PrReviewCircuitLegacyRecord | PrReviewCircuitRecordV2;
|
|
84
|
+
export interface PrReviewResiliencePolicyRecord {
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
canaryProbeMs: number;
|
|
87
|
+
statusProbeTimeoutMs: number;
|
|
88
|
+
correlatedFailureThreshold: number;
|
|
89
|
+
maxRetryAttemptsAfterInitial: number;
|
|
90
|
+
/** Issue #2382. Optional: policies persisted before the field existed parse unchanged. */
|
|
91
|
+
circuitOpenDurationMs?: number;
|
|
92
|
+
}
|
|
70
93
|
export declare const PrReviewCircuitLegacyRecordSchema: z.ZodObject<{
|
|
71
94
|
signature: z.ZodString;
|
|
72
95
|
count: z.ZodNumber;
|
|
@@ -130,6 +153,12 @@ export declare const PrReviewCircuitRecordSchema: z.ZodUnion<readonly [z.ZodObje
|
|
|
130
153
|
admittedAt: z.ZodString;
|
|
131
154
|
}, z.core.$strict>>;
|
|
132
155
|
}, z.core.$strict>]>;
|
|
156
|
+
/**
|
|
157
|
+
* The terminal delegation statuses the circuit consults. The single shared
|
|
158
|
+
* definition (issue #2385): the gate's settlement paths and this module read
|
|
159
|
+
* the same vocabulary.
|
|
160
|
+
*/
|
|
161
|
+
export declare const CIRCUIT_TERMINAL_DELEGATION_STATUSES: ReadonlySet<string>;
|
|
133
162
|
/**
|
|
134
163
|
* Derive the typed circuit signal from a durable delegation record's LATEST
|
|
135
164
|
* terminal state. Returns `null` for anything that is not a terminal failure
|
|
@@ -190,7 +219,7 @@ export interface PrReviewCircuitAdvanceInput {
|
|
|
190
219
|
admission?: {
|
|
191
220
|
batchId: string;
|
|
192
221
|
laneId: string;
|
|
193
|
-
};
|
|
222
|
+
} | undefined;
|
|
194
223
|
/** Latest-record signals for every dispatch lane of the current workflow. */
|
|
195
224
|
laneSignals: readonly PrReviewCircuitSignal[];
|
|
196
225
|
/**
|
|
@@ -202,7 +231,7 @@ export interface PrReviewCircuitAdvanceInput {
|
|
|
202
231
|
terminalStatus: string;
|
|
203
232
|
signal: PrReviewCircuitSignal | null;
|
|
204
233
|
terminalAtMs: number;
|
|
205
|
-
};
|
|
234
|
+
} | undefined;
|
|
206
235
|
}
|
|
207
236
|
export type PrReviewCircuitAdvanceResult = {
|
|
208
237
|
action: 'admit';
|
|
@@ -230,3 +259,31 @@ export type PrReviewCircuitAdvanceResult = {
|
|
|
230
259
|
* gate passes an explicit waterlined record for migration / re-enable births).
|
|
231
260
|
*/
|
|
232
261
|
export declare function advancePrReviewCircuit(current: PrReviewCircuitRecordV2 | null, input: PrReviewCircuitAdvanceInput): PrReviewCircuitAdvanceResult;
|
|
262
|
+
/**
|
|
263
|
+
* Resolve the effective resilience policy record from optional config. Every
|
|
264
|
+
* default comes from `DEFAULT_PR_REVIEW_RESILIENCE_CONFIG` (single source);
|
|
265
|
+
* a hardcoded literal here would drift from the config schema (issue #2385
|
|
266
|
+
* recurrence class G-2).
|
|
267
|
+
*/
|
|
268
|
+
export declare function resolvePrReviewResiliencePolicy(policy?: PrReviewResilienceConfig): PrReviewResiliencePolicyRecord;
|
|
269
|
+
/**
|
|
270
|
+
* Issue #2382 re-enable semantics (issue #2385: moved behind the machine).
|
|
271
|
+
* Re-enabling resilience after a live disable starts from a fresh v2 CLOSED
|
|
272
|
+
* generation with an evidence waterline at `nowMs` — pre-disable evidence can
|
|
273
|
+
* never resurrect. Generation strictly increases.
|
|
274
|
+
*/
|
|
275
|
+
export declare function resetPrReviewResilienceForReEnable(args: {
|
|
276
|
+
previousCircuit?: PrReviewCircuitRecord | null;
|
|
277
|
+
policy: PrReviewResiliencePolicyRecord;
|
|
278
|
+
nowMs: number;
|
|
279
|
+
}): PrReviewCircuitRecordV2;
|
|
280
|
+
/**
|
|
281
|
+
* Issue #2382 review (PRR-002) rolled-back-probe transition (issue #2385:
|
|
282
|
+
* moved behind the machine). A rolled-back HALF_OPEN probe can never produce
|
|
283
|
+
* a terminal record — the rollback's own precondition is that the batch has
|
|
284
|
+
* zero delegation records — so leaving the probe in place would wedge the
|
|
285
|
+
* circuit on probe_in_flight forever. End the probe lifecycle exactly the way
|
|
286
|
+
* an ignored outcome does: state stays OPEN with a restarted recovery
|
|
287
|
+
* cooldown, and no contributor, generation, or waterline changes.
|
|
288
|
+
*/
|
|
289
|
+
export declare function rollbackPrReviewCircuitProbe(circuit: PrReviewCircuitRecordV2, nowMs: number, openDurationMs: number): PrReviewCircuitRecordV2;
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PR-review completion / coverage-settlement authority (issues #2383, #2385).
|
|
3
|
+
*
|
|
4
|
+
* The six-dimension coverage reduction and terminal report eligibility
|
|
5
|
+
* machinery, moved out of `src/hooks/pr-workflow-gate.ts` behind the
|
|
6
|
+
* `src/pr-review/` boundary (issue #2385). This module owns:
|
|
7
|
+
*
|
|
8
|
+
* - the coverage-disclosure record vocabulary (v2 plural + legacy v1 singular),
|
|
9
|
+
* its Zod schemas, and the single legacy→v2 normalization read boundary;
|
|
10
|
+
* - the per-dimension attempt summary (`summarizePrReviewBaseDimensionAttempts`)
|
|
11
|
+
* and the terminal N-of-6 settlement derivation
|
|
12
|
+
* (`derivePrReviewDimensionSettlement`);
|
|
13
|
+
* - the disclosure admission / rollback / settled-assertion state machine
|
|
14
|
+
* (`admitPrReviewPartialBaseCoverage`,
|
|
15
|
+
* `rollbackPrReviewPartialBaseCoverageAdmission`,
|
|
16
|
+
* `assertPrReviewBaseCoverageSettled`);
|
|
17
|
+
* - the verdict eligibility matrix for terminal reports
|
|
18
|
+
* (`allowedPrReviewReportVerdicts`) and the read-only report projection
|
|
19
|
+
* (`readPrReviewTerminalCoverageForReport`).
|
|
20
|
+
*
|
|
21
|
+
* Binding contract (same precedent as `bindPrReviewReentryBindingReader` in
|
|
22
|
+
* `authorization.ts`): the boundary must never import the orchestration gate
|
|
23
|
+
* back. Gate-owned derivation helpers (`successfulObligationsFromExactBatch`,
|
|
24
|
+
* `recordsPassingBatchIntegrity`, `validatePrReviewDiscoveryLaneCompletion`,
|
|
25
|
+
* `validateExactStructuredReceiptCoverage`, `readBoundedSwarmRegularFile`,
|
|
26
|
+
* `createPrReviewGateContext`, `requireBoundState`,
|
|
27
|
+
* `readPrWorkflowGateStateFromDisk`) are supplied by the owning gate through
|
|
28
|
+
* `bindPrReviewCompletionHelpers`, bound once at gate module init.
|
|
29
|
+
*
|
|
30
|
+
* State typing: the moved functions read only the PR-review slice of
|
|
31
|
+
* `PrWorkflowGateState`, expressed as the local structural interface
|
|
32
|
+
* `PrReviewCompletionState`. The gate passes its full state, which satisfies
|
|
33
|
+
* the slice structurally. Durable reads/writes still go through
|
|
34
|
+
* `src/pr-review/persistence.ts` (the atomic persistence boundary) — this
|
|
35
|
+
* module never writes state outside `withSessionStateMutation` /
|
|
36
|
+
* `writeStateWhileLocked`.
|
|
37
|
+
*/
|
|
38
|
+
import { z } from 'zod';
|
|
39
|
+
import { type LaneOutputArtifact } from '../background/lane-output-store.js';
|
|
40
|
+
import { type BackgroundDelegationRecord, type BackgroundDelegationResult, type BackgroundDelegationWorkflowLaneFailureClass } from '../background/pending-delegations.js';
|
|
41
|
+
import { type PrReviewBaseDimensionId, type PrReviewResultReceipt } from '../background/pr-review-contract.js';
|
|
42
|
+
/** Declared lane shape of a base dispatch, as the settlement reads it. */
|
|
43
|
+
export interface PrReviewCompletionLane {
|
|
44
|
+
laneId: string;
|
|
45
|
+
workflowLane: string;
|
|
46
|
+
ownedWorkflowLanes?: readonly string[];
|
|
47
|
+
}
|
|
48
|
+
/** Base dispatch batch, as the settlement reads it. */
|
|
49
|
+
export interface PrReviewCompletionBaseDispatchRecord {
|
|
50
|
+
batchId: string;
|
|
51
|
+
lanes: ReadonlyArray<PrReviewCompletionLane>;
|
|
52
|
+
validatedAt: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The PR-review slice of the owning gate's `PrWorkflowGateState`: exactly the
|
|
56
|
+
* fields the moved settlement machinery reads. The gate's full state type
|
|
57
|
+
* satisfies this structurally, so the gate passes its state without a
|
|
58
|
+
* projection step. `schemaVersion`/`revision`/`sessionID` mirror
|
|
59
|
+
* `PrWorkflowPersistedStateBase` in `persistence.ts` so the CAS write generic
|
|
60
|
+
* accepts the slice.
|
|
61
|
+
*/
|
|
62
|
+
export interface PrReviewCompletionState {
|
|
63
|
+
schemaVersion: number;
|
|
64
|
+
revision: number;
|
|
65
|
+
sessionID: string;
|
|
66
|
+
workflowInstanceId?: string;
|
|
67
|
+
mode?: string;
|
|
68
|
+
prHeadSha?: string;
|
|
69
|
+
prReviewBaseSha?: string;
|
|
70
|
+
prReviewBaseDispatches?: PrReviewCompletionBaseDispatchRecord[];
|
|
71
|
+
prReviewContractRetryDimensions?: PrReviewBaseDimensionId[];
|
|
72
|
+
prReviewReservedRunId?: string;
|
|
73
|
+
prReviewArtifactRunId?: string;
|
|
74
|
+
prReviewArtifactBoundaries?: Array<'post_explorer' | 'post_reviewer' | 'post_critic'>;
|
|
75
|
+
prReviewDimensionCancellations?: Partial<Record<PrReviewBaseDimensionId, PrReviewDimensionCancellationRecord>>;
|
|
76
|
+
prReviewPartialBaseCoverage?: PrReviewPartialBaseCoverageRecord;
|
|
77
|
+
prReviewCoverageDisclosurePath?: string;
|
|
78
|
+
prReviewCoverageDisclosureDigest?: string;
|
|
79
|
+
}
|
|
80
|
+
/** The gate-context surface the settlement consumes (full ctx is gate-owned). */
|
|
81
|
+
export interface PrReviewCompletionGateContext {
|
|
82
|
+
readonly revisionDigest: string;
|
|
83
|
+
}
|
|
84
|
+
/** A batch-integrity-qualified record, as the settlement consumes it. */
|
|
85
|
+
export interface PrReviewCompletionQualifiedRecord {
|
|
86
|
+
record: BackgroundDelegationRecord;
|
|
87
|
+
expectedLane: PrReviewCompletionLane;
|
|
88
|
+
expectedWorkflowLane: string;
|
|
89
|
+
expectedOwnedLanes: string[];
|
|
90
|
+
}
|
|
91
|
+
/** Discovery-lane validation input, as the settlement supplies it. */
|
|
92
|
+
export interface PrReviewCompletionDiscoveryValidationInput {
|
|
93
|
+
record: BackgroundDelegationRecord;
|
|
94
|
+
result: BackgroundDelegationResult;
|
|
95
|
+
artifact: LaneOutputArtifact | null;
|
|
96
|
+
expected: {
|
|
97
|
+
mode: string;
|
|
98
|
+
workflowLane: string;
|
|
99
|
+
ownedWorkflowLanes?: readonly string[];
|
|
100
|
+
prHeadSha: string;
|
|
101
|
+
gitHead: string;
|
|
102
|
+
revisionDigest: string;
|
|
103
|
+
workflowInstanceId?: string;
|
|
104
|
+
workflowRevision?: number;
|
|
105
|
+
baseSha?: string;
|
|
106
|
+
reviewScope?: string;
|
|
107
|
+
checkWorkflowLane?: boolean;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** Structured-receipt coverage verdict, as the settlement consumes it. */
|
|
111
|
+
export type PrReviewCompletionStructuredReceiptCoverage = {
|
|
112
|
+
status: 'absent';
|
|
113
|
+
} | {
|
|
114
|
+
status: 'accepted';
|
|
115
|
+
receipt: PrReviewResultReceipt;
|
|
116
|
+
} | {
|
|
117
|
+
status: 'rejected';
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Gate-owned derivation helpers, bound by the owning gate at module init so
|
|
121
|
+
* this boundary never imports the gate back. Declared with method syntax on
|
|
122
|
+
* purpose: the gate's implementations accept/return its FULL state and result
|
|
123
|
+
* types, which are structural supersets of the slices below, and interface
|
|
124
|
+
* method parameters are checked bivariantly.
|
|
125
|
+
*/
|
|
126
|
+
export interface PrReviewCompletionGateHelpers {
|
|
127
|
+
createPrReviewGateContext(directory: string, state: PrReviewCompletionState): Promise<PrReviewCompletionGateContext>;
|
|
128
|
+
requireBoundState(directory: string, sessionID: string, expectedMode: string): Promise<PrReviewCompletionState>;
|
|
129
|
+
readPrWorkflowGateStateFromDisk(directory: string, sessionID: string): Promise<PrReviewCompletionState | null>;
|
|
130
|
+
readBoundedSwarmRegularFile(directory: string, relativePath: string, maxBytes: number, label: string): Promise<string>;
|
|
131
|
+
successfulObligationsFromExactBatch(directory: string, state: PrReviewCompletionState, batchId: string, expectedLanes: ReadonlyArray<PrReviewCompletionLane>, expectedMode: string, validatedAt: string, checkWorkflowLane?: boolean, forbiddenSubagentSessionIds?: ReadonlySet<string>, expectedRevisionDigest?: string, diagnostics?: string[]): Set<string>;
|
|
132
|
+
recordsPassingBatchIntegrity(directory: string, state: PrReviewCompletionState, batchId: string, expectedLanes: ReadonlyArray<PrReviewCompletionLane>, expectedMode: string, validatedAt: string, checkWorkflowLane?: boolean, forbiddenSubagentSessionIds?: ReadonlySet<string>, diagnostics?: string[]): PrReviewCompletionQualifiedRecord[];
|
|
133
|
+
validatePrReviewDiscoveryLaneCompletion(input: PrReviewCompletionDiscoveryValidationInput): {
|
|
134
|
+
ok: boolean;
|
|
135
|
+
};
|
|
136
|
+
validateExactStructuredReceiptCoverage(input: PrReviewCompletionDiscoveryValidationInput): PrReviewCompletionStructuredReceiptCoverage;
|
|
137
|
+
}
|
|
138
|
+
export declare function bindPrReviewCompletionHelpers(helpers: PrReviewCompletionGateHelpers): void;
|
|
139
|
+
/**
|
|
140
|
+
* Normalized terminal state of one canonical base dimension (issue #2383).
|
|
141
|
+
* Every dimension ends in exactly one of these; completion requires every
|
|
142
|
+
* LAUNCHED lane to be terminal (COVERED/FAILED) or explicitly cancelled, with
|
|
143
|
+
* no in-flight lane and no late result creditable to the active generation.
|
|
144
|
+
*/
|
|
145
|
+
export type PrReviewDimensionTerminalState = 'COVERED' | 'FAILED' | 'CANCELLED' | 'NOT_LAUNCHED';
|
|
146
|
+
/** Gate-derived per-dimension terminal evidence for an unresolved dimension. */
|
|
147
|
+
export interface PrReviewUnresolvedDimensionRecord {
|
|
148
|
+
dimension: PrReviewBaseDimensionId;
|
|
149
|
+
terminalState: 'FAILED' | 'CANCELLED' | 'NOT_LAUNCHED';
|
|
150
|
+
reasonKind: 'lane_failure' | 'cancelled' | 'not_launched';
|
|
151
|
+
failureClass?: BackgroundDelegationWorkflowLaneFailureClass;
|
|
152
|
+
terminalEventId?: string;
|
|
153
|
+
/** Contributing lane/batch identity, when available. */
|
|
154
|
+
batchId?: string;
|
|
155
|
+
laneId?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Bounded safe detail derived from the failure-class vocabulary — never
|
|
158
|
+
* lane output, prompts, or secrets.
|
|
159
|
+
*/
|
|
160
|
+
safeDetail?: string;
|
|
161
|
+
}
|
|
162
|
+
/** v2 terminal-settlement disclosure (issue #2383). The ONLY shape new writers emit. */
|
|
163
|
+
export interface PrReviewPartialBaseCoverageRecordV2 {
|
|
164
|
+
schemaVersion: 2;
|
|
165
|
+
runId: string;
|
|
166
|
+
prHeadSha: string;
|
|
167
|
+
revisionDigest: string;
|
|
168
|
+
unresolvedDimensions: PrReviewUnresolvedDimensionRecord[];
|
|
169
|
+
admittedAt: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Legacy v1 disclosure (pre-#2383): singular `missingDimension` with a typed
|
|
173
|
+
* terminal failure. Read-only — normalized to the v2 in-memory view at the
|
|
174
|
+
* single read boundary; never rewritten on disk.
|
|
175
|
+
*/
|
|
176
|
+
export interface PrReviewPartialBaseCoverageRecordV1 {
|
|
177
|
+
runId: string;
|
|
178
|
+
prHeadSha: string;
|
|
179
|
+
revisionDigest: string;
|
|
180
|
+
missingDimension: PrReviewBaseDimensionId;
|
|
181
|
+
failureClass: BackgroundDelegationWorkflowLaneFailureClass;
|
|
182
|
+
terminalEventId: string;
|
|
183
|
+
admittedAt: string;
|
|
184
|
+
}
|
|
185
|
+
export type PrReviewPartialBaseCoverageRecord = PrReviewPartialBaseCoverageRecordV2 | PrReviewPartialBaseCoverageRecordV1;
|
|
186
|
+
/** Terminal report kind of an N-of-6 settlement (issue #2383). */
|
|
187
|
+
export type PrReviewTerminalCoverageKind = 'COMPLETE' | 'PARTIAL' | 'NO_COVERAGE';
|
|
188
|
+
/** Controller-declared terminal verdict for a PR_REVIEW completion (issue #2383). */
|
|
189
|
+
export declare const PR_REVIEW_REPORT_VERDICTS: readonly ["APPROVE", "REQUEST_CHANGES", "INCOMPLETE"];
|
|
190
|
+
export type PrReviewReportVerdict = (typeof PR_REVIEW_REPORT_VERDICTS)[number];
|
|
191
|
+
/**
|
|
192
|
+
* Verdicts a terminal report may carry by coverage kind (issue #2383):
|
|
193
|
+
* PARTIAL may only request changes or declare itself incomplete; NO_COVERAGE
|
|
194
|
+
* is a forced INCOMPLETE operational report. Neither may ever APPROVE or
|
|
195
|
+
* claim a full review.
|
|
196
|
+
*/
|
|
197
|
+
export declare function allowedPrReviewReportVerdicts(kind: PrReviewTerminalCoverageKind): readonly PrReviewReportVerdict[];
|
|
198
|
+
export interface PrReviewTerminalCoverageSettlement {
|
|
199
|
+
kind: PrReviewTerminalCoverageKind;
|
|
200
|
+
coveredDimensions: PrReviewBaseDimensionId[];
|
|
201
|
+
unresolvedDimensions: PrReviewUnresolvedDimensionRecord[];
|
|
202
|
+
/** False while any dimension still has a live (in-flight) lane. */
|
|
203
|
+
allLaunchedTerminal: boolean;
|
|
204
|
+
}
|
|
205
|
+
/** Per-dimension explicit cancellation, written by armed recovery (issue #2383). */
|
|
206
|
+
export interface PrReviewDimensionCancellationRecord {
|
|
207
|
+
reason: string;
|
|
208
|
+
cancelledAt: string;
|
|
209
|
+
source: 'armed_recovery';
|
|
210
|
+
}
|
|
211
|
+
export declare const PrReviewPartialBaseCoverageRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
212
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
213
|
+
runId: z.ZodString;
|
|
214
|
+
prHeadSha: z.ZodString;
|
|
215
|
+
revisionDigest: z.ZodString;
|
|
216
|
+
unresolvedDimensions: z.ZodArray<z.ZodObject<{
|
|
217
|
+
dimension: z.ZodEnum<{
|
|
218
|
+
"intent-architecture": "intent-architecture";
|
|
219
|
+
"correctness-state": "correctness-state";
|
|
220
|
+
"tests-falsifiability": "tests-falsifiability";
|
|
221
|
+
"security-trust": "security-trust";
|
|
222
|
+
"reliability-performance": "reliability-performance";
|
|
223
|
+
"compatibility-delivery": "compatibility-delivery";
|
|
224
|
+
}>;
|
|
225
|
+
terminalState: z.ZodEnum<{
|
|
226
|
+
FAILED: "FAILED";
|
|
227
|
+
CANCELLED: "CANCELLED";
|
|
228
|
+
NOT_LAUNCHED: "NOT_LAUNCHED";
|
|
229
|
+
}>;
|
|
230
|
+
reasonKind: z.ZodEnum<{
|
|
231
|
+
cancelled: "cancelled";
|
|
232
|
+
lane_failure: "lane_failure";
|
|
233
|
+
not_launched: "not_launched";
|
|
234
|
+
}>;
|
|
235
|
+
failureClass: z.ZodOptional<z.ZodEnum<{
|
|
236
|
+
contract: "contract";
|
|
237
|
+
resource: "resource";
|
|
238
|
+
deadline: "deadline";
|
|
239
|
+
}>>;
|
|
240
|
+
terminalEventId: z.ZodOptional<z.ZodString>;
|
|
241
|
+
batchId: z.ZodOptional<z.ZodString>;
|
|
242
|
+
laneId: z.ZodOptional<z.ZodString>;
|
|
243
|
+
safeDetail: z.ZodOptional<z.ZodString>;
|
|
244
|
+
}, z.core.$strict>>;
|
|
245
|
+
admittedAt: z.ZodString;
|
|
246
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
247
|
+
runId: z.ZodString;
|
|
248
|
+
prHeadSha: z.ZodString;
|
|
249
|
+
revisionDigest: z.ZodString;
|
|
250
|
+
missingDimension: z.ZodEnum<{
|
|
251
|
+
"intent-architecture": "intent-architecture";
|
|
252
|
+
"correctness-state": "correctness-state";
|
|
253
|
+
"tests-falsifiability": "tests-falsifiability";
|
|
254
|
+
"security-trust": "security-trust";
|
|
255
|
+
"reliability-performance": "reliability-performance";
|
|
256
|
+
"compatibility-delivery": "compatibility-delivery";
|
|
257
|
+
}>;
|
|
258
|
+
failureClass: z.ZodEnum<{
|
|
259
|
+
contract: "contract";
|
|
260
|
+
resource: "resource";
|
|
261
|
+
deadline: "deadline";
|
|
262
|
+
}>;
|
|
263
|
+
terminalEventId: z.ZodString;
|
|
264
|
+
admittedAt: z.ZodString;
|
|
265
|
+
}, z.core.$strict>]>;
|
|
266
|
+
export declare const PrReviewDimensionCancellationRecordSchema: z.ZodObject<{
|
|
267
|
+
reason: z.ZodString;
|
|
268
|
+
cancelledAt: z.ZodString;
|
|
269
|
+
source: z.ZodLiteral<"armed_recovery">;
|
|
270
|
+
}, z.core.$strict>;
|
|
271
|
+
/**
|
|
272
|
+
* Normalize any disclosure record to the v2 in-memory view. A legacy v1
|
|
273
|
+
* record maps to exactly one FAILED entry; the durable file is never
|
|
274
|
+
* rewritten (its digest stays bound to the original bytes).
|
|
275
|
+
*/
|
|
276
|
+
export declare function normalizePrReviewPartialBaseCoverageRecord(record: PrReviewPartialBaseCoverageRecord): PrReviewPartialBaseCoverageRecordV2;
|
|
277
|
+
export interface PrReviewBaseDimensionAttempts {
|
|
278
|
+
/** Dimensions with a currently authoritative successful artifact. */
|
|
279
|
+
successful: Set<string>;
|
|
280
|
+
/** Dimensions with a currently in-flight or retryable recorded lane. */
|
|
281
|
+
inFlight: Set<string>;
|
|
282
|
+
/** Dimensions whose terminal record was a contract failure. */
|
|
283
|
+
contractFailed: Set<string>;
|
|
284
|
+
/** Dimensions that already consumed the dedicated contract retry channel. */
|
|
285
|
+
contractRetried: Set<string>;
|
|
286
|
+
/**
|
|
287
|
+
* The subset of `successful` supplied by a lane that owns that dimension
|
|
288
|
+
* alone. Used by the cumulative tier-L lane floor to decide when an earlier
|
|
289
|
+
* consolidated lane has been superseded and no longer spends lane budget.
|
|
290
|
+
*/
|
|
291
|
+
dedicatedSuccessful: Set<string>;
|
|
292
|
+
/** Dimensions whose recorded lane ran to a terminal, non-successful end. */
|
|
293
|
+
terminallyFailed: Set<string>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Per-dimension success/failure across every recorded base batch.
|
|
297
|
+
*
|
|
298
|
+
* The two halves deliberately use different evidence:
|
|
299
|
+
*
|
|
300
|
+
* - **successful** is revision-aware (`successfulObligationsFromExactBatch`
|
|
301
|
+
* compares each artifact's `revisionDigest` against the current worktree), so
|
|
302
|
+
* a stale artifact is correctly not a current source.
|
|
303
|
+
* - **terminallyFailed** is revision-INdependent on purpose.
|
|
304
|
+
* `recordsPassingBatchIntegrity` plus
|
|
305
|
+
* `hasRevisionIndependentDiscoverySemantics` use the artifact's recorded
|
|
306
|
+
* revision rather than the current worktree digest. If failure were
|
|
307
|
+
* derived from the revision-aware set instead, any working-tree edit would
|
|
308
|
+
* make all six dimensions read as "failed" at once and a caller could then
|
|
309
|
+
* consolidate the whole base wave into two lanes — re-opening the tier-L lane
|
|
310
|
+
* floor by a second route (issue #1968 BL-4).
|
|
311
|
+
*/
|
|
312
|
+
export declare function summarizePrReviewBaseDimensionAttempts(directory: string, state: PrReviewCompletionState, revisionDigest: string): PrReviewBaseDimensionAttempts;
|
|
313
|
+
export declare function coverageDisclosureRelativePath(runId: string): string;
|
|
314
|
+
/**
|
|
315
|
+
* Derive the normalized terminal N-of-6 settlement (issue #2383).
|
|
316
|
+
*
|
|
317
|
+
* Pure over durable state: no mutation, no audit. Every dimension maps to
|
|
318
|
+
* exactly one view — COVERED, a terminal unresolved record (FAILED /
|
|
319
|
+
* CANCELLED / NOT_LAUNCHED), or a live (in-flight) dimension that blocks
|
|
320
|
+
* settlement. Coverage success is revision-aware (a stale artifact never
|
|
321
|
+
* counts on the current worktree), and a FAILED dimension carries the typed
|
|
322
|
+
* terminal-failure evidence plus its contributing lane/batch identity.
|
|
323
|
+
*/
|
|
324
|
+
export declare function derivePrReviewDimensionSettlement(directory: string, state: PrReviewCompletionState, revisionDigest: string): PrReviewTerminalCoverageSettlement & {
|
|
325
|
+
liveDimensions: PrReviewBaseDimensionId[];
|
|
326
|
+
};
|
|
327
|
+
export declare function admitPrReviewPartialBaseCoverage(directory: string, sessionID: string, runId: string, unresolvedDimensions: readonly PrReviewBaseDimensionId[]): Promise<PrReviewCompletionState>;
|
|
328
|
+
/**
|
|
329
|
+
* Undo a newly admitted partial-base disclosure when the findings checkpoint
|
|
330
|
+
* cannot be completed. The compare-and-clear checks keep a stale writer from
|
|
331
|
+
* deleting a disclosure that another writer has already committed.
|
|
332
|
+
*/
|
|
333
|
+
export declare function rollbackPrReviewPartialBaseCoverageAdmission(directory: string, sessionID: string, options: {
|
|
334
|
+
runId: string;
|
|
335
|
+
boundary: 'post_explorer' | 'post_reviewer' | 'post_critic';
|
|
336
|
+
relativePath: string;
|
|
337
|
+
digest: string;
|
|
338
|
+
}): Promise<boolean>;
|
|
339
|
+
/**
|
|
340
|
+
* Validate durable terminal N-of-6 coverage evidence (issue #2383).
|
|
341
|
+
*
|
|
342
|
+
* Returns the settlement: COMPLETE when all six dimensions are covered, or
|
|
343
|
+
* PARTIAL / NO_COVERAGE when an admitted, still-accurate disclosure exactly
|
|
344
|
+
* matches the currently derived terminal settlement. Throws while any
|
|
345
|
+
* unresolved dimension still has a live lane, or when the disclosure has been
|
|
346
|
+
* invalidated by later evidence (e.g. a late success landing on the same
|
|
347
|
+
* revision) — the disclosure is immutable, so such a run must re-settle or
|
|
348
|
+
* restart rather than silently re-crediting.
|
|
349
|
+
*/
|
|
350
|
+
export declare function assertPrReviewBaseCoverageSettled(directory: string, sessionID: string, gateContext?: PrReviewCompletionGateContext): Promise<{
|
|
351
|
+
state: PrReviewCompletionState;
|
|
352
|
+
settlement: PrReviewTerminalCoverageSettlement & {
|
|
353
|
+
liveDimensions: PrReviewBaseDimensionId[];
|
|
354
|
+
};
|
|
355
|
+
}>;
|
|
356
|
+
/**
|
|
357
|
+
* Read-only terminal-coverage projection for the completion report surface
|
|
358
|
+
* (issue #2383). Pure derivation over the CURRENT state; returns null when no
|
|
359
|
+
* active PR_REVIEW gate exists. The completion tool reads this BEFORE the
|
|
360
|
+
* terminal clear so the response carries the truthful settlement summary.
|
|
361
|
+
*/
|
|
362
|
+
export declare function readPrReviewTerminalCoverageForReport(directory: string, sessionID: string): Promise<{
|
|
363
|
+
kind: PrReviewTerminalCoverageKind;
|
|
364
|
+
coveredDimensions: PrReviewBaseDimensionId[];
|
|
365
|
+
unresolvedDimensions: Array<{
|
|
366
|
+
dimension: PrReviewBaseDimensionId;
|
|
367
|
+
terminal_state: PrReviewUnresolvedDimensionRecord['terminalState'];
|
|
368
|
+
reason_kind: PrReviewUnresolvedDimensionRecord['reasonKind'];
|
|
369
|
+
failure_class?: BackgroundDelegationWorkflowLaneFailureClass;
|
|
370
|
+
}>;
|
|
371
|
+
liveDimensions: PrReviewBaseDimensionId[];
|
|
372
|
+
allowedVerdicts: readonly PrReviewReportVerdict[];
|
|
373
|
+
} | null>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PR-review critic routing — the single severity/impact/tag predicate
|
|
3
|
+
* (issues #2383, #2385).
|
|
4
|
+
*
|
|
5
|
+
* Issue #2385 makes `src/pr-review/critic-routing.ts` the canonical home of
|
|
6
|
+
* the shared production critic-routing predicate. `src/background/
|
|
7
|
+
* pr-review-contract.ts` re-exports it (single definition, two import paths —
|
|
8
|
+
* no duplication). Every production consumer (critic inventory derivation,
|
|
9
|
+
* artifact-record validation, coverage admission, reducer transitions)
|
|
10
|
+
* imports THIS predicate; inline severity triples are forbidden and a
|
|
11
|
+
* centralization guard test enforces it.
|
|
12
|
+
*/
|
|
13
|
+
import type { PrReviewRiskImpact, PrReviewRiskTag } from '../background/pr-review-contract.js';
|
|
14
|
+
export interface PrReviewCriticRoutingInput {
|
|
15
|
+
classification?: string;
|
|
16
|
+
severity?: string;
|
|
17
|
+
risk_impact?: PrReviewRiskImpact;
|
|
18
|
+
risk_tags?: readonly PrReviewRiskTag[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* THE shared production critic-routing predicate (issue #2383).
|
|
22
|
+
*
|
|
23
|
+
* Exactly one definition, imported by every production consumer (critic
|
|
24
|
+
* inventory derivation, artifact-record validation, coverage admission).
|
|
25
|
+
* Inline severity triples are forbidden — a parity/centralization guard test
|
|
26
|
+
* enforces it. Accepts only the normalized canonical shape:
|
|
27
|
+
*
|
|
28
|
+
* - non-CONFIRMED classifications are never critic-routed;
|
|
29
|
+
* - UNKNOWN/missing/invalid risk metadata routes to critic (fail-safe);
|
|
30
|
+
* - CRITICAL/HIGH always route to critic;
|
|
31
|
+
* - MEDIUM routes iff HIGH_IMPACT or at least one risk tag;
|
|
32
|
+
* - LOW/INFO/NONE follow the existing no-critic policy once metadata is known.
|
|
33
|
+
*
|
|
34
|
+
* Paths, dimensions, keywords, and prompt prose may suggest risk to the model
|
|
35
|
+
* but can never override this typed result.
|
|
36
|
+
*/
|
|
37
|
+
export declare function prReviewFindingRequiresCritic(input: PrReviewCriticRoutingInput): boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PR-review recurrence guardrails (issue #2385).
|
|
3
|
+
*
|
|
4
|
+
* Exported source scanners implementing the mechanical guardrails the issue
|
|
5
|
+
* requires. Each scanner is a PURE function over `{ path, content }` source
|
|
6
|
+
* maps; unit tests prove each scanner flags a synthetic violating snippet
|
|
7
|
+
* (the guardrail "biting") and then apply it over the real `src/` tree.
|
|
8
|
+
*
|
|
9
|
+
* 1. `scanObserverTerminalization` — (a) the historical wait-deadline/no-client
|
|
10
|
+
* terminalizer may never reappear by name; (b) in
|
|
11
|
+
* `src/tools/dispatch-lanes.ts`, durable delegation-transition writes are
|
|
12
|
+
* allowed only inside the sanctioned settlement functions.
|
|
13
|
+
* 2. `scanParallelCircuitRuleConstruction` — circuit-record construction may
|
|
14
|
+
* exist only under `src/pr-review/` (the inline-construction recurrence
|
|
15
|
+
* class G-1).
|
|
16
|
+
*
|
|
17
|
+
* Issue #2385 originally specified a third scanner for transcript-parsing
|
|
18
|
+
* locality (the 13 conversion symbols restricted to the legacy adapter),
|
|
19
|
+
* but its only test consumer was a synthetic-input bite demo with no
|
|
20
|
+
* production caller. The boundary is already enforced structurally
|
|
21
|
+
* (the legacy-transcript-adapter is the sole module that owns those symbols,
|
|
22
|
+
* and the two retained scanners cover the real recurrence classes). A
|
|
23
|
+
* scanner with no caller would create the appearance of a guardrail where
|
|
24
|
+
* there is none — per the issue's "no unwired functionality" bar, it was
|
|
25
|
+
* removed instead.
|
|
26
|
+
*/
|
|
27
|
+
export interface GuardrailSource {
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
}
|
|
31
|
+
export interface GuardrailHit {
|
|
32
|
+
path: string;
|
|
33
|
+
line: number;
|
|
34
|
+
rule: string;
|
|
35
|
+
excerpt: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The historical PR-review wait-deadline terminalizer (issue #2381 deleted
|
|
39
|
+
* it). Any reappearance of these names in `src/` is the exact recurrence
|
|
40
|
+
* class the issue forbids: a collection wait budget or an unavailable host
|
|
41
|
+
* messages client must never write a terminal delegation transition.
|
|
42
|
+
*/
|
|
43
|
+
export declare const FORBIDDEN_OBSERVER_TERMINALIZER_SYMBOLS: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Enclosing functions in `src/tools/dispatch-lanes.ts` that are allowed to
|
|
46
|
+
* write delegation transitions. Every entry is child-evidence-driven
|
|
47
|
+
* settlement (typed terminal error, explicit caller cancellation, or the
|
|
48
|
+
* age+liveness presumed-stale backstop) — never observer-deadline evidence:
|
|
49
|
+
* - `startAsyncLanePrompt`: `running` transition after a successful launch.
|
|
50
|
+
* - `appendAsyncLaneLaunchError`: typed `error` for a failed child launch.
|
|
51
|
+
* - `collectOnce`: explicit caller `cancelled` transition.
|
|
52
|
+
* - `settleCollectedLane`: `completed`/`error` settlement from child evidence.
|
|
53
|
+
* - `sweepStaleAsyncLaneRecords`: the presumed-stale `stale` backstop.
|
|
54
|
+
* Additions must document their evidence source here.
|
|
55
|
+
*/
|
|
56
|
+
export declare const DELEGATION_WRITE_ALLOWED_FUNCTIONS: ReadonlySet<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Guardrail 2. (a) flags any forbidden historical-terminalizer symbol;
|
|
59
|
+
* (b) for `src/tools/dispatch-lanes.ts`, flags delegation-transition writes
|
|
60
|
+
* inside any enclosing function outside the sanctioned allowlist. This
|
|
61
|
+
* module itself is exempt from rule (a): it DEFINES the forbidden names
|
|
62
|
+
* (the definition site is not a recurrence, same reasoning as the adapter
|
|
63
|
+
* allowlist in guardrail 1).
|
|
64
|
+
*/
|
|
65
|
+
export declare function scanObserverTerminalization(sources: readonly GuardrailSource[]): GuardrailHit[];
|
|
66
|
+
/** Guardrail 3 (issue #2385 recurrence class G-1). */
|
|
67
|
+
export declare function scanParallelCircuitRuleConstruction(sources: readonly GuardrailSource[]): GuardrailHit[];
|