mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-23 15:34:19 +00:00
fix(optimize): scope the apply-able subtotal to the local MCP subset
A mixed local + claude.ai connector finding is class `fix`, but `--apply` only mutates the local servers. classTotals now credits the `fix` group with `applyTokensSaved` when present, so the "Fix now (apply-able)" subtotal, the "apply-able: ~$X" headline and `summary.byClass.fix` (CLI, TUI and desktop all read these) describe what apply can actually recover. The finding keeps the whole opportunity in its own `tokensSaved`. Also fixes the desktop connector fixture, which predated the class/basis fields, and adds class-level coverage: connector-only findings resolve to `nudge` (no apply payload), a local server named like a connector stays manual-only, and local-only findings keep their full subtotal.
This commit is contained in:
parent
c5df60e69a
commit
117aa833cc
3 changed files with 71 additions and 3 deletions
|
|
@ -403,9 +403,17 @@ export function classTotals(findings: WasteFinding[], costRate: number): Record<
|
|||
keep: { tokensSaved: 0, savingsUSD: 0, count: 0 },
|
||||
}
|
||||
for (const f of findings) {
|
||||
const t = totals[findingClass(f)]
|
||||
t.tokensSaved += f.tokensSaved
|
||||
t.savingsUSD += f.tokensSaved * costRate
|
||||
const cls = findingClass(f)
|
||||
// A `fix` whose plan owns only part of its estimate (a mixed local +
|
||||
// claude.ai connector MCP finding) contributes only the apply-able
|
||||
// subset, so this subtotal and the "apply-able" headline never promise
|
||||
// what `--apply` cannot recover. The finding keeps the whole
|
||||
// opportunity in its own `tokensSaved`, so the fix subtotal can be
|
||||
// smaller than the findings listed under it.
|
||||
const tokens = cls === 'fix' ? f.applyTokensSaved ?? f.tokensSaved : f.tokensSaved
|
||||
const t = totals[cls]
|
||||
t.tokensSaved += tokens
|
||||
t.savingsUSD += tokens * costRate
|
||||
t.count++
|
||||
}
|
||||
return totals
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue