The Git commits the verified shim checkpoint already accounts for in `view`, beyond the markers the importer has. A checkpoint records that, at the Atomic state it names, its Git commit was the view's exact projection. That is the claim a push trailer makes, for a commit that cannot carry one: an agent's own commit, adopted as the projection of the turn that recorded it. When the view's history c
(
root: &Path,
view: &str,
imported_shas: &HashSet<String>,
known_states: &HashSet<atomic_core::types::Merkle>,
)
| 808 | /// nothing to the view. Without this the importer synthesizes an adopted |
| 809 | /// commit a second time, as a Git-authored change beside the agent's. |
| 810 | fn checkpoint_projection_markers( |
| 811 | root: &Path, |
| 812 | view: &str, |
| 813 | imported_shas: &HashSet<String>, |
| 814 | known_states: &HashSet<atomic_core::types::Merkle>, |
| 815 | ) -> HashSet<String> { |
| 816 | let mut covered = HashSet::new(); |
| 817 | let checkpoint = match super::checkpoint::read_checkpoint(root) { |
| 818 | Ok(Some(checkpoint)) => checkpoint, |
| 819 | Ok(None) => return covered, |
| 820 | Err(error) => { |
| 821 | log::debug!("no checkpoint markers for view '{view}': {error}"); |
| 822 | return covered; |
| 823 | } |
| 824 | }; |
| 825 | let state_in_view = known_states |
| 826 | .iter() |
| 827 | .any(|state| state.to_string() == checkpoint.atomic_state); |
| 828 | if checkpoint.view != view || !state_in_view { |
| 829 | return covered; |
| 830 | } |
| 831 | let Ok(git_repo) = GitRepository::open(root) else { |
| 832 | return covered; |
| 833 | }; |
| 834 | let Ok(head) = git2::Oid::from_str(&checkpoint.git_head) else { |
| 835 | return covered; |
| 836 | }; |
| 837 | let mut pending = vec![head]; |
| 838 | while let Some(oid) = pending.pop() { |
| 839 | let sha = oid.to_string(); |
| 840 | if imported_shas.contains(&sha) || covered.contains(&sha) { |
| 841 | continue; |
| 842 | } |
| 843 | let Ok(commit) = git_repo.find_commit(oid) else { |
| 844 | continue; |
| 845 | }; |
| 846 | covered.insert(sha); |
| 847 | pending.extend(commit.parent_ids()); |
| 848 | } |
| 849 | covered |
| 850 | } |
| 851 | |
| 852 | impl Command for Import { |
| 853 | fn run(&self) -> CliResult<()> { |
no test coverage detected