Skip to content

Commit febff8e

Browse files
committed
feat(autofix): Restore full auto-fix reporting for ALL issues
**Problem:** Auto-fix reporting was limited to only blocking issues - Developers couldn't see full cleanup potential - Missing info: "377 total issues auto-fixable" vs just "95 blocking" **Solution:** Show BOTH metrics - Blocking auto-fix count (must fix to pass PR) - Total auto-fix count (bonus cleanup opportunity) **Changes:** 1. Added `autoFixableTotalCount` calculation for all issues 2. Added "Auto-Fix Coverage (All Issues)" row to tables 3. Added "Bonus Opportunity" messages showing full cleanup potential 4. Example output: - Blocking: 95/100 issues (95%) auto-fixable - Total: 377/400 issues (94%) auto-fixable ← NEW! - Message: "Auto-fix 282 additional issues in ~6 minutes" ← NEW! **Impact:** - Developers see full value of auto-fix tools - Encourages comprehensive code cleanup - Better ROI visibility (minutes vs hours of work) This was previously implemented but got reduced to blocking-only. Restoring based on user feedback about limiting auto-fix unnecessarily.
1 parent 3ffe09b commit febff8e

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

packages/agents/src/two-branch/report/business-impact.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,11 @@ export function generateBusinessImpact(issues: EnrichedIssue[], groups: IssueGro
211211

212212
const immediateRisk = blocking.length > 0 ? '🔴 High' : '🟢 Low';
213213

214-
// SESSION 13 FIX #3 + TYPESCRIPT FIX: Count only blocking issues that are auto-fixable
215-
// Don't count entire group - only count the blocking issues within auto-fixable groups
214+
// SESSION 13 FIX #3 + TYPESCRIPT FIX: Count auto-fixable issues (both blocking and total)
215+
// Don't count entire group - only count the actual issues within auto-fixable groups
216+
217+
// Count blocking issues that are auto-fixable
216218
const autoFixableBlockingCount = blocking.filter(issue => {
217-
// Check if there's an auto-fixable group for this issue
218219
return autoFixableGroups.some(g =>
219220
g.rule === issue.rule &&
220221
g.tool === issue.tool &&
@@ -224,6 +225,16 @@ export function generateBusinessImpact(issues: EnrichedIssue[], groups: IssueGro
224225
const autoFixPercentage = blocking.length > 0 ? (autoFixableBlockingCount / blocking.length) * 100 : 0;
225226
const mostlyAutoFixable = autoFixPercentage >= 70; // 70%+ of blocking issues are auto-fixable
226227

228+
// Count ALL auto-fixable issues (not just blocking) - gives full cleanup potential
229+
const autoFixableTotalCount = issues.filter(issue => {
230+
return autoFixableGroups.some(g =>
231+
g.rule === issue.rule &&
232+
g.tool === issue.tool &&
233+
g.severity === issue.severity
234+
);
235+
}).length;
236+
const totalAutoFixPercentage = issues.length > 0 ? (autoFixableTotalCount / issues.length) * 100 : 0;
237+
227238
return `## 💼 Business Impact Analysis
228239
229240
### Executive Summary
@@ -244,24 +255,30 @@ ${autoFixableBlockingCount} of ${blocking.length} blocking issues (${autoFixPerc
244255
|--------|-------|
245256
| **Auto-Fix Time** | **${Math.ceil(autoFixableBlockingCount / 100)} minutes** (run formatters + linters) |
246257
| **Review Time** | **${baseFixHours.toFixed(1)} hours** (${baseFixHours.toFixed(1)}h × $${developerRate}/h = $${totalFixCost.toLocaleString()}) |
247-
| **Auto-Fix Coverage** | **${autoFixPercentage.toFixed(0)}%** of blocking issues |
258+
| **Auto-Fix Coverage (Blocking)** | **${autoFixPercentage.toFixed(0)}%** (${autoFixableBlockingCount}/${blocking.length} issues) |
259+
| **Auto-Fix Coverage (All Issues)** | **${totalAutoFixPercentage.toFixed(0)}%** (${autoFixableTotalCount}/${issues.length} issues) 🎁 |
248260
| **Recommendation** | Run IDE auto-fix + code formatter, then code review changes |
249261
250-
**Note:** Auto-fix takes minutes to run. Review time ($${totalFixCost.toLocaleString()}) covers code review of auto-generated changes, NOT manual coding.`
262+
**Note:** Auto-fix takes minutes to run. Review time ($${totalFixCost.toLocaleString()}) covers code review of auto-generated changes, NOT manual coding.
263+
264+
**💡 Bonus Opportunity:** Beyond the ${autoFixableBlockingCount} blocking issues, you can auto-fix ${autoFixableTotalCount - autoFixableBlockingCount} additional issues for massive code quality improvement in ~${Math.ceil(autoFixableTotalCount / 60)} minutes total.`
251265
: `| Metric | Value |
252266
|--------|-------|
253267
| **Total Fix Cost** | **$${totalFixCost.toLocaleString()}** (${baseFixHours.toFixed(1)} hours, ~${fixDays} developer-days at $${developerRate}/hour) |
254268
${autoFixableBlockingCount > 0 ? `| **Cost Breakdown** | ${autoFixableBlockingCount} auto-fixable (${autoFixPercentage.toFixed(0)}%, ~${(autoFixableBlockingCount * 0.1).toFixed(1)}h) + ${blocking.length - autoFixableBlockingCount} manual (~${((blocking.length - autoFixableBlockingCount) * 1.75).toFixed(1)}h) |` : ''}
269+
${autoFixableTotalCount > 0 ? `| **Auto-Fix Coverage (All Issues)** | **${totalAutoFixPercentage.toFixed(0)}%** (${autoFixableTotalCount}/${issues.length} issues) 🎁 |` : ''}
255270
| **Potential Exploit Cost** | **$${minExploitCost.toLocaleString()} - $${maxExploitCost.toLocaleString()}** |
256271
| **Security Risk** | ${exploitDesc} |
257272
| **Return on Investment** | **${roi}x minimum return** by preventing issues now vs. fixing in production |
258-
| **Risk-Adjusted Savings** | $${(minExploitCost - totalFixCost).toLocaleString()} minimum (prevention vs. remediation) |${autoFixableBlockingCount > 0 ? `\n\n**💡 Tip:** ${autoFixableBlockingCount} issue${autoFixableBlockingCount > 1 ? 's' : ''} can be auto-fixed with IDE tools (Checkstyle, Spotless, ESLint) in ~${Math.ceil(autoFixableBlockingCount / 60)} minute${Math.ceil(autoFixableBlockingCount / 60) > 1 ? 's' : ''}` : ''}`
273+
| **Risk-Adjusted Savings** | $${(minExploitCost - totalFixCost).toLocaleString()} minimum (prevention vs. remediation) |${autoFixableBlockingCount > 0 ? `\n\n**💡 Tip:** ${autoFixableBlockingCount} blocking issue${autoFixableBlockingCount > 1 ? 's' : ''} can be auto-fixed with IDE tools.` : ''}${autoFixableTotalCount > autoFixableBlockingCount ? `\n\n**🎁 Bonus:** ${autoFixableTotalCount - autoFixableBlockingCount} additional issues can be auto-fixed for major code quality improvement in ~${Math.ceil(autoFixableTotalCount / 60)} minutes total.` : ''}`
259274
: `**💚 Low Financial Risk**
260275
No critical or high-severity issues detected. All identified issues are related to code quality and maintainability (tabs, formatting, documentation).
261276
262277
**Cost to fix:** Minimal - most issues are auto-fixable via IDE tools or linters.
263278
**Impact if not fixed:** Gradual technical debt accumulation, slower code reviews, minor maintainability concerns.
264-
**Recommendation:** Address during regular refactoring cycles or enable pre-commit hooks (CheckStyle, Spotless).`
279+
**Recommendation:** Address during regular refactoring cycles or enable pre-commit hooks (CheckStyle, Spotless).
280+
281+
${autoFixableTotalCount > 0 ? `**🎁 Quick Win:** ${autoFixableTotalCount} of ${issues.length} issues (${totalAutoFixPercentage.toFixed(0)}%) can be auto-fixed in ~${Math.ceil(autoFixableTotalCount / 60)} minutes with IDE tools.` : ''}`
265282
}
266283
267284
### Risk Assessment

0 commit comments

Comments
 (0)