buildFakes function

Fakes buildFakes({
  1. String createdId = 'tgdog-sess1',
  2. WorkSignalProbe? workSignal,
})

Builds an StationServices over the fakes (the chokepoint writes through a recording bd runner; the transport is a controllable provider; land is wired to the recording git/PR ops) and returns it with the recorders.

Implementation

Fakes buildFakes({
  String createdId = 'tgdog-sess1',
  WorkSignalProbe? workSignal,
}) {
  final runner = RecordingBdRunner(createdId: createdId);
  final provider = FakeRuntimeProvider();
  final git = RecordingGitRunner();
  final pr = FakePrOpener();
  final writer = StationBeadWriter(
    bd: BdCliService(runner),
    ownership: BeadOwnershipPredicate(const {stateSubstation}),
  );
  return (
    // Station-level ambient only (ADR-0009 D2): transport + chokepoint + state
    // substation. The git/PR recorders are returned separately so a test wires its own
    // per-substation `GitSourceControl`/`ServiceBundle` (the workspace/branch
    // layout is the SourceControl's, not the station's — ADR-0008 D5).
    ctx: StationServices(
      provider: provider,
      writer: writer,
      stateSubstation: stateSubstation,
      // The COMPLETION FENCE's probe — null (the default) leaves the fence inert,
      // so every existing test is unchanged.
      workSignal: workSignal,
    ),
    runner: runner,
    provider: provider,
    git: git,
    pr: pr,
  );
}