expectEmptyWorkspaceProcessCensus function

void expectEmptyWorkspaceProcessCensus(
  1. WorkspaceProcessCensus census, {
  2. required String workspacePath,
  3. required String phase,
})

Refuses unless census is empty on BOTH arms, naming phase when it is not.

A delete is bounded by a WINDOW, and a window only proves a tree stays gone while nothing is working under it. So the same census is read on either side of it — before the delete, where residue is a writer the stop fence did not reach, and after it, where residue is a client that arrived while the window was running and can re-create the store the moment the test stops looking. Either one is the leak both fixtures are measured by, and the only useful report of one names the process: a teardown that deletes around a live writer is how a Dolt server was abandoned in /tmp in the first place.

Implementation

void expectEmptyWorkspaceProcessCensus(
  WorkspaceProcessCensus census, {
  required String workspacePath,
  required String phase,
}) {
  if (census.stores.isEmpty && census.residents.isEmpty) return;
  throw StateError(
    'the workspace $workspacePath was still held $phase: '
    '${describeWorkspaceProcessCensus(census)}',
  );
}