Repository navigation
Commit 2819b3d
authored
* feat(cli): end-of-run summary of dropped recommendations (closes #361)
Track and surface recommendations that were dropped during sizing,
filtering, or family-NU partitioning so users see why an instance
type didn't make it into the final plan instead of silently missing.
DropSummary collects per-stage counts with optional reasons; printed
at end-of-run when any drop occurred. applyFilters, applySizing, and
ApplyFamilyNUSizingRDS now thread a *common.DropSummary through their
signatures (nil-safe). Tests cover collection, formatting, and the
no-drops/nil-summary fast paths.
* fix(common): lazy-init counts map in DropSummary.Add to prevent panic on zero-value
Calling Add on a zero-value DropSummary (var d DropSummary) would panic
with "assignment to entry in nil map" because the counts map is only
populated by NewDropSummary. Lazily initialise the map on first Add so
both construction patterns are safe.
Adds a regression test that exercises a zero-value DropSummary directly.
Addresses CodeRabbit review on PR #875.
* fix(drops): nil-map guard in DropSummary.Add + NoNUSignal category + test coverage (#875 CR)
- DropSummary.Add already had the lazy-init nil-map guard; add
TestDropSummary_ZeroValue_Safe regression test to lock the behaviour
- Add DropFamilyNoNUSignal ("family-nu-no-nu-signal") constant and
FamilyDropCounts.NoNUSignal field for the case where AWS-rec NU sums
to zero (unknown/unrecognised sizes) -- distinct from AlreadyAtTarget
- Fix sizeRDSFamilyRecs: currentNU<=0 branch now sets NoNUSignal instead
of incorrectly reusing AlreadyAtTarget
- Propagate NoNUSignal in ApplyFamilyNUSizingRDS aggregation loop and
in cmd/multi_service_helpers.go drops recording
- Capture drops in all TestApplyFamilyNUSizingRDS subtests; assert
AlreadyAtTarget==1 for the "at target" case, SizedToZero==1 for a
new "floor(0)" test case, and zero total drops for passing-through cases
* fix(cli): extract writeReportAndSummary to reduce runToolMultiService complexity
gocyclo flagged runToolMultiService at complexity 11 (threshold 10).
Extract the final report-write-and-summary block into a dedicated
writeReportAndSummary helper, bringing the parent function to complexity 10.
No logic change.
* docs(family_nu): correct misleading comments about NoNUSignal drop behavior
The rdsInstanceNU map comment, rdsInstanceNUFromType comment,
ApplyFamilyNUSizingRDS return-value doc, and sizeRDSFamilyRecs
summary all claimed unknown-size recs "fall back to per-pool sizing"
or are "passed through unchanged". That is only true when rdsFamilyFromType
returns an empty prefix (those recs go to nonRDS via
partitionRDSRecsByFamily). When a rec has a known family prefix but
an unrecognised size suffix, it reaches sizeRDSFamilyRecs and, if
the whole family's NU sums to zero (currentNU <= 0), is dropped into
drops.NoNUSignal -- not returned unchanged or forwarded downstream.
Update all four comment blocks to reflect the three distinct outcomes
in sizeRDSFamilyRecs: CE-no-signal (return as-is), already-at-target
(drop to AlreadyAtTarget), and zero-rec-NU (drop to NoNUSignal).
* test(cli): assert drop-summary categories populated via non-nil DropSummary (refs #361)
Add discriminating tests for the four drop categories that were only
exercised via the nil-DropSummary path, leaving no regression guard
against a future removal of a drops.Add call site:
- TestApplyFilters_DropMinPoolSize: passes a non-nil DropSummary into
applyFilters with a rec whose avg < --min-pool-size and asserts the
DropMinPoolSize count is 1.
- TestApplyFilters_DropExtendedSupport: passes a non-nil DropSummary
into applyFilters with a MySQL 5.7 rec (all instances on extended
support) and asserts the DropExtendedSupport count is 1.
- TestApplyTargetCoverage_DropTargetAlreadyMet: passes a non-nil
DropSummary into ApplyTargetCoverage with ExistingCoveragePct=90
> target=80 and asserts the DropTargetAlreadyMet count is 1.
- TestApplyTargetCoverage_DropTargetSizedToZero: passes a non-nil
DropSummary into ApplyTargetCoverage with avg=0.4 at target=80
(floor(0.32)=0) and asserts the DropTargetSizedToZero count is 1.
Each test was verified to fail when its corresponding drops.Add call
was temporarily removed, and to pass with the call present.
* fix(lint): gofmt alignment and US-spelling in drop_summary + family_nu
- Align const block in drop_summary.go per gofmt (tab-aligned values)
- Fix "synchronisation" -> "synchronization" in drop_summary.go comment
- Fix "unrecognised/recognised" -> "unrecognized/recognized" in new
family_nu.go comments added by this branch (lines 20, 59, 147, 181)
- Add missing blank comment line before "The second return value" in
sizeRDSFamilyRecs godoc (gofmt list-item paragraph separator)
* fix(lint): gocritic rangeValCopy and unnamedResult in drop-summary helpers
Use index-based iteration to avoid copying large Recommendation structs
on each range step. Name return values on the four affected functions so
gocritic's unnamedResult check passes (3+ return values require names).
* fix(lint): collapse dead-valued dimension-filter reason variant
golangci v2.10.1 (CI) flagged two findings from the drop-summary change:
- unparam: passesDimensionFiltersWithReason always returns "" for its
dropReason result. --min-pool-size drops are counted in applyFilters
before processRecommendation runs, so the "WithReason" variant never
produces a reason. Collapse it back into passesDimensionFilters
(returning bool) and return "" directly in processRecommendation,
removing the dead return value and the misleading comment.
- gocritic paramTypeCombine: combine consecutive same-typed named
returns (kept bool, missingSignal bool) -> (kept, missingSignal bool)
in applyTargetCoverageOne.
* fix(cmd): report coverage drops in final summary
* fix(deps): bump brace-expansion to 1.1.16 (GHSA-3jxr-9vmj-r5cp)
npm audit flagged brace-expansion <1.1.16 as high severity DoS.
This was disclosed 2026-07-21 and affects all PR branches equally.
Lockfile-only change; no production API surface altered.
1 parent 0ca127b commit 2819b3d
7 files changed
Lines changed: 339 additions & 111 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
| |||
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
| 179 | + | |
| 180 | + | |
173 | 181 | | |
174 | 182 | | |
175 | 183 | | |
| |||
241 | 249 | | |
242 | 250 | | |
243 | 251 | | |
244 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
245 | 256 | | |
246 | 257 | | |
247 | 258 | | |
| |||
253 | 264 | | |
254 | 265 | | |
255 | 266 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 267 | + | |
| 268 | + | |
259 | 269 | | |
260 | 270 | | |
261 | 271 | | |
262 | 272 | | |
263 | 273 | | |
| 274 | + | |
| 275 | + | |
264 | 276 | | |
265 | 277 | | |
266 | 278 | | |
| |||
273 | 285 | | |
274 | 286 | | |
275 | 287 | | |
276 | | - | |
| 288 | + | |
277 | 289 | | |
278 | 290 | | |
279 | | - | |
| 291 | + | |
280 | 292 | | |
| 293 | + | |
281 | 294 | | |
282 | 295 | | |
283 | 296 | | |
284 | | - | |
| 297 | + | |
285 | 298 | | |
286 | 299 | | |
287 | 300 | | |
288 | 301 | | |
289 | 302 | | |
290 | | - | |
| 303 | + | |
291 | 304 | | |
292 | | - | |
| 305 | + | |
293 | 306 | | |
294 | | - | |
| 307 | + | |
295 | 308 | | |
296 | 309 | | |
297 | 310 | | |
298 | 311 | | |
299 | | - | |
| 312 | + | |
300 | 313 | | |
301 | | - | |
| 314 | + | |
302 | 315 | | |
303 | | - | |
| 316 | + | |
304 | 317 | | |
305 | 318 | | |
306 | 319 | | |
307 | 320 | | |
308 | 321 | | |
309 | | - | |
| 322 | + | |
310 | 323 | | |
311 | 324 | | |
312 | 325 | | |
313 | 326 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
318 | 332 | | |
319 | 333 | | |
320 | | - | |
| 334 | + | |
321 | 335 | | |
322 | 336 | | |
323 | 337 | | |
| |||
346 | 360 | | |
347 | 361 | | |
348 | 362 | | |
349 | | - | |
| 363 | + | |
350 | 364 | | |
351 | 365 | | |
352 | 366 | | |
| |||
366 | 380 | | |
367 | 381 | | |
368 | 382 | | |
369 | | - | |
| 383 | + | |
370 | 384 | | |
371 | 385 | | |
372 | 386 | | |
| |||
402 | 416 | | |
403 | 417 | | |
404 | 418 | | |
405 | | - | |
| 419 | + | |
406 | 420 | | |
407 | 421 | | |
408 | 422 | | |
| |||
463 | 477 | | |
464 | 478 | | |
465 | 479 | | |
466 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
467 | 484 | | |
468 | | - | |
| 485 | + | |
469 | 486 | | |
470 | | - | |
| 487 | + | |
471 | 488 | | |
472 | 489 | | |
473 | 490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
386 | 401 | | |
387 | 402 | | |
388 | 403 | | |
| |||
1028 | 1043 | | |
1029 | 1044 | | |
1030 | 1045 | | |
1031 | | - | |
| 1046 | + | |
1032 | 1047 | | |
1033 | 1048 | | |
1034 | 1049 | | |
| |||
1079 | 1094 | | |
1080 | 1095 | | |
1081 | 1096 | | |
1082 | | - | |
| 1097 | + | |
1083 | 1098 | | |
1084 | 1099 | | |
1085 | 1100 | | |
| |||
1095 | 1110 | | |
1096 | 1111 | | |
1097 | 1112 | | |
1098 | | - | |
| 1113 | + | |
1099 | 1114 | | |
1100 | 1115 | | |
1101 | 1116 | | |
| |||
1107 | 1122 | | |
1108 | 1123 | | |
1109 | 1124 | | |
1110 | | - | |
| 1125 | + | |
1111 | 1126 | | |
1112 | 1127 | | |
1113 | 1128 | | |
| |||
1198 | 1213 | | |
1199 | 1214 | | |
1200 | 1215 | | |
1201 | | - | |
| 1216 | + | |
1202 | 1217 | | |
1203 | 1218 | | |
1204 | 1219 | | |
| |||
1233 | 1248 | | |
1234 | 1249 | | |
1235 | 1250 | | |
1236 | | - | |
| 1251 | + | |
1237 | 1252 | | |
1238 | 1253 | | |
1239 | 1254 | | |
| |||
1247 | 1262 | | |
1248 | 1263 | | |
1249 | 1264 | | |
1250 | | - | |
| 1265 | + | |
1251 | 1266 | | |
1252 | 1267 | | |
1253 | 1268 | | |
| |||
1260 | 1275 | | |
1261 | 1276 | | |
1262 | 1277 | | |
1263 | | - | |
| 1278 | + | |
1264 | 1279 | | |
1265 | 1280 | | |
1266 | 1281 | | |
| |||
1281 | 1296 | | |
1282 | 1297 | | |
1283 | 1298 | | |
1284 | | - | |
| 1299 | + | |
1285 | 1300 | | |
1286 | 1301 | | |
1287 | 1302 | | |
| |||
1291 | 1306 | | |
1292 | 1307 | | |
1293 | 1308 | | |
1294 | | - | |
| 1309 | + | |
1295 | 1310 | | |
1296 | 1311 | | |
1297 | 1312 | | |
| |||
1336 | 1351 | | |
1337 | 1352 | | |
1338 | 1353 | | |
1339 | | - | |
| 1354 | + | |
1340 | 1355 | | |
1341 | 1356 | | |
1342 | 1357 | | |
| |||
1360 | 1375 | | |
1361 | 1376 | | |
1362 | 1377 | | |
1363 | | - | |
| 1378 | + | |
1364 | 1379 | | |
1365 | 1380 | | |
1366 | 1381 | | |
| |||
1381 | 1396 | | |
1382 | 1397 | | |
1383 | 1398 | | |
1384 | | - | |
| 1399 | + | |
1385 | 1400 | | |
1386 | 1401 | | |
1387 | 1402 | | |
1388 | 1403 | | |
1389 | 1404 | | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
0 commit comments