
Verify an archive's integrity and (optionally) a result's completeness
Source:R/archive_archive.R
archive_check.RdIntegrity 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.
Value
A list of class archive_check: shape_ok indicates that the
record list, the manifest, and (when sealed) the seal's stored record
count agree on cardinality, checked before any hash comparison so a
truncated or padded record list cannot slip through elementwise
recycling; records_ok indicates whether
every record matches its applicable manifest hash; root_ok indicates
whether the seal root (content root, manifest, and environment) is
valid, and content_root_ok whether the content root matches the
ordered record hashes – both 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
shape check, 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")))