refactor(simplify): drop a dead branch and repeated fixtures from the round-2 remediation
/simplify over bcf3adb..HEAD. Pass 3's last else could never run (RULE_KEYS is checked first); entryPaths tracks an open entry the way testFirstFileEntries does; wrapLine drops normalisations its callers already made. Tests: one payload builder, one BLOCKER fixture, one unreleasedBody helper, one 1.9-block loop, one plan-unreadable loop, and make_repo in the e2e script. No behaviour change; suite 2515 (2513/0/2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2cca61170a
commit
4d5c927c5d
7 changed files with 76 additions and 85 deletions
|
|
@ -562,10 +562,8 @@ function leadingSpans(text) {
|
|||
* @returns {string|null} the entry's new text, or null when the line is description
|
||||
*/
|
||||
function wrapLine(text, line) {
|
||||
const so = String(text ?? '');
|
||||
if (so.trim() === '') return line.trim();
|
||||
if (so.trimEnd().endsWith(',')) return `${so} ${line.trim()}`.trim();
|
||||
return null;
|
||||
if (text === '') return line.trim();
|
||||
return text.endsWith(',') ? `${text} ${line.trim()}` : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -579,21 +577,23 @@ export function entryPaths(text) {
|
|||
const files = [];
|
||||
const issues = [];
|
||||
const entries = [];
|
||||
// Whether the last entry still takes wrapped lines (operator decision 29).
|
||||
let open = false;
|
||||
String(text ?? '').split('\n').forEach((line, i) => {
|
||||
const item = LIST_ITEM.exec(line);
|
||||
const rest = line.trim();
|
||||
if (item) entries.push({ line: i + 1, entry: line.slice(item[0].length).trim(), closed: false });
|
||||
if (item) { entries.push({ line: i + 1, entry: line.slice(item[0].length).trim() }); open = true; }
|
||||
else if (rest === '') return;
|
||||
else if (entries.length === 0) entries.push({ line: i + 1, entry: rest, closed: false });
|
||||
else if (entries.length === 0) { entries.push({ line: i + 1, entry: rest }); open = true; }
|
||||
else {
|
||||
// A wrapped line joins the entry above it only after a comma, or when
|
||||
// the entry is empty (wrapLine); otherwise it closes the entry, and it
|
||||
// and every later wrapped line of that entry are description, never read
|
||||
// (operator decision 29).
|
||||
if (!open) return;
|
||||
const last = entries[entries.length - 1];
|
||||
if (last.closed) return;
|
||||
const joined = wrapLine(last.entry, rest);
|
||||
if (joined === null) last.closed = true;
|
||||
if (joined === null) open = false;
|
||||
else last.entry = joined;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -101,9 +101,8 @@ export const UNVERIFIED_REASONS = Object.freeze([
|
|||
// to MINOR, writing `brief_lowered_from: 'MAJOR'`. A BLOCKER and any
|
||||
// `/security-review` finding keep their severity and only carry the mark.
|
||||
// The verdict gate (verdict-gate.mjs) imports `illegalBriefLowering`; the
|
||||
// opt-in workflow review mirrors it. `original_severity` is never read here.
|
||||
// `original_severity` is what the kept finding itself asserted, before Pass 1
|
||||
// raised it to its group's severity (review 08deae68).
|
||||
// opt-in workflow review mirrors it. `original_severity` (what the kept finding
|
||||
// itself asserted before Pass 1 raised it, review 08deae68) is never read here.
|
||||
|
||||
// The payload `reviewer` names lib/review/engine-findings.mjs writes, and the
|
||||
// engine each one stands for.
|
||||
|
|
@ -456,11 +455,11 @@ export function reasonablenessFilter(findings) {
|
|||
suppress(f, 'unknown-rule_key', dropped, unverified);
|
||||
continue;
|
||||
}
|
||||
const rule = getRule(f.rule_key);
|
||||
const rule = getRule(f.rule_key); // never null: RULE_KEYS checked above
|
||||
if (lowerableBriefConflict(f)) {
|
||||
// The one legal lowering: a marked /code-review MAJOR on a MAJOR-tier key.
|
||||
kept.push({ ...f, severity: 'MINOR', brief_lowered_from: 'MAJOR' });
|
||||
} else if (rule) {
|
||||
} else {
|
||||
// Today's catalogue reset. A marked engine finding arrives at its tier
|
||||
// (engine-findings.mjs), so it lands here only when its severity was
|
||||
// changed on the way, and the reset puts it back with its mark kept.
|
||||
|
|
@ -470,8 +469,6 @@ export function reasonablenessFilter(findings) {
|
|||
...f, severity: rule.severity,
|
||||
...(own !== rule.severity ? { original_severity: own } : {}),
|
||||
});
|
||||
} else {
|
||||
kept.push(f);
|
||||
}
|
||||
}
|
||||
return { kept, dropped, unverified };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue