Repository navigation
fix(inventory): a padded version name stops at the last that keeps its zero - #13
Merged
adammharris merged 1 commit intoNov 11, 2026
Conversation
…s zero VersionNum::next refused a padded successor only once its digits outran the whole width, so v01 counted on to v99 and v0999 to v1000. A padded name keeps its leading zero, so those successors drop it, read back unpadded, and leave the object under two naming conventions (OCFL E011, E012, E013). next now refuses the successor of v09, v0999 and every padded name whose successor would fill the width, with Error::Conflict as before. validate reports the same thing from the other side: a new Violation::VersionNamesDiffer for every version not named the way the first is, so v10 among v01 … v09 is no longer called clean. Behavioural-change: committing onto a zero-padded object at its last name that keeps the leading zero (v09, v0999, …) now fails with Error::Conflict instead of writing v10 or v1000, and validate reports an object whose version names mix conventions as VersionNamesDiffer.
adammharris
deleted the
agent/backlog-a-padded-object-commits-past-its-width
branch
November 11, 2026 17:02
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.
Closes the task A padded object commits a version past its width, which this branch marks done.
What changed
VersionNum::next(mocfl/src/inventory.rs) refused a padded successor only when its digits outran the whole width, sov01counted on tov99andv0999tov1000. A padded name has to keep its leading zero: OCFL's own example allowsv00001tov09999and notv10000.nextnow refuses the successor ofv09,v0999and every padded name whose successor would fill the width, with the sameError::Conflictit already used for overflow. Its doc comment now gives the right ceiling.validate(mocfl/src/validate.rs) has a newViolation::VersionNamesDiffer(summary keyversion-names-differ). It reports every version whose name doesn't follow the convention the first version sets (unpadded, or padded to one width) (E011, E012, E013). Sov10amongv01…v09, orv2afterv01, is no longer called clean.Why
mocfl pads only what it opens, so this only bites on an object another tool wrote with padded names. That object's next commit, once it reached its last name, landed beside the padded ones under a second naming convention, and
validateandvalidate_deepboth called the result clean.Behavioural change
Committing onto a padded object at its last name (
v09,v0999, …) now fails withError::Conflictand writes nothing, where it used to writev10orv1000.validatenow reports mixed version names. Both are recorded in the commit'sBehavioural-change:trailer.Verified
inventory.rsand the newa_padded_object_at_its_last_name_commits_no_furtherboth failed onmain(v01counted tov99, and the tenth commit returnedOk(v10)). Both pass with the fix.v01,v2) give exactly oneVersionNamesDiffer;tests/fixtures.rschecks thatE011_E013_invalid_padded_head_version(v01 … v09, v10) is reported for its names, in both spec versions. Onmainthat fixture was only caught because of an unrelated disagreement in itsv08inventory.testjob run locally:cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo test --all-targetswithOCFL_FIXTURESpointing at a fresh clone of OCFL/fixtures, andcargo test --doc. All green. Themsrvjob (cargo +1.88 check --all-targets) passes too.interopjob locally becauserocflisn't installed on this machine. The objects it emits are unpadded, which this change doesn't touch.