From 52824453e1d0d0150b35bd4c179f16156544be0d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 22 Aug 2026 06:39:27 +0200 Subject: [PATCH] Unify workspace coverage authority assembly --- .../src/workspace_coverage_store_binding.rs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/epiphany-core/src/workspace_coverage_store_binding.rs b/epiphany-core/src/workspace_coverage_store_binding.rs index 2e9e4bbd..c32f9af5 100644 --- a/epiphany-core/src/workspace_coverage_store_binding.rs +++ b/epiphany-core/src/workspace_coverage_store_binding.rs @@ -196,8 +196,7 @@ pub fn bind_runtime_workspace_coverage_store( } } store.validate_path_identity()?; - drop(store); - let authority = open_workspace_coverage_authority(runtime_store)?; + let authority = assemble_workspace_coverage_authority(runtime_store, store)?; let route = authority.runtime_coverage_route.clone(); drop(authority); Ok(route) @@ -224,6 +223,17 @@ pub fn open_workspace_coverage_authority( runtime_store: impl AsRef, ) -> Result { let runtime_store = runtime_store.as_ref(); + let runtime_route = raw_runtime_route(runtime_store)? + .ok_or_else(|| anyhow!("runtime has no workspace coverage-store binding"))?; + let path = PathBuf::from(&runtime_route.projection_store_path); + let store = OwnedRedbMessagePackBackingStore::new(&path)?; + assemble_workspace_coverage_authority(runtime_store, store) +} + +fn assemble_workspace_coverage_authority( + runtime_store: &Path, + store: OwnedRedbMessagePackBackingStore, +) -> Result { let (body_route, body_route_envelope, body, body_envelope) = load_body_authority(runtime_store)?; let runtime_entries = SingleFileMessagePackBackingStore::new(runtime_store).pull_all()?; @@ -235,8 +245,10 @@ pub fn open_workspace_coverage_authority( .cloned() .ok_or_else(|| anyhow!("runtime has no workspace coverage-store binding"))?; let runtime_route: RuntimeWorkspaceCoverageStoreBinding = decode(&runtime_envelope)?; - let path = PathBuf::from(&runtime_route.projection_store_path); - let store = OwnedRedbMessagePackBackingStore::new(&path)?; + require_same_path( + store.path(), + Path::new(&runtime_route.projection_store_path), + )?; require_canonical_existing_outside(store.path(), &body)?; store.validate_path_identity()?; validate_runtime_route(