CB-10B bounded create-only publication queue (RFC §8.6, §8.5).
(remote: Option<&str>, max: usize, degraded_head_fallback: bool)
| 1029 | |
| 1030 | /// CB-10B bounded create-only publication queue (RFC §8.6, §8.5). |
| 1031 | fn queue(remote: Option<&str>, max: usize, degraded_head_fallback: bool) -> CliResult<()> { |
| 1032 | let root = find_repository_root()?; |
| 1033 | let mut repo = Repository::open(&root).map_err(CliError::Repository)?; |
| 1034 | let workspace = enter_workspace(&mut repo, boundary_mode(false))?; |
| 1035 | let working_copy = workspace.working_copy(); |
| 1036 | let git = open_git(&root)?; |
| 1037 | |
| 1038 | let outcome = super::transport::run_local_publish_queue(&repo, working_copy, &git, max)?; |
| 1039 | |
| 1040 | if !outcome.all_local_ok() { |
| 1041 | drop(workspace); |
| 1042 | return Err(CliError::Repository( |
| 1043 | atomic_repository::RepositoryError::InvalidOperation { |
| 1044 | message: format!( |
| 1045 | "{} stored binding(s) failed to load and were not published; \ |
| 1046 | refusing to continue past unresolvable local state", |
| 1047 | outcome.unresolvable |
| 1048 | ), |
| 1049 | }, |
| 1050 | )); |
| 1051 | } |
| 1052 | println!( |
| 1053 | "Local queue: {} published, {} already present ({} ref(s) considered)", |
| 1054 | outcome.published, |
| 1055 | outcome.already_present, |
| 1056 | outcome.refs.len(), |
| 1057 | ); |
| 1058 | |
| 1059 | let Some(remote_name) = remote else { |
| 1060 | print_hint("no --remote given; binding refs stayed local (RFC §8.6 transfer skipped)"); |
| 1061 | drop(workspace); |
| 1062 | return Ok(()); |
| 1063 | }; |
| 1064 | |
| 1065 | // CB-10B review R8: the workspace lease is retained through the NETWORK |
| 1066 | // transfer — the ordered boundary outlives the remote effects, so the |
| 1067 | // workspace is never dropped before network completion. |
| 1068 | let transferred = super::transport::transfer_binding_refs( |
| 1069 | &repo, |
| 1070 | &root, |
| 1071 | &git, |
| 1072 | remote_name, |
| 1073 | degraded_head_fallback, |
| 1074 | )?; |
| 1075 | drop(workspace); |
| 1076 | if transferred.is_empty() { |
| 1077 | print_info(&format!( |
| 1078 | "No binding refs to transfer to '{remote_name}' (none are published locally)." |
| 1079 | )); |
| 1080 | } else { |
| 1081 | // Publication is reported only after remote verification, which |
| 1082 | // transfer_binding_refs performs before returning. |
| 1083 | print_success(&format!( |
| 1084 | "Verified {} create-only binding ref(s) on remote '{remote_name}' at their exact targets.", |
| 1085 | transferred.len() |
| 1086 | )); |
| 1087 | print_hint("Transfers carry only the reviewed refs/atomic/bindings/* namespace; WIP refs and snapshots never transfer."); |
| 1088 | } |
no test coverage detected