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

export const filesystemKnownGood: FilesystemFixture = {
  fixtureId: "filesystem/known-good",
  filesystemVersion: "1.0",
  scenarios: [
    {
      scenarioId: "canonical-containment-after-symlink-resolution",
      kind: "path-containment",
      platform: "linux",
      declaredRoot: "/srv/app/data",
      operationPath: "cache/output.json",
      resolvedPath: "/srv/app/data/cache/output.json",
      canonicalContainmentChecked: true,
      containedAfterResolution: true,
      traversalRejected: true,
      rootUnambiguous: true,
      platformSemanticsPreserved: true,
    },
    {
      scenarioId: "atomic-rename-replacement",
      kind: "atomic-replacement",
      targetPath: "/srv/app/config/settings.json",
      readersRequireWholeFileConsistency: true,
      replaceStrategy: "atomic-rename",
      atomicOrTransactional: true,
      partialCanonicalStateObserved: false,
    },
    {
      scenarioId: "stale-lock-recovered",
      kind: "artifact-ownership",
      artifactKind: "lock",
      path: "/var/app/.lock",
      ownerId: "worker-42",
      collisionSafe: true,
      boundedLifetime: true,
      maxLifetimeMs: 300_000,
      observedLifetimeMs: 310_000,
      cleanupOnExit: true,
      cleanupObserved: true,
      staleOwnerRecovery: {
        contractDeclared: true,
        staleDetected: true,
        recovered: true,
        recoveryMethod: "stale-pid-check-and-break",
      },
    },
    {
      scenarioId: "temp-artifact-with-bounded-cleanup",
      kind: "artifact-ownership",
      artifactKind: "temp",
      path: "/tmp/app-upload-a1b2",
      ownerId: "upload-session-a1b2",
      collisionSafe: true,
      boundedLifetime: true,
      maxLifetimeMs: 3_600_000,
      observedLifetimeMs: 1_200_000,
      cleanupOnExit: true,
      cleanupObserved: true,
      staleOwnerRecovery: {
        contractDeclared: true,
        staleDetected: false,
        recovered: true,
        recoveryMethod: "owner-token-reclaim",
      },
    },
    {
      scenarioId: "transactional-replacement",
      kind: "atomic-replacement",
      targetPath: "/srv/app/state/checkpoint.db",
      readersRequireWholeFileConsistency: true,
      replaceStrategy: "transactional",
      atomicOrTransactional: true,
      partialCanonicalStateObserved: false,
    },
  ],
};
