@owasp-aghast/aghast 0.8.4 → 0.9.0-rc.1
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/dist/build-config.d.ts.map +1 -1
- package/dist/build-config.js +101 -2
- package/dist/build-config.js.map +1 -1
- package/dist/check-library.d.ts +25 -0
- package/dist/check-library.d.ts.map +1 -1
- package/dist/check-library.js +165 -0
- package/dist/check-library.js.map +1 -1
- package/dist/ci-metadata.d.ts +42 -0
- package/dist/ci-metadata.d.ts.map +1 -0
- package/dist/ci-metadata.js +131 -0
- package/dist/ci-metadata.js.map +1 -0
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/concurrency.d.ts +18 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +39 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/cost-tracker.d.ts +45 -0
- package/dist/cost-tracker.d.ts.map +1 -0
- package/dist/cost-tracker.js +56 -0
- package/dist/cost-tracker.js.map +1 -0
- package/dist/discoveries/glob-discovery.d.ts +21 -0
- package/dist/discoveries/glob-discovery.d.ts.map +1 -0
- package/dist/discoveries/glob-discovery.js +215 -0
- package/dist/discoveries/glob-discovery.js.map +1 -0
- package/dist/discoveries/script-discovery.d.ts +117 -0
- package/dist/discoveries/script-discovery.d.ts.map +1 -0
- package/dist/discoveries/script-discovery.js +593 -0
- package/dist/discoveries/script-discovery.js.map +1 -0
- package/dist/docs-url.d.ts +14 -0
- package/dist/docs-url.d.ts.map +1 -0
- package/dist/docs-url.js +17 -0
- package/dist/docs-url.js.map +1 -0
- package/dist/error-codes.d.ts +12 -1
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +16 -2
- package/dist/error-codes.js.map +1 -1
- package/dist/formatters/csv-formatter.d.ts +12 -1
- package/dist/formatters/csv-formatter.d.ts.map +1 -1
- package/dist/formatters/csv-formatter.js +64 -2
- package/dist/formatters/csv-formatter.js.map +1 -1
- package/dist/formatters/html-formatter.d.ts.map +1 -1
- package/dist/formatters/html-formatter.js +43 -3
- package/dist/formatters/html-formatter.js.map +1 -1
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +2 -0
- package/dist/formatters/index.js.map +1 -1
- package/dist/formatters/markdown-formatter.d.ts +61 -0
- package/dist/formatters/markdown-formatter.d.ts.map +1 -0
- package/dist/formatters/markdown-formatter.js +557 -0
- package/dist/formatters/markdown-formatter.js.map +1 -0
- package/dist/formatters/sarif-formatter.d.ts +7 -0
- package/dist/formatters/sarif-formatter.d.ts.map +1 -1
- package/dist/formatters/sarif-formatter.js +80 -0
- package/dist/formatters/sarif-formatter.js.map +1 -1
- package/dist/formatters/types.d.ts +24 -0
- package/dist/formatters/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +342 -9
- package/dist/index.js.map +1 -1
- package/dist/issue-file-writer.d.ts +21 -0
- package/dist/issue-file-writer.d.ts.map +1 -0
- package/dist/issue-file-writer.js +307 -0
- package/dist/issue-file-writer.js.map +1 -0
- package/dist/judge.d.ts +62 -0
- package/dist/judge.d.ts.map +1 -0
- package/dist/judge.js +305 -0
- package/dist/judge.js.map +1 -0
- package/dist/mock-agent-provider.d.ts +3 -0
- package/dist/mock-agent-provider.d.ts.map +1 -1
- package/dist/mock-agent-provider.js +13 -0
- package/dist/mock-agent-provider.js.map +1 -1
- package/dist/new-check.d.ts.map +1 -1
- package/dist/new-check.js +322 -13
- package/dist/new-check.js.map +1 -1
- package/dist/opencode-provider.d.ts.map +1 -1
- package/dist/opencode-provider.js +33 -0
- package/dist/opencode-provider.js.map +1 -1
- package/dist/repo-scan.d.ts +80 -0
- package/dist/repo-scan.d.ts.map +1 -0
- package/dist/repo-scan.js +250 -0
- package/dist/repo-scan.js.map +1 -0
- package/dist/result-handlers/pr-comment-handler.d.ts +136 -0
- package/dist/result-handlers/pr-comment-handler.d.ts.map +1 -0
- package/dist/result-handlers/pr-comment-handler.js +381 -0
- package/dist/result-handlers/pr-comment-handler.js.map +1 -0
- package/dist/retry.d.ts +128 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +261 -0
- package/dist/retry.js.map +1 -0
- package/dist/runtime-config.d.ts.map +1 -1
- package/dist/runtime-config.js +62 -0
- package/dist/runtime-config.js.map +1 -1
- package/dist/scan-runner.d.ts +31 -22
- package/dist/scan-runner.d.ts.map +1 -1
- package/dist/scan-runner.js +145 -100
- package/dist/scan-runner.js.map +1 -1
- package/dist/semgrep-runner.js +6 -4
- package/dist/semgrep-runner.js.map +1 -1
- package/dist/stats.d.ts.map +1 -1
- package/dist/stats.js +4 -1
- package/dist/stats.js.map +1 -1
- package/dist/types.d.ts +149 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/judge.js
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM judge stage: re-evaluates aggregated SecurityIssues after all checks have run.
|
|
3
|
+
* Annotates each issue with a verdict (true_positive / false_positive / uncertain),
|
|
4
|
+
* confidence, and rationale. Runs as a separate pipeline stage in runMultiScanWithCost.
|
|
5
|
+
*/
|
|
6
|
+
import { logProgress, logDebug, logWarn, createTimer } from './logging.js';
|
|
7
|
+
import { withRetry, defaultIsRetryable, DEFAULT_RETRY, AgentTimeoutError } from './retry.js';
|
|
8
|
+
import { BudgetExceededError } from './budget.js';
|
|
9
|
+
import { preflightBudget, recordUsage } from './cost-tracker.js';
|
|
10
|
+
import { mapWithConcurrency } from './concurrency.js';
|
|
11
|
+
const TAG = 'judge';
|
|
12
|
+
const DEFAULT_JUDGE_CONCURRENCY = 5;
|
|
13
|
+
const DEFAULT_JUDGE_TIMEOUT_MS = 5 * 60 * 1000;
|
|
14
|
+
/**
|
|
15
|
+
* Thrown by the internal timeout race when a judge provider call exceeds
|
|
16
|
+
* DEFAULT_JUDGE_TIMEOUT_MS. Module-private: callers distinguish it via
|
|
17
|
+
* `instanceof JudgeTimeoutError` inside this module only.
|
|
18
|
+
*/
|
|
19
|
+
class JudgeTimeoutError extends AgentTimeoutError {
|
|
20
|
+
constructor(timeoutSeconds) {
|
|
21
|
+
super(`Judge provider timed out after ${timeoutSeconds}s`);
|
|
22
|
+
// Deliberately does NOT override `name`: the retry classifier matches on
|
|
23
|
+
// `AgentTimeoutError` by name (so it survives a serialization boundary),
|
|
24
|
+
// and callers in this module distinguish it with `instanceof` anyway.
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse a raw judge response into a JudgeVerdict.
|
|
29
|
+
* Returns undefined if the response is not parseable or lacks required fields.
|
|
30
|
+
*/
|
|
31
|
+
export function parseJudgeResponse(raw) {
|
|
32
|
+
const tryParse = (text) => {
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(text);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
let parsed = tryParse(raw);
|
|
41
|
+
if (parsed === undefined) {
|
|
42
|
+
const fence = raw.match(/```(?:json)?\s*([\s\S]*?)```/i);
|
|
43
|
+
if (fence?.[1])
|
|
44
|
+
parsed = tryParse(fence[1]);
|
|
45
|
+
}
|
|
46
|
+
if (parsed === undefined) {
|
|
47
|
+
const firstBrace = raw.indexOf('{');
|
|
48
|
+
const lastBrace = raw.lastIndexOf('}');
|
|
49
|
+
if (firstBrace !== -1 && lastBrace > firstBrace) {
|
|
50
|
+
parsed = tryParse(raw.slice(firstBrace, lastBrace + 1));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
54
|
+
return undefined;
|
|
55
|
+
const obj = parsed;
|
|
56
|
+
const validVerdicts = ['true_positive', 'false_positive', 'uncertain'];
|
|
57
|
+
if (typeof obj.verdict !== 'string' || !validVerdicts.includes(obj.verdict))
|
|
58
|
+
return undefined;
|
|
59
|
+
if (typeof obj.confidence !== 'number' || obj.confidence < 0 || obj.confidence > 1)
|
|
60
|
+
return undefined;
|
|
61
|
+
if (typeof obj.rationale !== 'string')
|
|
62
|
+
return undefined;
|
|
63
|
+
return {
|
|
64
|
+
verdict: obj.verdict,
|
|
65
|
+
confidence: obj.confidence,
|
|
66
|
+
rationale: obj.rationale,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Build the judge prompt for a single issue. */
|
|
70
|
+
function buildJudgePrompt(issue, checkInstructions) {
|
|
71
|
+
const lines = [];
|
|
72
|
+
lines.push('You are a security finding validator. Review the following reported security issue and determine if it is a genuine vulnerability (true positive), a false alarm (false positive), or uncertain.');
|
|
73
|
+
lines.push('');
|
|
74
|
+
lines.push('Respond with JSON only:');
|
|
75
|
+
lines.push('{ "verdict": "true_positive" | "false_positive" | "uncertain", "confidence": <0.0-1.0>, "rationale": "<brief explanation>" }');
|
|
76
|
+
lines.push('');
|
|
77
|
+
lines.push(`## Check: ${issue.checkName}`);
|
|
78
|
+
if (checkInstructions) {
|
|
79
|
+
lines.push('');
|
|
80
|
+
lines.push('### What this check looks for:');
|
|
81
|
+
lines.push(checkInstructions);
|
|
82
|
+
}
|
|
83
|
+
lines.push('');
|
|
84
|
+
lines.push('## Reported Finding');
|
|
85
|
+
lines.push(`File: ${issue.file}`);
|
|
86
|
+
lines.push(`Lines: ${issue.startLine}–${issue.endLine}`);
|
|
87
|
+
lines.push(`Description: ${issue.description}`);
|
|
88
|
+
if (issue.codeSnippet) {
|
|
89
|
+
lines.push('');
|
|
90
|
+
lines.push('### Code snippet:');
|
|
91
|
+
lines.push('```');
|
|
92
|
+
lines.push(issue.codeSnippet);
|
|
93
|
+
lines.push('```');
|
|
94
|
+
}
|
|
95
|
+
if (issue.dataFlow && issue.dataFlow.length > 0) {
|
|
96
|
+
lines.push('');
|
|
97
|
+
lines.push('### Data flow:');
|
|
98
|
+
for (const step of issue.dataFlow) {
|
|
99
|
+
lines.push(` ${step.file}:${step.lineNumber} — ${step.label}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
lines.push('');
|
|
103
|
+
lines.push('Is this a real security issue? Respond with JSON only.');
|
|
104
|
+
return lines.join('\n');
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Run the judge stage over all collected issues.
|
|
108
|
+
* Mutates each issue in place by attaching a `judge` field.
|
|
109
|
+
* Returns the issues array (same reference, mutated).
|
|
110
|
+
*/
|
|
111
|
+
export async function runJudge(issues, checksById, repositoryPath, options, costTracker) {
|
|
112
|
+
if (issues.length === 0)
|
|
113
|
+
return issues;
|
|
114
|
+
const effectiveConcurrency = options.concurrency ?? DEFAULT_JUDGE_CONCURRENCY;
|
|
115
|
+
const judgeModel = options.model;
|
|
116
|
+
// Apply per-check model
|
|
117
|
+
options.provider.setModel?.(judgeModel);
|
|
118
|
+
logProgress(TAG, `Judging ${issues.length} issues (model: ${judgeModel}, concurrency: ${effectiveConcurrency})`);
|
|
119
|
+
const judgeTimer = createTimer();
|
|
120
|
+
const abortHandle = { aborted: false };
|
|
121
|
+
await mapWithConcurrency(issues, effectiveConcurrency, async (issue, _idx) => {
|
|
122
|
+
const checkEntry = checksById.get(issue.checkId);
|
|
123
|
+
// Per-check opt-out: skip if check.judge === false
|
|
124
|
+
if (checkEntry?.check.judge === false) {
|
|
125
|
+
logDebug(TAG, `Skipping issue from check "${issue.checkId}" (judge: false)`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const checkInstructions = checkEntry?.instructions;
|
|
129
|
+
const prompt = buildJudgePrompt(issue, checkInstructions);
|
|
130
|
+
try {
|
|
131
|
+
preflightBudget(costTracker);
|
|
132
|
+
}
|
|
133
|
+
catch (budgetErr) {
|
|
134
|
+
if (budgetErr instanceof BudgetExceededError) {
|
|
135
|
+
abortHandle.aborted = true;
|
|
136
|
+
abortHandle.reason = budgetErr;
|
|
137
|
+
throw budgetErr;
|
|
138
|
+
}
|
|
139
|
+
throw budgetErr;
|
|
140
|
+
}
|
|
141
|
+
logDebug(TAG, `Judging issue: ${issue.checkId} @ ${issue.file}:${issue.startLine}`);
|
|
142
|
+
try {
|
|
143
|
+
// Declared as a function so each retry gets a fresh timer — reusing a
|
|
144
|
+
// single handle across attempts would leave the first attempt's timeout
|
|
145
|
+
// armed and abort a later, healthy one. Mirrors `analyzeOnce` in the
|
|
146
|
+
// scan runner.
|
|
147
|
+
const judgeOnce = async () => {
|
|
148
|
+
let timeoutHandle;
|
|
149
|
+
return Promise.race([
|
|
150
|
+
options.provider.executeCheck(prompt, repositoryPath, `[judge:${issue.checkId}]`),
|
|
151
|
+
new Promise((_, reject) => {
|
|
152
|
+
timeoutHandle = setTimeout(() => reject(new JudgeTimeoutError(DEFAULT_JUDGE_TIMEOUT_MS / 1000)), DEFAULT_JUDGE_TIMEOUT_MS);
|
|
153
|
+
}),
|
|
154
|
+
]).finally(() => {
|
|
155
|
+
if (timeoutHandle)
|
|
156
|
+
clearTimeout(timeoutHandle);
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
// The judge makes its own AI calls, and they are as prone to transient
|
|
160
|
+
// provider failure as check analysis is. Without this a dropped stream
|
|
161
|
+
// degraded the verdict to `uncertain`, which escalates the check to
|
|
162
|
+
// FLAG — turning a network blip into a flagged security finding.
|
|
163
|
+
const agentResponse = await withRetry(judgeOnce, {
|
|
164
|
+
...DEFAULT_RETRY,
|
|
165
|
+
...options.retry,
|
|
166
|
+
breaker: options.breaker,
|
|
167
|
+
label: `judge:${issue.checkId}`,
|
|
168
|
+
// Stop retrying the moment another worker has aborted the run
|
|
169
|
+
// (budget exceeded, or a fatal provider error).
|
|
170
|
+
isRetryable: (err) => !abortHandle.aborted && defaultIsRetryable(err),
|
|
171
|
+
});
|
|
172
|
+
recordUsage(costTracker, agentResponse.tokenUsage, judgeModel);
|
|
173
|
+
const parsed = parseJudgeResponse(agentResponse.raw);
|
|
174
|
+
if (!parsed) {
|
|
175
|
+
logDebug(TAG, `Judge returned malformed response for ${issue.checkId}@${issue.file}:${issue.startLine}`);
|
|
176
|
+
issue.judge = {
|
|
177
|
+
verdict: 'uncertain',
|
|
178
|
+
confidence: 0,
|
|
179
|
+
rationale: 'judge failed: malformed response',
|
|
180
|
+
model: judgeModel,
|
|
181
|
+
provider: options.providerName,
|
|
182
|
+
tokenUsage: agentResponse.tokenUsage,
|
|
183
|
+
};
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// Apply minConfidence demotion: true_positive below threshold → uncertain
|
|
187
|
+
let { verdict, rationale } = parsed;
|
|
188
|
+
const { confidence } = parsed;
|
|
189
|
+
if (verdict === 'true_positive' &&
|
|
190
|
+
options.minConfidence !== undefined &&
|
|
191
|
+
confidence < options.minConfidence) {
|
|
192
|
+
logDebug(TAG, `Demoting true_positive to uncertain (confidence ${confidence} < minConfidence ${options.minConfidence})`);
|
|
193
|
+
verdict = 'uncertain';
|
|
194
|
+
rationale = `${rationale} [demoted: confidence ${confidence.toFixed(2)} < minConfidence ${options.minConfidence}]`;
|
|
195
|
+
}
|
|
196
|
+
issue.judge = {
|
|
197
|
+
verdict,
|
|
198
|
+
confidence,
|
|
199
|
+
rationale,
|
|
200
|
+
model: judgeModel,
|
|
201
|
+
provider: options.providerName,
|
|
202
|
+
tokenUsage: agentResponse.tokenUsage,
|
|
203
|
+
};
|
|
204
|
+
logDebug(TAG, `Judge verdict: ${verdict} (confidence: ${confidence}) for ${issue.checkId}@${issue.file}:${issue.startLine}`);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
if (err instanceof BudgetExceededError)
|
|
208
|
+
throw err;
|
|
209
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
210
|
+
if (err instanceof JudgeTimeoutError) {
|
|
211
|
+
logWarn(TAG, `Judge timed out for ${issue.checkId}@${issue.file}:${issue.startLine} — token usage for this call was not recorded`);
|
|
212
|
+
}
|
|
213
|
+
logDebug(TAG, `Judge error for ${issue.checkId}: ${errorMsg}`);
|
|
214
|
+
issue.judge = {
|
|
215
|
+
verdict: 'uncertain',
|
|
216
|
+
confidence: 0,
|
|
217
|
+
rationale: `judge failed: ${errorMsg}`,
|
|
218
|
+
model: judgeModel,
|
|
219
|
+
provider: options.providerName,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}, abortHandle);
|
|
223
|
+
logProgress(TAG, `Judge stage completed in ${judgeTimer.elapsedStr()}`);
|
|
224
|
+
return issues;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Recompute per-check statuses and summary counts after the judge stage.
|
|
228
|
+
*
|
|
229
|
+
* Recomputation order (per issue 290 design):
|
|
230
|
+
* 1. Apply minConfidence demotion (already done in runJudge per-issue)
|
|
231
|
+
* 2. Drop false positives if dropFalsePositives is set
|
|
232
|
+
* 3. Escalate checks whose remaining issues are all uncertain → FLAG
|
|
233
|
+
* 4. Set flagSource on issues
|
|
234
|
+
* 5. Recompute summary counts
|
|
235
|
+
*
|
|
236
|
+
* Returns the filtered issues array and updated check summaries.
|
|
237
|
+
*/
|
|
238
|
+
export function applyJudgeResults(allIssues, allCheckSummaries, options) {
|
|
239
|
+
// Count judge verdicts across all judged issues
|
|
240
|
+
let judgedCount = 0;
|
|
241
|
+
let fpCount = 0;
|
|
242
|
+
let uncertainCount = 0;
|
|
243
|
+
// Step 1: Remove confirmed false positives if dropFalsePositives is set
|
|
244
|
+
let filteredIssues = allIssues;
|
|
245
|
+
if (options.dropFalsePositives) {
|
|
246
|
+
filteredIssues = allIssues.filter((issue) => {
|
|
247
|
+
if (!issue.judge)
|
|
248
|
+
return true; // No verdict: keep
|
|
249
|
+
if (issue.judge.verdict === 'false_positive')
|
|
250
|
+
return false; // Drop FP
|
|
251
|
+
return true;
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
// Count verdicts from allIssues (pre-filter) so that dropped FPs are included
|
|
255
|
+
// in judgedIssues and falsePositives regardless of dropFalsePositives.
|
|
256
|
+
for (const issue of allIssues) {
|
|
257
|
+
if (issue.judge) {
|
|
258
|
+
judgedCount++;
|
|
259
|
+
if (issue.judge.verdict === 'false_positive')
|
|
260
|
+
fpCount++;
|
|
261
|
+
if (issue.judge.verdict === 'uncertain')
|
|
262
|
+
uncertainCount++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// Step 2: Group remaining issues by checkId
|
|
266
|
+
const issuesByCheck = new Map();
|
|
267
|
+
for (const issue of filteredIssues) {
|
|
268
|
+
const existing = issuesByCheck.get(issue.checkId);
|
|
269
|
+
if (existing) {
|
|
270
|
+
existing.push(issue);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
issuesByCheck.set(issue.checkId, [issue]);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Step 3: Recompute per-check status based on remaining issues
|
|
277
|
+
for (const summary of allCheckSummaries) {
|
|
278
|
+
const checkIssues = issuesByCheck.get(summary.checkId) ?? [];
|
|
279
|
+
// Restore any check that was FAIL but lost all its issues to FP drops → PASS
|
|
280
|
+
if (summary.status === 'FAIL' && checkIssues.length === 0 && options.dropFalsePositives) {
|
|
281
|
+
summary.status = 'PASS';
|
|
282
|
+
summary.issuesFound = 0;
|
|
283
|
+
}
|
|
284
|
+
else if (summary.status === 'FAIL' && checkIssues.length > 0) {
|
|
285
|
+
// Check if all remaining issues are uncertain → escalate to FLAG
|
|
286
|
+
const allUncertain = checkIssues.every((i) => i.judge && i.judge.verdict === 'uncertain');
|
|
287
|
+
if (allUncertain) {
|
|
288
|
+
summary.status = 'FLAG';
|
|
289
|
+
summary.issuesFound = checkIssues.length;
|
|
290
|
+
// Attach flagSource: "judge" to each uncertain issue
|
|
291
|
+
for (const issue of checkIssues) {
|
|
292
|
+
// Decision #9: flagSource:"check" wins if already set
|
|
293
|
+
if (!issue.flagSource) {
|
|
294
|
+
issue.flagSource = 'judge';
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
summary.issuesFound = checkIssues.length;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return { filteredIssues, judgedIssues: judgedCount, falsePositives: fpCount, uncertainJudgements: uncertainCount };
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=judge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge.js","sourceRoot":"","sources":["../src/judge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAA0C,MAAM,YAAY,CAAC;AACrI,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAwB,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAoB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAExE,MAAM,GAAG,GAAG,OAAO,CAAC;AACpB,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C;;;;GAIG;AACH,MAAM,iBAAkB,SAAQ,iBAAiB;IAC/C,YAAY,cAAsB;QAChC,KAAK,CAAC,kCAAkC,cAAc,GAAG,CAAC,CAAC;QAC3D,yEAAyE;QACzE,yEAAyE;QACzE,sEAAsE;IACxE,CAAC;CACF;AAuBD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAW,EAAE;QACzC,IAAI,CAAC;YAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,SAAS,CAAC;QAAC,CAAC;IAC9D,CAAC,CAAC;IAEF,IAA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C,KAAK,CACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,WAAW,CAClD,CAAC;YACF,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;gBACxB,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC;gBACzC,qDAAqD;gBACrD,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;oBAChC,sDAAsD;oBACtD,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;wBACtB,KAAK,CAAC,UAAU,GAAG,OAAO,CAAC;oBAC7B,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,CAAC;AACrH,CAAC"}
|
|
@@ -9,9 +9,12 @@ export declare class MockAgentProvider implements AgentProvider {
|
|
|
9
9
|
private rawResponse;
|
|
10
10
|
private model;
|
|
11
11
|
private tokenUsage;
|
|
12
|
+
/** Remaining calls that should fail before the mock starts succeeding. */
|
|
13
|
+
private failuresRemaining;
|
|
12
14
|
constructor(options: {
|
|
13
15
|
rawResponse: string;
|
|
14
16
|
tokenUsage?: TokenUsage;
|
|
17
|
+
failTimes?: number;
|
|
15
18
|
});
|
|
16
19
|
initialize(_config: ProviderConfig): Promise<void>;
|
|
17
20
|
executeCheck(_instructions: string, _repositoryPath: string, _logPrefix?: string, _options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-agent-provider.d.ts","sourceRoot":"","sources":["../src/mock-agent-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3F,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,UAAU,CAAyB;
|
|
1
|
+
{"version":3,"file":"mock-agent-provider.d.ts","sourceRoot":"","sources":["../src/mock-agent-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3F,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,UAAU,CAAyB;IAC3C,0EAA0E;IAC1E,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,OAAO,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,UAAU,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAMnF,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,YAAY,CAChB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,aAAa,CAAC;IAyBnB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxC,YAAY,IAAI,MAAM;IAItB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAI9B"}
|
|
@@ -8,14 +8,27 @@ export class MockAgentProvider {
|
|
|
8
8
|
rawResponse;
|
|
9
9
|
model = 'mock';
|
|
10
10
|
tokenUsage;
|
|
11
|
+
/** Remaining calls that should fail before the mock starts succeeding. */
|
|
12
|
+
failuresRemaining;
|
|
11
13
|
constructor(options) {
|
|
12
14
|
this.rawResponse = options.rawResponse;
|
|
13
15
|
this.tokenUsage = options.tokenUsage;
|
|
16
|
+
this.failuresRemaining = options.failTimes ?? 0;
|
|
14
17
|
}
|
|
15
18
|
async initialize(_config) {
|
|
16
19
|
// No-op
|
|
17
20
|
}
|
|
18
21
|
async executeCheck(_instructions, _repositoryPath, _logPrefix, _options) {
|
|
22
|
+
// Test hook: fail the first N calls with a retryable error, then succeed.
|
|
23
|
+
// Lets CLI-level tests prove that a transient provider failure is retried
|
|
24
|
+
// and the scan still completes, which cannot be observed from unit tests of
|
|
25
|
+
// withRetry alone. The error carries a 503 status so it is classified
|
|
26
|
+
// retryable by the real classifier rather than a test-only special case.
|
|
27
|
+
if (this.failuresRemaining > 0) {
|
|
28
|
+
this.failuresRemaining--;
|
|
29
|
+
const err = Object.assign(new Error('Mock transient provider failure (AGHAST_MOCK_FAIL_TIMES)'), { status: 503 });
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
19
32
|
const response = {
|
|
20
33
|
raw: this.rawResponse,
|
|
21
34
|
parsed: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-agent-provider.js","sourceRoot":"","sources":["../src/mock-agent-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,OAAO,iBAAiB;IACpB,WAAW,CAAS;IACpB,KAAK,GAAW,MAAM,CAAC;IACvB,UAAU,CAAyB;
|
|
1
|
+
{"version":3,"file":"mock-agent-provider.js","sourceRoot":"","sources":["../src/mock-agent-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,OAAO,iBAAiB;IACpB,WAAW,CAAS;IACpB,KAAK,GAAW,MAAM,CAAC;IACvB,UAAU,CAAyB;IAC3C,0EAA0E;IAClE,iBAAiB,CAAS;IAElC,YAAY,OAA6E;QACvF,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAuB;QACtC,QAAQ;IACV,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,aAAqB,EACrB,eAAuB,EACvB,UAAmB,EACnB,QAAgC;QAEhC,0EAA0E;QAC1E,0EAA0E;QAC1E,4EAA4E;QAC5E,sEAAsE;QACtE,yEAAyE;QACzE,IAAI,IAAI,CAAC,iBAAiB,GAAG,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CACvB,IAAI,KAAK,CAAC,0DAA0D,CAAC,EACrE,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAC;YACF,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,MAAM,QAAQ,GAAkB;YAC9B,GAAG,EAAE,IAAI,CAAC,WAAW;YACrB,MAAM,EAAE,SAAS;SAClB,CAAC;QACF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,QAAQ,CAAC,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CAEF"}
|
package/dist/new-check.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-check.d.ts","sourceRoot":"","sources":["../src/new-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"new-check.d.ts","sourceRoot":"","sources":["../src/new-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA80BH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyH/D"}
|