sessionSweepReportLines function

List<String> sessionSweepReportLines(
  1. SessionSweepReport report
)

Renders report as the fa session clean output lines (the exact plan for a dry run, the applied outcome otherwise; AC6). Empty for a silent no-cap report below the soft-warn threshold.

Implementation

List<String> sessionSweepReportLines(SessionSweepReport report) {
  if (!report.capConfigured) {
    return _noCapSweepLines(report);
  }
  final lines = <String>[
    _sweepHeaderLine(report),
    for (final action in report.deletions) _deletionLine(report, action),
  ];
  if (report.freedBytes > 0) {
    lines.add(
      'freed: ${formatRetentionBytes(report.freedBytes)} ยท '
      'remaining: ${formatRetentionBytes(report.remainingBytes)}',
    );
  }
  if (report.overCapSweepOff) {
    lines.add(
      'sessions over cap (${formatRetentionBytes(report.totalBytes)} > '
      '${formatRetentionBytes(report.capBytes)}) and retention sweep is off; '
      'run fa session clean to enforce it',
    );
  }
  _appendBlockerLines(report, lines);
  lines.addAll(report.notes);
  return lines;
}