Skip to contents

Integrity checks compare hashes recomputed from the stored record lines with the applicable manifest hash family. For a sealed archive, the original root is recomputed from the original manifest hashes. For a redacted archive, the public root is recomputed from the redacted record lines rather than from the manifest's public hashes. Completeness checks report result rows that do not match a logged response_id.

Usage

archive_check(archive, results = NULL)

Arguments

archive

An archive.

results

Optional data frame with a response_id column.

Value

A list of class archive_check: records_ok indicates whether every record matches its applicable manifest hash; root_ok indicates whether the original seal root is valid and is NA for an unsealed archive; public_root_ok indicates whether the public root is valid and is NA for an unredacted archive; intact is the conjunction of the record comparison and every applicable root check. The remaining fields are redacted, n_records, bad_records (indices), duplicate_response_ids and duplicate_request_hashes (each a character vector of any values that appear on more than one record), n_results, n_matched, and unmatched_ids. The last three are typed missing or empty values when results is not supplied.

Examples

log <- tempfile(fileext = ".jsonl")
writeLines(paste0('{"ts":"2026-06-01T10:00:01+0000","schema_version":"1.0",',
  '"kind":"call","provider":"groq","model":"openai/gpt-oss-20b",',
  '"request":{"q":1},"usage":{"sent":5,"rec":2},',
  '"response_id":"r-1","text":"reply"}'), log)
a <- archive_seal(archive_build(log))
archive_check(a)
archive_check(a, results = data.frame(response_id = c("r-1", "orphan")))