fix(git): error on missing operations child mapping - #206
Closed
presempathy-awb wants to merge 1 commit into
Closed
Conversation
zhangfengcdt
approved these changes
Aug 25, 2026
zhangfengcdt
left a comment
Owner
There was a problem hiding this comment.
Reviewed: implementation and tests pass; no public API surface change detected.
Owner
|
Resolved and integrated via #245 after the full CI matrix passed. |
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.
Git Operations Error On Missing Historical Child Mapping
Bug
GitOperations::diff,show, andrevertreconstruct historical key/valuestate directly from a commit's
prolly_config_tree_configandprolly_hash_mappingsfiles. During internal-node traversal, a child hash thatwas absent from the historical mapping file was skipped instead of reported.
Impact
A corrupt historical mapping file could make a whole child subtree disappear
from
git-prolly difforgit-prolly show. The CLI could then report fakedeletions, and
GitOperations::revertcould apply an incorrect inverse changebased on incomplete historical state.
Fix
Historical traversal now carries the expected node hash through recursion and
validates every internal child edge. Child hash bytes must have the configured
digest length, every child hash must exist in the historical mapping file, and
cyclic child references are rejected.
Regression Proof
The branch adds
show_reports_missing_historical_child_mappinginsrc/git/operations.rs. The test creates a multi-level historical tree, commitsa deliberately corrupt mapping file with one child mapping removed, restores a
good mapping in a later HEAD commit, then asks
GitOperations::showto inspectthe corrupt historical commit.
Against the unfixed code,
showreturnedOk(_)and reported fake removals forthe missing child subtree. The fixed branch returns an error mentioning the
missing child mapping.
Verification
Run on
fix/git-operations-missing-child-mapping:RUSTC="$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc" CARGO_TARGET_DIR=/tmp/prollytree-ops-missing-child-target /opt/homebrew/bin/cargo test --lib --features git show_reports_missing_historical_child_mapping -- --nocaptureRUSTC="$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc" CARGO_TARGET_DIR=/tmp/prollytree-ops-missing-child-target /opt/homebrew/bin/cargo test --lib --features git git::operations::tests -- --nocapture/opt/homebrew/bin/cargo fmt --all -- --checkRUSTC="$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc" CARGO_TARGET_DIR=/tmp/prollytree-ops-missing-child-target /opt/homebrew/bin/cargo build --alltimeout 240 zsh -lc 'CARGO_TARGET_DIR=/tmp/prollytree-ops-missing-child-clippy-target /opt/homebrew/bin/cargo clippy --all -q; rc=$?; echo CLIPPY_STATUS:$rc; exit $rc'