feat(prune): R2 dry-run prune shell + persist wiring, report-only

Add ReaSamplerSession::pruneDryRun enumerating the resolved current bank
folder, feeding the R1 core, and returning a PruneReport (count/bytes/list).
New pure bankRelativeForName + buildPruneReport keep spelling and tally
testable. Register forever-stable BANK_PRUNE_FOLDER action, report-only. No deletion.
This commit is contained in:
2026-07-26 18:19:41 -04:00
parent 46176f3f04
commit c1473c42e1
10 changed files with 297 additions and 1 deletions
+19
View File
@@ -33,4 +33,23 @@ std::vector<std::string> pruneOrphans(const std::vector<std::string>& present,
return orphans;
}
PruneReport buildPruneReport(
const std::vector<std::string>& orphans,
const std::unordered_map<std::string, std::uint64_t>& sizeByPath,
std::size_t displayCap) {
PruneReport report;
report.count = orphans.size();
for (const std::string& o : orphans) {
// Sum EVERY orphan's bytes (the exact reclaimable total), not just the displayed
// ones. A path with no stat'd size contributes 0 — never dropped, never negative.
const auto it = sizeByPath.find(o);
report.totalBytes += (it != sizeByPath.end()) ? it->second : 0;
// Display list is capped (0 = uncapped). count stays exact above regardless.
if (displayCap == 0 || report.orphans.size() < displayCap)
report.orphans.push_back(o);
}
report.truncated = report.orphans.size() < report.count;
return report;
}
} // namespace reasampler