test(ai-review): 補日誌 input/output/result helper 與誤報裁決、usage 解析、parseBot 健壯性測試
This commit is contained in:
@@ -211,6 +211,20 @@ describe('findings exclusions', () => {
|
||||
assert.deepEqual(result.map(f => f.location), ['a.js:1']); // a 失敗→保守保留;b 誤報→剔除
|
||||
});
|
||||
|
||||
it('keeps findings when the defender returns malformed verdicts (conservative)', async () => {
|
||||
const findings = [
|
||||
{ level: 'warning', role: 'Mage', location: 'a.js:1', problem: 'p', suggestion: 's' },
|
||||
{ level: 'warning', role: 'Leo', location: 'b.js:2', problem: 'p', suggestion: 's' },
|
||||
];
|
||||
// 回傳 null / 無 verdict 欄位 / 非預期結構 → 皆非 false_positive,保守保留
|
||||
const responses = [null, { foo: 'bar' }];
|
||||
let i = 0;
|
||||
const chatFn = async () => responses[i++ % responses.length];
|
||||
|
||||
const result = await filterFalsePositivesWithAI(findings, [], chatFn);
|
||||
assert.equal(result.length, 2);
|
||||
});
|
||||
|
||||
it('logs exclusions file metadata and repo state when loading exclusions', () => {
|
||||
const fullPath = path.join(workspace, EXCLUSIONS_PATH);
|
||||
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user