import type { BoundedFixture } from "./types.js";

export const boundedKnownGood: BoundedFixture = {
  fixtureId: "bounded/known-good",
  boundedVersion: "1.0",
  scenarios: [
    {
      scenarioId: "stream-limited-during-consumption",
      kind: "consumption-limit",
      observations: [
        {
          dimension: "body-bytes",
          declaredLimit: 1_048_576,
          peakObserved: 1_048_576,
          limitEnforcedDuringConsumption: true,
          rejectedAtConsumption: true,
          typedTerminalFailure: {
            type: "BodyTooLarge",
            observed: true,
          },
        },
        {
          dimension: "fan-out",
          declaredLimit: 8,
          peakObserved: 8,
          limitEnforcedDuringConsumption: true,
          rejectedAtConsumption: true,
          typedTerminalFailure: {
            type: "FanOutLimitExceeded",
            observed: true,
          },
        },
      ],
    },
    {
      scenarioId: "bounded-retry-with-typed-failure",
      kind: "wait-retry",
      observation: {
        loopKind: "retry",
        boundedProgressRule: "exponential-backoff-cap-30s",
        maxAttempts: 5,
        attemptsObserved: 5,
        elapsedMs: 12_000,
        cancellationPathAvailable: true,
        terminalState: "failed",
        terminalFailureTyped: true,
        failureType: "RetryBudgetExhausted",
        statesDistinct: true,
      },
    },
    {
      scenarioId: "child-inherits-only-declared",
      kind: "child-process",
      declared: {
        descriptors: [0, 1, 2],
        environmentKeys: ["PATH", "NODE_ENV"],
        signals: ["SIGTERM"],
        workingDirectory: "/srv/app",
        processGroup: "worker-pool",
      },
      observed: {
        descriptors: [0, 1, 2],
        environment: {
          PATH: "/usr/bin",
          NODE_ENV: "production",
        },
        signals: ["SIGTERM"],
        workingDirectory: "/srv/app",
        processGroup: "worker-pool",
      },
    },
  ],
};
