Stop absence from authorizing freshness
This commit is contained in:
parent
d023a919d8
commit
f1f29a0af5
9 changed files with 440 additions and 49 deletions
|
|
@ -145,7 +145,7 @@ fn retrieval_freshness(retrieval: Option<&EpiphanyRetrievalState>) -> EpiphanyRe
|
|||
"Retrieval catalog is ready.".to_string()
|
||||
}
|
||||
EpiphanyRetrievalStatus::Ready => {
|
||||
format!("Retrieval catalog is ready with {dirty_path_count} dirty path(s) noted.")
|
||||
format!("Retrieval catalog is stale because {dirty_path_count} dirty path(s) remain.")
|
||||
}
|
||||
EpiphanyRetrievalStatus::Stale => {
|
||||
format!("Retrieval catalog is stale; {dirty_path_count} dirty path(s) need refresh.")
|
||||
|
|
@ -156,7 +156,10 @@ fn retrieval_freshness(retrieval: Option<&EpiphanyRetrievalState>) -> EpiphanyRe
|
|||
|
||||
EpiphanyRetrievalFreshness {
|
||||
status: match retrieval.status {
|
||||
EpiphanyRetrievalStatus::Ready => EpiphanyRetrievalFreshnessStatus::Ready,
|
||||
EpiphanyRetrievalStatus::Ready if dirty_path_count == 0 => {
|
||||
EpiphanyRetrievalFreshnessStatus::Ready
|
||||
}
|
||||
EpiphanyRetrievalStatus::Ready => EpiphanyRetrievalFreshnessStatus::Stale,
|
||||
EpiphanyRetrievalStatus::Stale => EpiphanyRetrievalFreshnessStatus::Stale,
|
||||
EpiphanyRetrievalStatus::Indexing => EpiphanyRetrievalFreshnessStatus::Indexing,
|
||||
EpiphanyRetrievalStatus::Unavailable => EpiphanyRetrievalFreshnessStatus::Unavailable,
|
||||
|
|
@ -170,7 +173,7 @@ fn retrieval_freshness(retrieval: Option<&EpiphanyRetrievalState>) -> EpiphanyRe
|
|||
}
|
||||
}
|
||||
|
||||
fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGraphFreshness {
|
||||
pub(super) fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGraphFreshness {
|
||||
let Some(state) = state else {
|
||||
return EpiphanyGraphFreshness {
|
||||
status: EpiphanyGraphFreshnessStatus::Missing,
|
||||
|
|
@ -199,32 +202,38 @@ fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGraphFreshnes
|
|||
.churn
|
||||
.as_ref()
|
||||
.and_then(|churn| churn.graph_freshness.clone());
|
||||
let freshness_hint_stale = graph_freshness
|
||||
.as_deref()
|
||||
.is_some_and(|freshness| !matches!(freshness, "fresh" | "ready" | "current" | "ok"));
|
||||
let is_stale = dirty_path_count > 0
|
||||
|| open_question_count > 0
|
||||
|| open_gap_count > 0
|
||||
|| freshness_hint_stale;
|
||||
let note = if is_stale {
|
||||
let freshness_hint_current = graph_freshness.as_deref().is_some_and(|freshness| {
|
||||
matches!(
|
||||
freshness.trim().to_ascii_lowercase().as_str(),
|
||||
"fresh" | "ready" | "current" | "ok"
|
||||
)
|
||||
});
|
||||
let has_pressure = dirty_path_count > 0 || open_question_count > 0 || open_gap_count > 0;
|
||||
let checkpoint_id = state
|
||||
.graph_checkpoint
|
||||
.as_ref()
|
||||
.map(|checkpoint| checkpoint.checkpoint_id.clone());
|
||||
let status = if has_pressure || (graph_freshness.is_some() && !freshness_hint_current) {
|
||||
EpiphanyGraphFreshnessStatus::Stale
|
||||
} else if checkpoint_id.is_none() || graph_freshness.is_none() {
|
||||
EpiphanyGraphFreshnessStatus::Missing
|
||||
} else {
|
||||
EpiphanyGraphFreshnessStatus::Ready
|
||||
};
|
||||
let note = if status == EpiphanyGraphFreshnessStatus::Stale {
|
||||
format!(
|
||||
"Graph freshness is stale; frontier has {dirty_path_count} dirty path(s), {open_question_count} open question id(s), and {open_gap_count} open gap id(s)."
|
||||
)
|
||||
} else if status == EpiphanyGraphFreshnessStatus::Missing {
|
||||
"Graph freshness requires both an explicit current hint and a graph checkpoint.".to_string()
|
||||
} else {
|
||||
"Graph freshness is ready.".to_string()
|
||||
};
|
||||
|
||||
EpiphanyGraphFreshness {
|
||||
status: if is_stale {
|
||||
EpiphanyGraphFreshnessStatus::Stale
|
||||
} else {
|
||||
EpiphanyGraphFreshnessStatus::Ready
|
||||
},
|
||||
status,
|
||||
graph_freshness,
|
||||
checkpoint_id: state
|
||||
.graph_checkpoint
|
||||
.as_ref()
|
||||
.map(|checkpoint| checkpoint.checkpoint_id.clone()),
|
||||
checkpoint_id,
|
||||
dirty_path_count,
|
||||
dirty_paths,
|
||||
open_question_count,
|
||||
|
|
@ -270,14 +279,14 @@ fn invalidation_input(
|
|||
|
||||
if changed_paths.is_empty() {
|
||||
return EpiphanyInvalidationInput {
|
||||
status: EpiphanyInvalidationStatus::Clean,
|
||||
status: EpiphanyInvalidationStatus::Unavailable,
|
||||
watched_root,
|
||||
observed_at_unix_seconds: watcher.observed_at_unix_seconds,
|
||||
changed_path_count,
|
||||
changed_paths,
|
||||
graph_node_ids: Vec::new(),
|
||||
active_frontier_node_ids: Vec::new(),
|
||||
note: "Watcher has not observed recent filesystem changes under the workspace root."
|
||||
note: "Watcher supplied no observation; absence of changed paths is not proof of a clean workspace."
|
||||
.to_string(),
|
||||
};
|
||||
}
|
||||
|
|
@ -397,7 +406,9 @@ fn epiphany_path_key(path: &Path) -> String {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use epiphany_state_model::EpiphanyChurnState;
|
||||
use epiphany_state_model::EpiphanyCodeRef;
|
||||
use epiphany_state_model::EpiphanyGraphCheckpoint;
|
||||
use epiphany_state_model::EpiphanyGraphFrontier;
|
||||
use epiphany_state_model::EpiphanyGraphNode;
|
||||
use epiphany_state_model::EpiphanyGraphs;
|
||||
|
|
@ -419,6 +430,110 @@ mod tests {
|
|||
assert_eq!(view.watcher.status, EpiphanyInvalidationStatus::Unavailable);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_state_is_not_graph_ready() {
|
||||
let state = EpiphanyThreadState::default();
|
||||
let view = derive_freshness(EpiphanyFreshnessInput {
|
||||
state: Some(&state),
|
||||
retrieval_override: None,
|
||||
watcher: None,
|
||||
});
|
||||
|
||||
assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Missing);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn graph_ready_requires_checkpoint_explicit_current_hint_and_no_pressure() {
|
||||
let state = EpiphanyThreadState {
|
||||
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
|
||||
checkpoint_id: "graph-1".to_string(),
|
||||
..Default::default()
|
||||
}),
|
||||
churn: Some(EpiphanyChurnState {
|
||||
graph_freshness: Some(" CURRENT ".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let view = derive_freshness(EpiphanyFreshnessInput {
|
||||
state: Some(&state),
|
||||
retrieval_override: None,
|
||||
watcher: None,
|
||||
});
|
||||
|
||||
assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Ready);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn graph_missing_checkpoint_or_hint_is_missing() {
|
||||
let checkpoint_only = EpiphanyThreadState {
|
||||
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
|
||||
checkpoint_id: "graph-1".to_string(),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let hint_only = EpiphanyThreadState {
|
||||
churn: Some(EpiphanyChurnState {
|
||||
graph_freshness: Some("fresh".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
for state in [&checkpoint_only, &hint_only] {
|
||||
let view = derive_freshness(EpiphanyFreshnessInput {
|
||||
state: Some(state),
|
||||
retrieval_override: None,
|
||||
watcher: None,
|
||||
});
|
||||
assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Missing);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn graph_pressure_overrides_current_hint_and_checkpoint() {
|
||||
let state = EpiphanyThreadState {
|
||||
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
|
||||
checkpoint_id: "graph-1".to_string(),
|
||||
..Default::default()
|
||||
}),
|
||||
churn: Some(EpiphanyChurnState {
|
||||
graph_freshness: Some("fresh".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
graph_frontier: Some(EpiphanyGraphFrontier {
|
||||
open_question_ids: vec!["q-1".to_string()],
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let view = derive_freshness(EpiphanyFreshnessInput {
|
||||
state: Some(&state),
|
||||
retrieval_override: None,
|
||||
watcher: None,
|
||||
});
|
||||
|
||||
assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Stale);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn available_watcher_without_observation_is_not_clean() {
|
||||
let changed_paths = Vec::new();
|
||||
let view = derive_freshness(EpiphanyFreshnessInput {
|
||||
state: None,
|
||||
retrieval_override: None,
|
||||
watcher: Some(EpiphanyFreshnessWatcherInput {
|
||||
available: true,
|
||||
workspace_root: None,
|
||||
observed_at_unix_seconds: None,
|
||||
changed_paths: &changed_paths,
|
||||
}),
|
||||
});
|
||||
|
||||
assert_eq!(view.watcher.status, EpiphanyInvalidationStatus::Unavailable);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stale_retrieval_and_frontier_make_graph_stale() {
|
||||
let state = EpiphanyThreadState {
|
||||
|
|
@ -455,6 +570,30 @@ mod tests {
|
|||
assert_eq!(view.graph.open_gap_count, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ready_retrieval_with_dirty_paths_is_stale() {
|
||||
let state = EpiphanyThreadState {
|
||||
retrieval: Some(EpiphanyRetrievalState {
|
||||
workspace_root: PathBuf::from("E:/repo"),
|
||||
status: EpiphanyRetrievalStatus::Ready,
|
||||
dirty_paths: vec![PathBuf::from("src/dirty.rs")],
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let view = derive_freshness(EpiphanyFreshnessInput {
|
||||
state: Some(&state),
|
||||
retrieval_override: None,
|
||||
watcher: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
view.retrieval.status,
|
||||
EpiphanyRetrievalFreshnessStatus::Stale
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn watcher_maps_changed_paths_to_graph_and_frontier() {
|
||||
let state = EpiphanyThreadState {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use super::freshness::{EpiphanyGraphFreshnessStatus, graph_freshness};
|
||||
use epiphany_state_model::EpiphanyJobBinding;
|
||||
use epiphany_state_model::EpiphanyJobKind;
|
||||
use epiphany_state_model::EpiphanyRetrievalState;
|
||||
|
|
@ -245,27 +246,8 @@ fn remap_job(state: Option<&EpiphanyThreadState>) -> EpiphanyJobView {
|
|||
);
|
||||
};
|
||||
|
||||
let frontier = state.graph_frontier.as_ref();
|
||||
let dirty_path_count = frontier
|
||||
.map(|frontier| frontier.dirty_paths.len())
|
||||
.unwrap_or_default();
|
||||
let open_count = frontier
|
||||
.map(|frontier| frontier.open_question_ids.len() + frontier.open_gap_ids.len())
|
||||
.unwrap_or_default();
|
||||
let graph_freshness = state
|
||||
.churn
|
||||
.as_ref()
|
||||
.and_then(|churn| churn.graph_freshness.as_deref());
|
||||
let freshness_needs_work = graph_freshness
|
||||
.is_some_and(|freshness| !matches!(freshness, "fresh" | "ready" | "current" | "ok"));
|
||||
let needs_work = dirty_path_count > 0 || open_count > 0 || freshness_needs_work;
|
||||
let progress_note = if needs_work {
|
||||
format!(
|
||||
"Graph frontier has {dirty_path_count} dirty path(s) and {open_count} open question/gap id(s)."
|
||||
)
|
||||
} else {
|
||||
"Graph frontier has no reflected remap pressure.".to_string()
|
||||
};
|
||||
let freshness = graph_freshness(Some(state));
|
||||
let needs_work = freshness.status != EpiphanyGraphFreshnessStatus::Ready;
|
||||
|
||||
EpiphanyJobView {
|
||||
id: "graph-remap".to_string(),
|
||||
|
|
@ -281,7 +263,7 @@ fn remap_job(state: Option<&EpiphanyThreadState>) -> EpiphanyJobView {
|
|||
},
|
||||
items_processed: None,
|
||||
items_total: None,
|
||||
progress_note: Some(progress_note),
|
||||
progress_note: Some(freshness.note),
|
||||
last_checkpoint_at_unix_seconds: None,
|
||||
blocking_reason: None,
|
||||
active_thread_ids: Vec::new(),
|
||||
|
|
@ -397,6 +379,8 @@ fn latest_runtime_link_for_binding<'a>(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use epiphany_state_model::EpiphanyChurnState;
|
||||
use epiphany_state_model::EpiphanyGraphCheckpoint;
|
||||
use epiphany_state_model::EpiphanyGraphFrontier;
|
||||
use epiphany_state_model::EpiphanyInvariant;
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -469,6 +453,45 @@ mod tests {
|
|||
assert_eq!(verification.items_total, Some(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remap_job_consumes_graph_freshness_authority() {
|
||||
let incomplete = EpiphanyThreadState::default();
|
||||
let jobs = derive_jobs(EpiphanyJobsInput {
|
||||
state: Some(&incomplete),
|
||||
retrieval_override: None,
|
||||
});
|
||||
assert_eq!(
|
||||
jobs.iter()
|
||||
.find(|job| job.id == "graph-remap")
|
||||
.unwrap()
|
||||
.status,
|
||||
EpiphanyJobStatus::Needed
|
||||
);
|
||||
|
||||
let ready = EpiphanyThreadState {
|
||||
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
|
||||
checkpoint_id: "graph-1".to_string(),
|
||||
..Default::default()
|
||||
}),
|
||||
churn: Some(EpiphanyChurnState {
|
||||
graph_freshness: Some("ok".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let jobs = derive_jobs(EpiphanyJobsInput {
|
||||
state: Some(&ready),
|
||||
retrieval_override: None,
|
||||
});
|
||||
assert_eq!(
|
||||
jobs.iter()
|
||||
.find(|job| job.id == "graph-remap")
|
||||
.unwrap()
|
||||
.status,
|
||||
EpiphanyJobStatus::Idle
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overlays_binding_with_runtime_link() {
|
||||
let state = EpiphanyThreadState {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ pub enum EpiphanyReorientReason {
|
|||
CheckpointPathsChanged,
|
||||
FrontierChanged,
|
||||
UnanchoredCheckpointWhileStateStale,
|
||||
RetrievalFreshnessBlocked,
|
||||
GraphFreshnessBlocked,
|
||||
WatcherFreshnessBlocked,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
@ -228,13 +231,33 @@ pub fn recommend_reorientation(
|
|||
if unanchored_checkpoint_while_state_stale {
|
||||
reasons.push(EpiphanyReorientReason::UnanchoredCheckpointWhileStateStale);
|
||||
}
|
||||
let retrieval_blocked = input.retrieval_status != EpiphanyReorientFreshnessStatus::Clean;
|
||||
let graph_blocked = input.graph_status != EpiphanyReorientFreshnessStatus::Clean;
|
||||
let watcher_blocked = matches!(
|
||||
input.watcher_status,
|
||||
EpiphanyReorientFreshnessStatus::Dirty
|
||||
| EpiphanyReorientFreshnessStatus::Stale
|
||||
| EpiphanyReorientFreshnessStatus::Changed
|
||||
);
|
||||
if retrieval_blocked {
|
||||
reasons.push(EpiphanyReorientReason::RetrievalFreshnessBlocked);
|
||||
}
|
||||
if graph_blocked {
|
||||
reasons.push(EpiphanyReorientReason::GraphFreshnessBlocked);
|
||||
}
|
||||
if watcher_blocked {
|
||||
reasons.push(EpiphanyReorientReason::WatcherFreshnessBlocked);
|
||||
}
|
||||
|
||||
let should_regather = checkpoint.disposition
|
||||
== EpiphanyInvestigationDisposition::RegatherRequired
|
||||
|| !checkpoint_dirty_paths.is_empty()
|
||||
|| !checkpoint_changed_paths.is_empty()
|
||||
|| frontier_changed
|
||||
|| unanchored_checkpoint_while_state_stale;
|
||||
|| unanchored_checkpoint_while_state_stale
|
||||
|| retrieval_blocked
|
||||
|| graph_blocked
|
||||
|| watcher_blocked;
|
||||
|
||||
if !should_regather {
|
||||
reasons.push(EpiphanyReorientReason::CheckpointReady);
|
||||
|
|
@ -286,6 +309,24 @@ pub fn recommend_reorientation(
|
|||
.to_string(),
|
||||
);
|
||||
}
|
||||
if retrieval_blocked {
|
||||
note_fragments.push(format!(
|
||||
"retrieval freshness is {:?}, not clean",
|
||||
input.retrieval_status
|
||||
));
|
||||
}
|
||||
if graph_blocked {
|
||||
note_fragments.push(format!(
|
||||
"graph freshness is {:?}, not clean",
|
||||
input.graph_status
|
||||
));
|
||||
}
|
||||
if watcher_blocked {
|
||||
note_fragments.push(format!(
|
||||
"watcher freshness is {:?} and reports invalidation pressure",
|
||||
input.watcher_status
|
||||
));
|
||||
}
|
||||
|
||||
(
|
||||
EpiphanyReorientStateStatus::Ready,
|
||||
|
|
@ -416,7 +457,10 @@ mod tests {
|
|||
assert_eq!(decision.action, EpiphanyReorientAction::Regather);
|
||||
assert_eq!(
|
||||
decision.reasons,
|
||||
vec![EpiphanyReorientReason::CheckpointPathsChanged]
|
||||
vec![
|
||||
EpiphanyReorientReason::CheckpointPathsChanged,
|
||||
EpiphanyReorientReason::WatcherFreshnessBlocked,
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
decision.checkpoint_changed_paths,
|
||||
|
|
@ -424,6 +468,84 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn freshness_authorities_block_resume_but_unknown_watcher_does_not() {
|
||||
let checkpoint = checkpoint();
|
||||
for (field, status, reason) in [
|
||||
(
|
||||
"retrieval",
|
||||
EpiphanyReorientFreshnessStatus::Unknown,
|
||||
EpiphanyReorientReason::RetrievalFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"retrieval",
|
||||
EpiphanyReorientFreshnessStatus::Dirty,
|
||||
EpiphanyReorientReason::RetrievalFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"retrieval",
|
||||
EpiphanyReorientFreshnessStatus::Stale,
|
||||
EpiphanyReorientReason::RetrievalFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"retrieval",
|
||||
EpiphanyReorientFreshnessStatus::Changed,
|
||||
EpiphanyReorientReason::RetrievalFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"graph",
|
||||
EpiphanyReorientFreshnessStatus::Unknown,
|
||||
EpiphanyReorientReason::GraphFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"graph",
|
||||
EpiphanyReorientFreshnessStatus::Dirty,
|
||||
EpiphanyReorientReason::GraphFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"graph",
|
||||
EpiphanyReorientFreshnessStatus::Stale,
|
||||
EpiphanyReorientReason::GraphFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"graph",
|
||||
EpiphanyReorientFreshnessStatus::Changed,
|
||||
EpiphanyReorientReason::GraphFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"watcher",
|
||||
EpiphanyReorientFreshnessStatus::Dirty,
|
||||
EpiphanyReorientReason::WatcherFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"watcher",
|
||||
EpiphanyReorientFreshnessStatus::Stale,
|
||||
EpiphanyReorientReason::WatcherFreshnessBlocked,
|
||||
),
|
||||
(
|
||||
"watcher",
|
||||
EpiphanyReorientFreshnessStatus::Changed,
|
||||
EpiphanyReorientReason::WatcherFreshnessBlocked,
|
||||
),
|
||||
] {
|
||||
let mut candidate = input(Some(&checkpoint));
|
||||
match field {
|
||||
"retrieval" => candidate.retrieval_status = status,
|
||||
"graph" => candidate.graph_status = status,
|
||||
"watcher" => candidate.watcher_status = status,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
let (_, decision) = recommend_reorientation(candidate);
|
||||
assert_eq!(decision.action, EpiphanyReorientAction::Regather);
|
||||
assert!(decision.reasons.contains(&reason));
|
||||
}
|
||||
|
||||
let mut candidate = input(Some(&checkpoint));
|
||||
candidate.watcher_status = EpiphanyReorientFreshnessStatus::Unknown;
|
||||
let (_, decision) = recommend_reorientation(candidate);
|
||||
assert_eq!(decision.action, EpiphanyReorientAction::Resume);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_state_regathers() {
|
||||
let mut input = input(None);
|
||||
|
|
|
|||
|
|
@ -504,6 +504,9 @@ fn reorient_reason_label(reason: EpiphanyReorientReason) -> &'static str {
|
|||
EpiphanyReorientReason::UnanchoredCheckpointWhileStateStale => {
|
||||
"unanchoredCheckpointWhileStateStale"
|
||||
}
|
||||
EpiphanyReorientReason::RetrievalFreshnessBlocked => "retrievalFreshnessBlocked",
|
||||
EpiphanyReorientReason::GraphFreshnessBlocked => "graphFreshnessBlocked",
|
||||
EpiphanyReorientReason::WatcherFreshnessBlocked => "watcherFreshnessBlocked",
|
||||
EpiphanyReorientReason::CheckpointReady => "checkpointReady",
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1757,3 +1757,35 @@ metadata only. A surface earns readmission only through an owning provider's
|
|||
provenance-bearing typed CultMesh contract that survives Snapshot, schema
|
||||
validation, and Eve lowering; advertised actions additionally require a real
|
||||
typed dispatcher and receipt path.
|
||||
|
||||
## Missing freshness evidence substituted for cleanliness (2026-07-15)
|
||||
|
||||
Confirmed and cut. The graph freshness projection previously asked only
|
||||
whether any known stale signal was present. A default typed state with no graph
|
||||
checkpoint and no freshness assertion therefore became `Ready`. The watcher
|
||||
made the same inversion: an available watcher with an empty transient event
|
||||
buffer became `Clean`, despite carrying no generation, cursor, start boundary,
|
||||
or continuity receipt. Reorientation then ignored its retrieval, graph, and
|
||||
watcher status fields when deciding Resume; path overlap heuristics were the
|
||||
actual hidden owner.
|
||||
|
||||
The repaired authority is conjunctive. `derive_freshness` owns judgments from
|
||||
canonical retrieval state, graph checkpoint, churn assertion, frontier
|
||||
pressure, and positive watcher changes. Retrieval Ready with any dirty path
|
||||
derives Stale rather than Clean. Graph Ready requires checkpoint plus
|
||||
recognized-current assertion plus zero dirty/question/gap pressure. Missing
|
||||
evidence is Missing/Unknown, watcher silence is Unavailable/Unknown, and
|
||||
observed Changed remains positive evidence. `recommend_reorientation` alone
|
||||
owns Resume/Regather: checkpoint ResumeReady, retrieval Clean, graph Clean, and
|
||||
watcher Clean/Unknown are required to Resume. Other retrieval/graph states and
|
||||
watcher Dirty/Stale/Changed force Regather. Jobs, MVP mappings, worker launch,
|
||||
coordinator, and CRRC are derived consumers; graph-remap jobs now consume the
|
||||
same graph judgment instead of re-parsing the churn string.
|
||||
|
||||
One scar remains open rather than laundered into completion:
|
||||
`churn.graph_freshness` is still free-form text and
|
||||
`graph_checkpoint.graph_revision` is not correlated with graph mutation. The
|
||||
final cut is one typed, revision-bearing Modeling freshness receipt that binds
|
||||
generation, checkpoint, verdict, and pressure basis. The immediate repair
|
||||
prevents absence from masquerading as readiness; it does not make split
|
||||
authority sacred.
|
||||
|
|
|
|||
|
|
@ -718,5 +718,35 @@ Future audit frontier, not established anatomy: sibling Bifrost subprocess JSON
|
|||
used by readiness needs a focused identity/schema/provenance audit before any
|
||||
cut or confirmed finding.
|
||||
|
||||
## Freshness -> reorientation authority (2026-07-15)
|
||||
|
||||
```text
|
||||
canonical retrieval state -----------------------> retrieval judgment --+
|
||||
graph checkpoint + churn assertion + frontier ---> graph judgment -------+--> reorientation decision --> CRRC/coordinator/launch
|
||||
positive watcher changes ------------------------> watcher judgment -----+
|
||||
durable investigation checkpoint ---------------------------------------+
|
||||
```
|
||||
|
||||
`derive_freshness` owns the first three judgments. Retrieval Ready becomes
|
||||
Clean only with an empty dirty-path set; otherwise it derives Stale. Graph
|
||||
Clean/Ready requires a checkpoint, a recognized-current assertion, and zero
|
||||
dirty/question/gap pressure. Missing evidence stays Missing/Unknown. Watcher silence stays
|
||||
Unavailable/Unknown because no continuity receipt exists; Changed is positive
|
||||
evidence. `surfaces/jobs.rs` consumes the same graph judgment for remap work.
|
||||
|
||||
`recommend_reorientation` alone owns Resume/Regather. Resume requires a
|
||||
resume-ready investigation checkpoint, retrieval Clean, graph Clean, and a
|
||||
watcher that is Clean or Unknown. Any retrieval/graph non-clean value or
|
||||
watcher Dirty/Stale/Changed forces Regather. Path matches, status labels,
|
||||
worker-launch documents, coordinator rows, and CRRC recommendations are derived
|
||||
consumers and forbidden decision writers.
|
||||
|
||||
The remaining deletion line is architectural rather than behavioral:
|
||||
`churn.graph_freshness` is a free string, and the typed graph checkpoint's
|
||||
revision is not correlated with graph mutation. Replace both authorities with
|
||||
one typed, revision-bearing Modeling freshness receipt. Until then the strict
|
||||
conjunction prevents false readiness but must not be mistaken for final typed
|
||||
ownership.
|
||||
|
||||
This map must change when ownership changes. Historical scars belong in git,
|
||||
evidence, or an explicitly archived note—not in the machine's Modeling state.
|
||||
|
|
|
|||
|
|
@ -1569,3 +1569,45 @@ scheduled tasks and the tunnel return after logon, establish a fresh reconciler
|
|||
-> exactly-one-projector chain and launch-correlated heartbeat, then obtain
|
||||
semantic ranking from packaged Mind and Modeling queries using the explicit
|
||||
Qdrant and Ollama endpoints.
|
||||
|
||||
## Freshness and reorientation authority repair (2026-07-15)
|
||||
|
||||
The freshness surface no longer converts missing evidence into confidence.
|
||||
Retrieval `Ready` is Clean only when `dirty_paths` is empty; a Ready label with
|
||||
one or more dirty paths derives Stale and therefore cannot authorize Resume.
|
||||
Graph `Ready` requires all of: a typed graph checkpoint, an explicitly
|
||||
recognized current `churn.graph_freshness` value, and no dirty paths, open
|
||||
questions, or open gaps. Missing checkpoint or freshness is unknown/missing,
|
||||
not ready. A watcher with no buffered changes is also unknown/unavailable:
|
||||
there is no watcher generation, cursor, start boundary, or continuity receipt
|
||||
from which silence could prove cleanliness. Observed changes remain valid
|
||||
positive evidence.
|
||||
|
||||
`recommend_reorientation` now owns the whole Resume/Regather verdict. Resume
|
||||
requires a resume-ready investigation checkpoint, retrieval Clean, graph
|
||||
Clean, and watcher Clean or Unknown. Retrieval or graph values other than
|
||||
Clean, and watcher Dirty/Stale/Changed, force Regather with explicit reasons.
|
||||
Path overlap remains explanatory derived state; it cannot rescue a stale or
|
||||
unknown map. `epiphany-mvp-status`, worker launch, coordinator, and CRRC all
|
||||
consume this decision. `surfaces/jobs.rs` consumes the same derived graph
|
||||
freshness judgment for graph-remap work instead of maintaining a second churn
|
||||
string tribunal.
|
||||
|
||||
Authority map: `derive_freshness` owns freshness judgment from canonical
|
||||
retrieval state, graph checkpoint, churn assertion, frontier pressure, and
|
||||
positive watcher observations. `recommend_reorientation` owns the action.
|
||||
Their outputs are derived read projections and one reorientation decision.
|
||||
Watcher silence, MVP mappings, jobs, worker launch, coordinator, and CRRC are
|
||||
forbidden readiness/action writers. All launch and operator paths share the
|
||||
same derivation and decision primitives.
|
||||
|
||||
The immediate invariant is repaired, but the final owner is not yet pure.
|
||||
`churn.graph_freshness` remains an `Option<String>`, while
|
||||
`graph_checkpoint.graph_revision` is not authenticated against graph mutation.
|
||||
Modeling must eventually replace that split opinion with one typed,
|
||||
revision-bearing freshness receipt that binds the graph generation, checkpoint,
|
||||
freshness verdict, and pressure basis.
|
||||
|
||||
The deployment next action is unchanged and permission-bound. Do not reboot
|
||||
without exact live operator approval. With that approval, run the real
|
||||
reboot/logon recovery proof already specified above.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -126,7 +126,7 @@ active_subgoals:
|
|||
- Use `notes/continuity-cultnet-contracts.md` as the authority map for Continuity's CultNet contract surface. Continuity is the continuity protocol surface: compaction checkpoints, sleep distillation, recovery receipts, stale-turn repair, and continuity refusals preserve what survives rupture without pretending transcript residue is durable state.
|
||||
- Hands now has a first executable runtime-spine receipt artery: `HandsActionIntent`, `HandsActionReview`, `HandsPatchReceipt`, `HandsCommandReceipt`, and `HandsCommitReceipt` are typed CultCache documents in `epiphany-core::hands_gateway`, runtime-spine registers and persists/rereads them, `epiphany-hands-action-smoke` proves the chain without executing shell commands, editing files, or creating a real commit, and the repo-action launch proof profile now requires the full Hands intent/review/patch chain instead of only the patch receipt. `epiphany-mvp-coordinator` no longer treats `continueImplementation` as a passive stop action: it persists a scoped Substrate Gate grant, Hands action intent, and Hands action review into runtime-spine and exposes the receipt ids in the operator step. The gate also carries a structured `recordPassCommand` template for the post-edit/check/commit receipt call. `epiphany-hands-action` records real patch/command/commit receipts against a stored intent/review, refuses unapproved or mismatched gates, and enforces changed-path scope for patch/commit receipts. Its `record-pass` command can load `finalAction.handsActionGate` from `coordinator-summary.json` and emit patch, command, and commit receipts in one post-implementation call. The local MVP wrapper builds this recorder with the other operator binaries. `epiphany-mvp-coordinator-smoke` now includes a deterministic Hands pass proof: forced `continueImplementation`, gate emission, and `record-pass` receipts in the smoke runtime-spine store. Live model-backed verification can now be accepted as receipt-only truth when Soul returns `needs-evidence` without a statePatch; that acceptance advances the coordinator to a real Hands gate. Runtime-spine can detect and summarize a complete post-verification Hands patch/command/commit receipt chain; the coordinator treats that chain as implementation evidence after Soul. Bridge launch context now writes the latest chain into typed internal CultMesh state as `epiphany.cultmesh.work_loop_telemetry.v0`, renders that packet for Soul, and later enriches the same internal Verse packet with Soul acceptance receipt ids for Modeling/modeling. The telemetry packet now includes resolved patch/command/commit payload previews, artifact previews, commit diff preview, source proof notes, and verification assertions so Soul can judge the actual body without a separate evidence-gathering lane. Local Verse prompt context exposes only a sealed `latest_work_loop_summary` digest with telemetry id, Hands receipt ids, path/source/assertion counts, and Soul receipt ids; receipt payload previews, artifact previews, and commit diff previews remain internal telemetry. Tests prove the CultMesh round trip, local Verse digest projection without preview leakage, prompt rendering of the digest, Soul launch projection, receipt payload previews, artifact previews, and Modeling launch projection. Worker auto-tool continuation preserves real Soul evidence trails under an explicit hard ceiling while sealing repeated identical typed tool intent fingerprints as `tool-loop-stalled`. The work loop is dependency-shaped: Hands produces consequence receipts, Soul verifies those receipts and the changed body, Modeling updates the machine model from verified consequence, and only then should Self route the next Hands turn.
|
||||
- Soul result recovery is typed state, not manual broom work. Failed Verification/Soul results remain terminal reviewable lane results; a `roleFailureReview` acceptance receipt with status `superseded` records operator review and lets Self relaunch Soul against current evidence. Complete typed Hands receipt triplets (`hands-patch-*`, `hands-command-*`, `hands-commit-*`) count as implementation evidence for coordinator coverage, so a Soul finding that verifies the Hands chain routed through work-loop telemetry covers the current modeling context even when it does not repeat the accepted Modeling evidence id.
|
||||
- Native MVP status must share the same typed inputs as live app-server status before it recommends coordinator actions. CRRC/reorientation in native status derives freshness through `derive_freshness` from `EpiphanyThreadState` instead of hand-filled unknowns, and native coordinator signals load typed runtime-spine role findings before deciding whether completed Modeling/Soul results are accepted or reviewable. The status surface may seal long findings for operators, but Self must receive structured role truth from runtime-spine.
|
||||
- Native MVP status must share the same typed inputs as live app-server status before it recommends coordinator actions. CRRC/reorientation in native status derives freshness through `derive_freshness` from `EpiphanyThreadState` instead of hand-filled unknowns, and native coordinator signals load typed runtime-spine role findings before deciding whether completed Modeling/Soul results are accepted or reviewable. Retrieval Ready is Clean only when its dirty-path set is empty; a Ready label carrying dirty paths derives Stale. Graph readiness requires a graph checkpoint, an explicitly recognized current `churn.graph_freshness` value, and zero frontier dirty paths, open questions, or open gaps. Missing checkpoint/freshness is unknown rather than ready. Watcher silence is unknown because the watcher has no continuity-bearing receipt; only observed changes are positive evidence. The status surface may seal long findings for operators, but Self must receive structured role truth from runtime-spine.
|
||||
- Runtime auto-tool continuation now has an executable proof seam. `ToolLoopGuard` owns repeated tool-request detection in `epiphany-openai-runtime`, the production repeated-loop path uses the same helper that tests call to fail the outer worker job, and tests prove changing tool requests do not stall while three identical consecutive pending tool sets return `tool-loop-stalled` and persist a failed worker result. Soul accepted the bounded proof for commit `ce20529e`; the remaining work-loop invariant is Modeling admission, not more Hands work.
|
||||
- Modeling must update the machine map before Self routes back to Hands. A completed Modeling/Modeling result with no reviewable `statePatch` is not a successful map update; it is an unreviewable lane result that must be superseded through typed review and relaunched with the role-specific output schema carried into the model request. This path is now live-proved: run `local-20260613-204521` accepted the Modeling `statePatch` for the Soul-verified `ToolLoopGuard`/Hands receipt-chain consequence and only then emitted a new `continueImplementation` Hands gate.
|
||||
- Aetheria task `019f3fe1-9f69-74e3-97fb-a18490d72119` is positive dogfood evidence for the Epiphany organ hypothesis, not merely for a persistent Modeling index: Modeling named migration bodies, Eyes changed the plan by finding substrate defects, Hands received bounded disjoint cuts, Soul rejected partial-index visibility after a plausible green fix, Imagination corrected roadmap mythology, and Self preserved dependency order across Aetheria/EveUnity/CultLib. The machine must preserve this causal organ loop in typed artifacts: findings alter plans, plans constrain Hands, Soul can falsify claimed completion, and Self routes from accepted evidence without collapsing the judgments into transcript memory. Modeling's typed searchable anatomy/freshness/frontier/index is connective tissue serving that loop, not the end state. Preserve the successful prompt shapes: exact compile boundary plus deletion line for research, hostile negative acceptance criteria for Hands, explicit permission to stop and name a missing primitive, and ownership review beyond green tests.
|
||||
|
|
@ -192,11 +192,11 @@ accepted_design:
|
|||
- Durable `job_bindings` now form a thin Epiphany-owned launcher seam: new specialist/reorient launches write only binding id, kind, scope, owner role, authority scope, linked ids, and an optional blocking reason. Runtime lifecycle ids live in `runtime_links` and runtime-spine job/result records, not in durable job bindings.
|
||||
- The `jobs` view lens is a read-only job/progress reflection: it derives indexing, remap, verification, and specialist slots from authoritative state and retrieval summaries, then projects heartbeat-backed bindings as pending heartbeat turns. It is not the scheduler, notification stream, durable runtime job table, or SQLite reader.
|
||||
- `thread/epiphany/jobsUpdated` is sealed legacy Codex evacuation telemetry. The handler no longer emits Epiphany updates from old runtime `agent_job_progress:{json}` background events; heartbeat/runtime-spine is the live activation and result path.
|
||||
- `thread/epiphany/freshness` is the first read-only freshness surface: it derives retrieval and graph staleness from live retrieval summaries plus frontier/churn state, and for loaded threads reflects watcher-backed invalidation inputs with changed paths plus mapped graph/frontier hits, without mutating, scheduling, or performing automatic semantic invalidation.
|
||||
- Native `derive_freshness` is the read-only freshness judgment: canonical retrieval state, graph checkpoint, churn freshness, frontier pressure, and positive watcher changes are its inputs; retrieval/graph/watcher judgments are its outputs. Watcher silence, MVP adapters, jobs, reorientation, CRRC, and launch projection are forbidden readiness writers. `surfaces/jobs.rs` consumes the same derived graph judgment for remap work instead of interpreting the churn string independently. The remaining authority scar is explicit: `churn.graph_freshness` is still a free string and `graph_checkpoint.graph_revision` is not correlated with graph mutation. They must later collapse into one typed, revision-bearing Modeling freshness receipt.
|
||||
- `thread/epiphany/context` is the targeted read-only state-shard surface: `epiphany-core` selects graph nodes/edges, active frontier, checkpoint, observations, and evidence from authoritative typed state while app-server only adapts protocol, without mutating or notifying.
|
||||
- `thread/epiphany/graphQuery` is the read-only graph traversal surface over authoritative typed state: `epiphany-core` returns explicit nodes, path/symbol matches, bounded neighbors, and frontier neighborhoods with architecture/dataflow links while app-server only adapts protocol, without mutating, notifying, indexing, scheduling, proposing, or promoting.
|
||||
- The `pressure` view lens derives context pressure from current context usage, not cumulative token spend, against auto-compact/context limits without compacting, scheduling, mutating, or notifying; compaction prep starts at 80% of the active limit.
|
||||
- The `reorient` view lens derives a bounded read-only `resume` versus `regather` verdict from checkpoint, freshness, watcher, and pressure signals without mutating state, compacting, scheduling, or silently continuing work.
|
||||
- The `reorient` view lens is the sole owner of the bounded read-only `resume` versus `regather` verdict. Resume requires a durable resume-ready investigation checkpoint, retrieval Clean, graph Clean, and watcher Clean or Unknown. Retrieval/graph non-clean or watcher Dirty/Stale/Changed forces Regather with an explicit reason; path-overlap heuristics no longer override freshness authority. MVP status, worker launch, coordinator, and CRRC consume this one decision and may not reinterpret it. The lens does not mutate state, compact, schedule, or silently continue work.
|
||||
- The `crrc` view lens composes pressure, the reorientation verdict, fixed reorient-worker binding/result status, finding read-back, and available actions into one read-only recommendation without launching, accepting, compacting, scheduling, or mutating state.
|
||||
- A narrow auditable coordinator is central to the MVP because implementation, modeling/checkpoint, verification/review, and CRRC automation feed each other's machine-signals. CRRC itself is harness workflow automation, not a specialist-agent soul: it watches pressure/continuity, ensures persistence, triggers compaction/rehydration/reorientation when needed, and may launch a bounded reorient-worker specialist when semantic regathering is required.
|
||||
- Native coordinator status composes roles, pressure, reorientation, CRRC, role results, and reorientation results into an operator-safe action recommendation. It reads native thread/runtime stores; no `ThreadEpiphany*` projection or app-server emission step exists.
|
||||
|
|
|
|||
Reference in a new issue