Authenticate terminal sight against runtime Body
This commit is contained in:
parent
599a0804e4
commit
67f0fe0b44
6 changed files with 23 additions and 25 deletions
|
|
@ -60,8 +60,8 @@ use epiphany_core::{
|
|||
WorkspaceCoverageProcessBootstrap, WorkspaceCoverageProcessLifecycleObservation,
|
||||
authenticate_recovery_workspace_coverage_claim_sight,
|
||||
authenticate_workspace_coverage_managed_process_launch,
|
||||
authenticate_workspace_coverage_replacement_lineage,
|
||||
authenticate_workspace_coverage_provider_heartbeat,
|
||||
authenticate_workspace_coverage_replacement_lineage,
|
||||
authenticate_workspace_coverage_termination_with_envelope_digest, capture_process_instance,
|
||||
load_latest_workspace_coverage_managed_process_launch,
|
||||
load_latest_workspace_coverage_provider_heartbeat,
|
||||
|
|
@ -2440,8 +2440,8 @@ fn reconcile_workspace_coverage_projector(
|
|||
return Ok(());
|
||||
}
|
||||
let terminal_sight = match authenticate_current_workspace_coverage_terminal_sight(
|
||||
&args.store,
|
||||
&runtime_store,
|
||||
&args.store,
|
||||
&args.runtime_id,
|
||||
host.entry(),
|
||||
) {
|
||||
|
|
@ -4561,7 +4561,9 @@ mod semantic_projector_authority_tests {
|
|||
.unwrap();
|
||||
let stale_rotation = body.find("if !current_policy_matches_latest").unwrap();
|
||||
let terminal_sight = body
|
||||
.find("let terminal_sight = match authenticate_current_workspace_coverage_terminal_sight")
|
||||
.find(
|
||||
"let terminal_sight = match authenticate_current_workspace_coverage_terminal_sight",
|
||||
)
|
||||
.unwrap();
|
||||
let claim_sight = body
|
||||
.find("let target = match authenticate_recovery_workspace_coverage_claim_sight")
|
||||
|
|
@ -4616,13 +4618,18 @@ mod semantic_projector_authority_tests {
|
|||
fn terminal_workspace_coverage_is_observed_without_recovery_authority() {
|
||||
let source = include_str!("epiphany-daemon-supervisor.rs");
|
||||
let start = source
|
||||
.find("let terminal_sight = match authenticate_current_workspace_coverage_terminal_sight")
|
||||
.find(
|
||||
"let terminal_sight = match authenticate_current_workspace_coverage_terminal_sight",
|
||||
)
|
||||
.unwrap();
|
||||
let end = source[start..]
|
||||
.find("let target = match authenticate_recovery_workspace_coverage_claim_sight")
|
||||
.map(|offset| start + offset)
|
||||
.unwrap();
|
||||
let branch = &source[start..end];
|
||||
assert!(branch.contains(
|
||||
"authenticate_current_workspace_coverage_terminal_sight(\n &runtime_store,\n &args.store,"
|
||||
));
|
||||
let lineage = branch
|
||||
.find("authenticate_workspace_coverage_replacement_lineage")
|
||||
.unwrap();
|
||||
|
|
|
|||
|
|
@ -1244,9 +1244,9 @@ pub use workspace_coverage_process_documents::{
|
|||
authenticate_historical_workspace_coverage_managed_process_launch,
|
||||
authenticate_recovery_workspace_coverage_claim_sight,
|
||||
authenticate_workspace_coverage_managed_process_launch,
|
||||
authenticate_workspace_coverage_replacement_lineage,
|
||||
authenticate_workspace_coverage_process_termination_observation,
|
||||
authenticate_workspace_coverage_provider_heartbeat,
|
||||
authenticate_workspace_coverage_replacement_lineage,
|
||||
authenticate_workspace_coverage_termination_with_envelope_digest,
|
||||
load_latest_workspace_coverage_managed_process_launch,
|
||||
load_latest_workspace_coverage_provider_heartbeat,
|
||||
|
|
|
|||
|
|
@ -533,10 +533,9 @@ fn provider_authority_failures(
|
|||
failures.push("source-commit");
|
||||
}
|
||||
if !executable.is_some_and(|path| {
|
||||
canonical_or_absolute(path)
|
||||
== canonical_or_absolute(Path::new(&value.process_executable_path))
|
||||
})
|
||||
{
|
||||
canonical_or_absolute(path)
|
||||
== canonical_or_absolute(Path::new(&value.process_executable_path))
|
||||
}) {
|
||||
failures.push("executable");
|
||||
}
|
||||
if value.status != "ready" {
|
||||
|
|
|
|||
|
|
@ -1271,10 +1271,9 @@ pub fn authenticate_workspace_coverage_replacement_lineage(
|
|||
host_identity,
|
||||
)?
|
||||
};
|
||||
let parent_id = child
|
||||
.replaces_launch_id
|
||||
.as_deref()
|
||||
.ok_or_else(|| anyhow!("workspace coverage replacement lineage ended before the claimed launch"))?;
|
||||
let parent_id = child.replaces_launch_id.as_deref().ok_or_else(|| {
|
||||
anyhow!("workspace coverage replacement lineage ended before the claimed launch")
|
||||
})?;
|
||||
let (termination, termination_digest) =
|
||||
authenticate_workspace_coverage_termination_with_envelope_digest(
|
||||
store_path,
|
||||
|
|
@ -2387,9 +2386,7 @@ pub fn write_workspace_coverage_recovery_directive(
|
|||
replacement_ready_heartbeat_id,
|
||||
host.entry(),
|
||||
)?;
|
||||
if ready.launch_id != replacement.launch_id
|
||||
|| ready.status != "ready"
|
||||
{
|
||||
if ready.launch_id != replacement.launch_id || ready.status != "ready" {
|
||||
bail!("workspace coverage recovery directive evidence is not an exact ready replacement");
|
||||
}
|
||||
let mut entry = WorkspaceCoverageRecoveryDirectiveEntry {
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ use crate::{
|
|||
validate_workspace_coverage_projection_plan, workspace_coverage_execution_collection,
|
||||
workspace_coverage_process_documents::{
|
||||
authenticate_historical_workspace_coverage_managed_process_launch_with_envelope_digest,
|
||||
authenticate_workspace_coverage_replacement_lineage,
|
||||
authenticate_workspace_coverage_managed_process_launch_with_envelope_digest,
|
||||
authenticate_workspace_coverage_provider_heartbeat_with_envelope_digest,
|
||||
authenticate_workspace_coverage_replacement_lineage,
|
||||
authenticate_workspace_coverage_termination_with_envelope_digest,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -272,8 +272,7 @@ impl WorkspaceCoverageProjectorServiceBody {
|
|||
&authority.runtime_id,
|
||||
&self.managed_process_launch_id,
|
||||
&authority.trusted_host,
|
||||
)?
|
||||
{
|
||||
)? {
|
||||
if directive.workspace_id != basis.workspace_id
|
||||
|| directive.body_binding_sha256 != basis.body_binding_sha256
|
||||
|| directive.body_observation_id != basis.observation_id
|
||||
|
|
@ -430,12 +429,8 @@ mod tests {
|
|||
let recovery = body
|
||||
.find("recover_workspace_coverage_projection_with_authority")
|
||||
.unwrap();
|
||||
let retirement = body
|
||||
.find("retire_workspace_coverage_collections")
|
||||
.unwrap();
|
||||
let classification = body
|
||||
.find("classify_current_workspace_coverage")
|
||||
.unwrap();
|
||||
let retirement = body.find("retire_workspace_coverage_collections").unwrap();
|
||||
let classification = body.find("classify_current_workspace_coverage").unwrap();
|
||||
let new_work = body.find("RepositoryBodyReadSession::open").unwrap();
|
||||
assert!(retirement < classification);
|
||||
assert!(classification < directive && directive < recovery);
|
||||
|
|
|
|||
Reference in a new issue