Repository navigation
fix(validate): read each version directory's inventory - #8
Merged
adammharris merged 1 commit intoNov 6, 2026
Merged
Conversation
validate read the root inventory and its sidecar and never opened vN/inventory.json, so an object whose version inventories were corrupt or disagreed with the root got the verdict a sound object gets. Behavioural-change: validate and validate_deep report new Violation variants for objects they used to call valid: a version directory's sidecar missing or disagreeing, its inventory unreadable, a head inventory not identical to the root, an id that differs, a spec version moving back, and a version block that differs from the root's. An object with no inventory in a version directory still validates clean.
adammharris
deleted the
agent/backlog-validate-never-reads-a-version-inventory
branch
November 6, 2026 17:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
validateandvalidate_deepnow read the inventory in every version directory that holds one, and report:VersionSidecarMissing,VersionSidecarMismatch)VersionInventoryUnreadable)HeadInventoryDiffers)idthat differs from the root's (VersionIdDiffers)typeolder than the version before it (SpecVersionMovedBack)VersionStateDiffers), or that the root lacks (VersionUnknownToRoot)Logical state is compared by digest and by content path. Where the digest algorithm changed, only the content paths are compared. An inventory's content paths for a logical path must all be listed for that path in the root, the rule ocfl-py applies.
A version directory with no inventory is still not a violation, since the spec has it as SHOULD. The root's sidecar check now shares a helper with the version directories.
Why
An object whose version inventories were corrupt, or disagreed with the root, got
valid, and with--deep,content verified, where rocfl refuses it. "Not checked" read as "checked and fine".Closes the task
docs/tasks/validate-never-reads-a-version-inventory.md, marked done in this branch.Behaviour
Objects that used to pass can now fail
validate. This is recorded in the commit'sBehavioural-change:trailer. The newViolationvariants are additive, and the enum is#[non_exhaustive].Verification
objects_whose_version_inventories_disagree_are_caughtintests/fixtures.rsholds the task's eleven fixtures by name.E011_E013_invalid_padded_head_version,E040_head_not_most_recentandE060_E064_root_inventory_digest_mismatch, in both spec versions. All three are bad objects, caught because they disagree with the root. Every good fixture still validates clean.cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo test --all-targetswithOCFL_FIXTURESset,cargo test --doc,cargo +1.88 check --all-targets, androcfl validate(1.7.0) on the interop object, which is valid with warnings.