pub fn collect_pool(root: &Path) -> Vec<SidecarResult>Expand description
Pool every sidecar JSON under every run directory at root.
Walks each immediate subdirectory of root (one per run, named
{kernel}-{project_commit} by sidecar_dir where
{project_commit} is the project tree’s HEAD short hex with
-dirty suffix when the worktree differs from HEAD) and
concatenates the sidecars each one yields via
collect_sidecars_with_errors (per directory, so the per-directory
stale-sidecar skip counts aggregate into one pool-wide summary). The
result is a flat
Vec<SidecarResult> covering every recorded run on disk —
cargo ktstr perf-delta’s pool-driven sourcing reads it
once, applies the typed --a-* / --b-* filters in memory,
and partitions the survivors into A/B sides.
root is typically runs_root; pass an alternate path when
comparing archived sidecar trees copied off a CI host (the
--dir escape hatch on perf-delta).
Returns an empty Vec when root does not exist or contains no
run directories. Per-run failure (a corrupt sidecar, a partial
directory) is counted and skipped — pool-collection never aborts
on a single bad file, and emits ONE aggregated
warn_skipped_sidecars summary for the whole walk rather than a
per-file line.
Performance: this is a full filesystem walk over root. On a
host with many archived runs (dozens to hundreds), each
invocation re-reads every sidecar JSON. The cost is acceptable
for the current operator workflow (one comparison per
session) but is taskifyable if it becomes a hot path — a
directory-name fast-path could skip runs whose
{kernel}-{project_commit} prefix does not match the active
--a-kernel / --b-kernel filter.