Report observed drift between the checkpoint and current state as plain observations. No stale-baseline classification is made: index movement is legitimate Git work between boundaries (CB-11A).
(
checkpoint: Option<&crate::commands::git::observation::ShimCheckpointObservation>,
atomic: &AtomicAnchorObservation,
git: &GitObservation,
)
| 922 | /// observations. No stale-baseline classification is made: index movement is |
| 923 | /// legitimate Git work between boundaries (CB-11A). |
| 924 | fn forensic_drift( |
| 925 | checkpoint: Option<&crate::commands::git::observation::ShimCheckpointObservation>, |
| 926 | atomic: &AtomicAnchorObservation, |
| 927 | git: &GitObservation, |
| 928 | ) -> Vec<String> { |
| 929 | let Some(checkpoint) = checkpoint else { |
| 930 | return vec!["checkpoint absent (nothing to compare)".to_string()]; |
| 931 | }; |
| 932 | let GitObservation::Repository(repository) = git else { |
| 933 | return vec!["git repository absent".to_string()]; |
| 934 | }; |
| 935 | let mut drift = Vec::new(); |
| 936 | if checkpoint.view != atomic.view { |
| 937 | drift.push(format!( |
| 938 | "view: checkpoint {} vs current {}", |
| 939 | checkpoint.view, atomic.view |
| 940 | )); |
| 941 | } |
| 942 | if checkpoint.atomic_state != atomic.state { |
| 943 | drift.push(format!( |
| 944 | "atomic state: checkpoint {} vs current {}", |
| 945 | checkpoint.atomic_state, atomic.state |
| 946 | )); |
| 947 | } |
| 948 | let observed_head = repository |
| 949 | .head |
| 950 | .oid() |
| 951 | .map(|oid| oid.to_string()) |
| 952 | .unwrap_or_else(|| "none".to_string()); |
| 953 | if checkpoint.git_head != observed_head { |
| 954 | drift.push(format!( |
| 955 | "Git HEAD: checkpoint {} vs current {observed_head}", |
| 956 | checkpoint.git_head |
| 957 | )); |
| 958 | } |
| 959 | let observed_tree = repository |
| 960 | .head_tree_oid |
| 961 | .map(|oid| oid.to_string()) |
| 962 | .unwrap_or_else(|| "none".to_string()); |
| 963 | if checkpoint.git_tree != observed_tree { |
| 964 | drift.push(format!( |
| 965 | "Git tree: checkpoint {} vs current {observed_tree}", |
| 966 | checkpoint.git_tree |
| 967 | )); |
| 968 | } |
| 969 | if drift.is_empty() { |
| 970 | drift.push("none (checkpoint matches current state)".to_string()); |
| 971 | } |
| 972 | drift |
| 973 | } |
| 974 | |
| 975 | fn build_forensic_report( |
| 976 | repo_root: &Path, |
no test coverage detected