fix: Loop-Erkennung meldet bei „Blocker: Keine“ keinen falschen Schleifenabbruch
Zwei Judge-Runden mit „Blocker: Keine“ und verschiedenen Major-Punkten galten als „gleicher Blocker zweimal“. loopKey() vergleicht jetzt die Blocker, bei leerem Blocker-Abschnitt die Major-Punkte, sonst den ganzen Judge-Text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a608f1dda8
commit
2acfc85482
1 changed files with 50 additions and 7 deletions
|
|
@ -677,6 +677,23 @@ function parseBlockers(text: string): string {
|
|||
return m ? m[1].trim() : "";
|
||||
}
|
||||
|
||||
// Schlüssel für die Loop-Erkennung im /optimize-Loop: der Blocker-Abschnitt; steht dort nur „Keine“ o. ä.,
|
||||
// der Major-Abschnitt; fehlen beide, der ganze Judge-Text. Ohne diese Unterscheidung galten zwei Runden mit
|
||||
// „Blocker: Keine“ und unterschiedlichen Major-Punkten als „gleicher Blocker“ (Fehlalarm).
|
||||
function loopKey(text: string): string {
|
||||
const stop = "(?:\\n(?:\\*\\*(?:Blocker|Major|Minor)\\*\\*|##\\s*(?:Blocker|Major|Minor)|[-–*]\\s*(?:Blocker|Major|Minor))|$)";
|
||||
const section = (name) => {
|
||||
const m = text.match(new RegExp(`(?:\\*\\*${name}\\*\\*|##\\s*${name}|[-–*]\\s*${name})[:\\n]([\\s\\S]*?)${stop}`, "i"));
|
||||
return m ? m[1].trim() : "";
|
||||
};
|
||||
const isNone = (s) => /^[\s\-–*•:]*(keine?r?|none|n\/a|nichts|—|-)?[\s.!]*$/i.test(s);
|
||||
const blockers = section("Blocker");
|
||||
if (blockers && !isNone(blockers)) return blockers;
|
||||
const majors = section("Major");
|
||||
if (majors && !isNone(majors)) return "MAJOR: " + majors;
|
||||
return text;
|
||||
}
|
||||
|
||||
// Gibt geänderte Quelldateien seit einem Git-Tag zurück.
|
||||
// null = Tag existiert nicht (erster Lauf) → alles verarbeiten
|
||||
// [] = nichts geändert → Phase überspringen
|
||||
|
|
@ -1372,10 +1389,9 @@ export default function (pi: ExtensionAPI) {
|
|||
}
|
||||
|
||||
// Loop-Erkennung: gleiche Beanstandung zweimal → manuell eingreifen.
|
||||
// Fallback auf den gesamten Judge-Text, wenn kein Blocker-Abschnitt vorhanden ist
|
||||
// (z.B. reine Minor-Concerns) — sonst würde die Erkennung dort nie greifen.
|
||||
// Schlüssel: Blocker, bei „Blocker: Keine“ die Major-Punkte, sonst der ganze Judge-Text (loopKey).
|
||||
// Normalisierung verhindert False-Negatives durch minimale Formulierungsunterschiede.
|
||||
const currentBlockers = parseBlockers(judgeText) || judgeText;
|
||||
const currentBlockers = loopKey(judgeText);
|
||||
if (currentBlockers && normalizeForComparison(currentBlockers) === normalizeForComparison(lastBlockers)) {
|
||||
ctx.ui.setStatus("optimize", `${prog} ⚠ Gleicher Blocker in Runde ${round} – manuelle Intervention nötig`);
|
||||
finalNotify(ctx, "⚠ Schleife", "Gleicher Blocker zweimal – manuelle Intervention nötig");
|
||||
|
|
|
|||
Loading…
Reference in a new issue