{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "recordType",
    "candidateId",
    "sourceCommit",
    "gitTree",
    "scopeSha256",
    "chain",
    "threatModel",
    "methodology",
    "privacyPredicates",
    "allPassed",
    "summary",
    "tests"
  ],
  "properties": {
    "schemaVersion": {
      "const": "3.0.0"
    },
    "recordType": {
      "const": "privacy-unlinkability-test-results"
    },
    "candidateId": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "sourceCommit": {
      "type": "string",
      "pattern": "^[0-9a-f]{40}$"
    },
    "gitTree": {
      "type": "string",
      "pattern": "^[0-9a-f]{40}$"
    },
    "scopeSha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "chain": {
      "const": "base"
    },
    "threatModel": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "modelId",
        "prohibitsCrossPartnerLinkage",
        "prohibitsCrossChainIdentityLinkage",
        "attackerCapabilities",
        "linkageVectors"
      ],
      "properties": {
        "modelId": {
          "const": "vaultfire-public-observer-collusion-v1"
        },
        "prohibitsCrossPartnerLinkage": {
          "const": true
        },
        "prohibitsCrossChainIdentityLinkage": {
          "const": true
        },
        "attackerCapabilities": {
          "const": [
            "cross-partner-collusion",
            "public-chain-observation",
            "timing-correlation"
          ]
        },
        "linkageVectors": {
          "const": [
            "commitment-reuse",
            "identifier-reuse",
            "metadata-correlation",
            "timing-correlation"
          ]
        }
      }
    },
    "methodology": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "methodologyId",
        "implementationVersion",
        "sampleCount",
        "positivePairCount",
        "negativePairCount",
        "confidenceMethod",
        "confidenceLevelBps",
        "maximumFalseLinkRateBps",
        "observedFalseLinkRateBps",
        "calculatedUpperFalseLinkRateBps",
        "seedCommitmentPath",
        "seedCommitmentSha256",
        "inputs",
        "usesRawPersonalData",
        "usesSurveillanceInputs"
      ],
      "properties": {
        "methodologyId": {
          "const": "vaultfire-chain-specific-unlinkability-v1"
        },
        "implementationVersion": {
          "type": "string",
          "pattern": "^[1-9][0-9]*\\.[0-9]+\\.[0-9]+$"
        },
        "sampleCount": {
          "type": "integer",
          "minimum": 1000
        },
        "positivePairCount": {
          "type": "integer",
          "minimum": 100
        },
        "negativePairCount": {
          "type": "integer",
          "minimum": 100
        },
        "confidenceMethod": {
          "const": "one-sided-hoeffding-v1"
        },
        "confidenceLevelBps": {
          "type": "integer",
          "minimum": 9500,
          "maximum": 9999
        },
        "maximumFalseLinkRateBps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "observedFalseLinkRateBps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "calculatedUpperFalseLinkRateBps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "seedCommitmentPath": {
          "type": "string",
          "pattern": "^pr10/partner-package/evidence/organizational/privacy-inputs/[a-z0-9-]+\\.json$"
        },
        "seedCommitmentSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "inputs": {
          "type": "array",
          "minItems": 4,
          "maxItems": 4,
          "uniqueItems": true,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "inputType",
              "path",
              "sha256"
            ],
            "properties": {
              "inputType": {
                "enum": [
                  "random-seed-opening",
                  "corpus-universe",
                  "deterministic-selection",
                  "test-command"
                ]
              },
              "path": {
                "type": "string",
                "pattern": "^pr10/partner-package/evidence/organizational/privacy-(logs|transcripts|inputs)/[a-z0-9-]+\\.json$"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              }
            }
          }
        },
        "usesRawPersonalData": {
          "const": false
        },
        "usesSurveillanceInputs": {
          "const": false
        }
      }
    },
    "privacyPredicates": {
      "const": {
        "explicitConsent": true,
        "dataMinimized": true,
        "chainSpecific": true,
        "nonLinkable": true,
        "crossChainValueFlowAbsent": true
      }
    },
    "allPassed": {
      "const": true
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "total",
        "passed",
        "failed",
        "totalSamples",
        "aggregateChallengePairs",
        "aggregateFalseLinks",
        "derivedObservedFalseLinkRateBps",
        "derivedUpperConfidenceBoundBps",
        "combinedLogPath",
        "combinedLogSha256"
      ],
      "properties": {
        "total": {
          "const": 3
        },
        "passed": {
          "const": 3
        },
        "failed": {
          "const": 0
        },
        "totalSamples": {
          "type": "integer",
          "minimum": 1000
        },
        "aggregateChallengePairs": {
          "type": "integer",
          "minimum": 1000
        },
        "aggregateFalseLinks": {
          "type": "integer",
          "minimum": 0
        },
        "derivedObservedFalseLinkRateBps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "derivedUpperConfidenceBoundBps": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000
        },
        "combinedLogPath": {
          "type": "string",
          "pattern": "^pr10/partner-package/evidence/organizational/privacy-(logs|transcripts|inputs)/[a-z0-9-]+\\.json$"
        },
        "combinedLogSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "tests": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "uniqueItems": true,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "testId",
          "methodId",
          "sampleCount",
          "expected",
          "observed",
          "passed",
          "logPath",
          "logSha256"
        ],
        "properties": {
          "testId": {
            "enum": [
              "privacy.commitment-reuse",
              "privacy.cross-partner-collusion",
              "privacy.metadata-timing-correlation"
            ]
          },
          "methodId": {
            "const": "statistical-linkage-challenge-v1"
          },
          "sampleCount": {
            "type": "integer",
            "minimum": 100
          },
          "expected": {
            "const": "unlinkable"
          },
          "observed": {
            "const": "unlinkable"
          },
          "passed": {
            "const": true
          },
          "logPath": {
            "type": "string",
            "pattern": "^pr10/partner-package/evidence/organizational/privacy-(logs|transcripts|inputs)/[a-z0-9-]+\\.json$"
          },
          "logSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      }
    }
  }
}
