Transfer the create-only binding namespace to `remote` and verify the remote actually holds every expected ref at its exact target before reporting publication. Pre-transfer validation (RFC §8.6 privacy boundary; CB-10B review R1): only refs backed by a stored binding transfer, each ref name must be the canonical `refs/atomic/bindings/ / ` layout for its binding, and each carrier must pa
(
repo: &Repository,
repo_root: &Path,
git: &GitRepository,
remote: &str,
degraded_fallback: bool,
)
| 255 | /// gap is a typed refusal and **no publication is reported** (RFC §8.6, |
| 256 | /// §12.11). WIP refs and snapshots are excluded by the transport allowlist. |
| 257 | pub fn transfer_binding_refs( |
| 258 | repo: &Repository, |
| 259 | repo_root: &Path, |
| 260 | git: &GitRepository, |
| 261 | remote: &str, |
| 262 | degraded_fallback: bool, |
| 263 | ) -> CliResult<Vec<String>> { |
| 264 | // The advertised-ref surface: exactly the reviewed binding namespace. |
| 265 | let refs = |
| 266 | transferable_binding_refs(git).map_err(|error| CliError::GitError { message: error })?; |
| 267 | if refs.is_empty() { |
| 268 | return Ok(Vec::new()); |
| 269 | } |
| 270 | let workdir = git |
| 271 | .workdir() |
| 272 | .ok_or_else(|| CliError::GitError { |
| 273 | message: "Git repository has no working directory".to_string(), |
| 274 | })? |
| 275 | .to_path_buf(); |
| 276 | |
| 277 | let stored_ids: BTreeSet<String> = repo |
| 278 | .binding_ids() |
| 279 | .map_err(CliError::Repository)? |
| 280 | .into_iter() |
| 281 | .map(|id| id.to_hex()) |
| 282 | .collect(); |
| 283 | |
| 284 | // CB-10B review R8: per-ref transfer evidence. The journal is |
| 285 | // consent-gated (the shim opt-in) and lossy; every transferred ref |
| 286 | // gets an event after its exact-target verification. |
| 287 | let journal = |
| 288 | atomic_repository::repository::observability::BridgeEventJournal::for_repository(repo); |
| 289 | let transfer_event = |binding_id: &atomic_repository::git_binding::BindingId, |
| 290 | outcome: atomic_repository::repository::observability::EventOutcome, |
| 291 | destination: Option<String>| { |
| 292 | journal.emit_lossy( |
| 293 | atomic_repository::repository::observability::BridgeEventKind::BindingTransfer { |
| 294 | binding: atomic_repository::repository::observability::HexBindingId::new( |
| 295 | &binding_id.to_hex(), |
| 296 | ) |
| 297 | .expect("validated binding id hex"), |
| 298 | outcome, |
| 299 | destination, |
| 300 | }, |
| 301 | ); |
| 302 | }; |
| 303 | |
| 304 | let mut spec: Vec<(String, String)> = Vec::new(); |
| 305 | for name in &refs { |
| 306 | // Unregistered refs never transfer: the namespace allowlist decides |
| 307 | // the SHAPE of the surface, the stored-binding set decides its |
| 308 | // MEMBERSHIP, and the carrier validation decides its CONTENT. |
| 309 | let Some(id) = binding_id_from_ref_name(name) else { |
| 310 | return Err(CliError::GitError { |
| 311 | message: format!( |
| 312 | "binding ref '{name}' does not carry its binding id in the canonical \ |
| 313 | refs/atomic/bindings/<shard>/<id> layout; unregistered refs never transfer" |
| 314 | ), |
no test coverage detected