{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/auth-isolated-staging-rehearsal-receipt.v1.schema.json",
  "title": "Auth S07 完全隔离预发布演练回执",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "subknifeId",
    "parentSubknife",
    "status",
    "observedAt",
    "source",
    "isolation",
    "migrationLedger",
    "journeys",
    "shadowRuntime",
    "recovery",
    "retirement",
    "productionBoundary",
    "decision"
  ],
  "properties": {
    "schemaVersion": {
      "const": "developer.reits.tech/auth-isolated-staging-rehearsal-receipt/v1"
    },
    "subknifeId": {
      "const": "D05-A03-P03c-S07"
    },
    "parentSubknife": {
      "const": "D05-A03-P03c-S06"
    },
    "status": {
      "const": "PASS_ISOLATED_STAGING_REHEARSAL_PRODUCTION_HELD"
    },
    "observedAt": {
      "type": "string",
      "format": "date-time"
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repository", "revision", "binarySha256"],
      "properties": {
        "repository": {"const": "reits/reits-auth"},
        "revision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
        "binarySha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
      }
    },
    "isolation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "databaseEngine",
        "databaseTransport",
        "authTransport",
        "databaseNetworkListening",
        "remoteDatabaseParametersAccepted",
        "productionDsnLoaded",
        "productionCredentialsLoaded",
        "productionDataLoaded",
        "syntheticDataOnly"
      ],
      "properties": {
        "databaseEngine": {"const": "11.4.12-MariaDB"},
        "databaseTransport": {"const": "LOCAL_UNIX_SOCKET_ONLY"},
        "authTransport": {"const": "LOCAL_LOOPBACK_ONLY"},
        "databaseNetworkListening": {"const": false},
        "remoteDatabaseParametersAccepted": {"const": false},
        "productionDsnLoaded": {"const": false},
        "productionCredentialsLoaded": {"const": false},
        "productionDataLoaded": {"const": false},
        "syntheticDataOnly": {"const": true}
      }
    },
    "migrationLedger": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "migrationIds",
        "firstApplied",
        "secondExactDigestSkips",
        "convergenceTables",
        "schemaAfterFirst",
        "schemaAfterSecond",
        "ledgerDigest"
      ],
      "properties": {
        "migrationIds": {
          "type": "array",
          "prefixItems": [
            {"const": "001"},
            {"const": "002"},
            {"const": "003"},
            {"const": "004"},
            {"const": "011"},
            {"const": "012"}
          ],
          "items": false
        },
        "firstApplied": {"const": 6},
        "secondExactDigestSkips": {"const": 6},
        "convergenceTables": {"const": 7},
        "schemaAfterFirst": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "schemaAfterSecond": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "ledgerDigest": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
      }
    },
    "journeys": {
      "type": "object",
      "additionalProperties": false,
      "required": ["status", "sourceRevision", "identity", "refresh", "resourceValidator", "database"],
      "properties": {
        "status": {"const": "PASS_SQL_AND_RESOURCE_JOURNEYS"},
        "sourceRevision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
        "identity": {
          "type": "object",
          "required": [
            "keyVersion",
            "preflight",
            "concurrentWorkers",
            "legacyLinksCreated",
            "canonicalReads",
            "singleAccountConverged",
            "ownershipConflictDenied",
            "invalidIdentityWrites"
          ],
          "properties": {
            "keyVersion": {"const": 7},
            "preflight": {"const": "PASS"},
            "concurrentWorkers": {"const": 32},
            "legacyLinksCreated": {"const": 1},
            "canonicalReads": {"const": 31},
            "singleAccountConverged": {"const": true},
            "ownershipConflictDenied": {"const": true},
            "invalidIdentityWrites": {"const": 0}
          }
        },
        "refresh": {
          "type": "object",
          "required": [
            "pepperVersion",
            "instances",
            "preflights",
            "concurrentLegacySuccesses",
            "concurrentReplayDenials",
            "crossInstanceReplayDenied",
            "familyRevokedAfterReplay",
            "rotationGeneration",
            "consumedTokenReplayDenied",
            "expiredSessionDenied",
            "unknownPepperDenied"
          ],
          "properties": {
            "pepperVersion": {"const": 3},
            "instances": {"const": 2},
            "preflights": {"const": 2},
            "concurrentLegacySuccesses": {"const": 1},
            "concurrentReplayDenials": {"const": 1},
            "crossInstanceReplayDenied": {"const": true},
            "familyRevokedAfterReplay": {"const": true},
            "rotationGeneration": {"const": 2},
            "consumedTokenReplayDenied": {"const": true},
            "expiredSessionDenied": {"const": true},
            "unknownPepperDenied": {"const": true}
          }
        },
        "resourceValidator": {
          "type": "object",
          "required": [
            "classes",
            "exactJourneys",
            "hostileCases",
            "crossClassFallbacks",
            "deterministicClock",
            "allHostileCasesDenied"
          ],
          "properties": {
            "classes": {
              "type": "array",
              "prefixItems": [
                {"const": "email_otp"},
                {"const": "phone_otp"},
                {"const": "hosted"},
                {"const": "pws"},
                {"const": "im_delegate"},
                {"const": "machine"}
              ],
              "items": false
            },
            "exactJourneys": {"const": 6},
            "hostileCases": {"const": 54},
            "crossClassFallbacks": {"const": 0},
            "deterministicClock": {"const": true},
            "allHostileCasesDenied": {"const": true}
          }
        },
        "database": {
          "type": "object",
          "required": [
            "identityKeyRows",
            "pepperRows",
            "identityLinks",
            "refreshFamilies",
            "refreshTokens",
            "replayWitnesses",
            "refreshReceipts"
          ],
          "properties": {
            "identityKeyRows": {"const": 1},
            "pepperRows": {"const": 1},
            "identityLinks": {"const": 2},
            "refreshFamilies": {"const": 2},
            "refreshTokens": {"const": 3},
            "replayWitnesses": {"const": 2},
            "refreshReceipts": {"const": 2}
          }
        }
      }
    },
    "shadowRuntime": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "storePreflight",
        "listenerStartedAfterPreflight",
        "mode",
        "schemaState",
        "productionActivated",
        "observationChecks",
        "observationFailures",
        "prelistenerConflictDenials",
        "activeModeDenied",
        "keyConflictDenied",
        "schemaConflictDenied",
        "productionShadowDenied"
      ],
      "properties": {
        "storePreflight": {"const": "PASS"},
        "listenerStartedAfterPreflight": {"const": true},
        "mode": {"const": "shadow"},
        "schemaState": {"const": "012-ready"},
        "productionActivated": {"const": false},
        "observationChecks": {"const": 24},
        "observationFailures": {"const": 0},
        "prelistenerConflictDenials": {"const": 4},
        "activeModeDenied": {"const": true},
        "keyConflictDenied": {"const": true},
        "schemaConflictDenied": {"const": true},
        "productionShadowDenied": {"const": true}
      }
    },
    "recovery": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "backupDigest",
        "schemaBeforeBackup",
        "schemaAfterRestore",
        "dataBeforeBackup",
        "dataAfterRestore",
        "schemaRestoredExactly",
        "dataRestoredExactly",
        "rollbackFloorRevision",
        "rollbackFloorStorePreflight"
      ],
      "properties": {
        "backupDigest": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "schemaBeforeBackup": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "schemaAfterRestore": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "dataBeforeBackup": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "dataAfterRestore": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
        "schemaRestoredExactly": {"const": true},
        "dataRestoredExactly": {"const": true},
        "rollbackFloorRevision": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
        "rollbackFloorStorePreflight": {"const": "PASS"}
      }
    },
    "retirement": {
      "type": "object",
      "minProperties": 6,
      "maxProperties": 6,
      "propertyNames": {
        "enum": [
          "authProcesses",
          "databaseProcesses",
          "databaseSockets",
          "loopbackListeners",
          "temporaryWorkDirectories",
          "secretMounts"
        ]
      },
      "additionalProperties": {"const": 0}
    },
    "productionBoundary": {
      "type": "object",
      "minProperties": 12,
      "maxProperties": 12,
      "additionalProperties": {"const": 0}
    },
    "decision": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "s07Complete",
        "s08Allowed",
        "productionMigrationAllowed",
        "productionAuthDeploymentAllowed",
        "activeModeAllowed",
        "productionActivationAllowed",
        "nextStage"
      ],
      "properties": {
        "s07Complete": {"const": true},
        "s08Allowed": {"const": true},
        "productionMigrationAllowed": {"const": false},
        "productionAuthDeploymentAllowed": {"const": false},
        "activeModeAllowed": {"const": false},
        "productionActivationAllowed": {"const": false},
        "nextStage": {"const": "S08_FOUR_OWNER_PRODUCTION_CHANGE_REVIEW"}
      }
    }
  }
}
