crysk 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -37
- package/dist/SKILL-12as0f3q.md +74 -0
- package/dist/SKILL-2h445snn.md +140 -0
- package/dist/SKILL-6j27707y.md +140 -0
- package/dist/SKILL-6vy283pt.md +140 -0
- package/dist/SKILL-816621e5.md +74 -0
- package/dist/SKILL-bnh7nrjz.md +74 -0
- package/dist/SKILL-ebn0fqaq.md +140 -0
- package/dist/SKILL-fv8x6hhx.md +140 -0
- package/dist/SKILL-nv32jpc5.md +74 -0
- package/dist/SKILL-qnfc8yp3.md +539 -0
- package/dist/SKILL-xr56f0b6.md +140 -0
- package/dist/SKILL-yz6wk92g.md +542 -0
- package/dist/ci-admission-09k2ba89.md +126 -0
- package/dist/ci-admission-a6d0wk1c.md +128 -0
- package/dist/ci-admission-f19qh39t.md +128 -0
- package/dist/ci-admission-tcqsj7b2.md +126 -0
- package/dist/cli.js +11544 -10726
- package/dist/index.js +1578 -942
- package/dist/materiality-f1qwnvg1.md +27 -0
- package/dist/review-refuter-btpgnkcd.md +77 -0
- package/package.json +3 -2
- package/prompts/default/PROVENANCE.md +1 -0
- package/prompts/default/review-refuter.md +6 -0
- package/prompts/materiality.md +27 -0
- package/skills/crysk/SKILL.md +5 -5
- package/skills/crysk-ci-setup/SKILL.md +16 -10
- package/skills/crysk-ci-setup/references/ci-admission.md +4 -0
- package/skills/crysk-loop/SKILL.md +32 -5
- package/src/asset-manifest.ts +2 -0
- package/src/assets.ts +4 -1
- package/src/brand.ts +11 -9
- package/src/ci/cli-record.ts +1 -1
- package/src/ci/gates.ts +31 -0
- package/src/ci/outcome.ts +6 -5
- package/src/ci/override.ts +11 -10
- package/src/ci/publish.ts +44 -103
- package/src/ci/reporter.ts +34 -5
- package/src/ci/review-levels.ts +21 -0
- package/src/ci/setup.ts +1 -2
- package/src/commands/ci-setup.ts +21 -18
- package/src/commands/init.ts +21 -12
- package/src/commands/post.ts +17 -0
- package/src/compare/loop.ts +356 -0
- package/src/compare/materiality.ts +266 -0
- package/src/compare/noise.ts +166 -0
- package/src/diversity/projection.ts +3 -0
- package/src/doctor.ts +48 -29
- package/src/index.ts +1 -1
- package/src/menu-context.ts +1 -1
- package/src/model/routing.ts +62 -0
- package/src/pr/admission.ts +13 -1
- package/src/pr/discovery.ts +17 -5
- package/src/pr/inline.ts +15 -1
- package/src/pr/plan.ts +5 -0
- package/src/pr/post-floor.ts +30 -0
- package/src/pr/posting.ts +4 -0
- package/src/pr/pr-status.ts +14 -0
- package/src/pr/pr.ts +50 -34
- package/src/pr/preflight.ts +2 -2
- package/src/pr/publish-outcome.ts +4 -0
- package/src/pr/review-pr.ts +65 -26
- package/src/pr/target.ts +16 -3
- package/src/pr/teardown.ts +1 -1
- package/src/rereview/prepare.ts +16 -0
- package/src/rereview/state.ts +206 -25
- package/src/review/boundary.ts +5 -1
- package/src/review/dedupe.ts +48 -4
- package/src/review/findings.ts +47 -1
- package/src/review/materiality-gate.ts +158 -0
- package/src/review/pipeline.ts +581 -56
- package/src/review/preflight.ts +201 -28
- package/src/review/prompt-set.ts +12 -8
- package/src/review/report.ts +73 -10
- package/src/review/review.ts +30 -5
- package/src/review/route-preflight.ts +29 -1
- package/src/review/run.ts +56 -18
- package/src/ui/config.ts +8 -0
- package/src/updater.ts +1 -1
- package/src/wizard.ts +35 -9
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// The noise baseline's pure half (Stage 2 noise yardstick, step 2).
|
|
2
|
+
//
|
|
3
|
+
// The materiality judge (src/compare/materiality.ts), once it has passed its
|
|
4
|
+
// exam, labels every finding the engine posted on a real PR. The baseline is
|
|
5
|
+
// the share labelled `immaterial`, overall and broken down by severity, tier,
|
|
6
|
+
// hunter, repo and triage tag. The impure half (store read, PR titles, judge
|
|
7
|
+
// spawns) is scripts/noise-baseline.ts.
|
|
8
|
+
|
|
9
|
+
import type { MaterialityLabel } from "#compare/materiality";
|
|
10
|
+
|
|
11
|
+
// One finding as the store holds it, one row per run it appeared in.
|
|
12
|
+
export interface PostedFindingRow {
|
|
13
|
+
repo: string;
|
|
14
|
+
pr: number;
|
|
15
|
+
runId: number;
|
|
16
|
+
findingId: string;
|
|
17
|
+
dedupeKey: string;
|
|
18
|
+
claim: string;
|
|
19
|
+
severity: string;
|
|
20
|
+
tier: string;
|
|
21
|
+
hunter: string;
|
|
22
|
+
triageTag: string | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// One finding per PR. A re-review re-posts the same defect at a new head;
|
|
26
|
+
// counting it per head would weigh long PRs more than short ones.
|
|
27
|
+
export interface NoiseItem {
|
|
28
|
+
key: string;
|
|
29
|
+
repo: string;
|
|
30
|
+
pr: number;
|
|
31
|
+
claim: string;
|
|
32
|
+
severity: string;
|
|
33
|
+
tier: string;
|
|
34
|
+
hunter: string;
|
|
35
|
+
triageTag: string | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function itemKey(repo: string, pr: number, dedupeKey: string): string {
|
|
39
|
+
return `${repo}#${pr}#${dedupeKey}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Keeps the first run's copy of each (repo, pr, dedupe key): what the PR
|
|
43
|
+
// author saw first. A triage tag from any copy is kept, the newest winning,
|
|
44
|
+
// because a finding is usually answered on a later head than it was posted.
|
|
45
|
+
export function dedupePostedFindings(rows: PostedFindingRow[]): NoiseItem[] {
|
|
46
|
+
const ordered = [...rows].sort((a, b) => a.runId - b.runId);
|
|
47
|
+
const items = new Map<string, NoiseItem>();
|
|
48
|
+
for (const row of ordered) {
|
|
49
|
+
const key = itemKey(row.repo, row.pr, row.dedupeKey);
|
|
50
|
+
const existing = items.get(key);
|
|
51
|
+
if (existing === undefined) {
|
|
52
|
+
items.set(key, {
|
|
53
|
+
key,
|
|
54
|
+
repo: row.repo,
|
|
55
|
+
pr: row.pr,
|
|
56
|
+
claim: row.claim,
|
|
57
|
+
severity: row.severity,
|
|
58
|
+
tier: row.tier,
|
|
59
|
+
hunter: row.hunter,
|
|
60
|
+
triageTag: row.triageTag,
|
|
61
|
+
});
|
|
62
|
+
} else if (row.triageTag !== null) {
|
|
63
|
+
existing.triageTag = row.triageTag;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return [...items.values()];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface NoiseRow {
|
|
70
|
+
group: string;
|
|
71
|
+
judged: number;
|
|
72
|
+
immaterial: number;
|
|
73
|
+
failed: number;
|
|
74
|
+
// immaterial / (judged - failed); null when nothing was labelled.
|
|
75
|
+
noise: number | null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type NoiseDimension = "severity" | "tier" | "hunter" | "repo" | "triage";
|
|
79
|
+
|
|
80
|
+
export interface NoiseReport {
|
|
81
|
+
overall: NoiseRow;
|
|
82
|
+
by: Record<NoiseDimension, NoiseRow[]>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function groupOf(item: NoiseItem, dimension: NoiseDimension): string {
|
|
86
|
+
switch (dimension) {
|
|
87
|
+
case "severity":
|
|
88
|
+
return item.severity;
|
|
89
|
+
case "tier":
|
|
90
|
+
return item.tier;
|
|
91
|
+
case "hunter":
|
|
92
|
+
return item.hunter;
|
|
93
|
+
case "repo":
|
|
94
|
+
return item.repo;
|
|
95
|
+
case "triage":
|
|
96
|
+
return item.triageTag ?? "(no reply)";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function tally(
|
|
101
|
+
group: string,
|
|
102
|
+
items: NoiseItem[],
|
|
103
|
+
labels: Map<string, MaterialityLabel | null>,
|
|
104
|
+
): NoiseRow {
|
|
105
|
+
let judged = 0;
|
|
106
|
+
let immaterial = 0;
|
|
107
|
+
let failed = 0;
|
|
108
|
+
for (const item of items) {
|
|
109
|
+
if (!labels.has(item.key)) continue;
|
|
110
|
+
judged += 1;
|
|
111
|
+
const label = labels.get(item.key);
|
|
112
|
+
if (label === null) failed += 1;
|
|
113
|
+
else if (label === "immaterial") immaterial += 1;
|
|
114
|
+
}
|
|
115
|
+
const labelled = judged - failed;
|
|
116
|
+
return {
|
|
117
|
+
group,
|
|
118
|
+
judged,
|
|
119
|
+
immaterial,
|
|
120
|
+
failed,
|
|
121
|
+
noise: labelled === 0 ? null : immaterial / labelled,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Failed spawns are left out of the rate, not counted as material or noise:
|
|
126
|
+
// they say nothing about the finding. Their count is reported beside it.
|
|
127
|
+
export function noiseReport(
|
|
128
|
+
items: NoiseItem[],
|
|
129
|
+
labels: Map<string, MaterialityLabel | null>,
|
|
130
|
+
): NoiseReport {
|
|
131
|
+
const dimensions: NoiseDimension[] = [
|
|
132
|
+
"severity",
|
|
133
|
+
"tier",
|
|
134
|
+
"hunter",
|
|
135
|
+
"repo",
|
|
136
|
+
"triage",
|
|
137
|
+
];
|
|
138
|
+
const by = {} as Record<NoiseDimension, NoiseRow[]>;
|
|
139
|
+
for (const dimension of dimensions) {
|
|
140
|
+
const groups = new Map<string, NoiseItem[]>();
|
|
141
|
+
for (const item of items) {
|
|
142
|
+
const group = groupOf(item, dimension);
|
|
143
|
+
const list = groups.get(group) ?? [];
|
|
144
|
+
list.push(item);
|
|
145
|
+
groups.set(group, list);
|
|
146
|
+
}
|
|
147
|
+
by[dimension] = [...groups.entries()]
|
|
148
|
+
.map(([group, list]) => tally(group, list, labels))
|
|
149
|
+
.sort((a, b) => b.judged - a.judged || a.group.localeCompare(b.group));
|
|
150
|
+
}
|
|
151
|
+
return { overall: tally("all", items, labels), by };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function pct(rate: number | null): string {
|
|
155
|
+
return rate === null ? "n/a" : `${(rate * 100).toFixed(1)}%`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function renderNoiseReport(report: NoiseReport): string[] {
|
|
159
|
+
const line = (row: NoiseRow) =>
|
|
160
|
+
` ${row.group.padEnd(34)} ${pct(row.noise).padStart(6)} (${row.immaterial}/${row.judged - row.failed}${row.failed > 0 ? `, ${row.failed} failed` : ""})`;
|
|
161
|
+
const out = ["noise = share judged immaterial", line(report.overall)];
|
|
162
|
+
for (const [dimension, rows] of Object.entries(report.by)) {
|
|
163
|
+
out.push("", `by ${dimension}:`, ...rows.map(line));
|
|
164
|
+
}
|
|
165
|
+
return out;
|
|
166
|
+
}
|
|
@@ -35,6 +35,9 @@ export function projectAdjudicationToFindings(
|
|
|
35
35
|
severity: canonical.severity,
|
|
36
36
|
evidence_class: canonical.evidenceClass,
|
|
37
37
|
refuter_verdict: refuterVerdict,
|
|
38
|
+
causal_disposition: canonical.causalDisposition,
|
|
39
|
+
claim: canonical.claim,
|
|
40
|
+
path: canonical.path,
|
|
38
41
|
}),
|
|
39
42
|
hops_used: canonical.hopsUsed,
|
|
40
43
|
hop_trail: canonical.hopTrail,
|
package/src/doctor.ts
CHANGED
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
localReviewSpec,
|
|
14
14
|
resolveAgentsDirSetting,
|
|
15
15
|
} from "#review/preflight";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
REVIEW_MD_FILE_NAME,
|
|
18
|
+
resolveReviewInstructions,
|
|
19
|
+
shadowedGotchasNotice,
|
|
20
|
+
} from "#review/run";
|
|
17
21
|
import {
|
|
18
22
|
detectAgentEnvironments,
|
|
19
23
|
inspectMcpRegistration,
|
|
@@ -437,39 +441,54 @@ export async function runDoctor(
|
|
|
437
441
|
}
|
|
438
442
|
}
|
|
439
443
|
|
|
440
|
-
// 3.
|
|
444
|
+
// 3. Review instructions check: REVIEW.md, else gotchas (only when repo root
|
|
445
|
+
// is supplied or discovered). Same resolver and predicate the review gates
|
|
446
|
+
// use, and that is the point: a doctor that answers this question its own
|
|
447
|
+
// way eventually green-lights a file the very next command refuses, or
|
|
448
|
+
// blocks on an absence the review accepts, and the user then hunts for the
|
|
449
|
+
// problem somewhere it is not.
|
|
441
450
|
if (repoDir) {
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
? readFile(gotchasPath)
|
|
445
|
-
: undefined;
|
|
446
|
-
// Same predicate the review gates use, and that is the point: a doctor
|
|
447
|
-
// that answers this question its own way eventually green-lights a file
|
|
448
|
-
// the very next command refuses, and the user then hunts for the problem
|
|
449
|
-
// somewhere it is not.
|
|
450
|
-
const unusable = gotchasUnusableReason(gotchasContent ?? "");
|
|
451
|
-
if (unusable === "placeholder") {
|
|
451
|
+
const instructions = resolveReviewInstructions(undefined, repoDir, exists);
|
|
452
|
+
if (instructions.path === undefined) {
|
|
452
453
|
checks.push({
|
|
453
454
|
name: "gotchas",
|
|
454
|
-
severity: "
|
|
455
|
-
message: `
|
|
456
|
-
hint:
|
|
457
|
-
`Replace the placeholder lines with real repository invariants, and delete the \`${GOTCHAS_PLACEHOLDER_MARKER}\` ` +
|
|
458
|
-
"marker line at the top if it is still there — Crysk refuses to review the scaffold.",
|
|
459
|
-
});
|
|
460
|
-
} else if (unusable !== undefined) {
|
|
461
|
-
checks.push({
|
|
462
|
-
name: "gotchas",
|
|
463
|
-
severity: "blocking",
|
|
464
|
-
message: `Repository gotchas file (${repoDirName}/gotchas.md) is empty or missing`,
|
|
465
|
-
hint: `Create and populate ${repoDirName}/gotchas.md with repository-specific invariants and failure traps.`,
|
|
455
|
+
severity: "degraded",
|
|
456
|
+
message: `No review instructions (${REVIEW_MD_FILE_NAME} or ${repoDirName}/gotchas.md): reviews run with the default guidance only`,
|
|
457
|
+
hint: `Add a ${REVIEW_MD_FILE_NAME} at the repository root with the facts the diff does not show: deliberate oddities, invariants enforced elsewhere, conventions a newcomer would break.`,
|
|
466
458
|
});
|
|
467
459
|
} else {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
460
|
+
const label = path.relative(repoDir, instructions.path);
|
|
461
|
+
const unusable = gotchasUnusableReason(readFile(instructions.path) ?? "");
|
|
462
|
+
if (unusable === "placeholder") {
|
|
463
|
+
checks.push({
|
|
464
|
+
name: "gotchas",
|
|
465
|
+
severity: "blocking",
|
|
466
|
+
message: `Repository review instructions (${label}) are still the untouched scaffold`,
|
|
467
|
+
hint:
|
|
468
|
+
`Replace the placeholder lines with real repository rules and invariants, and delete the \`${GOTCHAS_PLACEHOLDER_MARKER}\` ` +
|
|
469
|
+
"marker line at the top if it is still there — Crysk refuses to review the scaffold.",
|
|
470
|
+
});
|
|
471
|
+
} else if (unusable !== undefined) {
|
|
472
|
+
checks.push({
|
|
473
|
+
name: "gotchas",
|
|
474
|
+
severity: "blocking",
|
|
475
|
+
message: `Repository review instructions (${label}) are empty`,
|
|
476
|
+
hint: `Write repository-specific rules and invariants into ${label}, or delete it to review with the default guidance only.`,
|
|
477
|
+
});
|
|
478
|
+
} else if (instructions.shadowed !== undefined) {
|
|
479
|
+
checks.push({
|
|
480
|
+
name: "gotchas",
|
|
481
|
+
severity: "degraded",
|
|
482
|
+
message: shadowedGotchasNotice(instructions.shadowed),
|
|
483
|
+
hint: `Move what ${path.relative(repoDir, instructions.shadowed)} says into ${REVIEW_MD_FILE_NAME}, then delete it.`,
|
|
484
|
+
});
|
|
485
|
+
} else {
|
|
486
|
+
checks.push({
|
|
487
|
+
name: "gotchas",
|
|
488
|
+
severity: "healthy",
|
|
489
|
+
message: `Repository review instructions present (${label})`,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
473
492
|
}
|
|
474
493
|
}
|
|
475
494
|
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Public API surface; the deep-review lab consumes exactly these exports.
|
|
3
3
|
|
|
4
4
|
export const ENGINE_NAME = "pr-hero";
|
|
5
|
-
export const ENGINE_VERSION = "0.3.
|
|
5
|
+
export const ENGINE_VERSION = "0.3.3";
|
|
6
6
|
|
|
7
7
|
// errors and git/refs used to reach this surface only through re-exports in
|
|
8
8
|
// review/preflight.ts; they are exported directly now that those re-exports
|
package/src/menu-context.ts
CHANGED
|
@@ -120,7 +120,7 @@ export function getMenuOptions(
|
|
|
120
120
|
items.push({
|
|
121
121
|
id: "init",
|
|
122
122
|
label: "Initialize repo",
|
|
123
|
-
desc: "Scaffold <repo>/.crysk/ config
|
|
123
|
+
desc: "Scaffold <repo>/.crysk/ config and a REVIEW.md",
|
|
124
124
|
cliHint: "init",
|
|
125
125
|
action: "init",
|
|
126
126
|
});
|
package/src/model/routing.ts
CHANGED
|
@@ -517,6 +517,63 @@ export interface BuildRoutePlanInput {
|
|
|
517
517
|
frontmatterModel?: string;
|
|
518
518
|
defaultModel?: string;
|
|
519
519
|
};
|
|
520
|
+
// The materiality judge (odd/tasks/materiality-gate.md S14). Present only
|
|
521
|
+
// when the gate is enabled, so a run with the gate off keeps its plan's step
|
|
522
|
+
// keys and fingerprint byte for byte.
|
|
523
|
+
readonly materiality?: true;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// The step key the materiality judge runs under in every route plan.
|
|
527
|
+
export const MATERIALITY_STEP_KEY = "materiality";
|
|
528
|
+
|
|
529
|
+
// The judge was measured on Claude sonnet and opus through the Claude Code CLI
|
|
530
|
+
// (same bundled prompt, same bar; both passed, lab bench/METRICS.md
|
|
531
|
+
// 2026-11-01); sonnet was chosen because it costs half for a difference within
|
|
532
|
+
// one run's noise. A judge on any other model or transport is a different,
|
|
533
|
+
// unmeasured judge. So the model
|
|
534
|
+
// is pinned (never `--model`, never the routing default model) and the route is
|
|
535
|
+
// returned only when it lands on the claude-code backend.
|
|
536
|
+
export const MATERIALITY_JUDGE_MODEL = "sonnet";
|
|
537
|
+
|
|
538
|
+
// The judge's route, or undefined when it would not run the measured judge:
|
|
539
|
+
// the routing config sends sonnet to another backend, or cannot resolve it at
|
|
540
|
+
// all (a disabled route, an unmapped snapshot). Never throws: the gate is
|
|
541
|
+
// optional and fails open toward blocking, so a route it cannot use must make
|
|
542
|
+
// the stage stand down, never kill the run. Omitting a non-claude route from
|
|
543
|
+
// the plan also keeps route admission from gating the run on a step that will
|
|
544
|
+
// never spawn.
|
|
545
|
+
export function resolveMaterialityJudgeRoute(
|
|
546
|
+
routingConfig: RoutingConfig | undefined,
|
|
547
|
+
): ResolvedStepRoute | undefined {
|
|
548
|
+
let step: ResolvedStepRoute;
|
|
549
|
+
try {
|
|
550
|
+
step = resolveStepRoute({
|
|
551
|
+
stepKey: MATERIALITY_STEP_KEY,
|
|
552
|
+
role: "other",
|
|
553
|
+
specModel: MATERIALITY_JUDGE_MODEL,
|
|
554
|
+
routingConfig,
|
|
555
|
+
});
|
|
556
|
+
} catch {
|
|
557
|
+
return undefined;
|
|
558
|
+
}
|
|
559
|
+
return isMeasuredJudgeRoute(step.route) ? step : undefined;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// The route the judge was measured on: the Claude Code CLI talking straight to
|
|
563
|
+
// Anthropic. Through any other gateway, spawnModelForClaudeCli passes the
|
|
564
|
+
// mapping's modelSnapshot verbatim as --model, so a claude-code route over
|
|
565
|
+
// openrouter or a configured gateway can run an arbitrary model — a different,
|
|
566
|
+
// unmeasured judge that the pinned prompt hash cannot detect.
|
|
567
|
+
export function isMeasuredJudgeRoute(route: {
|
|
568
|
+
backend: string;
|
|
569
|
+
provider: string;
|
|
570
|
+
gateway?: string;
|
|
571
|
+
}): boolean {
|
|
572
|
+
return (
|
|
573
|
+
route.backend === "claude-code" &&
|
|
574
|
+
route.provider === "anthropic" &&
|
|
575
|
+
(route.gateway === undefined || route.gateway === "direct")
|
|
576
|
+
);
|
|
520
577
|
}
|
|
521
578
|
|
|
522
579
|
export function buildResolvedRoutePlan(
|
|
@@ -571,6 +628,11 @@ export function buildResolvedRoutePlan(
|
|
|
571
628
|
}),
|
|
572
629
|
);
|
|
573
630
|
}
|
|
631
|
+
if (input.materiality) {
|
|
632
|
+
// No `cliModel` on purpose: `--model sonnet` must not move the judge.
|
|
633
|
+
const judge = resolveMaterialityJudgeRoute(input.routingConfig);
|
|
634
|
+
if (judge !== undefined) stepRoutes.push(judge);
|
|
635
|
+
}
|
|
574
636
|
return createResolvedRoutePlan(stepRoutes);
|
|
575
637
|
}
|
|
576
638
|
|
package/src/pr/admission.ts
CHANGED
|
@@ -572,6 +572,10 @@ function newestCarriedVerdict(statuses: readonly CommitStatusFact[]) {
|
|
|
572
572
|
);
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
export const NOTHING_TO_REVIEW_DESCRIPTION = clipStatusDescription(
|
|
576
|
+
`${STATUS_CONTEXT}: nothing to review — every changed file is excluded`,
|
|
577
|
+
);
|
|
578
|
+
|
|
575
579
|
function failClosed(label: string): AdmissionStatusDecision {
|
|
576
580
|
return {
|
|
577
581
|
state: "failure",
|
|
@@ -796,6 +800,12 @@ async function gateSkipDecision(
|
|
|
796
800
|
},
|
|
797
801
|
skip: CliRecord["skip"],
|
|
798
802
|
): Promise<AdmissionStatusDecision | null> {
|
|
803
|
+
// #317: nothing reviewable changed. A finished no-op, so the head reads
|
|
804
|
+
// green; the text is no review verdict (isReviewVerdictStatus), so a later
|
|
805
|
+
// skip's carry walks past it to the last real review.
|
|
806
|
+
if (skip === "excluded") {
|
|
807
|
+
return { state: "success", description: NOTHING_TO_REVIEW_DESCRIPTION };
|
|
808
|
+
}
|
|
799
809
|
if (skip === "size" || skip === "budget") {
|
|
800
810
|
const request = skipCommitStatusRequest({
|
|
801
811
|
kind: skip,
|
|
@@ -856,6 +866,8 @@ function cliSkipKindOf(plan: CiGateSkipPlan): CliRecord["skip"] {
|
|
|
856
866
|
return "coverage";
|
|
857
867
|
case "manual-required":
|
|
858
868
|
return "manual-required";
|
|
869
|
+
case "skipped-excluded":
|
|
870
|
+
return "excluded";
|
|
859
871
|
default:
|
|
860
872
|
return undefined;
|
|
861
873
|
}
|
|
@@ -892,7 +904,7 @@ export async function publishCiSkip(input: {
|
|
|
892
904
|
// The record names the skip kind only. The plan carries no head, so none is
|
|
893
905
|
// written: the publisher takes the head from the trigger's record.
|
|
894
906
|
const skip = cliSkipKindOf(input.plan);
|
|
895
|
-
if (input.post) {
|
|
907
|
+
if (input.post && input.plan.postsComment !== false) {
|
|
896
908
|
// Repost, never edit in place: an edited notice is invisible on GitHub,
|
|
897
909
|
// so a later push that was skipped again looked like nothing happened.
|
|
898
910
|
// See repostMarkedPrComment's WHY. A repost that throws is the notice's own
|
package/src/pr/discovery.ts
CHANGED
|
@@ -95,6 +95,19 @@ export interface PrDiscoveryGit {
|
|
|
95
95
|
): Promise<{ ok: boolean; stdout: string; stderr: string }>;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// A first review whose every changed file is excluded by the ignore rules
|
|
99
|
+
// (#317). A CliError with the same message as before, so a caller that does not
|
|
100
|
+
// look for it still exits 1 with the same line. The CI path catches it and ends
|
|
101
|
+
// the run as a skip: nothing reviewable changed, so nothing is owed.
|
|
102
|
+
export class AllExcludedError extends CliError {
|
|
103
|
+
readonly droppedPaths: readonly string[];
|
|
104
|
+
|
|
105
|
+
constructor(droppedPaths: readonly string[]) {
|
|
106
|
+
super(allExcludedMessage([...droppedPaths]));
|
|
107
|
+
this.droppedPaths = droppedPaths;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
98
111
|
export interface PrDiscoveryResult {
|
|
99
112
|
prepared: PreparedDiscovery;
|
|
100
113
|
skipDiscovery: boolean;
|
|
@@ -224,11 +237,10 @@ export async function resolvePrDiscovery(params: {
|
|
|
224
237
|
prepared.plan.emptyDeltaIsError &&
|
|
225
238
|
effectiveDiff.patch.trim().length === 0
|
|
226
239
|
) {
|
|
227
|
-
|
|
228
|
-
effectiveDiff.droppedPaths
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
);
|
|
240
|
+
if (effectiveDiff.droppedPaths.length > 0) {
|
|
241
|
+
throw new AllExcludedError(effectiveDiff.droppedPaths);
|
|
242
|
+
}
|
|
243
|
+
throw new CliError(emptyDiffMessage(baseRef, headLabel, false));
|
|
232
244
|
}
|
|
233
245
|
const skipDiscovery =
|
|
234
246
|
skipPlannedDiscovery || effectiveDiff.patch.trim().length === 0;
|
package/src/pr/inline.ts
CHANGED
|
@@ -374,6 +374,12 @@ export interface PostPlan {
|
|
|
374
374
|
issueComments: PostableFinding[];
|
|
375
375
|
persisting: FindingMatch[];
|
|
376
376
|
resolved: PostedFindingComment[];
|
|
377
|
+
// Unmatched findings below `post_min_severity` (pr/post-floor.ts): never
|
|
378
|
+
// posted, counted in the summary instead. Taken out AFTER matching on
|
|
379
|
+
// purpose: dropped before it, a still-live advisory comment from an earlier
|
|
380
|
+
// head would land in `resolved` and read as fixed. A hidden finding that
|
|
381
|
+
// matches an earlier comment stays in `persisting`.
|
|
382
|
+
notPosted: PostableFinding[];
|
|
377
383
|
// From the matcher, not a stored count (design D5): persist = matched,
|
|
378
384
|
// new = reviewComments.length + issueComments.length, resolved = prior
|
|
379
385
|
// comments with nothing matched to them.
|
|
@@ -386,6 +392,8 @@ export function buildPostPlan(input: {
|
|
|
386
392
|
posted: PostedFindingComment[];
|
|
387
393
|
headSha: string;
|
|
388
394
|
window?: number;
|
|
395
|
+
// Ids of the findings below `post_min_severity`. Absent posts everything.
|
|
396
|
+
hiddenIds?: ReadonlySet<string>;
|
|
389
397
|
}): PostPlan {
|
|
390
398
|
// Resolve post lines BEFORE matching: a re-anchored finding (544 → 938)
|
|
391
399
|
// has to compare against a prior comment stored at 938, or a re-run on
|
|
@@ -405,7 +413,12 @@ export function buildPostPlan(input: {
|
|
|
405
413
|
});
|
|
406
414
|
const reviewComments: PostableFinding[] = [];
|
|
407
415
|
const issueComments: PostableFinding[] = [];
|
|
416
|
+
const notPosted: PostableFinding[] = [];
|
|
408
417
|
for (const finding of match.fresh) {
|
|
418
|
+
if (input.hiddenIds?.has(finding.id) === true) {
|
|
419
|
+
notPosted.push(finding);
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
409
422
|
const anchorability = classifyAnchorability(finding, input.anchors);
|
|
410
423
|
if (anchorability === "anchorable") reviewComments.push(finding);
|
|
411
424
|
else issueComments.push(finding);
|
|
@@ -415,9 +428,10 @@ export function buildPostPlan(input: {
|
|
|
415
428
|
issueComments,
|
|
416
429
|
persisting: match.persist,
|
|
417
430
|
resolved: match.resolved,
|
|
431
|
+
notPosted,
|
|
418
432
|
delta: {
|
|
419
433
|
resolved: match.resolved.length,
|
|
420
|
-
new:
|
|
434
|
+
new: reviewComments.length + issueComments.length,
|
|
421
435
|
persist: match.persist.length,
|
|
422
436
|
},
|
|
423
437
|
};
|
package/src/pr/plan.ts
CHANGED
|
@@ -46,6 +46,7 @@ import type { buildPhaseBQueue, PreparedDiscovery } from "#rereview/prepare";
|
|
|
46
46
|
import {
|
|
47
47
|
type AgentsDirSource,
|
|
48
48
|
type CliOptions,
|
|
49
|
+
resolveMaterialityGate,
|
|
49
50
|
resolveMaxVerificationSteps,
|
|
50
51
|
} from "#review/preflight";
|
|
51
52
|
import type { ParsedAgent } from "#review/prompt-set";
|
|
@@ -213,6 +214,10 @@ export async function resolvePrPlanAndConfirm(params: {
|
|
|
213
214
|
summarizerEnabled: params.summary.enabled && !params.skipDiscovery,
|
|
214
215
|
scoutEnabled: params.options.scout && !params.skipDiscovery,
|
|
215
216
|
consolidateEnabled: !params.skipDiscovery,
|
|
217
|
+
// Mirrors pipelineMaterialityInput in review-pr.ts: no judge step on a
|
|
218
|
+
// re-review that hunts nothing new.
|
|
219
|
+
materialityEnabled:
|
|
220
|
+
resolveMaterialityGate(params.config) && !params.skipDiscovery,
|
|
216
221
|
});
|
|
217
222
|
const routePlan = productionRoute?.routePlan;
|
|
218
223
|
const productionAdmission = productionRoute?.productionAdmission;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// `post_min_severity`: the lowest finding a PR review posts. A posting filter
|
|
2
|
+
// only: the pipeline still finds, refutes and tiers every finding, and local
|
|
3
|
+
// reports still show all of them. The PR comments change, and with them the
|
|
4
|
+
// re-review admission, which scores only what was posted: a finding nobody
|
|
5
|
+
// sees should not spend a re-review. The gate is unaffected, since a blocking
|
|
6
|
+
// finding is never hidden.
|
|
7
|
+
//
|
|
8
|
+
// The floor never hides a blocking finding: `blocking` hides every advisory one,
|
|
9
|
+
// `warning` hides advisory SUGGESTIONs only, so a BLOCKER/CRITICAL the refuter
|
|
10
|
+
// demoted to advisory still posts there. Absent means `suggestion`: post
|
|
11
|
+
// everything, the behaviour before this key existed.
|
|
12
|
+
|
|
13
|
+
import type { Severity, Tier } from "#review/findings";
|
|
14
|
+
|
|
15
|
+
export const POST_MIN_SEVERITIES = [
|
|
16
|
+
"suggestion",
|
|
17
|
+
"warning",
|
|
18
|
+
"blocking",
|
|
19
|
+
] as const;
|
|
20
|
+
export type PostMinSeverity = (typeof POST_MIN_SEVERITIES)[number];
|
|
21
|
+
|
|
22
|
+
export function isBelowPostFloor(
|
|
23
|
+
finding: { tier: Tier; severity: Severity },
|
|
24
|
+
floor: PostMinSeverity | undefined,
|
|
25
|
+
): boolean {
|
|
26
|
+
if (finding.tier === "blocking") return false;
|
|
27
|
+
if (floor === "blocking") return true;
|
|
28
|
+
if (floor === "warning") return finding.severity === "SUGGESTION";
|
|
29
|
+
return false;
|
|
30
|
+
}
|
package/src/pr/posting.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// comparison guard in comparison.ts.
|
|
16
16
|
|
|
17
17
|
import type { InlinePostOutcome } from "#pr/inline";
|
|
18
|
+
import type { PostMinSeverity } from "#pr/post-floor";
|
|
18
19
|
import { ghRepoWebUrl, postInlineIfEligible, writePostReceipt } from "#pr/pr";
|
|
19
20
|
import type { CiMode } from "#pr/preflight";
|
|
20
21
|
import type { RereviewProvenance } from "#rereview/prepare";
|
|
@@ -57,6 +58,8 @@ export async function postFindingsIfEnabled(input: {
|
|
|
57
58
|
// A comment-triggered run. Forwarded so the summary counter stays put (see
|
|
58
59
|
// nextStateReviewCount in ci/review-admission.ts).
|
|
59
60
|
force?: boolean;
|
|
61
|
+
// The `post_min_severity` config key (pr/post-floor.ts). Absent posts all.
|
|
62
|
+
postMinSeverity?: PostMinSeverity;
|
|
60
63
|
}): Promise<PostingStageResult> {
|
|
61
64
|
if (!input.postEnabled) {
|
|
62
65
|
return { posted: null, postedWebUrl: undefined };
|
|
@@ -83,6 +86,7 @@ export async function postFindingsIfEnabled(input: {
|
|
|
83
86
|
rereviewPriors: input.rereviewPriors,
|
|
84
87
|
ciMode: input.ciMode,
|
|
85
88
|
force: input.force,
|
|
89
|
+
postMinSeverity: input.postMinSeverity,
|
|
86
90
|
});
|
|
87
91
|
if (posted) {
|
|
88
92
|
input.onDelivered?.();
|
package/src/pr/pr-status.ts
CHANGED
|
@@ -549,6 +549,10 @@ const CARRIED_BLOCKING_GATE = /^crysk: \d+ blocking finding\(s\) carried from /;
|
|
|
549
549
|
const UNVERIFIED_FIXES_GATE =
|
|
550
550
|
/^crysk: \d+ answered finding\(s\), fixes unverified \(/;
|
|
551
551
|
|
|
552
|
+
// The green a skip writes when every changed file is excluded (admission.ts NOTHING_TO_REVIEW_DESCRIPTION, #317).
|
|
553
|
+
const NOTHING_TO_REVIEW_GATE =
|
|
554
|
+
/^crysk: nothing to review — every changed file is excluded$/;
|
|
555
|
+
|
|
552
556
|
// A blocking finding whose newest reply is a dismissal the CI adjudicator upheld on this head.
|
|
553
557
|
function upheldDismissal(a: AnalyzedFinding): boolean {
|
|
554
558
|
return (
|
|
@@ -634,6 +638,16 @@ function decideNext(
|
|
|
634
638
|
reason: `The gate is green on answered findings no review verified (${gate.description}); the PR is ready to merge, or comment ${commandHint(REVIEW_COMMAND, "")} for another review.`,
|
|
635
639
|
};
|
|
636
640
|
}
|
|
641
|
+
// #317: no review ran, so the reason must not read as a review that passed.
|
|
642
|
+
if (
|
|
643
|
+
NOTHING_TO_REVIEW_GATE.test(canonicalStatusText(gate.description ?? ""))
|
|
644
|
+
) {
|
|
645
|
+
return {
|
|
646
|
+
next_action: "done",
|
|
647
|
+
reason:
|
|
648
|
+
"Every changed file on this head is excluded from review, so there was nothing to review; nothing is owed.",
|
|
649
|
+
};
|
|
650
|
+
}
|
|
637
651
|
return {
|
|
638
652
|
next_action: "done",
|
|
639
653
|
reason:
|