crysk 0.3.1 → 0.3.2
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 +9 -5
- package/dist/SKILL-6j27707y.md +140 -0
- package/dist/SKILL-816621e5.md +74 -0
- package/dist/SKILL-bnh7nrjz.md +74 -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-f19qh39t.md +128 -0
- package/dist/ci-admission-tcqsj7b2.md +126 -0
- package/dist/cli.js +1831 -1150
- package/dist/index.js +1464 -911
- package/dist/materiality-f1qwnvg1.md +27 -0
- package/package.json +3 -2
- package/prompts/materiality.md +27 -0
- package/skills/crysk/SKILL.md +2 -2
- package/skills/crysk-ci-setup/SKILL.md +13 -7
- 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 +2 -1
- 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/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/index.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/teardown.ts +1 -1
- package/src/rereview/prepare.ts +16 -0
- package/src/rereview/state.ts +206 -25
- package/src/review/boundary.ts +4 -1
- package/src/review/dedupe.ts +48 -4
- package/src/review/findings.ts +47 -1
- package/src/review/materiality-gate.ts +134 -0
- package/src/review/pipeline.ts +521 -41
- package/src/review/preflight.ts +69 -0
- package/src/review/report.ts +73 -10
- package/src/review/review.ts +16 -0
- package/src/review/route-preflight.ts +29 -1
- package/src/review/run.ts +2 -0
- package/src/ui/config.ts +8 -0
- package/src/updater.ts +1 -1
package/src/ci/publish.ts
CHANGED
|
@@ -56,7 +56,6 @@ import {
|
|
|
56
56
|
MARKER_OPEN,
|
|
57
57
|
matchMarkerPrefix,
|
|
58
58
|
STATUS_CONTEXT,
|
|
59
|
-
statusContextForms,
|
|
60
59
|
} from "../brand";
|
|
61
60
|
import type {
|
|
62
61
|
CliRecord,
|
|
@@ -616,43 +615,17 @@ function workflowCommand(
|
|
|
616
615
|
return `::${command} title=crysk::${escaped}\n`;
|
|
617
616
|
}
|
|
618
617
|
|
|
619
|
-
// The status write
|
|
620
|
-
//
|
|
621
|
-
//
|
|
622
|
-
//
|
|
623
|
-
//
|
|
618
|
+
// The status write: one POST on `status.context`, the crysk name, retried once unless
|
|
619
|
+
// `attempts` is 1. Since #457 the legacy `pr-hero` context is never written, only read
|
|
620
|
+
// (isStatusContext), so a branch protection that still requires `pr-hero` must switch to
|
|
621
|
+
// `crysk`. Returns the failure's HTTP status when gh printed one, so the renderer can pick
|
|
622
|
+
// the permission or the server wording.
|
|
624
623
|
function postStatus(
|
|
625
624
|
deps: PublishDeps,
|
|
626
625
|
repository: string,
|
|
627
626
|
headSha: string,
|
|
628
627
|
status: StatusPost,
|
|
629
628
|
attempts = 2,
|
|
630
|
-
): { ok: true } | { ok: false; httpStatus: number | undefined } {
|
|
631
|
-
let failure: { ok: false; httpStatus: number | undefined } | undefined;
|
|
632
|
-
for (const context of statusContextForms(status.context)) {
|
|
633
|
-
const posted = postStatusOn(
|
|
634
|
-
deps,
|
|
635
|
-
repository,
|
|
636
|
-
headSha,
|
|
637
|
-
status,
|
|
638
|
-
context,
|
|
639
|
-
attempts,
|
|
640
|
-
);
|
|
641
|
-
if (!posted.ok) failure ??= posted;
|
|
642
|
-
}
|
|
643
|
-
return failure ?? { ok: true };
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// One write on one context, retried once unless `attempts` is 1. Returns the failure's HTTP
|
|
647
|
-
// status when gh printed one, so the renderer can pick the permission or the server
|
|
648
|
-
// wording.
|
|
649
|
-
function postStatusOn(
|
|
650
|
-
deps: PublishDeps,
|
|
651
|
-
repository: string,
|
|
652
|
-
headSha: string,
|
|
653
|
-
status: StatusPost,
|
|
654
|
-
context: string,
|
|
655
|
-
attempts: number,
|
|
656
629
|
): { ok: true } | { ok: false; httpStatus: number | undefined } {
|
|
657
630
|
const args = [
|
|
658
631
|
"api",
|
|
@@ -660,7 +633,7 @@ function postStatusOn(
|
|
|
660
633
|
"-f",
|
|
661
634
|
`state=${status.state}`,
|
|
662
635
|
"-f",
|
|
663
|
-
`context=${context}`,
|
|
636
|
+
`context=${status.context}`,
|
|
664
637
|
"-f",
|
|
665
638
|
`description=${status.description}`,
|
|
666
639
|
"-f",
|
|
@@ -1112,13 +1085,15 @@ function parseStatusRow(line: string): HeadStatusRow | undefined {
|
|
|
1112
1085
|
// The head's newest pr-hero status, as the three states the table needs. The newest row is
|
|
1113
1086
|
// picked by its time, not by its place in the answer. A failed read, no pr-hero row, or a
|
|
1114
1087
|
// state the table does not name is unknown, which the table answers with the status.
|
|
1115
|
-
// Copies the verdict of a
|
|
1116
|
-
//
|
|
1117
|
-
//
|
|
1118
|
-
//
|
|
1119
|
-
//
|
|
1120
|
-
//
|
|
1121
|
-
// and the
|
|
1088
|
+
// Copies the verdict of a stranded pair onto crysk when crysk is the name that missed it
|
|
1089
|
+
// (strandedStatusPair): a crysk pending behind a later pr-hero verdict an older action or a
|
|
1090
|
+
// run before #457 wrote. crysk is the required check, and the readers below take the newest
|
|
1091
|
+
// row across both names, so nothing else would ever settle it. Only crysk is written: the
|
|
1092
|
+
// verdict, which may be a human's override, is never replaced, and a stuck legacy `pr-hero`
|
|
1093
|
+
// row is left as it is, because the legacy name is never written since #457. A failed copy is
|
|
1094
|
+
// a warning, and the run goes on as it would have. Returns the verdict whenever the pair is
|
|
1095
|
+
// stranded, copied or not: it, not the stuck pending row, is the gate's state, and the
|
|
1096
|
+
// readers' newest-row pick could still choose the stuck row on a same-second tie.
|
|
1122
1097
|
function repairStrandedPair(
|
|
1123
1098
|
deps: PublishDeps,
|
|
1124
1099
|
repo: string,
|
|
@@ -1127,6 +1102,7 @@ function repairStrandedPair(
|
|
|
1127
1102
|
): HeadStatusRow | undefined {
|
|
1128
1103
|
const pair = strandedStatusPair(statuses, STATUS_CONTEXT);
|
|
1129
1104
|
if (pair === undefined) return undefined;
|
|
1105
|
+
if (pair.stranded.context !== STATUS_CONTEXT) return pair.verdict;
|
|
1130
1106
|
const state = pair.verdict.state;
|
|
1131
1107
|
const description = pair.verdict.description;
|
|
1132
1108
|
// A verdict this step cannot reproduce faithfully is not copied: a blank description
|
|
@@ -1138,19 +1114,12 @@ function repairStrandedPair(
|
|
|
1138
1114
|
) {
|
|
1139
1115
|
return pair.verdict;
|
|
1140
1116
|
}
|
|
1141
|
-
const posted =
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
context: STATUS_CONTEXT,
|
|
1148
|
-
description,
|
|
1149
|
-
targetUrl: pair.verdict.targetUrl ?? actionsRunUrl(deps.env) ?? "",
|
|
1150
|
-
},
|
|
1151
|
-
pair.stranded.context,
|
|
1152
|
-
2,
|
|
1153
|
-
);
|
|
1117
|
+
const posted = postStatus(deps, repo, sha, {
|
|
1118
|
+
state,
|
|
1119
|
+
context: STATUS_CONTEXT,
|
|
1120
|
+
description,
|
|
1121
|
+
targetUrl: pair.verdict.targetUrl ?? actionsRunUrl(deps.env) ?? "",
|
|
1122
|
+
});
|
|
1154
1123
|
deps.stdout(
|
|
1155
1124
|
posted.ok
|
|
1156
1125
|
? workflowCommand(
|
|
@@ -1237,30 +1206,19 @@ function overrideDescription(actor: string): string {
|
|
|
1237
1206
|
// an override the status never received would be a false record.
|
|
1238
1207
|
function overrideCommentBody(
|
|
1239
1208
|
plan: Extract<Publication, { kind: "override" }>,
|
|
1240
|
-
landed:
|
|
1209
|
+
landed: boolean,
|
|
1241
1210
|
at: Date,
|
|
1242
1211
|
): string {
|
|
1243
1212
|
const when = `${at.toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
1244
1213
|
const marker = `${MARKER_OPEN}override head=${plan.headSha ?? "unknown"} run=${plan.runId} attempt=${plan.runAttempt} -->`;
|
|
1245
|
-
if (landed
|
|
1246
|
-
//
|
|
1247
|
-
//
|
|
1248
|
-
const names = landed.map((context) => `\`${context}\``).join(" and ");
|
|
1249
|
-
const missed = statusContextForms(STATUS_CONTEXT).filter(
|
|
1250
|
-
(context) => !landed.includes(context),
|
|
1251
|
-
);
|
|
1252
|
-
const missedNote =
|
|
1253
|
-
missed.length === 0
|
|
1254
|
-
? ""
|
|
1255
|
-
: ` The ${missed.map((context) => `\`${context}\``).join(" and ")} status could not be written, so a rule that requires it is still blocked: comment ${commandHint(OVERRIDE_COMMAND)} again to retry.`;
|
|
1214
|
+
if (landed && plan.headSha !== undefined) {
|
|
1215
|
+
// Names the one context written: since #457 an override posts `crysk` alone, and this
|
|
1216
|
+
// comment is never cleaned up, so it must not claim a legacy `pr-hero` status.
|
|
1256
1217
|
return [
|
|
1257
1218
|
marker,
|
|
1258
1219
|
"",
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
: `@${plan.actor}'s override of Crysk's gate on head \`${plan.headSha}\` at ${when} landed only in part. `) +
|
|
1262
|
-
`The ${names} status${landed.length > 1 ? "es" : ""} on that head ${landed.length > 1 ? "are" : "is"} now success, with no review of this head.` +
|
|
1263
|
-
missedNote +
|
|
1220
|
+
`Crysk's gate was overridden by @${plan.actor} on head \`${plan.headSha}\` at ${when}. ` +
|
|
1221
|
+
`The \`${STATUS_CONTEXT}\` status on that head is now success, with no review of this head.` +
|
|
1264
1222
|
` A new push or a later ${commandHint(REVIEW_COMMAND)} on this head replaces it.`,
|
|
1265
1223
|
].join("\n");
|
|
1266
1224
|
}
|
|
@@ -1283,41 +1241,26 @@ function publishOverride(
|
|
|
1283
1241
|
deps: PublishDeps,
|
|
1284
1242
|
plan: Extract<Publication, { kind: "override" }>,
|
|
1285
1243
|
): number {
|
|
1286
|
-
|
|
1244
|
+
let landed = false;
|
|
1287
1245
|
let exitCode = 0;
|
|
1288
1246
|
if (plan.headSha !== undefined) {
|
|
1289
|
-
//
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
{
|
|
1299
|
-
state: "success",
|
|
1300
|
-
context: STATUS_CONTEXT,
|
|
1301
|
-
description: overrideDescription(plan.actor),
|
|
1302
|
-
targetUrl: plan.runUrl,
|
|
1303
|
-
},
|
|
1304
|
-
context,
|
|
1305
|
-
2,
|
|
1306
|
-
);
|
|
1307
|
-
if (posted.ok) landed.push(context);
|
|
1308
|
-
else failure ??= posted;
|
|
1309
|
-
}
|
|
1310
|
-
if (landed.includes(STATUS_CONTEXT)) {
|
|
1247
|
+
// One write, on crysk alone (#457): the legacy `pr-hero` context is no longer posted.
|
|
1248
|
+
const posted = postStatus(deps, plan.repository, plan.headSha, {
|
|
1249
|
+
state: "success",
|
|
1250
|
+
context: STATUS_CONTEXT,
|
|
1251
|
+
description: overrideDescription(plan.actor),
|
|
1252
|
+
targetUrl: plan.runUrl,
|
|
1253
|
+
});
|
|
1254
|
+
landed = posted.ok;
|
|
1255
|
+
if (posted.ok) {
|
|
1311
1256
|
// WHY here, right after the success and before the audit comment: the crysk gate is
|
|
1312
|
-
// green now, so an earlier run's outcome comment contradicts it.
|
|
1313
|
-
//
|
|
1314
|
-
// gate this cleanup, and its warnings never change the exit code (as for a review).
|
|
1257
|
+
// green now, so an earlier run's outcome comment contradicts it. The audit comment does
|
|
1258
|
+
// not gate this cleanup, and its warnings never change the exit code (as for a review).
|
|
1315
1259
|
cleanupOlderOutcomes(deps, plan);
|
|
1316
|
-
}
|
|
1317
|
-
if (failure !== undefined) {
|
|
1260
|
+
} else {
|
|
1318
1261
|
reportStatusWriteFailure(
|
|
1319
1262
|
deps,
|
|
1320
|
-
|
|
1263
|
+
posted.httpStatus,
|
|
1321
1264
|
plan.runId,
|
|
1322
1265
|
plan.runUrl,
|
|
1323
1266
|
);
|
|
@@ -1327,11 +1270,9 @@ function publishOverride(
|
|
|
1327
1270
|
deps.stdout(
|
|
1328
1271
|
workflowCommand(
|
|
1329
1272
|
"notice",
|
|
1330
|
-
landed
|
|
1273
|
+
landed
|
|
1331
1274
|
? `crysk gate overridden by @${plan.actor} on head ${plan.headSha}.`
|
|
1332
|
-
:
|
|
1333
|
-
? `crysk override by @${plan.actor} set only the ${landed.join(", ")} status on head ${plan.headSha}.`
|
|
1334
|
-
: `crysk override by @${plan.actor} set no commit status.`,
|
|
1275
|
+
: `crysk override by @${plan.actor} set no commit status.`,
|
|
1335
1276
|
),
|
|
1336
1277
|
);
|
|
1337
1278
|
const at = (deps.now ?? (() => new Date()))();
|
package/src/ci/reporter.ts
CHANGED
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
// multiple output keys written across several tool calls). An overwrite here
|
|
32
32
|
// would silently destroy an earlier step's contribution to the same file.
|
|
33
33
|
import { appendFile } from "node:fs/promises";
|
|
34
|
+
import { listPaths } from "#git/refs";
|
|
34
35
|
import type { CiMode } from "#pr/preflight";
|
|
35
36
|
import type { Finding, Severity } from "#review/findings";
|
|
36
37
|
import {
|
|
37
38
|
blobUrl,
|
|
39
|
+
code,
|
|
38
40
|
formatElapsed,
|
|
39
41
|
type PrCommentDelta,
|
|
40
42
|
severityEmoji,
|
|
@@ -155,6 +157,12 @@ interface CiSkipBudgetSummary {
|
|
|
155
157
|
budgetUsd: number;
|
|
156
158
|
}
|
|
157
159
|
|
|
160
|
+
interface CiSkipExcludedSummary {
|
|
161
|
+
kind: "skipped-excluded";
|
|
162
|
+
prNumber: number;
|
|
163
|
+
excludedPaths: string[];
|
|
164
|
+
}
|
|
165
|
+
|
|
158
166
|
interface CiSkipCoverageSummary {
|
|
159
167
|
kind: "skipped-coverage";
|
|
160
168
|
prNumber: number;
|
|
@@ -198,6 +206,7 @@ export type CiSummaryData =
|
|
|
198
206
|
| CiReviewSummary
|
|
199
207
|
| CiSkipSizeSummary
|
|
200
208
|
| CiSkipBudgetSummary
|
|
209
|
+
| CiSkipExcludedSummary
|
|
201
210
|
| CiSkipCoverageSummary
|
|
202
211
|
| CiManualRequiredSummary;
|
|
203
212
|
|
|
@@ -336,6 +345,24 @@ function skipBudgetLines(data: CiSkipBudgetSummary): string[] {
|
|
|
336
345
|
];
|
|
337
346
|
}
|
|
338
347
|
|
|
348
|
+
// #317: not a review held back but a diff with nothing in scope, so the heading
|
|
349
|
+
// is a plain fact, not a warning, and the wording never says "found nothing":
|
|
350
|
+
// nothing was looked at.
|
|
351
|
+
function skipExcludedLines(data: CiSkipExcludedSummary): string[] {
|
|
352
|
+
return [
|
|
353
|
+
`### Crysk: nothing to review — PR #${data.prNumber}`,
|
|
354
|
+
"",
|
|
355
|
+
"**Reason:** every changed file is excluded from review by the ignore " +
|
|
356
|
+
"rules (`.cryskignore` and the shipped defaults).",
|
|
357
|
+
"",
|
|
358
|
+
// Capped like every other path list (listPaths), and each path through
|
|
359
|
+
// code(): the paths are the author's, and a backtick would break the span.
|
|
360
|
+
listPaths(data.excludedPaths.map(code)),
|
|
361
|
+
"",
|
|
362
|
+
"Nothing was spawned and nothing was spent.",
|
|
363
|
+
];
|
|
364
|
+
}
|
|
365
|
+
|
|
339
366
|
function admissionMetricRows(
|
|
340
367
|
data: CiSkipCoverageSummary | CiManualRequiredSummary,
|
|
341
368
|
): string[] {
|
|
@@ -466,11 +493,13 @@ export function renderStepSummary(
|
|
|
466
493
|
? skipSizeLines(data)
|
|
467
494
|
: data.kind === "skipped-budget"
|
|
468
495
|
? skipBudgetLines(data)
|
|
469
|
-
: data.kind === "skipped-
|
|
470
|
-
?
|
|
471
|
-
: data.kind === "
|
|
472
|
-
?
|
|
473
|
-
:
|
|
496
|
+
: data.kind === "skipped-excluded"
|
|
497
|
+
? skipExcludedLines(data)
|
|
498
|
+
: data.kind === "skipped-coverage"
|
|
499
|
+
? skipCoverageLines(data)
|
|
500
|
+
: data.kind === "manual-required"
|
|
501
|
+
? manualRequiredLines(data)
|
|
502
|
+
: reviewedLines(data);
|
|
474
503
|
const out = [...body, "---", "", footerFor(ciMode)];
|
|
475
504
|
return `${out.join("\n").trimEnd()}\n`;
|
|
476
505
|
}
|
package/src/ci/review-levels.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// keys it sets are always written to .crysk/config.json, so what a repo does
|
|
9
9
|
// is visible in the file it versions, never inherited silently.
|
|
10
10
|
|
|
11
|
+
import type { PostMinSeverity } from "#pr/post-floor";
|
|
11
12
|
import { DEFAULT_SIZE_GATE } from "#review/size-gate";
|
|
12
13
|
import { CI_DEFAULT_METERED_BUDGET_USD } from "./gates";
|
|
13
14
|
import {
|
|
@@ -236,6 +237,12 @@ export interface ConfigPlan {
|
|
|
236
237
|
remove: string[];
|
|
237
238
|
}
|
|
238
239
|
|
|
240
|
+
// What setup writes for `post_min_severity`. The engine's own default stays
|
|
241
|
+
// "post everything", so a repo changes only when setup runs on it: a new repo,
|
|
242
|
+
// or a re-run (`--force` included) on one whose config has no floor yet. Filled
|
|
243
|
+
// only when absent, so a floor someone chose is never reset.
|
|
244
|
+
export const RECOMMENDED_POST_MIN_SEVERITY: PostMinSeverity = "warning";
|
|
245
|
+
|
|
239
246
|
export function configPlan(choices: CiSetupChoices): ConfigPlan {
|
|
240
247
|
const { ignorePatterns: _ignored, ...advanced } = choices.advanced;
|
|
241
248
|
const set: Record<string, unknown> = {};
|
|
@@ -251,6 +258,7 @@ export function configPlan(choices: CiSetupChoices): ConfigPlan {
|
|
|
251
258
|
} else fillIfAbsent.push(levelKeys);
|
|
252
259
|
if (choices.chosen.maxChangedLines) Object.assign(set, lineKeys);
|
|
253
260
|
else fillIfAbsent.push(lineKeys);
|
|
261
|
+
fillIfAbsent.push({ post_min_severity: RECOMMENDED_POST_MIN_SEVERITY });
|
|
254
262
|
// An advanced key is present only because someone gave it.
|
|
255
263
|
for (const [key, value] of Object.entries(advanced)) {
|
|
256
264
|
if (value !== undefined) set[key] = value;
|
|
@@ -303,8 +311,21 @@ export function renderChoicesSummary(
|
|
|
303
311
|
` observe only ${a.ci_admission_observe_only === true ? "yes: skip decisions are logged, every push is reviewed" : "no"}`,
|
|
304
312
|
` trusted actors ${a.ci_trusted_actors && a.ci_trusted_actors.length > 0 ? a.ci_trusted_actors.join(", ") : "none beyond the workflow actor"}`,
|
|
305
313
|
` size limit ${"max_changed_lines" in kept ? `${JSON.stringify(kept.max_changed_lines)} changed lines (kept)` : choices.maxChangedLines === 0 ? "no changed-lines limit (0)" : `${choices.maxChangedLines} changed lines`}, ${a.max_changed_files === undefined ? "files resolved from how the review is paid" : `${a.max_changed_files} files`}`,
|
|
314
|
+
` posting ${postingLine(effective.post_min_severity)}`,
|
|
306
315
|
` exclusions ${a.ignorePatterns && a.ignorePatterns.length > 0 ? `${a.ignorePatterns.join(", ")} (.cryskignore)` : "none added (.cryskignore)"}`,
|
|
307
316
|
"Change them later in the repo config (.crysk/config.json, or .prhero/config.json in a repo set up before the rename) and the review workflow (.github/workflows/crysk.yml, or pr-hero.yml in a repo set up before the rename) (`npx -y crysk config` shows the effective values).",
|
|
308
317
|
];
|
|
309
318
|
return lines;
|
|
310
319
|
}
|
|
320
|
+
|
|
321
|
+
// Read off the file as written, so a floor set by hand is reported as it stands.
|
|
322
|
+
function postingLine(value: unknown): string {
|
|
323
|
+
if (value === "blocking") {
|
|
324
|
+
return "blocking findings only; advisory ones are counted in the summary (post_min_severity)";
|
|
325
|
+
}
|
|
326
|
+
if (value === "warning") {
|
|
327
|
+
return "every finding except advisory suggestions, which are counted in the summary (post_min_severity)";
|
|
328
|
+
}
|
|
329
|
+
if (value === "suggestion") return "every finding (post_min_severity)";
|
|
330
|
+
return "every finding (post_min_severity unset)";
|
|
331
|
+
}
|
package/src/ci/setup.ts
CHANGED
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
// caller points it at (via `crysk setup --ci` / `crysk ci init`); a repo that
|
|
13
13
|
// already has the pre-rename `pr-hero.yml` keeps that file, updated in place.
|
|
14
14
|
// Pillar 3 Phase 5 (tasks.md 5.2) reuses this SAME function to produce this
|
|
15
|
-
// repo's own canonical example workflow (
|
|
16
|
-
// repo is the existing-repo case), rather than
|
|
15
|
+
// repo's own canonical example workflow (at `crysk.yml`), rather than
|
|
17
16
|
// hand-authoring a second copy that could silently drift from what every
|
|
18
17
|
// caller of `setup --ci` actually gets — test/packaging.test.ts asserts the
|
|
19
18
|
// committed file's bytes equal generateCiWorkflowTemplate()'s output exactly.
|
package/src/commands/post.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { assertRunMatchesPr } from "#ci/gates";
|
|
5
|
+
import { loadEffectiveConfig } from "#config/config";
|
|
4
6
|
import { resolveRepoRoot } from "#git/git";
|
|
5
7
|
import { postingExitCode } from "#pr/inline";
|
|
8
|
+
import type { PostMinSeverity } from "#pr/post-floor";
|
|
6
9
|
import {
|
|
7
10
|
ghCurrentBranchPr,
|
|
8
11
|
ghRepoWebUrl,
|
|
@@ -54,11 +57,19 @@ export async function postCommand(options: CliOptions): Promise<number> {
|
|
|
54
57
|
options.pr === "current"
|
|
55
58
|
? resolveCurrentPrNumber(await ghCurrentBranchPr(operatorRoot))
|
|
56
59
|
: options.pr;
|
|
60
|
+
// The same floor `review --pr --post` applies, read from the same layers,
|
|
61
|
+
// so a replayed run posts what the live run would have.
|
|
62
|
+
const { effective } = await loadEffectiveConfig({
|
|
63
|
+
root: operatorRoot,
|
|
64
|
+
home: os.homedir(),
|
|
65
|
+
configFlag: options.config,
|
|
66
|
+
});
|
|
57
67
|
return runPostCommand({
|
|
58
68
|
operatorRoot,
|
|
59
69
|
pr: prNumber,
|
|
60
70
|
from: options.from,
|
|
61
71
|
dryRun: options.dryRun,
|
|
72
|
+
postMinSeverity: effective.post_min_severity,
|
|
62
73
|
});
|
|
63
74
|
}
|
|
64
75
|
|
|
@@ -68,6 +79,7 @@ export async function runPostCommand(input: {
|
|
|
68
79
|
from: string;
|
|
69
80
|
dryRun: boolean;
|
|
70
81
|
spawnFn?: typeof Bun.spawn;
|
|
82
|
+
postMinSeverity?: PostMinSeverity;
|
|
71
83
|
}): Promise<number> {
|
|
72
84
|
const { operatorRoot, pr: prNumber, dryRun, spawnFn } = input;
|
|
73
85
|
const runDir = path.resolve(input.from);
|
|
@@ -193,6 +205,7 @@ export async function runPostCommand(input: {
|
|
|
193
205
|
doc,
|
|
194
206
|
diffPatch,
|
|
195
207
|
spawnFn,
|
|
208
|
+
postMinSeverity: input.postMinSeverity,
|
|
196
209
|
});
|
|
197
210
|
// The preview refuses whatever the post would refuse. A dry run that
|
|
198
211
|
// prints a plan for a run dir the live path then rejects is a $0 gate
|
|
@@ -234,6 +247,9 @@ export async function runPostCommand(input: {
|
|
|
234
247
|
for (const finding of plan.issueComments) {
|
|
235
248
|
log(` outside ${finding.path}:${finding.line} ${finding.id}`);
|
|
236
249
|
}
|
|
250
|
+
for (const finding of plan.notPosted) {
|
|
251
|
+
log(` hidden ${finding.path}:${finding.line} ${finding.id}`);
|
|
252
|
+
}
|
|
237
253
|
log("dry run: nothing was fetched-for-mutation or posted.");
|
|
238
254
|
return 0;
|
|
239
255
|
}
|
|
@@ -253,6 +269,7 @@ export async function runPostCommand(input: {
|
|
|
253
269
|
...(rereview === undefined ? {} : { rereview, rereviewPriors: [] }),
|
|
254
270
|
requireRereviewOnPriorSummary: true,
|
|
255
271
|
refuseOnVanishedPriorSummary: true,
|
|
272
|
+
postMinSeverity: input.postMinSeverity,
|
|
256
273
|
});
|
|
257
274
|
await writePostReceipt(runDir, prNumber, doc.head_sha, outcome);
|
|
258
275
|
log(
|