Repository navigation
fix(object): refuse a commit whose logical paths conflict - #6
Merged
adammharris merged 1 commit intoNov 3, 2026
Merged
Conversation
Object::commit checked each logical path on its own, so a path given twice, or a path with another beneath it, got through: the first wrote one content path for two digests, the second failed after writing part of a version, or succeeded when the shorter path's bytes were already stored. commit now checks the version's paths against each other before anything is written and returns Error::Conflict naming both. validate reports the same conflicts, as LogicalPathConflict for a version's state and ContentPathConflict for the manifest, in an object another tool wrote; the structural pass now catches 51 of the 107 bad-object fixtures, up from 45. Behavioural-change: Object::commit returns Error::Conflict for a version that lists one logical path twice (even with the same bytes) or a path with another beneath it, where it used to accept or half-write it. Behavioural-change: validate and validate_deep report LogicalPathConflict and ContentPathConflict, two new Violation variants, for inventories they used to pass.
adammharris
deleted the
agent/backlog-fix-commit-accepts-conflicting-logical-paths
branch
November 3, 2026 04:40
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 Commit accepts logical paths that conflict, and marks it done in this branch.
What changed
Object::commitnow checks a version's logical paths against each other after staging and before anything is written. A path given twice, or a path with another beneath it (aanda/b), returnsError::Conflictnaming both paths. Paths that only start with the same string (a,a-b,ab) still commit.validateandvalidate_deepreport two newViolationvariants for objects another tool wrote:LogicalPathConflict(a version's state) andContentPathConflict(the manifest).summarizecounts them aslogical-path-conflictandcontent-path-conflict.inventory::conflicting_paths, finds the conflicts for both callers.bad-objectsfixtures, up from 45, and "non-unique logical paths" comes off the list of gaps.Why
Each of the task's three cases got through:
atwice wrote one content path for two digests, so the first file's bytes were lost and onlyvalidate_deepnoticed;awitha/bfailed withIo(AlreadyExists)after writingv1/content/a; and the same pair across versions committed a state no filesystem can hold.Behavioural change
commitrefuses what it used to accept or half-write, including one path given twice with the same bytes, which it used to merge silently.validatereports violations it used to miss.Violationis#[non_exhaustive], so the new variants do not break callers that match on it.Verification
mocfl/src/object.rs, plus one for paths that only share a leading string. Three tests inmocfl/src/validate.rscover the new violations. All six failed before the fix.cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo test --all-targetswithOCFL_FIXTURESpointing at a fresh clone of OCFL/fixtures (every good object still validates clean),cargo test --doc, the interop emit test, andcargo +1.88 check --all-targets.