Add clean-checkout regeneration and reproducibility tests #17
Labels
No labels
area/deployment
area/governance
area/metadata
area/pipeline
area/search
type/data
type/design
type/implementation
type/testing
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Reference
Arkive/arkive#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Run the documented end-to-end processing command in the test workflow.
Compare regenerated records with committed expected outputs using a deterministic comparison.
Verify original-file byte size and SHA-256 values.
Verify every chunk text against its half-open offsets.
Verify source → document → chunk lineage and source consistency.
Verify repeated runs produce identical records and stable identifiers.
Verify representative failures are clear and do not alter successful committed output.
Document any intentionally excluded nondeterministic field and justify it.
Manual editorial approval of extracted text.
Search index generation.
Performance benchmarking.
OCR, embeddings, LLMs, translation, or speech.
Regenerated deterministic records match committed expected records.
All file checksums and sizes are correct.
All chunk texts and offsets are exact.
All lineage and cross-record validations pass.
Two consecutive runs produce identical deterministic output.
Failure tests prove final outputs remain unchanged.
The complete test suite passes without network access.
Run the regeneration test twice and compare outputs.
Run with networking disabled.
Inspect the test workspace to confirm failures leave no partial final records.
Two constraints from the merged #8 identifier rules that affect how this issue's reproducibility tests can be written. Recording them here so they are known before the tests are designed.
1. Identifiers are not re-derivable after a metadata correction
docs/source-intake.md§6.1 derives the source key from the normalized title and a canonical identity built from title, authors, publisher, publication date, edition, and language. It also states that a committed identifier is immutable and that correcting metadata must not rename it.Both rules are correct individually. Together they mean that once any of those six fields is corrected, re-deriving the identifier from the committed record produces a different key than the one committed.
Determinism therefore holds at first assignment only, not as a property that can be re-verified from the record afterwards.
Consequence for this issue: a regeneration test that recomputes source or document identifiers and compares them against committed values will produce false failures on any source whose metadata was ever corrected. Committed identifiers must be treated as authoritative input to regeneration, not as recomputed output to be checked.
If identifier derivation should remain auditable, one cheap option is to record the canonical-identity string, or its SHA-256, in the source record at assignment time. Regeneration could then verify that the stored identity still matches the stored identifier without requiring current metadata to reproduce it.
2. Document identity currently includes the file checksum, which couples identifiers to tool output
§6.2 builds the canonical document identity from
source_id,artifact_key,role,language,derived_from, andchecksum_sha256.Because the checksum participates in identity, any change to derived output bytes produces a different canonical identity. Re-running OCR or normalization with a different tool version therefore yields a different identity, while the natural key
<source-key>-<artifact-key>is already held by the previous identity. Rule 3 then applies the collision path and produces a second document identifier, and rule 9 forbids updating the existing record's identifier in place. Chunk records referencing the previousdocument_idbecome stale.This means "clean-checkout regeneration produces identical records" holds only while every transformation tool and version is pinned. Any dependency upgrade that alters output bytes will change document identifiers rather than just checksums.
Two possible resolutions, both worth deciding before the tests are written:
checksum_sha256from the document identity tuple, leaving(source_id, artifact_key, role, language, derived_from), so regeneration updates the checksum field while the identifier and all chunk references stay stable.The second option is more consistent with §6.3, which argues that source identifiers should not be content hashes precisely because file integrity belongs in checksum fields. This has been raised as a finding on #9, since the identifier rules may be amended there.