Move coordinator judgment into core
This commit is contained in:
parent
f3984d293e
commit
3d4ed26b0f
9 changed files with 461 additions and 285 deletions
|
|
@ -236,6 +236,9 @@ pub use surfaces::EpiphanyCoordinatorRoleResultStatus;
|
|||
pub use surfaces::EpiphanyCoordinatorRoleStatus;
|
||||
pub use surfaces::EpiphanyCoordinatorSceneAction;
|
||||
pub use surfaces::EpiphanyCoordinatorSignals;
|
||||
pub use surfaces::EpiphanyCoordinatorSourceSignals;
|
||||
pub use surfaces::EpiphanyCoordinatorStatus;
|
||||
pub use surfaces::EpiphanyCoordinatorStatusInput;
|
||||
pub use surfaces::EpiphanyCrrcAction;
|
||||
pub use surfaces::EpiphanyCrrcInput;
|
||||
pub use surfaces::EpiphanyCrrcRecommendation;
|
||||
|
|
@ -275,6 +278,7 @@ pub use surfaces::EpiphanyReorientDecision;
|
|||
pub use surfaces::EpiphanyReorientFindingInterpretation;
|
||||
pub use surfaces::EpiphanyReorientFreshnessStatus;
|
||||
pub use surfaces::EpiphanyReorientInput;
|
||||
pub use surfaces::EpiphanyReorientLaunchRequestInput;
|
||||
pub use surfaces::EpiphanyReorientPressureLevel;
|
||||
pub use surfaces::EpiphanyReorientReason;
|
||||
pub use surfaces::EpiphanyReorientStateStatus;
|
||||
|
|
@ -312,10 +316,12 @@ pub use surfaces::EpiphanyWorkerLaunchDocument;
|
|||
pub use surfaces::REORIENT_WORKER_OUTPUT_CONTRACT_ID;
|
||||
pub use surfaces::ROLE_WORKER_OUTPUT_CONTRACT_ID;
|
||||
pub use surfaces::build_reorient_acceptance_bundle;
|
||||
pub use surfaces::build_reorient_job_launch_request;
|
||||
pub use surfaces::build_role_acceptance_bundle;
|
||||
pub use surfaces::coordinator_automation_action;
|
||||
pub use surfaces::crrc_scene_action_to_coordinator_scene_action;
|
||||
pub use surfaces::derive_context;
|
||||
pub use surfaces::derive_coordinator_status;
|
||||
pub use surfaces::derive_freshness;
|
||||
pub use surfaces::derive_graph_query;
|
||||
pub use surfaces::derive_jobs;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
use super::EpiphanyCrrcAction;
|
||||
use super::EpiphanyCrrcSceneAction;
|
||||
use super::EpiphanyCrrcStateStatus;
|
||||
use super::EpiphanyPressure;
|
||||
use super::EpiphanyPressureLevel;
|
||||
use super::EpiphanyReorientAction;
|
||||
use super::EpiphanyRoleBoardLane;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
|
|
@ -91,6 +95,18 @@ pub struct EpiphanyCoordinatorSignals {
|
|||
pub verification_result_status: EpiphanyCoordinatorRoleResultStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EpiphanyCoordinatorSourceSignals {
|
||||
pub pressure_level: EpiphanyPressureLevel,
|
||||
pub should_prepare_compaction: bool,
|
||||
pub reorient_action: EpiphanyReorientAction,
|
||||
pub crrc_action: EpiphanyCrrcAction,
|
||||
pub modeling_result_status: EpiphanyCoordinatorRoleResultStatus,
|
||||
pub verification_result_status: EpiphanyCoordinatorRoleResultStatus,
|
||||
pub reorient_result_status: super::EpiphanyCrrcResultStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EpiphanyCoordinatorRoleLane {
|
||||
|
|
@ -129,6 +145,36 @@ pub struct EpiphanyCoordinatorDecision {
|
|||
pub reason: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EpiphanyCoordinatorStatusInput {
|
||||
pub state_status: EpiphanyCrrcStateStatus,
|
||||
pub checkpoint_present: bool,
|
||||
pub pressure: EpiphanyPressure,
|
||||
pub recommendation: super::EpiphanyCrrcRecommendation,
|
||||
pub roles: Vec<EpiphanyRoleBoardLane>,
|
||||
pub reorient_action: EpiphanyReorientAction,
|
||||
pub modeling_result_status: EpiphanyCoordinatorRoleResultStatus,
|
||||
pub verification_result_status: EpiphanyCoordinatorRoleResultStatus,
|
||||
pub reorient_result_status: super::EpiphanyCrrcResultStatus,
|
||||
pub modeling_result_accepted: bool,
|
||||
pub modeling_result_reviewable: bool,
|
||||
pub modeling_result_accepted_after_verification: bool,
|
||||
pub implementation_evidence_after_verification: bool,
|
||||
pub verification_result_cites_implementation_evidence: bool,
|
||||
pub verification_result_covers_current_modeling: bool,
|
||||
pub verification_result_accepted: bool,
|
||||
pub verification_result_allows_implementation: bool,
|
||||
pub verification_result_needs_evidence: bool,
|
||||
pub reorient_finding_accepted: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EpiphanyCoordinatorStatus {
|
||||
pub decision: EpiphanyCoordinatorDecision,
|
||||
pub source_signals: EpiphanyCoordinatorSourceSignals,
|
||||
pub roles: Vec<EpiphanyRoleBoardLane>,
|
||||
}
|
||||
|
||||
pub fn crrc_scene_action_to_coordinator_scene_action(
|
||||
action: EpiphanyCrrcSceneAction,
|
||||
) -> EpiphanyCoordinatorSceneAction {
|
||||
|
|
@ -141,6 +187,70 @@ pub fn crrc_scene_action_to_coordinator_scene_action(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn derive_coordinator_status(
|
||||
input: EpiphanyCoordinatorStatusInput,
|
||||
) -> EpiphanyCoordinatorStatus {
|
||||
let source_signals = EpiphanyCoordinatorSourceSignals {
|
||||
pressure_level: input.pressure.level,
|
||||
should_prepare_compaction: input.pressure.should_prepare_compaction,
|
||||
reorient_action: input.reorient_action,
|
||||
crrc_action: input.recommendation.action,
|
||||
modeling_result_status: input.modeling_result_status,
|
||||
verification_result_status: input.verification_result_status,
|
||||
reorient_result_status: input.reorient_result_status,
|
||||
};
|
||||
let coordinator_roles = input
|
||||
.roles
|
||||
.iter()
|
||||
.map(coordinator_role_lane_from_role_board)
|
||||
.collect();
|
||||
let decision = recommend_coordinator_action(EpiphanyCoordinatorInput {
|
||||
state_status: input.state_status,
|
||||
checkpoint_present: input.checkpoint_present,
|
||||
should_prepare_compaction: input.pressure.should_prepare_compaction,
|
||||
recommendation: EpiphanyCoordinatorCrrcRecommendation {
|
||||
action: input.recommendation.action,
|
||||
recommended_scene_action: input
|
||||
.recommendation
|
||||
.recommended_scene_action
|
||||
.map(crrc_scene_action_to_coordinator_scene_action),
|
||||
},
|
||||
roles: coordinator_roles,
|
||||
signals: EpiphanyCoordinatorSignals {
|
||||
modeling_result_status: input.modeling_result_status,
|
||||
verification_result_status: input.verification_result_status,
|
||||
},
|
||||
modeling_result_accepted: input.modeling_result_accepted,
|
||||
modeling_result_reviewable: input.modeling_result_reviewable,
|
||||
modeling_result_accepted_after_verification: input
|
||||
.modeling_result_accepted_after_verification,
|
||||
implementation_evidence_after_verification: input
|
||||
.implementation_evidence_after_verification,
|
||||
verification_result_cites_implementation_evidence: input
|
||||
.verification_result_cites_implementation_evidence,
|
||||
verification_result_covers_current_modeling: input
|
||||
.verification_result_covers_current_modeling,
|
||||
verification_result_accepted: input.verification_result_accepted,
|
||||
verification_result_allows_implementation: input.verification_result_allows_implementation,
|
||||
verification_result_needs_evidence: input.verification_result_needs_evidence,
|
||||
reorient_finding_accepted: input.reorient_finding_accepted,
|
||||
});
|
||||
EpiphanyCoordinatorStatus {
|
||||
decision,
|
||||
source_signals,
|
||||
roles: input.roles,
|
||||
}
|
||||
}
|
||||
|
||||
fn coordinator_role_lane_from_role_board(
|
||||
lane: &EpiphanyRoleBoardLane,
|
||||
) -> EpiphanyCoordinatorRoleLane {
|
||||
EpiphanyCoordinatorRoleLane {
|
||||
id: lane.id,
|
||||
status: lane.status,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn recommend_coordinator_action(
|
||||
input: EpiphanyCoordinatorInput,
|
||||
) -> EpiphanyCoordinatorDecision {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@ pub use coordinator::EpiphanyCoordinatorRoleResultStatus;
|
|||
pub use coordinator::EpiphanyCoordinatorRoleStatus;
|
||||
pub use coordinator::EpiphanyCoordinatorSceneAction;
|
||||
pub use coordinator::EpiphanyCoordinatorSignals;
|
||||
pub use coordinator::EpiphanyCoordinatorSourceSignals;
|
||||
pub use coordinator::EpiphanyCoordinatorStatus;
|
||||
pub use coordinator::EpiphanyCoordinatorStatusInput;
|
||||
pub use coordinator::coordinator_automation_action;
|
||||
pub use coordinator::crrc_scene_action_to_coordinator_scene_action;
|
||||
pub use coordinator::derive_coordinator_status;
|
||||
pub use coordinator::recommend_coordinator_action;
|
||||
pub use coordinator::select_coordinator_automation_action;
|
||||
pub use crrc::EpiphanyCrrcAction;
|
||||
|
|
@ -124,8 +128,10 @@ pub use scene::EpiphanySceneStatusCount;
|
|||
pub use scene::EpiphanySceneSubgoal;
|
||||
pub use scene::derive_scene;
|
||||
pub use state_patch::EpiphanyRoleStatePatchDocument;
|
||||
pub use worker_launch::EpiphanyReorientLaunchRequestInput;
|
||||
pub use worker_launch::EpiphanyReorientWorkerLaunchDocument;
|
||||
pub use worker_launch::EpiphanyRoleWorkerLaunchDocument;
|
||||
pub use worker_launch::EpiphanyWorkerLaunchDocument;
|
||||
pub use worker_launch::REORIENT_WORKER_OUTPUT_CONTRACT_ID;
|
||||
pub use worker_launch::ROLE_WORKER_OUTPUT_CONTRACT_ID;
|
||||
pub use worker_launch::build_reorient_job_launch_request;
|
||||
|
|
|
|||
|
|
@ -6,12 +6,23 @@ use epiphany_state_model::EpiphanyGraphFrontier;
|
|||
use epiphany_state_model::EpiphanyGraphs;
|
||||
use epiphany_state_model::EpiphanyInvariant;
|
||||
use epiphany_state_model::EpiphanyInvestigationCheckpoint;
|
||||
use epiphany_state_model::EpiphanyInvestigationDisposition;
|
||||
use epiphany_state_model::EpiphanyJobKind;
|
||||
use epiphany_state_model::EpiphanyObservation;
|
||||
use epiphany_state_model::EpiphanyPlanningState;
|
||||
use epiphany_state_model::EpiphanyScratchPad;
|
||||
use epiphany_state_model::EpiphanySubgoal;
|
||||
use epiphany_state_model::EpiphanyThreadState;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::EpiphanyJobLaunchRequest;
|
||||
use crate::EpiphanyReorientAction;
|
||||
use crate::EpiphanyReorientDecision;
|
||||
use crate::EpiphanyReorientFreshnessStatus;
|
||||
use crate::EpiphanyReorientPressureLevel;
|
||||
use crate::EpiphanyReorientReason;
|
||||
|
||||
pub const ROLE_WORKER_OUTPUT_CONTRACT_ID: &str = "epiphany.worker.role_result.v0";
|
||||
pub const REORIENT_WORKER_OUTPUT_CONTRACT_ID: &str = "epiphany.worker.reorient_result.v0";
|
||||
|
|
@ -120,3 +131,285 @@ pub struct EpiphanyReorientWorkerLaunchDocument {
|
|||
#[serde(default)]
|
||||
pub linked_graph_node_ids: Vec<String>,
|
||||
}
|
||||
|
||||
pub struct EpiphanyReorientLaunchRequestInput<'a> {
|
||||
pub thread_id: &'a str,
|
||||
pub expected_revision: Option<u64>,
|
||||
pub max_runtime_seconds: Option<u64>,
|
||||
pub binding_id: &'a str,
|
||||
pub owner_role: &'a str,
|
||||
pub instruction: String,
|
||||
pub state: &'a EpiphanyThreadState,
|
||||
pub checkpoint: &'a EpiphanyInvestigationCheckpoint,
|
||||
pub decision: &'a EpiphanyReorientDecision,
|
||||
}
|
||||
|
||||
pub fn build_reorient_job_launch_request(
|
||||
input: EpiphanyReorientLaunchRequestInput<'_>,
|
||||
) -> EpiphanyJobLaunchRequest {
|
||||
let linked_subgoal_ids = active_subgoal_ids(input.state);
|
||||
let linked_graph_node_ids = unique_strings(
|
||||
active_graph_node_ids(input.state)
|
||||
.into_iter()
|
||||
.chain(input.decision.active_frontier_node_ids.iter().cloned()),
|
||||
);
|
||||
let launch_document =
|
||||
EpiphanyWorkerLaunchDocument::Reorient(build_reorient_worker_launch_document(
|
||||
input.thread_id,
|
||||
input.state,
|
||||
input.checkpoint,
|
||||
input.decision,
|
||||
linked_subgoal_ids.clone(),
|
||||
linked_graph_node_ids.clone(),
|
||||
));
|
||||
let output_contract_id = launch_document.output_contract_id().to_string();
|
||||
|
||||
EpiphanyJobLaunchRequest {
|
||||
expected_revision: input.expected_revision,
|
||||
binding_id: input.binding_id.to_string(),
|
||||
kind: EpiphanyJobKind::Specialist,
|
||||
scope: reorient_launch_scope(input.decision.action).to_string(),
|
||||
owner_role: input.owner_role.to_string(),
|
||||
authority_scope: reorient_launch_authority_scope(input.decision.action).to_string(),
|
||||
linked_subgoal_ids,
|
||||
linked_graph_node_ids,
|
||||
instruction: input.instruction,
|
||||
launch_document,
|
||||
output_contract_id,
|
||||
max_runtime_seconds: input.max_runtime_seconds,
|
||||
}
|
||||
}
|
||||
|
||||
fn build_reorient_worker_launch_document(
|
||||
thread_id: &str,
|
||||
state: &EpiphanyThreadState,
|
||||
checkpoint: &EpiphanyInvestigationCheckpoint,
|
||||
decision: &EpiphanyReorientDecision,
|
||||
linked_subgoal_ids: Vec<String>,
|
||||
linked_graph_node_ids: Vec<String>,
|
||||
) -> EpiphanyReorientWorkerLaunchDocument {
|
||||
EpiphanyReorientWorkerLaunchDocument {
|
||||
thread_id: thread_id.to_string(),
|
||||
mode: reorient_action_label(decision.action).to_string(),
|
||||
checkpoint_id: checkpoint.checkpoint_id.clone(),
|
||||
checkpoint_kind: checkpoint.kind.clone(),
|
||||
checkpoint_disposition: investigation_disposition_label(checkpoint.disposition).to_string(),
|
||||
checkpoint_focus: Some(checkpoint.focus.clone()),
|
||||
checkpoint_summary: checkpoint.summary.clone(),
|
||||
checkpoint_next_action: checkpoint
|
||||
.next_action
|
||||
.clone()
|
||||
.unwrap_or_else(|| decision.next_action.clone()),
|
||||
checkpoint_open_questions: checkpoint.open_questions.clone(),
|
||||
checkpoint_evidence_ids: checkpoint.evidence_ids.clone(),
|
||||
checkpoint_code_refs: checkpoint.code_refs.clone(),
|
||||
decision_reasons: decision
|
||||
.reasons
|
||||
.iter()
|
||||
.map(|reason| reorient_reason_label(*reason).to_string())
|
||||
.collect(),
|
||||
decision_note: decision.note.clone(),
|
||||
pressure_level: reorient_pressure_level_label(decision.pressure_level).to_string(),
|
||||
retrieval_status: reorient_freshness_status_label(decision.retrieval_status).to_string(),
|
||||
graph_status: reorient_freshness_status_label(decision.graph_status).to_string(),
|
||||
watcher_status: reorient_freshness_status_label(decision.watcher_status).to_string(),
|
||||
checkpoint_dirty_paths: decision
|
||||
.checkpoint_dirty_paths
|
||||
.iter()
|
||||
.map(path_to_display_string)
|
||||
.collect(),
|
||||
checkpoint_changed_paths: decision
|
||||
.checkpoint_changed_paths
|
||||
.iter()
|
||||
.map(path_to_display_string)
|
||||
.collect(),
|
||||
scratch: state.scratch.clone(),
|
||||
graphs: Some(state.graphs.clone()),
|
||||
recent_evidence: state.recent_evidence.iter().take(8).cloned().collect(),
|
||||
recent_observations: state.observations.iter().take(8).cloned().collect(),
|
||||
active_frontier_node_ids: decision.active_frontier_node_ids.clone(),
|
||||
linked_subgoal_ids,
|
||||
linked_graph_node_ids,
|
||||
}
|
||||
}
|
||||
|
||||
fn active_subgoal_ids(state: &EpiphanyThreadState) -> Vec<String> {
|
||||
state
|
||||
.active_subgoal_id
|
||||
.clone()
|
||||
.map(|id| vec![id])
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn active_graph_node_ids(state: &EpiphanyThreadState) -> Vec<String> {
|
||||
state
|
||||
.graph_frontier
|
||||
.as_ref()
|
||||
.map(|frontier| frontier.active_node_ids.clone())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn unique_strings(values: impl IntoIterator<Item = String>) -> Vec<String> {
|
||||
let mut unique = Vec::new();
|
||||
for value in values {
|
||||
if !unique.iter().any(|existing| existing == &value) {
|
||||
unique.push(value);
|
||||
}
|
||||
}
|
||||
unique
|
||||
}
|
||||
|
||||
fn path_to_display_string(path: impl AsRef<Path>) -> String {
|
||||
path.as_ref().to_string_lossy().to_string()
|
||||
}
|
||||
|
||||
fn reorient_launch_authority_scope(action: EpiphanyReorientAction) -> &'static str {
|
||||
match action {
|
||||
EpiphanyReorientAction::Resume => "epiphany.reorient.resume",
|
||||
EpiphanyReorientAction::Regather => "epiphany.reorient.regather",
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_launch_scope(action: EpiphanyReorientAction) -> &'static str {
|
||||
match action {
|
||||
EpiphanyReorientAction::Resume => "reorient-guided checkpoint resume",
|
||||
EpiphanyReorientAction::Regather => "reorient-guided checkpoint regather",
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_action_label(action: EpiphanyReorientAction) -> &'static str {
|
||||
match action {
|
||||
EpiphanyReorientAction::Resume => "resume",
|
||||
EpiphanyReorientAction::Regather => "regather",
|
||||
}
|
||||
}
|
||||
|
||||
fn investigation_disposition_label(disposition: EpiphanyInvestigationDisposition) -> &'static str {
|
||||
match disposition {
|
||||
EpiphanyInvestigationDisposition::ResumeReady => "resume_ready",
|
||||
EpiphanyInvestigationDisposition::RegatherRequired => "regather_required",
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_reason_label(reason: EpiphanyReorientReason) -> &'static str {
|
||||
match reason {
|
||||
EpiphanyReorientReason::MissingState => "missingState",
|
||||
EpiphanyReorientReason::MissingCheckpoint => "missingCheckpoint",
|
||||
EpiphanyReorientReason::CheckpointRequestedRegather => "checkpointRequestedRegather",
|
||||
EpiphanyReorientReason::CheckpointPathsDirty => "checkpointPathsDirty",
|
||||
EpiphanyReorientReason::CheckpointPathsChanged => "checkpointPathsChanged",
|
||||
EpiphanyReorientReason::FrontierChanged => "frontierChanged",
|
||||
EpiphanyReorientReason::UnanchoredCheckpointWhileStateStale => {
|
||||
"unanchoredCheckpointWhileStateStale"
|
||||
}
|
||||
EpiphanyReorientReason::CheckpointReady => "checkpointReady",
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_pressure_level_label(level: EpiphanyReorientPressureLevel) -> &'static str {
|
||||
match level {
|
||||
EpiphanyReorientPressureLevel::Unknown => "unknown",
|
||||
EpiphanyReorientPressureLevel::Low => "low",
|
||||
EpiphanyReorientPressureLevel::Medium => "medium",
|
||||
EpiphanyReorientPressureLevel::High => "high",
|
||||
EpiphanyReorientPressureLevel::Critical => "critical",
|
||||
}
|
||||
}
|
||||
|
||||
fn reorient_freshness_status_label(status: EpiphanyReorientFreshnessStatus) -> &'static str {
|
||||
match status {
|
||||
EpiphanyReorientFreshnessStatus::Unknown => "unknown",
|
||||
EpiphanyReorientFreshnessStatus::Clean => "clean",
|
||||
EpiphanyReorientFreshnessStatus::Dirty => "dirty",
|
||||
EpiphanyReorientFreshnessStatus::Stale => "stale",
|
||||
EpiphanyReorientFreshnessStatus::Changed => "changed",
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use epiphany_state_model::EpiphanyCodeRef;
|
||||
use epiphany_state_model::EpiphanyGraphFrontier;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn reorient_launch_request_is_composed_from_typed_state() {
|
||||
let state = EpiphanyThreadState {
|
||||
revision: 7,
|
||||
active_subgoal_id: Some("sg-1".to_string()),
|
||||
graph_frontier: Some(EpiphanyGraphFrontier {
|
||||
active_node_ids: vec!["node-a".to_string()],
|
||||
active_edge_ids: Vec::new(),
|
||||
open_question_ids: Vec::new(),
|
||||
open_gap_ids: Vec::new(),
|
||||
dirty_paths: Vec::new(),
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let checkpoint = EpiphanyInvestigationCheckpoint {
|
||||
checkpoint_id: "ix-1".to_string(),
|
||||
kind: "implementation".to_string(),
|
||||
disposition: EpiphanyInvestigationDisposition::RegatherRequired,
|
||||
focus: "runtime seam".to_string(),
|
||||
summary: Some("resume here".to_string()),
|
||||
next_action: None,
|
||||
captured_at_turn_id: Some("turn-1".to_string()),
|
||||
open_questions: Vec::new(),
|
||||
code_refs: vec![EpiphanyCodeRef {
|
||||
path: PathBuf::from("src/lib.rs"),
|
||||
start_line: None,
|
||||
end_line: None,
|
||||
symbol: None,
|
||||
note: None,
|
||||
}],
|
||||
evidence_ids: vec!["ev-1".to_string()],
|
||||
};
|
||||
let decision = EpiphanyReorientDecision {
|
||||
action: EpiphanyReorientAction::Regather,
|
||||
checkpoint_status: crate::EpiphanyReorientCheckpointStatus::RegatherRequired,
|
||||
checkpoint_id: Some("ix-1".to_string()),
|
||||
pressure_level: EpiphanyReorientPressureLevel::High,
|
||||
retrieval_status: EpiphanyReorientFreshnessStatus::Stale,
|
||||
graph_status: EpiphanyReorientFreshnessStatus::Changed,
|
||||
watcher_status: EpiphanyReorientFreshnessStatus::Dirty,
|
||||
reasons: vec![EpiphanyReorientReason::FrontierChanged],
|
||||
checkpoint_dirty_paths: vec![PathBuf::from("src/lib.rs")],
|
||||
checkpoint_changed_paths: vec![PathBuf::from("src/main.rs")],
|
||||
active_frontier_node_ids: vec!["node-b".to_string()],
|
||||
next_action: "Regather the seam.".to_string(),
|
||||
note: "continuity moved".to_string(),
|
||||
};
|
||||
|
||||
let request = build_reorient_job_launch_request(EpiphanyReorientLaunchRequestInput {
|
||||
thread_id: "thread-1",
|
||||
expected_revision: Some(state.revision),
|
||||
max_runtime_seconds: Some(60),
|
||||
binding_id: "reorient-worker",
|
||||
owner_role: "epiphany-reorient",
|
||||
instruction: "do the reorientation".to_string(),
|
||||
state: &state,
|
||||
checkpoint: &checkpoint,
|
||||
decision: &decision,
|
||||
});
|
||||
|
||||
assert_eq!(request.binding_id, "reorient-worker");
|
||||
assert_eq!(request.scope, "reorient-guided checkpoint regather");
|
||||
assert_eq!(request.authority_scope, "epiphany.reorient.regather");
|
||||
assert_eq!(request.linked_subgoal_ids, vec!["sg-1"]);
|
||||
assert_eq!(
|
||||
request.linked_graph_node_ids,
|
||||
vec!["node-a".to_string(), "node-b".to_string()]
|
||||
);
|
||||
let EpiphanyWorkerLaunchDocument::Reorient(document) = request.launch_document else {
|
||||
panic!("expected reorient launch document");
|
||||
};
|
||||
assert_eq!(document.mode, "regather");
|
||||
assert_eq!(document.checkpoint_next_action, "Regather the seam.");
|
||||
assert_eq!(document.decision_reasons, vec!["frontierChanged"]);
|
||||
assert_eq!(document.pressure_level, "high");
|
||||
assert_eq!(document.retrieval_status, "stale");
|
||||
assert_eq!(document.graph_status, "changed");
|
||||
assert_eq!(document.watcher_status, "dirty");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue