@codyswann/lisa 5.10.1 → 5.12.0
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/all/copy-overwrite/scripts/check-third-party-review-evidence.mjs +241 -36
- package/all/copy-overwrite/scripts/lisa-gates.mjs +112 -2
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +1 -1
- package/all/copy-overwrite/scripts/review-evidence-event.mjs +7 -1
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +52 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +13 -11
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/expo/create-only/.github/required-checks.json +1 -0
- package/nestjs/create-only/.github/required-checks.json +1 -0
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/lisa/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/lisa-agy/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/lisa-copilot/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/lisa-cursor/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/lisa-devin/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +20 -2
- package/plugins/src/base/skills/lisa-pull-request-review/SKILL.md +37 -10
- package/typescript/copy-overwrite/.github/GITHUB_ACTIONS.md +0 -17
- package/typescript/copy-overwrite/scripts/check-skipped-required-checks.mjs +313 -18
- package/typescript/create-only/.github/required-checks.json +1 -0
|
@@ -1039,7 +1039,10 @@ export function loadDeclaration(rootDir) {
|
|
|
1039
1039
|
`check-skipped-required-checks: ${DECLARATION_PATH} does not exist. This guard rests on two REVIEWED SNAPSHOTS that cannot be derived from the repository — the ruleset's required contexts, and what each \`skip_jobs\` token silences. Create it (Lisa ships a seed) rather than deleting the guard.`
|
|
1040
1040
|
);
|
|
1041
1041
|
}
|
|
1042
|
-
const declaration =
|
|
1042
|
+
const declaration = withGateReviewers(
|
|
1043
|
+
JSON.parse(readFileSync(path, "utf8")),
|
|
1044
|
+
gateReviewers(rootDir)
|
|
1045
|
+
);
|
|
1043
1046
|
assertRequiredDeclarationKeys(declaration);
|
|
1044
1047
|
assertDeclarationCollections(declaration);
|
|
1045
1048
|
assertRequiredContextsByBranch(declaration);
|
|
@@ -1052,6 +1055,226 @@ export function loadDeclaration(rootDir) {
|
|
|
1052
1055
|
return declaration;
|
|
1053
1056
|
}
|
|
1054
1057
|
|
|
1058
|
+
/** Repo-relative path of the project's Lisa config, which holds the gates. */
|
|
1059
|
+
const LISA_CONFIG_PATH = ".lisa.config.json";
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* @typedef {Record<string, {proof?: string[], no_work?: string[]}>} GateVocabularies
|
|
1063
|
+
* Description vocabulary per reviewer context, as read from the gates config.
|
|
1064
|
+
*/
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* The third-party reviewers `.lisa.config.json` declares, as description
|
|
1068
|
+
* vocabularies keyed by the awaited context (CodySwannGT/lisa#4914).
|
|
1069
|
+
*
|
|
1070
|
+
* A reviewer is a gate whose pull-request entry awaits a context and marks it
|
|
1071
|
+
* `evidence.reviewer: true` — the same reading as `configuredReviewers` in
|
|
1072
|
+
* `check-third-party-review-evidence.mjs`. That script ships from the `all/`
|
|
1073
|
+
* template and this one from `typescript/`, so a host can carry either without
|
|
1074
|
+
* the other; the reading is repeated here rather than imported, and a unit test
|
|
1075
|
+
* holds the two to the same answer.
|
|
1076
|
+
*
|
|
1077
|
+
* Reviewers come back in two sets. `checks` must post a check, so they are
|
|
1078
|
+
* evidence-bearing. `reviewBy` are proven by `evidence.review_by`: the prover
|
|
1079
|
+
* reads their `await` check first and falls back to their submitted review only
|
|
1080
|
+
* when they posted none, so a check they DO post is still examined for a hollow
|
|
1081
|
+
* green — but one that never posted is not a finding, because a review is
|
|
1082
|
+
* that reviewer's evidence.
|
|
1083
|
+
*
|
|
1084
|
+
* No config means no reviewers. A config that does not parse, or a reviewer
|
|
1085
|
+
* gate whose phrases are malformed, is refused: this guard would otherwise
|
|
1086
|
+
* examine fewer reviewers, or other words, than the project declared and say
|
|
1087
|
+
* nothing.
|
|
1088
|
+
* @param {string} rootDir - Repository root
|
|
1089
|
+
* @returns {{checks: GateVocabularies, reviewBy: GateVocabularies}} Vocabulary per reviewer context
|
|
1090
|
+
* @throws {Error} When `.lisa.config.json` does not parse or a reviewer gate's phrases are malformed
|
|
1091
|
+
*/
|
|
1092
|
+
function gateReviewers(rootDir) {
|
|
1093
|
+
const path = resolveWithinRoot(rootDir, LISA_CONFIG_PATH, "the Lisa config");
|
|
1094
|
+
/** @type {{checks: GateVocabularies, reviewBy: GateVocabularies}} */
|
|
1095
|
+
const reviewers = { checks: {}, reviewBy: {} };
|
|
1096
|
+
if (!existsSync(path)) return reviewers;
|
|
1097
|
+
let config;
|
|
1098
|
+
try {
|
|
1099
|
+
config = JSON.parse(readFileSync(path, "utf8"));
|
|
1100
|
+
} catch (error) {
|
|
1101
|
+
throw new Error(
|
|
1102
|
+
`check-skipped-required-checks: ${LISA_CONFIG_PATH} is not readable (${/** @type {Error} */ (error).message}). Its gates declare the third-party reviewers this guard examines, so it refuses rather than examining none of them.`
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
for (const [gateId, gate] of Object.entries(config?.gates ?? {})) {
|
|
1106
|
+
if (!isPlainObject(gate)) continue;
|
|
1107
|
+
const entry = gate["pull-request"];
|
|
1108
|
+
if (!isPlainObject(entry)) continue;
|
|
1109
|
+
const evidence = entry.evidence;
|
|
1110
|
+
if (evidence?.reviewer !== true) continue;
|
|
1111
|
+
if (typeof entry.await !== "string" || entry.await.trim() === "") continue;
|
|
1112
|
+
const vocabulary = {};
|
|
1113
|
+
for (const list of ["proof", "no_work"]) {
|
|
1114
|
+
if (evidence[list] === undefined) continue;
|
|
1115
|
+
assertGatePhrases(gateId, list, evidence[list]);
|
|
1116
|
+
vocabulary[list] = evidence[list];
|
|
1117
|
+
}
|
|
1118
|
+
// A gate pinned by `posted_by` never takes the review route (#4916), so it
|
|
1119
|
+
// must post its check: evidence-bearing, as the prover reads it.
|
|
1120
|
+
const set =
|
|
1121
|
+
entry.posted_by === undefined &&
|
|
1122
|
+
typeof evidence.review_by === "string" &&
|
|
1123
|
+
evidence.review_by.trim() !== ""
|
|
1124
|
+
? reviewers.reviewBy
|
|
1125
|
+
: reviewers.checks;
|
|
1126
|
+
set[entry.await] = mergeVocabulary(set[entry.await] ?? {}, vocabulary);
|
|
1127
|
+
}
|
|
1128
|
+
// A context another gate requires to post a check is evidence-bearing, and
|
|
1129
|
+
// judging it twice would report one hollow green as two. It is judged once,
|
|
1130
|
+
// reading both gates' phrases.
|
|
1131
|
+
for (const name of Object.keys(reviewers.checks)) {
|
|
1132
|
+
if (!Object.hasOwn(reviewers.reviewBy, name)) continue;
|
|
1133
|
+
reviewers.checks[name] = mergeVocabulary(
|
|
1134
|
+
reviewers.checks[name],
|
|
1135
|
+
reviewers.reviewBy[name]
|
|
1136
|
+
);
|
|
1137
|
+
delete reviewers.reviewBy[name];
|
|
1138
|
+
}
|
|
1139
|
+
return reviewers;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Whether a value is a non-null, non-array object.
|
|
1144
|
+
* @param {unknown} value - Any value
|
|
1145
|
+
* @returns {boolean} True for a plain object
|
|
1146
|
+
*/
|
|
1147
|
+
function isPlainObject(value) {
|
|
1148
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Refuses a reviewer gate's phrase list unless it is an array of non-blank
|
|
1153
|
+
* strings, naming the gate it came from so the fix lands in the right file.
|
|
1154
|
+
* @param {string} gateId - The gate's id in `.lisa.config.json`
|
|
1155
|
+
* @param {string} list - `proof` or `no_work`
|
|
1156
|
+
* @param {unknown} phrases - The declared value
|
|
1157
|
+
* @returns {void}
|
|
1158
|
+
* @throws {Error} When the list is malformed
|
|
1159
|
+
*/
|
|
1160
|
+
function assertGatePhrases(gateId, list, phrases) {
|
|
1161
|
+
if (
|
|
1162
|
+
!Array.isArray(phrases) ||
|
|
1163
|
+
phrases.some(
|
|
1164
|
+
phrase =>
|
|
1165
|
+
typeof phrase !== "string" || normalizeDescription(phrase) === ""
|
|
1166
|
+
)
|
|
1167
|
+
) {
|
|
1168
|
+
throw new Error(
|
|
1169
|
+
`check-skipped-required-checks: ${LISA_CONFIG_PATH} \`gates.${gateId}.pull-request.evidence.${list}\` must be an array of non-empty description strings.`
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Two vocabularies for one check, as one: each phrase list is the union of
|
|
1176
|
+
* both, in order, without repeats. Phrases only ever ADD to the shipped
|
|
1177
|
+
* defaults, so a union is the reading that keeps both declarations' meaning.
|
|
1178
|
+
*
|
|
1179
|
+
* A list `left` holds that is not an array is kept as it is, so
|
|
1180
|
+
* `assertEvidenceBearingChecks` still refuses it rather than seeing the other
|
|
1181
|
+
* declaration's valid list in its place.
|
|
1182
|
+
* @param {Record<string, unknown>} left - One vocabulary
|
|
1183
|
+
* @param {Record<string, unknown>} right - The other
|
|
1184
|
+
* @returns {Record<string, unknown>} The combined vocabulary
|
|
1185
|
+
*/
|
|
1186
|
+
function mergeVocabulary(left, right) {
|
|
1187
|
+
const merged = { ...left };
|
|
1188
|
+
for (const list of ["proof", "no_work"]) {
|
|
1189
|
+
if (right[list] === undefined) continue;
|
|
1190
|
+
if (left[list] === undefined) merged[list] = right[list];
|
|
1191
|
+
else if (Array.isArray(left[list]) && Array.isArray(right[list]))
|
|
1192
|
+
merged[list] = [...new Set([...left[list], ...right[list]])];
|
|
1193
|
+
}
|
|
1194
|
+
return merged;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* The phrases each check run is decoded with: the evidence-bearing checks'
|
|
1199
|
+
* and the review_by checks', unioned per name (#4914). A review_by run decoded
|
|
1200
|
+
* without its gate's phrases would miss a declared no-work title and read as
|
|
1201
|
+
* proved.
|
|
1202
|
+
* @param {object} declaration - The loaded declaration.
|
|
1203
|
+
* @returns {Record<string, object>} Phrases by check name.
|
|
1204
|
+
*/
|
|
1205
|
+
export function decodingVocabulary(declaration) {
|
|
1206
|
+
const evidence =
|
|
1207
|
+
/** @type {{evidence_bearing_checks?: Record<string, object>|null, review_by_checks?: Record<string, object>|null}} */ (
|
|
1208
|
+
declaration
|
|
1209
|
+
);
|
|
1210
|
+
const merged = { ...evidence.evidence_bearing_checks };
|
|
1211
|
+
for (const [name, vocabulary] of Object.entries(
|
|
1212
|
+
evidence.review_by_checks ?? {}
|
|
1213
|
+
)) {
|
|
1214
|
+
const existing = merged[name];
|
|
1215
|
+
merged[name] =
|
|
1216
|
+
existing && typeof existing === "object"
|
|
1217
|
+
? mergeVocabulary(existing, vocabulary ?? {})
|
|
1218
|
+
: (vocabulary ?? {});
|
|
1219
|
+
}
|
|
1220
|
+
return merged;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* The declaration with the gates config's reviewers added
|
|
1225
|
+
* (CodySwannGT/lisa#4914).
|
|
1226
|
+
*
|
|
1227
|
+
* The gates config is where a project names its reviewer; a project switching
|
|
1228
|
+
* vendors edits it and this guard follows. Reviewers that must post a check
|
|
1229
|
+
* join `evidence_bearing_checks`; names already there keep working, and a name
|
|
1230
|
+
* declared in both reads both vocabularies. Reviewers proven by
|
|
1231
|
+
* `evidence.review_by` go to `review_by_checks`, which only the vacuity arm
|
|
1232
|
+
* reads and only for a check they actually posted — see
|
|
1233
|
+
* {@link evaluateVacuousChecks}. With no reviewer gate the declaration is
|
|
1234
|
+
* returned as is.
|
|
1235
|
+
* @param {object} declaration - Parsed `.github/required-checks.json`
|
|
1236
|
+
* @param {{checks: GateVocabularies, reviewBy: GateVocabularies}} reviewers - From {@link gateReviewers}
|
|
1237
|
+
* @returns {object} The declaration to validate and judge
|
|
1238
|
+
*/
|
|
1239
|
+
function withGateReviewers(declaration, reviewers) {
|
|
1240
|
+
const declared = declaration.evidence_bearing_checks;
|
|
1241
|
+
// A malformed declared value is left for `assertEvidenceBearingChecks` to
|
|
1242
|
+
// refuse, instead of being papered over by the gates' entries.
|
|
1243
|
+
if (declared !== undefined && declared !== null && !isPlainObject(declared))
|
|
1244
|
+
return declaration;
|
|
1245
|
+
const checks = { ...declared };
|
|
1246
|
+
for (const [name, vocabulary] of Object.entries(reviewers.checks)) {
|
|
1247
|
+
if (!Object.hasOwn(checks, name)) checks[name] = vocabulary;
|
|
1248
|
+
// Likewise a malformed declared entry, `null` included, stays as written.
|
|
1249
|
+
else if (isPlainObject(checks[name]))
|
|
1250
|
+
checks[name] = mergeVocabulary(checks[name], vocabulary);
|
|
1251
|
+
}
|
|
1252
|
+
/** @type {GateVocabularies} */
|
|
1253
|
+
const reviewBy = {};
|
|
1254
|
+
for (const [name, vocabulary] of Object.entries(reviewers.reviewBy)) {
|
|
1255
|
+
// A name `evidence_bearing_checks` declares must post a check; it is
|
|
1256
|
+
// judged there, reading the review_by gate's phrases too.
|
|
1257
|
+
if (!Object.hasOwn(checks, name)) reviewBy[name] = vocabulary;
|
|
1258
|
+
else if (isPlainObject(checks[name]))
|
|
1259
|
+
checks[name] = mergeVocabulary(checks[name], vocabulary);
|
|
1260
|
+
}
|
|
1261
|
+
// `review_by_checks` is derived from the gates and nowhere else, so a copy
|
|
1262
|
+
// written into the declaration by hand is not read.
|
|
1263
|
+
const base = Object.fromEntries(
|
|
1264
|
+
Object.entries(declaration).filter(([key]) => key !== "review_by_checks")
|
|
1265
|
+
);
|
|
1266
|
+
return {
|
|
1267
|
+
...base,
|
|
1268
|
+
...((declared === undefined || declared === null) &&
|
|
1269
|
+
Object.keys(checks).length === 0
|
|
1270
|
+
? {}
|
|
1271
|
+
: { evidence_bearing_checks: checks }),
|
|
1272
|
+
...(Object.keys(reviewBy).length === 0
|
|
1273
|
+
? {}
|
|
1274
|
+
: { review_by_checks: reviewBy }),
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1055
1278
|
/**
|
|
1056
1279
|
* Validate reasoned registration deferrals against the set actually judged.
|
|
1057
1280
|
* This only removes absence/registration observations. GitHub still requires
|
|
@@ -1612,7 +1835,11 @@ function findOrphanedExemptions(declarations, skipped) {
|
|
|
1612
1835
|
* @returns {string} One of `DESCRIPTION_VERDICTS`
|
|
1613
1836
|
*/
|
|
1614
1837
|
export function classifyCheckDescription(description, vocabulary = {}) {
|
|
1615
|
-
|
|
1838
|
+
// Whitespace-collapsed, as the review-evidence prover's normalizeDescription
|
|
1839
|
+
// reads a description, so the two checkers give the same answer.
|
|
1840
|
+
const fold = (/** @type {string} */ value) =>
|
|
1841
|
+
value.trim().replace(/\s+/gu, " ").toLowerCase();
|
|
1842
|
+
const text = fold(description ?? "");
|
|
1616
1843
|
if (text === "") return DESCRIPTION_VERDICTS.unproven;
|
|
1617
1844
|
|
|
1618
1845
|
// No-work is tested FIRST. The lists are asserted non-overlapping in the
|
|
@@ -1623,7 +1850,7 @@ export function classifyCheckDescription(description, vocabulary = {}) {
|
|
|
1623
1850
|
...REVIEW_DESCRIPTION_DEFAULTS.no_work,
|
|
1624
1851
|
...(vocabulary.no_work ?? []),
|
|
1625
1852
|
];
|
|
1626
|
-
if (noWork.some(phrase => text.includes(phrase
|
|
1853
|
+
if (noWork.some(phrase => text.includes(fold(phrase)))) {
|
|
1627
1854
|
return DESCRIPTION_VERDICTS.noWork;
|
|
1628
1855
|
}
|
|
1629
1856
|
|
|
@@ -1631,7 +1858,7 @@ export function classifyCheckDescription(description, vocabulary = {}) {
|
|
|
1631
1858
|
...REVIEW_DESCRIPTION_DEFAULTS.proof,
|
|
1632
1859
|
...(vocabulary.proof ?? []),
|
|
1633
1860
|
];
|
|
1634
|
-
if (proof.some(phrase => text === phrase
|
|
1861
|
+
if (proof.some(phrase => text === fold(phrase))) {
|
|
1635
1862
|
return DESCRIPTION_VERDICTS.proved;
|
|
1636
1863
|
}
|
|
1637
1864
|
return DESCRIPTION_VERDICTS.unproven;
|
|
@@ -1694,8 +1921,20 @@ export function evaluateVacuousChecks(declaration, checks, options = {}) {
|
|
|
1694
1921
|
});
|
|
1695
1922
|
if (violation !== null) violations.push(violation);
|
|
1696
1923
|
}
|
|
1924
|
+
// A reviewer proven by its submitted review (`evidence.review_by`, #4914) is
|
|
1925
|
+
// judged only on a check it actually posted: a hollow green from it is as
|
|
1926
|
+
// hollow as anyone's, but posting nothing is how that reviewer works.
|
|
1927
|
+
const reviewedBy = reportedReviewByChecks(declaration, checks);
|
|
1928
|
+
for (const [name, entry] of reviewedBy) {
|
|
1929
|
+
const violation = evaluateEvidenceBearingCheck(name, entry, checks, {
|
|
1930
|
+
at,
|
|
1931
|
+
required,
|
|
1932
|
+
trustRequired,
|
|
1933
|
+
});
|
|
1934
|
+
if (violation !== null) violations.push(violation);
|
|
1935
|
+
}
|
|
1697
1936
|
|
|
1698
|
-
return { violations, checked: entries.length };
|
|
1937
|
+
return { violations, checked: entries.length + reviewedBy.length };
|
|
1699
1938
|
}
|
|
1700
1939
|
|
|
1701
1940
|
/**
|
|
@@ -4319,6 +4558,25 @@ export function fetchChecksForCommit(sha, repo, evidenceChecks = {}) {
|
|
|
4319
4558
|
);
|
|
4320
4559
|
}
|
|
4321
4560
|
|
|
4561
|
+
/**
|
|
4562
|
+
* The phrase a structured success line names, or null.
|
|
4563
|
+
*
|
|
4564
|
+
* Reads `Result: Success - <phrase>` with any spacing around the words, by
|
|
4565
|
+
* plain string steps rather than a regular expression, so no input can make it
|
|
4566
|
+
* backtrack.
|
|
4567
|
+
* @param {string} line - A first summary line.
|
|
4568
|
+
* @returns {string|null} The trimmed phrase, or null when the line has another shape.
|
|
4569
|
+
*/
|
|
4570
|
+
function structuredSuccessPhrase(line) {
|
|
4571
|
+
if (!line.startsWith("Result:")) return null;
|
|
4572
|
+
const outcome = line.slice("Result:".length).trimStart();
|
|
4573
|
+
if (!outcome.startsWith("Success")) return null;
|
|
4574
|
+
const rest = outcome.slice("Success".length).trimStart();
|
|
4575
|
+
if (!rest.startsWith("-")) return null;
|
|
4576
|
+
const phrase = rest.slice(1).trim();
|
|
4577
|
+
return phrase === "" ? null : phrase;
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4322
4580
|
/**
|
|
4323
4581
|
* Decode a selected check run without changing legacy commit-status policy.
|
|
4324
4582
|
*
|
|
@@ -4352,12 +4610,18 @@ function checkRunReviewDescription(row, vocabulary) {
|
|
|
4352
4610
|
) {
|
|
4353
4611
|
return firstLine;
|
|
4354
4612
|
}
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4613
|
+
const succeeded = row.status === "completed" && row.conclusion === "success";
|
|
4614
|
+
const proves = (/** @type {string} */ phrase) =>
|
|
4615
|
+
classifyCheckDescription(phrase, vocabulary) ===
|
|
4616
|
+
DESCRIPTION_VERDICTS.proved;
|
|
4617
|
+
// `Result: Success - <phrase>` stands for `<phrase>` when the phrase is
|
|
4618
|
+
// declared proof — CodeRabbit's `Result: Success - Review completed` is one
|
|
4619
|
+
// instance, not the rule (#4909). The same pattern is in
|
|
4620
|
+
// `check-third-party-review-evidence.mjs`, and the parity tests hold the two
|
|
4621
|
+
// provers to the same answers.
|
|
4622
|
+
const structured = structuredSuccessPhrase(firstLine);
|
|
4623
|
+
if (succeeded && structured !== null && proves(structured)) {
|
|
4624
|
+
return structured;
|
|
4361
4625
|
}
|
|
4362
4626
|
const resultLooking =
|
|
4363
4627
|
/^[\s>#|]*Result\b/iu.test(firstLine) ||
|
|
@@ -4365,6 +4629,9 @@ function checkRunReviewDescription(row, vocabulary) {
|
|
|
4365
4629
|
if (resultLooking) {
|
|
4366
4630
|
return firstLine;
|
|
4367
4631
|
}
|
|
4632
|
+
// A reviewer that writes its verdict as a plain first summary line is read
|
|
4633
|
+
// by its own declared proof phrases (#4909).
|
|
4634
|
+
if (succeeded && proves(firstLine)) return firstLine;
|
|
4368
4635
|
return title;
|
|
4369
4636
|
}
|
|
4370
4637
|
|
|
@@ -4468,8 +4735,28 @@ export function declaredEvidenceChecks(declaration) {
|
|
|
4468
4735
|
* @returns {boolean} True when nothing declared is still in flight
|
|
4469
4736
|
*/
|
|
4470
4737
|
export function checksSettled(declaration, checks) {
|
|
4471
|
-
return
|
|
4472
|
-
|
|
4738
|
+
return (
|
|
4739
|
+
declaredEvidenceChecks(declaration).every(name =>
|
|
4740
|
+
checkSettled(checks.find(check => check.name === name))
|
|
4741
|
+
) &&
|
|
4742
|
+
reportedReviewByChecks(declaration, checks).every(([name]) =>
|
|
4743
|
+
checkSettled(checks.find(check => check.name === name))
|
|
4744
|
+
)
|
|
4745
|
+
);
|
|
4746
|
+
}
|
|
4747
|
+
|
|
4748
|
+
/**
|
|
4749
|
+
* The `review_by_checks` entries whose context posted a row (#4914). One that
|
|
4750
|
+
* posted nothing is neither a finding nor still in flight: that reviewer's
|
|
4751
|
+
* evidence is its submitted review, which the review-evidence prover reads.
|
|
4752
|
+
*
|
|
4753
|
+
* @param {object} declaration - The per-repo declaration
|
|
4754
|
+
* @param {ReadonlyArray<{name: string}>} checks - Rows
|
|
4755
|
+
* @returns {Array<[string, object]>} Name and vocabulary of each reported one
|
|
4756
|
+
*/
|
|
4757
|
+
function reportedReviewByChecks(declaration, checks) {
|
|
4758
|
+
return Object.entries(declaration.review_by_checks ?? {}).filter(([name]) =>
|
|
4759
|
+
checks.some(check => check.name === name)
|
|
4473
4760
|
);
|
|
4474
4761
|
}
|
|
4475
4762
|
|
|
@@ -4533,8 +4820,7 @@ export function fetchSettledChecks(declaration, pr, repo, options = {}) {
|
|
|
4533
4820
|
return fetchChecksForCommit(
|
|
4534
4821
|
headSha,
|
|
4535
4822
|
slug,
|
|
4536
|
-
|
|
4537
|
-
(declaration).evidence_bearing_checks ?? {}
|
|
4823
|
+
decodingVocabulary(declaration)
|
|
4538
4824
|
);
|
|
4539
4825
|
});
|
|
4540
4826
|
const resolveHead = options.headSha ?? resolveHeadSha;
|
|
@@ -4555,6 +4841,9 @@ export function fetchSettledChecks(declaration, pr, repo, options = {}) {
|
|
|
4555
4841
|
);
|
|
4556
4842
|
// A substitute is useful only at the head it was actually read for. Pending
|
|
4557
4843
|
// rows still wait, and a missing required reviewer still needs a real row.
|
|
4844
|
+
// A review_by reviewer's check that posted is waited for like any other
|
|
4845
|
+
// (#4914); one that posted nothing is not in flight — see
|
|
4846
|
+
// {@link reportedReviewByChecks}.
|
|
4558
4847
|
const evidenceReady = observed =>
|
|
4559
4848
|
declaredEvidenceChecks(declaration).every(name => {
|
|
4560
4849
|
const found = observed.checks.find(check => check.name === name);
|
|
@@ -4564,7 +4853,10 @@ export function fetchSettledChecks(declaration, pr, repo, options = {}) {
|
|
|
4564
4853
|
observed.headSha === options.substituteHead &&
|
|
4565
4854
|
options.substitutes?.has(name))
|
|
4566
4855
|
);
|
|
4567
|
-
})
|
|
4856
|
+
}) &&
|
|
4857
|
+
reportedReviewByChecks(declaration, observed.checks).every(([name]) =>
|
|
4858
|
+
checkSettled(observed.checks.find(check => check.name === name))
|
|
4859
|
+
);
|
|
4568
4860
|
|
|
4569
4861
|
// Bracket checks with coherent head/base observations. The early substitute
|
|
4570
4862
|
// read can supply the first observation without another metadata request.
|
|
@@ -4796,10 +5088,13 @@ export function vacuityRefusal(input) {
|
|
|
4796
5088
|
reason: `PR #${pr} reported ZERO checks of any kind. A pull request with no checks and a pull request whose checks are all honest produce the same silence from this arm, so it refuses rather than picking one. Confirm the token can read checks (\`actions: read\` for the \`gh pr checks\` rollup, or \`checks: read\` + \`statuses: read\` for the fallback) before believing this.`,
|
|
4797
5089
|
};
|
|
4798
5090
|
}
|
|
4799
|
-
if (
|
|
5091
|
+
if (
|
|
5092
|
+
declaredEvidenceChecks(declaration).length === 0 &&
|
|
5093
|
+
Object.keys(declaration.review_by_checks ?? {}).length === 0
|
|
5094
|
+
) {
|
|
4800
5095
|
return {
|
|
4801
5096
|
kind: VACUITY_REFUSALS.noneDeclared,
|
|
4802
|
-
reason: `\`evidence_bearing_checks\` in ${DECLARATION_PATH} is empty, so this repository has declared that NO check's green means anything reviewed the code — and the vacuity arm examined nothing on PR #${pr}. If that is true, say so by removing the arm from your workflow. If it is not, name the checks: \`"evidence_bearing_checks": { "
|
|
5097
|
+
reason: `\`evidence_bearing_checks\` in ${DECLARATION_PATH} is empty, so this repository has declared that NO check's green means anything reviewed the code — and the vacuity arm examined nothing on PR #${pr}. If that is true, say so by removing the arm from your workflow. If it is not, name the checks by their exact check names: \`"evidence_bearing_checks": { "<reviewer check name>": {} }\`.`,
|
|
4803
5098
|
};
|
|
4804
5099
|
}
|
|
4805
5100
|
return null;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"It reads `gh pr checks --json name,state,bucket,description`, the only route that carries the description for a legacy commit status like CodeRabbit's, and falls back to the commit-status API when the token lacks `actions: read` (`gh pr checks` resolves the rollup through `checkSuite.workflowRun`, and without that scope it exits non-zero with EMPTY STDOUT — a failure shaped like a content problem that never says the word \"permission\").",
|
|
19
19
|
"IT REFUSES RATHER THAN REPORTING AN EMPTY INSPECTION. An unresolvable pull request, a `gh` it could not read, a roster with no checks in it, or an empty `evidence_bearing_checks` all print the same \"nothing vacuous here\" that a genuinely clean run prints — so the guard fails instead and names which of the four it hit (`vacuity_pr_unresolved`, `vacuity_checks_unreadable`, `vacuity_no_checks_reported`, `vacuity_none_declared`). A refusal is NOT a finding: NOBODY LOOKED and THE REVIEW WAS FAKE are opposite facts, and a single red job would otherwise report them identically.",
|
|
20
20
|
"`evidence_bearing_checks` names the checks whose GREEN is supposed to mean something reviewed the code. Use `{}` to accept the shipped description vocabulary, or add `proof` / `no_work` arrays to extend it — extensions ADD to the defaults, they do not replace them. Undeclared checks are never examined, because most CI jobs ship an empty description and flagging them all would bury the one finding that matters.",
|
|
21
|
+
"A THIRD-PARTY REVIEWER DECLARED IN `.lisa.config.json` IS EVIDENCE-BEARING TOO (CodySwannGT/lisa#4914): every `gates.<id>.pull-request` with `evidence.reviewer: true` adds its `await` context here at load time, with that gate's `evidence.proof` / `evidence.no_work` phrases (a name in both reads both). So the gates config is where the reviewer is named, and the review-evidence prover reads the same gates. `CodeRabbit` stays below because Lisa seeds no reviewer gate for a new project. To switch vendors, declare the new reviewer gate in `.lisa.config.json` and delete `CodeRabbit` from this list once, so it is not reported as never having reported. A gate proven by `evidence.review_by` and not pinned by `posted_by` (its reviewer may answer with a pull-request review instead of a check) is not added here unless this list already names it: its `await` check is examined for a hollow green whenever it reports, and one that never reports is not a finding, because the review-evidence prover then reads the submitted review.",
|
|
21
22
|
"This arm REPORTS AND NEVER BLOCKS, in every enforcement mode. A review bot can go hollow because an org-wide SPENDING CAP was hit, and a gate that reddens every PR on a billing state is worse than the one it criticises. What it changes is what you may CLAIM: a PR carrying a `vacuous_required_check` finding has not been shown to be reviewed, so do not record it as reviewed. Once you have made the governance call, `--fail-on-vacuous` is the supported way to ask for an exit code — add it to the command in `review-evidence.yml`, instead of writing a wrapper that reads `--json`.",
|
|
22
23
|
"PER-BRANCH SETS (CodySwannGT/lisa#4484). `required_contexts` is the UNION across every protected branch, which is the wrong set for judging which required contexts did NOT REPORT on one pull request: a context only `dev` requires was reported absent on every staging-base pull request. Optionally add `required_contexts_by_branch: { \"<branch>\": [ ...contexts ] }`, each set transcribed byte for byte from `gh api repos/OWNER/NAME/rules/branches/<branch> --jq '.[] | select(.type==\"required_status_checks\") | .parameters.required_status_checks[].context'` (read access only). The absent arm judges the PR against its current base (`--base`, else current metadata from the existing PR head read). If current metadata is unreadable it uses only a matching PR/repository event (`GITHUB_BASE_REF`, else `pull_request.base.ref`). A rerun replays the old event, so matching identity alone does not establish the current base. Head/base observations bracket each check read; a retarget retries within the same settlement deadline, and registration and absence share the resulting selection. Without a set for that base it falls back to the union — same findings as before — and says so as `required_contexts_branch_fallback`; every run prints which set it used. Every per-branch context must also appear in `required_contexts`, and the one `baseline_fetched_at` stamp covers both."
|
|
23
24
|
],
|