Inspect, validate, and export archives¶
VERA provides read-only inspection and validation commands plus an export command for restoring the embedded source document.
Inspect metadata¶
Inspection reports the format version, source filename, page and chunk counts, embedding model and dimensions, parser, and creation time.
For structured output:
Metadata values stored by the format may be strings even when they look
numeric. Summary counts such as pages, chunks, and embeddings are
integers.
Validate integrity¶
Validation checks:
- SQLite integrity;
- required tables and metadata;
- document, page, chunk, embedding, FTS, and asset counts;
- one embedding and one FTS row per chunk;
- embedding blob dimensions;
- page references;
- presence of the original source document.
JSON mode returns the full report:
The report includes ok, issues, warnings, counts, checks, and
metadata. Exit status is 0 when ok is true and 1 when validation finds an
issue. An invalid archive still emits the JSON report, so callers should retain
stdout when handling exit status 1.
An archive created with --store-original false is searchable. Validation
reports the missing original source as a warning rather than an issue.
Export the original source¶
Export to the stored filename in the current directory:
Choose a path:
If the output names an existing directory, VERA writes the stored filename inside that directory:
JSON mode reports the output path, stored filename, MIME type, and source hash:
If the archive does not contain the original source, export returns
{"ok": false, "error": "..."} and exits 1.
Export writes to disk and may create parent directories. Choose the destination carefully.
Python API¶
from vera import VeraDocument
from vera_ingest.viewer import export_source_document, get_source_document
doc = VeraDocument.open("manual.vera")
try:
info = doc.inspect()
report = doc.validate()
source = get_source_document(doc)
print(source.filename, source.media_type, source.checksum)
output = export_source_document(doc, "./exports")
print(output)
finally:
doc.close()
source.data contains the original bytes. get_source_document() and
export_source_document() raise ValueError when no original source is
stored.
Recovery guidance¶
Validation identifies damage but does not repair an archive. The safest recovery is:
- preserve the failing archive for diagnosis;
- verify that the source PDF is available;
- convert the source into a new output path;
- validate the new archive;
- replace the old archive only after confirming search behavior.
Do not edit the SQLite tables directly as a routine repair strategy.