# apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts · screen/t3code-personal

[View on GitCafe](https://git.cafe/screen/t3code-personal/blob/04c15f34b756aadbff4c93ff07a217fa2398e5d5/apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts)

Repository: [screen/t3code-personal](https://git.cafe/screen/t3code-personal)

Visibility: public

Requested revision: 04c15f34b756aadbff4c93ff07a217fa2398e5d5

Requested commit: 04c15f34b756aadbff4c93ff07a217fa2398e5d5

Commit: 04c15f34b756aadbff4c93ff07a217fa2398e5d5

Blob: 586281dc9c6b410735fb56952c985389497ad558

Size: 1345 bytes

[Immutable source](https://git.cafe/screen/t3code-personal/blob/04c15f34b756aadbff4c93ff07a217fa2398e5d5/apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts?format=markdown)

```
/**
 * RuntimeReceiptBus layers.
 *
 * `RuntimeReceiptBusLive` is the production default and intentionally does not
 * retain or broadcast receipts. `RuntimeReceiptBusTest` installs the in-memory
 * PubSub-backed implementation used by integration tests that need to await
 * checkpoint-reactor milestones precisely.
 *
 * @module RuntimeReceiptBus
 */
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as PubSub from "effect/PubSub";
import * as Stream from "effect/Stream";

import {
  RuntimeReceiptBus,
  type RuntimeReceiptBusShape,
  type OrchestrationRuntimeReceipt,
} from "../Services/RuntimeReceiptBus.ts";

const makeRuntimeReceiptBus = Effect.succeed({
  publish: () => Effect.void,
  streamEventsForTest: Stream.empty,
} satisfies RuntimeReceiptBusShape);

const makeRuntimeReceiptBusTest = Effect.gen(function* () {
  const pubSub = yield* PubSub.unbounded<OrchestrationRuntimeReceipt>();

  return {
    publish: (receipt) => PubSub.publish(pubSub, receipt).pipe(Effect.asVoid),
    get streamEventsForTest() {
      return Stream.fromPubSub(pubSub);
    },
  } satisfies RuntimeReceiptBusShape;
});

export const RuntimeReceiptBusLive = Layer.effect(RuntimeReceiptBus, makeRuntimeReceiptBus);
export const RuntimeReceiptBusTest = Layer.effect(RuntimeReceiptBus, makeRuntimeReceiptBusTest);

```
