Launch Hands branch-turn workers
This commit is contained in:
parent
a3e7950c2a
commit
235cc81b17
15 changed files with 306 additions and 44 deletions
|
|
@ -1,5 +1,7 @@
|
|||
use epiphany_core::EPIPHANY_IMAGINATION_OWNER_ROLE;
|
||||
use epiphany_core::EPIPHANY_IMAGINATION_ROLE_BINDING_ID;
|
||||
use epiphany_core::EPIPHANY_IMPLEMENTATION_OWNER_ROLE;
|
||||
use epiphany_core::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID;
|
||||
use epiphany_core::EPIPHANY_MODELING_ROLE_BINDING_ID;
|
||||
use epiphany_core::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
|
||||
use epiphany_core::EPIPHANY_REORIENT_OWNER_ROLE;
|
||||
|
|
@ -389,10 +391,12 @@ pub fn map_epiphany_roles(
|
|||
pressure_level: format!("{:?}", pressure.level),
|
||||
reorient_result_status: result_status,
|
||||
reorient_job: reorient_job.map(map_core_role_board_job),
|
||||
implementation_binding_id: EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID.to_string(),
|
||||
imagination_binding_id: EPIPHANY_IMAGINATION_ROLE_BINDING_ID.to_string(),
|
||||
research_binding_id: EPIPHANY_RESEARCH_ROLE_BINDING_ID.to_string(),
|
||||
modeling_binding_id: EPIPHANY_MODELING_ROLE_BINDING_ID.to_string(),
|
||||
verification_binding_id: EPIPHANY_VERIFICATION_ROLE_BINDING_ID.to_string(),
|
||||
implementation_owner_role: EPIPHANY_IMPLEMENTATION_OWNER_ROLE.to_string(),
|
||||
reorient_owner_role: EPIPHANY_REORIENT_OWNER_ROLE.to_string(),
|
||||
imagination_owner_role: EPIPHANY_IMAGINATION_OWNER_ROLE.to_string(),
|
||||
research_owner_role: epiphany_core::EPIPHANY_RESEARCH_OWNER_ROLE.to_string(),
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
pub use epiphany_core::EPIPHANY_IMAGINATION_OWNER_ROLE;
|
||||
pub use epiphany_core::EPIPHANY_IMAGINATION_ROLE_BINDING_ID;
|
||||
pub use epiphany_core::EPIPHANY_IMPLEMENTATION_OWNER_ROLE;
|
||||
pub use epiphany_core::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID;
|
||||
pub use epiphany_core::EPIPHANY_MODELING_OWNER_ROLE;
|
||||
pub use epiphany_core::EPIPHANY_MODELING_ROLE_BINDING_ID;
|
||||
pub use epiphany_core::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use std::path::Path;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use epiphany_core::CONTINUITY_RECOVERY_RECEIPT_TYPE;
|
||||
use epiphany_core::EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID;
|
||||
use epiphany_core::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
|
||||
use epiphany_core::EPIPHANY_RESEARCH_ROLE_BINDING_ID;
|
||||
use epiphany_core::EYES_EVIDENCE_PACKET_TYPE;
|
||||
|
|
@ -60,6 +61,7 @@ use epiphany_core::runtime_soul_verdict_receipt;
|
|||
use epiphany_core::runtime_substrate_gate_repo_access_grant_receipt;
|
||||
use epiphany_core::soul_verdict_receipt_from_verification_finding;
|
||||
use epiphany_core::substrate_gate_repo_access_grant_for_launch;
|
||||
use epiphany_core::substrate_gate_repo_mutation_grant_for_launch;
|
||||
use epiphany_state_model::EpiphanyEvidenceRecord;
|
||||
use epiphany_state_model::EpiphanyJobKind as CoreEpiphanyJobKind;
|
||||
use epiphany_state_model::EpiphanyRetrievalState;
|
||||
|
|
@ -1042,18 +1044,25 @@ fn maybe_put_substrate_gate_launch_grant(
|
|||
request: &EpiphanyJobLaunchRequest,
|
||||
backend_job_id: &str,
|
||||
) -> BridgeResult<()> {
|
||||
if request.binding_id != EPIPHANY_RESEARCH_ROLE_BINDING_ID {
|
||||
return Ok(());
|
||||
}
|
||||
let grant = substrate_gate_repo_access_grant_for_launch(
|
||||
substrate_gate_grant_receipt_id(backend_job_id),
|
||||
backend_job_id.to_string(),
|
||||
request,
|
||||
Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true),
|
||||
);
|
||||
let granted_at = Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true);
|
||||
let grant = match request.binding_id.as_str() {
|
||||
EPIPHANY_RESEARCH_ROLE_BINDING_ID => substrate_gate_repo_access_grant_for_launch(
|
||||
substrate_gate_grant_receipt_id(backend_job_id),
|
||||
backend_job_id.to_string(),
|
||||
request,
|
||||
granted_at,
|
||||
),
|
||||
EPIPHANY_IMPLEMENTATION_ROLE_BINDING_ID => substrate_gate_repo_mutation_grant_for_launch(
|
||||
substrate_gate_grant_receipt_id(backend_job_id),
|
||||
backend_job_id.to_string(),
|
||||
request,
|
||||
granted_at,
|
||||
),
|
||||
_ => return Ok(()),
|
||||
};
|
||||
put_substrate_gate_repo_access_grant_receipt(runtime_store_path, &grant).map_err(|err| {
|
||||
EpiphanyBridgeError::Fatal(format!(
|
||||
"failed to persist Substrate Gate access grant for research launch: {err}"
|
||||
"failed to persist Substrate Gate access grant for worker launch: {err}"
|
||||
))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue