Evaluation reporting APIs
Persist native evaluation reports and upload their original bytes.
Import LedgeKitTesting for these APIs. Credentials come from LedgeKit.
LedgeEvaluationFile
public init(data: Data) throwsA Sendable value exposing the original data: Data and decoded native result id: UUID. Construction validates the native report structure. It does not execute an evaluation or translate it into another report format.
LedgeEvaluationReporter
An actor with a caller-selected durable directory and write credential.
public init(directory: URL, credentials: LedgeCredentials, session: URLSession = .shared)
public func submit(_ report: LedgeEvaluationFile) async throws
public func retryPending() async throws -> [Delivery]submit saves original bytes before upload. It moves the file from Pending to Uploaded only after a valid receipt with a matching report ID. Different bytes with the same local result ID cause a conflict. Temporary failures receive up to three total attempts per delivery; failed files remain pending.
retryPending attempts previously saved files without running inference. It can throw for directory access; individual file results are returned as Delivery values with file: URL and error: String?. A nil error indicates successful delivery.
LedgeEvaluationError
Cases: invalidReport(String), conflictingLocalReport, uploadRejected(Int), invalidResponse. The enum conforms to Error, LocalizedError, and Sendable.
See uploading reports for complete persistence and retry examples.