Skip to content

Commit c7abb44

Browse files
committed
fix: require alias evidence for AI game fallback labels
Backfill AI game fallback now accepts a detected game only when the issue text contains a literal alias token for the mapped game label. Add explicit logs for AI accept/reject/unmapped outcomes to make attribution auditable in job logs and prevent false positives like issue #17.
1 parent 840e890 commit c7abb44

1 file changed

Lines changed: 36 additions & 4 deletions

File tree

.github/workflows/labeler.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,20 @@ jobs:
183183
return { labels, scripts };
184184
}
185185
186+
function hasAliasHitForLabel(text, targetLabel, gameAliasToLabel) {
187+
const normalizedText = normalizeName(text);
188+
if (!normalizedText || !targetLabel) return false;
189+
190+
const paddedText = ` ${normalizedText} `;
191+
for (const [alias, label] of gameAliasToLabel.entries()) {
192+
if (label !== targetLabel) continue;
193+
if (alias.length < 3) continue;
194+
if (paddedText.includes(` ${alias} `)) return true;
195+
}
196+
197+
return false;
198+
}
199+
186200
function parseServerlistCsv(csvText) {
187201
const rows = [];
188202
const lines = (csvText || '').split(/\r?\n/);
@@ -1344,10 +1358,28 @@ jobs:
13441358
const mappedLabel =
13451359
gameAliasToLabel.get(detectedGame) || gameLabelByNormalized.get(detectedGame);
13461360
if (mappedLabel) {
1347-
desiredGames.add(mappedLabel);
1348-
const mappedScript = gameAliasToScript.get(detectedGame);
1349-
if (mappedScript) desiredServerScripts.add(mappedScript);
1350-
aiGameMatches += 1;
1361+
const hasAliasEvidence = hasAliasHitForLabel(
1362+
`${title}\n${body}`,
1363+
mappedLabel,
1364+
gameAliasToLabel
1365+
);
1366+
if (hasAliasEvidence) {
1367+
desiredGames.add(mappedLabel);
1368+
const mappedScript = gameAliasToScript.get(detectedGame);
1369+
if (mappedScript) desiredServerScripts.add(mappedScript);
1370+
aiGameMatches += 1;
1371+
console.log(
1372+
`#${rawIssue.number}: AI fallback accepted game "${mappedLabel}" from "${parsed?.detected_game}"`
1373+
);
1374+
} else {
1375+
console.log(
1376+
`#${rawIssue.number}: AI fallback rejected game "${mappedLabel}" (no literal alias evidence in issue text)`
1377+
);
1378+
}
1379+
} else {
1380+
console.log(
1381+
`#${rawIssue.number}: AI fallback returned unmapped game "${parsed?.detected_game}"`
1382+
);
13511383
}
13521384
}
13531385
} else {

0 commit comments

Comments
 (0)