One-line informative description for Observe output and typed refusals. This is the safe-to-display summary; it never includes workspace contents, only classification evidence.
(&self)
| 665 | /// This is the safe-to-display summary; it never includes workspace |
| 666 | /// contents, only classification evidence. |
| 667 | pub fn describe(&self) -> String { |
| 668 | match self { |
| 669 | Self::GitOperationInProgress { |
| 670 | repository_state, |
| 671 | markers, |
| 672 | conflict_stages, |
| 673 | disposition, |
| 674 | .. |
| 675 | } => { |
| 676 | let mut description = format!( |
| 677 | "Git operation in progress ({repository_state}): {}", |
| 678 | disposition.describe() |
| 679 | ); |
| 680 | if !markers.is_empty() { |
| 681 | let names: Vec<String> = |
| 682 | markers.iter().map(|marker| marker.to_string()).collect(); |
| 683 | description.push_str(&format!("; sequence markers: {}", names.join(", "))); |
| 684 | } |
| 685 | if !conflict_stages.is_empty() { |
| 686 | description.push_str(&format!( |
| 687 | "; index holds {} conflicted stage entries", |
| 688 | conflict_stages.len() |
| 689 | )); |
| 690 | } |
| 691 | description |
| 692 | } |
| 693 | Self::Unanchored { state, .. } => { |
| 694 | let mut description = |
| 695 | format!("workspace is not anchored to a verified Git baseline: {state:?}"); |
| 696 | if let Some(remediation) = state.remediation() { |
| 697 | description.push_str("\n\n"); |
| 698 | description.push_str(&remediation); |
| 699 | } |
| 700 | description |
| 701 | } |
| 702 | Self::OperationHeadsDiverged { heads } => format!( |
| 703 | "operation heads diverged; resolve the competing leases instead of retrying a stale plan: {}", |
| 704 | heads.iter().map(ToString::to_string).collect::<Vec<_>>().join(", ") |
| 705 | ), |
| 706 | Self::ConcurrentGitMutation { |
| 707 | attempts, |
| 708 | first, |
| 709 | last, |
| 710 | } => format!( |
| 711 | "Git HEAD/index changed between observations across {attempts} attempt(s); \ |
| 712 | aborting on a possibly stale baseline (first token {first:?}, last token {last:?})" |
| 713 | ), |
| 714 | Self::GitLocksBusy { reason, detail } => { |
| 715 | format!("Git-owned transaction in flight ({reason}): {detail}") |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |