-
Notifications
You must be signed in to change notification settings - Fork 0
feat: WARNING false positive reduction (#438, #439, #440) #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c9aa982
d026cba
2b2071e
ce704b0
5bfd218
2b03281
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -462,6 +462,9 @@ Format: \`CRITICAL (85%)\` or \`WARNING (60%)\` | |||||||||
| - **"What if" speculation** — cite concrete code, not hypotheticals | ||||||||||
| - **Config values** — JSON/YAML values are intentional choices | ||||||||||
| - **Test patterns** — mocks, stubs, simplified logic are intentional in tests | ||||||||||
| - **Guarded values** — if there is an early return, null check, or ?? fallback that handles the value BEFORE the line you're looking at, it is NOT a bug | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Guarded Values Not Considered for Null/Undefined Checking Confidence: 🟢 92% Problem: In packages/core/src/l1/reviewer.ts:464-465 The documentation suggests that guarded values (early returns, null checks, or ?? fallbacks) are not bugs, but the logic does not account for these cases when checking for issues like division by zero or null/undefined with ?? or ?. . Evidence:
Suggestion: Modify the logic to check for early returns, null checks, or ?? fallbacks in the surrounding code before flagging issues. 🔍 Individual Reviews (2 reviewers)r-llama31 💬
r-llama31 💬
✅ Discussion d002 — 1 round(s), consensusVerdict: WARNING — Majority consensus (2/3 agree) Flagged by: r-llama31 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Null/Undefined Not Handled When ?? or ?. Used Confidence: 🟢 92% Problem: In packages/core/src/l1/reviewer.ts:464-465 The documentation suggests that null/undefined with ?? or ?. is handled when the same expression is used, but the logic does not actually check for this. Evidence:
Suggestion: Modify the logic to check for ?? or ?. when used on the same expression in the surrounding code before flagging null/undefined issues. 🔍 Individual Reviews (2 reviewers)r-llama31 💬
r-llama31 💬
✅ Discussion d002 — 1 round(s), consensusVerdict: WARNING — Majority consensus (2/3 agree) Flagged by: r-llama31 | CodeAgora |
||||||||||
| - **Division by zero with prior guard** — if the divisor is checked (<=0, ===0, etc.) with an early return above, do NOT flag division by zero | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 SUGGESTION — Division by zero is not explicitly handled in documentation Confidence: 🟡 79% Problem: In packages/core/src/l1/reviewer.ts:465 The documentation for the new Division by zero with prior guard section does not explicitly explain how to handle division by zero cases. Evidence:
Suggested change
Flagged by: r-llama31 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Division by Zero Not Handled When Prior Guard Present Confidence: 🟢 92% Problem: In packages/core/src/l1/reviewer.ts:465 The documentation suggests that division by zero is not a bug when there is a prior guard (e.g., divisor checked for <=0 or ===0), but the logic does not actually check for this prior guard. Evidence:
Suggestion: Modify the logic to check for prior guards (early returns, null checks, or ?? fallbacks) in the surrounding code before flagging division by zero issues. Flagged by: r-llama31 | CodeAgora |
||||||||||
| - **Null/undefined with ?? or ?.** — if the value uses ?? (nullish coalescing) or ?. (optional chaining) on the SAME expression, the null case is handled | ||||||||||
|
|
||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 SUGGESTION — Null/undefined values are not explicitly handled in documentation Confidence: 🟡 79% Problem: In packages/core/src/l1/reviewer.ts:467 The documentation for the new Null/undefined with ?? or ?. section does not explicitly explain how to handle null/undefined values. Evidence:
Suggested change
Flagged by: r-llama31 | CodeAgora |
||||||||||
| **Example Evidence Document:** | ||||||||||
|
|
||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -83,8 +83,138 @@ export function filterHallucinations( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 CRITICAL — Potential for false positives in hallucination filtering Confidence: 🟢 93% Problem: In packages/core/src/pipeline/hallucination-filter.ts:83-148 The implementation of hallucination filtering has potential for false positives that could cause valid issues to be incorrectly filtered as contradictions of themselves. Evidence:
Suggested change
✅ Discussion d002 — 1 round(s), consensusVerdict: HARSHLY_CRITICAL — All supporters agreed on the issue Flagged by: r-qwen3 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HARSHLY CRITICAL — Missing Validation for Guarded Division by Zero Confidence: 🟢 100% Problem: In packages/core/src/pipeline/hallucination-filter.ts:83-90 The code does not validate if the divisor is checked for being non-zero before division. This can lead to a division by zero error if the divisor is zero. Evidence:
Suggested change
🔍 Individual Reviews (4 reviewers)r-llama31 💬
r-llama31 💬
r-llama31 💬
r-llama31 💬
Flagged by: r-llama31 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HARSHLY CRITICAL — Guarded Values May Not Be Handled Correctly Confidence: 🟢 100% Problem: In packages/core/src/pipeline/hallucination-filter.ts:83-90 The code checks for self-contradictory findings, but it may not handle guarded values correctly. Guarded values are values that are checked for being non-zero or non-null before use. The code may not handle these values correctly, which can lead to errors. Evidence:
Suggested change
🔍 Individual Reviews (4 reviewers)r-llama31 💬
r-llama31 💬
r-llama31 💬
r-llama31 💬
Flagged by: r-llama31 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HARSHLY CRITICAL — Null/Undefined Values May Not Be Handled Correctly Confidence: 🟢 100% Problem: In packages/core/src/pipeline/hallucination-filter.ts:83-90 The code checks for self-contradictory findings, but it may not handle null or undefined values correctly. The code assumes that the values are not null or undefined, but it does not check for this. Evidence:
Suggested change
🔍 Individual Reviews (4 reviewers)r-llama31 💬
r-llama31 💬
r-llama31 💬
r-llama31 💬
Flagged by: r-llama31 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HARSHLY CRITICAL — "What If" Speculation May Not Be Handled Correctly Confidence: 🟢 100% Problem: In packages/core/src/pipeline/hallucination-filter.ts:83-90 The code checks for self-contradictory findings, but it may not handle "what if" speculation correctly. "What if" speculation is a type of speculation that assumes a hypothetical situation. The code may not handle this type of speculation correctly, which can lead to errors. Evidence:
Suggested change
🔍 Individual Reviews (4 reviewers)r-llama31 💬
r-llama31 💬
r-llama31 💬
r-llama31 💬
Flagged by: r-llama31 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Improper Hallucination Penalty for Self-Contradiction Confidence: 🟢 100% Problem: In packages/core/src/pipeline/hallucination-filter.ts:80-83 The current implementation of hallucination filtering penalizes findings for self-contradiction by reducing their confidence to 30% (80 * 0.3). However, this approach might be too harsh and could lead to false negatives, especially in cases where the self-contradiction is minor or context-dependent. Evidence:
Suggestion: Implement a more nuanced approach to evaluating self-contradictions, potentially involving machine learning models or more sophisticated natural language processing techniques to better assess the context and severity of self-contradictions. ✅ Discussion d001 — 1 round(s), consensusVerdict: CRITICAL — All supporters rejected HARSHLY_CRITICAL claim — downgraded to CRITICAL for human review Flagged by: r-scout | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Potential False Positives in Hallucination Filter Confidence: 🔴 25% Problem: In packages/core/src/pipeline/hallucination-filter.ts:83-90 The hallucination filter currently checks for self-contradiction by admitting the issue is handled. However, this approach may lead to potential false positives. For instance, findings with evidence that mentions a prior check or guard might be incorrectly down-weighted if the context of the check is not properly considered. Evidence:
Suggested change
Flagged by: r-scout | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check 4: Self-contradiction — finding admits the issue is already handled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (detectSelfContradiction(doc)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HARSHLY CRITICAL — Potential for false positives in hallucination filtering Confidence: 🟢 93% Problem: In packages/core/src/pipeline/hallucination-filter.ts:86-93 The implementation of the self-contradiction detection has patterns that may cause legitimate findings to be incorrectly marked as self-contradictory. Evidence:
Suggestion: 1. Refactor pattern to Flagged by: r-qwen3 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| doc.confidence = Math.round((doc.confidence ?? 50) * 0.3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Improper Confidence Adjustment for Self-Contradicting Findings Confidence: 🔴 22% Problem: In packages/core/src/pipeline/hallucination-filter.ts:87-90 The code checks for self-contradicting findings and adjusts their confidence levels. However, it does not handle cases where the evidence list is empty. Evidence:
Suggested change
Flagged by: r-scout | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filtered.push(doc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return { filtered, removed }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const SELF_CONTRADICTION_PATTERNS = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /already\s+(?:handled|checked|validated|prevented|avoided|guarded|addressed)/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /prior\s+check/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:is|are)\s+avoided\s+due\s+to/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /not\s+a\s+concern/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /already\s+returns?\s+(?:early|before|50|default)/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /(?:guard|check)\s+(?:above|before|prevents?|ensures?)/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /however.*(?:is|are)\s+(?:already|properly)\s+(?:handled|checked)/i, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Detect findings that contradict themselves by admitting the issue is handled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Example: "Division by zero possible" + evidence "avoided due to prior check" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function detectSelfContradiction(doc: EvidenceDocument): boolean { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!doc) return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const text = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| doc.problem || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...(doc.evidence || []), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| doc.suggestion || '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ].join(' ').trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!text) return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return SELF_CONTRADICTION_PATTERNS.some(p => p.test(text)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Incomplete handling of optional evidence fields Confidence: 🟢 99% Problem: In packages/core/src/pipeline/hallucination-filter.ts:112 The Evidence:
Suggested change
Flagged by: r-qwen3 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 CRITICAL — Missing Input Validation Confidence: 🟡 51% Problem: In packages/core/src/pipeline/hallucination-filter.ts:120-123 The input Evidence:
Suggested change
✅ Discussion d001 — 1 round(s), consensusVerdict: CRITICAL — Majority rejected HARSHLY_CRITICAL claim (2/3 disagree) — downgraded to CRITICAL Flagged by: r-llama31 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Deduplicate evidence documents at the individual finding level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Merges findings on the same file + overlapping line range + similar title. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Keeps highest confidence, combines evidence lists. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Optimized: Groups by filePath first to avoid O(N^2) comparison across different files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function deduplicateEvidence(docs: EvidenceDocument[]): EvidenceDocument[] { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!docs || docs.length <= 1) return docs || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HARSHLY CRITICAL — Missing Security Boundary Checks Confidence: 🔴 33% Problem: In packages/core/src/pipeline/hallucination-filter.ts:130-137 The code is not performing any security boundary checks on the Evidence:
Suggested change
Flagged by: r-llama31 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Group by filePath to reduce comparison space | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const fileGroups = new Map<string, EvidenceDocument[]>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const doc of docs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Potential Performance Issue in deduplicateEvidence Function Confidence: 🔴 0% Problem: In packages/core/src/pipeline/hallucination-filter.ts:134-139 The deduplicateEvidence function groups by filePath and then merges findings on the same file and similar title. However, this approach can lead to performance issues when dealing with a large number of findings. Evidence:
Suggestion: Consider optimizing the deduplicateEvidence function to use a more efficient data structure or algorithm, such as using a Trie or a suffix tree. Flagged by: r-llama31 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const list = fileGroups.get(doc.filePath || 'unknown') || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| list.push(doc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fileGroups.set(doc.filePath || 'unknown', list); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result: EvidenceDocument[] = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const group of fileGroups.values()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (group.length === 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Inefficient Algorithm in Deduplication Confidence: 🔴 22% Problem: In packages/core/src/pipeline/hallucination-filter.ts:143-176 The Evidence:
Suggested change
Flagged by: r-scout | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.push(group[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const mergedIndices = new Set<number>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let i = 0; i < group.length; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (mergedIndices.has(i)) continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let primary = { ...group[i], evidence: [...(group[i].evidence || [])] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let hasSelfContradiction = detectSelfContradiction(primary); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let j = i + 1; j < group.length; j++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (mergedIndices.has(j)) continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (shouldMergeEvidence(primary, group[j])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Merge: keep higher confidence, combine evidence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const primaryConf = primary.confidence ?? 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const otherConf = group[j].confidence ?? 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Missing Confidence Check Confidence: 🔴 25% Problem: In packages/core/src/pipeline/hallucination-filter.ts:161-162 The code is not checking if the confidence level of a finding is within the expected range (0-100). If the confidence level is outside this range, it could lead to incorrect calculation of the L1 confidence. Evidence:
Suggested change
Flagged by: r-llama31 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (otherConf > primaryConf) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primary.confidence = otherConf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Potential for evidence ordering issues Confidence: 🔴 27% Problem: In packages/core/src/pipeline/hallucination-filter.ts:143-144 The implementation adds evidence items to the primary document without preserving their original order. Evidence:
Suggested change
Flagged by: r-qwen3 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Add unique evidence items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const otherEvidence = group[j].evidence || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const e of otherEvidence) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!primary.evidence.includes(e)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primary.evidence.push(e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasSelfContradiction = hasSelfContradiction || detectSelfContradiction(group[j]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mergedIndices.add(j); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (hasSelfContradiction) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| primary.confidence = Math.round((primary.confidence ?? 50) * 0.3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result.push(primary); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function shouldMergeEvidence(a: EvidenceDocument, b: EvidenceDocument): boolean { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Same file is guaranteed by caller (deduplicateEvidence groups by filePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Potential Edge Case in shouldMergeEvidence Function Confidence: 🔴 16% Problem: In packages/core/src/pipeline/hallucination-filter.ts:184-187 The shouldMergeEvidence function checks for overlapping line ranges and similar titles before merging findings. However, this approach may not handle edge cases where the line ranges or titles are very similar but not exactly the same. Evidence:
Suggestion: Consider modifying the shouldMergeEvidence function to use a more robust algorithm for comparing line ranges and titles, such as using a tolerance value or a fuzzy matching algorithm. No other issues found. Flagged by: r-llama31 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Overlapping line ranges (within 15 lines) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const LINE_TOLERANCE = 15; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const overlap = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| a.lineRange[0] <= b.lineRange[1] + LINE_TOLERANCE && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| b.lineRange[0] <= a.lineRange[1] + LINE_TOLERANCE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!overlap) return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Similar titles (Jaccard > 0.5) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const titleSim = jaccardSimilarity(a.issueTitle || '', b.issueTitle || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return titleSim > 0.5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — jaccardSimilarity function does not handle cases with non-string inputs Confidence: 🟡 72% Problem: In packages/core/src/pipeline/hallucination-filter.ts:166 The jaccardSimilarity function does not handle cases where the input is not a string. Evidence:
Suggested change
Flagged by: r-llama31 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function jaccardSimilarity(a: string, b: string): number { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!a && !b) return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!a || !b) return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const wordsA = new Set(a.toLowerCase().split(/\s+/).filter(Boolean)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 CRITICAL — Potential Divide by Zero Error in Confidence: 🟢 86% Problem: In packages/core/src/pipeline/hallucination-filter.ts:170-179 The Evidence:
Suggested change
🔍 Individual Reviews (2 reviewers)r-scout 💬
r-llama33 💬
Flagged by: r-scout, r-llama33 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Inadequate Input Validation in Confidence: 🟡 79% Problem: In packages/core/src/pipeline/hallucination-filter.ts:170-170 The Evidence:
Suggested change
🔍 Individual Reviews (2 reviewers)r-scout 💬
r-llama33 💬
Flagged by: r-scout, r-llama33 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 SUGGESTION — Inefficient Jaccard Similarity Computation Confidence: 🔴 13% Problem: In packages/core/src/pipeline/hallucination-filter.ts:170-179 The Jaccard similarity computation involves set operations that could be inefficient for very large sets of words. Evidence:
Suggestion: Explore more efficient algorithms for computing Jaccard similarity, such as using bitwise operations or optimized set libraries. Flagged by: r-scout | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const wordsB = new Set(b.toLowerCase().split(/\s+/).filter(Boolean)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (wordsA.size === 0 && wordsB.size === 0) return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let intersection = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const w of wordsA) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (wordsB.has(w)) intersection++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const union = wordsA.size + wordsB.size - intersection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return union <= 0 ? 0 : intersection / union; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -750,6 +750,10 @@ export async function runPipeline(input: PipelineInput, progress?: ProgressEmitt | |||||||||||||||||
| } | ||||||||||||||||||
| allEvidenceDocs = hallucinationResult.filtered; | ||||||||||||||||||
|
|
||||||||||||||||||
| // === EVIDENCE DEDUP: Merge duplicate findings (#439) === | ||||||||||||||||||
| const { deduplicateEvidence } = await import('./hallucination-filter.js'); | ||||||||||||||||||
| allEvidenceDocs = deduplicateEvidence(allEvidenceDocs); | ||||||||||||||||||
|
Comment on lines
+753
to
+755
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Score corroboration before deduplicating evidence.
💡 Suggested change- // === EVIDENCE DEDUP: Merge duplicate findings (`#439`) ===
- const { deduplicateEvidence } = await import('./hallucination-filter.js');
- allEvidenceDocs = deduplicateEvidence(allEvidenceDocs);
-
// === CONFIDENCE: Compute L1 confidence for non-rule docs ===
const totalReviewers = allReviewerInputs.length;
const totalDiffLines = filteredDiffContent.split('\n').length;
for (const doc of allEvidenceDocs) {
if (doc.source !== 'rule') {
doc.confidence = computeL1Confidence(doc, allEvidenceDocs, totalReviewers, totalDiffLines);
}
}
+
+ // === EVIDENCE DEDUP: Merge duplicate findings (`#439`) ===
+ const { deduplicateEvidence } = await import('./hallucination-filter.js');
+ allEvidenceDocs = deduplicateEvidence(allEvidenceDocs);🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 SUGGESTION — Inconsistent Import Statements Confidence: 🔴 28% Problem: In packages/core/src/pipeline/orchestrator.ts:754-756 The import statement for Evidence:
Suggested change
Flagged by: r-scout | CodeAgora |
||||||||||||||||||
|
|
||||||||||||||||||
| // === CONFIDENCE: Compute L1 confidence for non-rule docs === | ||||||||||||||||||
| const totalReviewers = allReviewerInputs.length; | ||||||||||||||||||
| const totalDiffLines = filteredDiffContent.split('\n').length; | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||||||||||
| import { describe, it, expect } from 'vitest'; | ||||||||||||||||||||||||||||
| import { filterHallucinations } from '../pipeline/hallucination-filter.js'; | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 SUGGESTION — Missing Test Cases for Edge Scenarios Confidence: 🔴 25% Problem: In packages/core/src/tests/hallucination-filter.test.ts:1-245 The test cases do not cover edge scenarios, such as empty evidence lists or documents with missing fields. Evidence:
Suggested change
Flagged by: r-scout | CodeAgora |
||||||||||||||||||||||||||||
| import { filterHallucinations, detectSelfContradiction, deduplicateEvidence } from '../pipeline/hallucination-filter.js'; | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the unused Line 2 currently fails 🧰 Tools🪛 ESLint[error] 2-2: 'detectSelfContradiction' is defined but never used. Allowed unused vars must match /^_/u. ( 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| import type { EvidenceDocument } from '../types/core.js'; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Minimal diff for testing | ||||||||||||||||||||||||||||
|
|
@@ -115,6 +115,30 @@ describe('filterHallucinations', () => { | |||||||||||||||||||||||||||
| expect(result.removed).toHaveLength(0); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should penalize confidence for self-contradicting findings', () => { | ||||||||||||||||||||||||||||
| const docs = [makeDoc({ | ||||||||||||||||||||||||||||
| evidence: ['Division by zero is avoided due to prior check on line 5'], | ||||||||||||||||||||||||||||
| confidence: 80, | ||||||||||||||||||||||||||||
| })]; | ||||||||||||||||||||||||||||
| const result = filterHallucinations(docs, SAMPLE_DIFF); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(result.filtered).toHaveLength(1); | ||||||||||||||||||||||||||||
| expect(result.filtered[0].confidence).toBe(24); // 80 * 0.3 | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should not penalize confidence for findings without self-contradiction', () => { | ||||||||||||||||||||||||||||
| const docs = [makeDoc({ | ||||||||||||||||||||||||||||
| problem: 'Division by zero on line 12', | ||||||||||||||||||||||||||||
| evidence: ['computeValue() may return 0'], | ||||||||||||||||||||||||||||
| suggestion: 'Validate the divisor is non-zero', | ||||||||||||||||||||||||||||
| confidence: 80, | ||||||||||||||||||||||||||||
| })]; | ||||||||||||||||||||||||||||
| const result = filterHallucinations(docs, SAMPLE_DIFF); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(result.filtered).toHaveLength(1); | ||||||||||||||||||||||||||||
| expect(result.filtered[0].confidence).toBe(80); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should correctly split mixed valid/invalid docs', () => { | ||||||||||||||||||||||||||||
| const docs = [ | ||||||||||||||||||||||||||||
| makeDoc({ filePath: 'src/utils.ts', lineRange: [11, 12] }), // valid | ||||||||||||||||||||||||||||
|
|
@@ -133,3 +157,89 @@ describe('filterHallucinations', () => { | |||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| describe('deduplicateEvidence', () => { | ||||||||||||||||||||||||||||
| it('should merge findings on same file, same line, similar title', () => { | ||||||||||||||||||||||||||||
| const docs = [ | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Null pointer dereference risk', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [10, 12], | ||||||||||||||||||||||||||||
| confidence: 70, | ||||||||||||||||||||||||||||
| evidence: ['evidence A'], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Null pointer dereference possible', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [11, 13], | ||||||||||||||||||||||||||||
| confidence: 85, | ||||||||||||||||||||||||||||
| evidence: ['evidence B'], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| const result = deduplicateEvidence(docs); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(result).toHaveLength(1); | ||||||||||||||||||||||||||||
| expect(result[0].confidence).toBe(85); // higher confidence kept | ||||||||||||||||||||||||||||
| expect(result[0].evidence).toContain('evidence A'); | ||||||||||||||||||||||||||||
| expect(result[0].evidence).toContain('evidence B'); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should not merge findings on different files', () => { | ||||||||||||||||||||||||||||
| const docs = [ | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Incomplete test coverage for edge cases in deduplication Confidence: 🔴 22% Problem: In packages/core/src/tests/hallucination-filter.test.ts:187-203, packages/core/src/tests/hallucination-filter.test.ts:205-221, packages/core/src/tests/hallucination-filter.test.ts:223-248 The test cases for evidence deduplication don't cover several important edge cases. Evidence:
Suggestion: 1. Add test for documents with no evidence |
||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Null pointer dereference', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [10, 12], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Null pointer dereference', | ||||||||||||||||||||||||||||
| filePath: 'src/index.ts', | ||||||||||||||||||||||||||||
| lineRange: [10, 12], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| const result = deduplicateEvidence(docs); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(result).toHaveLength(2); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should not merge findings with very different titles', () => { | ||||||||||||||||||||||||||||
| const docs = [ | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'SQL injection vulnerability', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [10, 12], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Memory leak in event handler', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [10, 12], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| const result = deduplicateEvidence(docs); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(result).toHaveLength(2); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| it('should preserve self-contradiction penalty after merge', () => { | ||||||||||||||||||||||||||||
| const docs = [ | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Division by zero risk in helper', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [10, 12], | ||||||||||||||||||||||||||||
| confidence: 24, | ||||||||||||||||||||||||||||
| evidence: ['Division by zero is avoided due to prior check on line 5'], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| makeDoc({ | ||||||||||||||||||||||||||||
| issueTitle: 'Division by zero possible in helper', | ||||||||||||||||||||||||||||
| filePath: 'src/utils.ts', | ||||||||||||||||||||||||||||
| lineRange: [11, 13], | ||||||||||||||||||||||||||||
| confidence: 80, | ||||||||||||||||||||||||||||
| evidence: ['Potential divide by zero in compute path'], | ||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| const result = deduplicateEvidence(docs); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| expect(result).toHaveLength(1); | ||||||||||||||||||||||||||||
| expect(result[0].confidence).toBe(24); // max(24,80)=80 then contradiction penalty => 24 | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -84,6 +84,7 @@ vi.mock('../../packages/core/src/l0/quality-tracker.js', () => ({ | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| vi.mock('../../packages/shared/src/utils/diff.js', () => ({ | ||||||||||||||||||||||||||||||||||||||||||
| extractMultipleSnippets: vi.fn(), | ||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Potential Memory Leak in Mocked Functions Confidence: 🔴 22% Problem: In src/tests/critical-core-errors-orchestrator.test.ts:85-89, src/tests/e2e-mock-scenarios.test.ts:82-87, src/tests/orchestrator-branches.test.ts:80-85, src/tests/pipeline-chunk-parallel.test.ts:80-85 The Evidence:
Suggested change
Flagged by: r-llama33 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Missing Input Validation for Confidence: 🔴 22% Problem: In src/tests/critical-core-errors-orchestrator.test.ts:85-86 The Evidence:
Suggested change
Flagged by: r-llama33 | CodeAgora There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Inconsistent Mocking of Confidence: 🔴 22% Problem: In src/tests/critical-core-errors-orchestrator.test.ts:85, src/tests/e2e-mock-scenarios.test.ts:83, src/tests/orchestrator-branches.test.ts:80, src/tests/pipeline-chunk-parallel.test.ts:81 The Evidence:
Suggested change
Flagged by: r-llama33 | CodeAgora |
||||||||||||||||||||||||||||||||||||||||||
| extractFileListFromDiff: vi.fn().mockReturnValue([]), | ||||||||||||||||||||||||||||||||||||||||||
| parseDiffFileRanges: vi.fn().mockReturnValue([]), | ||||||||||||||||||||||||||||||||||||||||||
| readSurroundingContext: vi.fn().mockResolvedValue(null), | ||||||||||||||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,12 +79,11 @@ vi.mock('../../packages/core/src/l0/quality-tracker.js', () => ({ | |
| getRecords: vi.fn().mockReturnValue([]), | ||
| })), | ||
| })); | ||
|
|
||
| vi.mock('../../packages/shared/src/utils/diff.js', () => ({ | ||
| extractMultipleSnippets: vi.fn(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Inconsistent Mocking of Confidence: 🔴 16% Problem: In src/tests/e2e-mock-scenarios.test.ts:82-83 The Evidence:
Suggestion: Remove the duplicated mock and keep only one implementation of the Flagged by: r-llama33 | CodeAgora |
||
| extractFileListFromDiff: vi.fn().mockReturnValue([]), | ||
| parseDiffFileRanges: vi.fn().mockReturnValue([]), | ||
| readSurroundingContext: vi.fn().mockResolvedValue(null), | ||
| extractFileListFromDiff: vi.fn().mockReturnValue([]), | ||
| })); | ||
|
|
||
| vi.mock('../../packages/shared/src/utils/logger.js', () => ({ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -79,6 +79,9 @@ vi.mock('../../packages/core/src/l0/quality-tracker.js', () => ({ | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| vi.mock('../../packages/shared/src/utils/diff.js', () => ({ | ||||||||||||||||||||||||
| extractMultipleSnippets: vi.fn(), | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 WARNING — Missing Error Handling for Confidence: 🔴 19% Problem: In src/tests/orchestrator-branches.test.ts:80-81 The Evidence:
Suggested change
Flagged by: r-llama33 | CodeAgora |
||||||||||||||||||||||||
| extractFileListFromDiff: vi.fn().mockReturnValue([]), | ||||||||||||||||||||||||
| parseDiffFileRanges: vi.fn().mockReturnValue([]), | ||||||||||||||||||||||||
| readSurroundingContext: vi.fn().mockResolvedValue(null), | ||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| vi.mock('../../packages/shared/src/utils/logger.js', () => ({ | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 SUGGESTION — Guarded values are not explicitly handled in documentation
Confidence: 🟡 79%
Problem: In packages/core/src/l1/reviewer.ts:463
The documentation for the new Guarded values section does not explicitly explain how to handle early returns, null checks, or ?? fallbacks.
Evidence:
Flagged by: r-llama31 | CodeAgora