Delete false graph freshness authority

This commit is contained in:
Meta Vens 2026-07-15 20:21:38 +01:00
commit cd1a16669b
13 changed files with 42 additions and 160 deletions

View file

@ -934,7 +934,6 @@ fn reorient_retrieval_status(
fn reorient_graph_status(status: EpiphanyGraphFreshnessStatus) -> EpiphanyReorientFreshnessStatus {
match status {
EpiphanyGraphFreshnessStatus::Missing => EpiphanyReorientFreshnessStatus::Unknown,
EpiphanyGraphFreshnessStatus::Ready => EpiphanyReorientFreshnessStatus::Clean,
EpiphanyGraphFreshnessStatus::Stale => EpiphanyReorientFreshnessStatus::Stale,
}
}

View file

@ -569,17 +569,6 @@ fn is_accepting_status(status: &str) -> bool {
fn is_risky_delta(churn: &EpiphanyChurnState) -> bool {
pressure_rank(&churn.diff_pressure) >= 2
|| churn
.graph_freshness
.as_deref()
.map(|freshness| {
let freshness = freshness.trim().to_ascii_lowercase();
freshness.contains("broadened")
|| freshness.contains("expanded")
|| freshness.contains("semantic")
|| freshness.contains("updated")
})
.unwrap_or(false)
}
fn pressure_rank(value: &str) -> u8 {
@ -865,7 +854,6 @@ mod tests {
churn: Some(EpiphanyChurnState {
understanding_status: "grounded".to_string(),
diff_pressure: "low".to_string(),
graph_freshness: Some("fresh".to_string()),
..Default::default()
}),
..promotion_input(true, vec![observation()], vec![evidence()], "ok")
@ -897,7 +885,6 @@ mod tests {
churn: Some(EpiphanyChurnState {
understanding_status: "proposal_updates_map".to_string(),
diff_pressure: "high".to_string(),
graph_freshness: Some("proposal-updated".to_string()),
..Default::default()
}),
..promotion_input(true, vec![observation()], vec![evidence()], "ok")
@ -913,24 +900,17 @@ mod tests {
}
#[test]
fn evaluate_promotion_rejects_expanded_churn_even_with_low_pressure() {
fn evaluate_promotion_uses_diff_pressure_as_churn_risk_authority() {
let decision = evaluate_promotion(EpiphanyPromotionInput {
churn: Some(EpiphanyChurnState {
understanding_status: "proposal_expands_map".to_string(),
diff_pressure: "low".to_string(),
graph_freshness: Some("proposal-expanded".to_string()),
..Default::default()
}),
..promotion_input(true, vec![observation()], vec![evidence()], "ok")
});
assert!(!decision.accepted);
assert!(
decision
.reasons
.iter()
.any(|reason| reason.contains("patch.churn.warning"))
);
assert!(decision.accepted, "{:?}", decision.reasons);
}
#[test]
@ -939,7 +919,6 @@ mod tests {
input.churn = Some(EpiphanyChurnState {
understanding_status: "proposal_refines_map".to_string(),
diff_pressure: "medium".to_string(),
graph_freshness: Some("proposal-broadened".to_string()),
warning: Some("Same-path broadening needs explicit verifier review.".to_string()),
..Default::default()
});
@ -962,7 +941,6 @@ mod tests {
input.churn = Some(EpiphanyChurnState {
understanding_status: "proposal_refines_map".to_string(),
diff_pressure: "medium".to_string(),
graph_freshness: Some("proposal-expanded".to_string()),
warning: Some("Expansion requires a real verifier kind.".to_string()),
..Default::default()
});
@ -985,7 +963,6 @@ mod tests {
churn: Some(EpiphanyChurnState {
understanding_status: "proposal_refines_map".to_string(),
diff_pressure: "medium".to_string(),
graph_freshness: Some("proposal-semantically-anchored".to_string()),
warning: Some(
"Semantic anchoring was verified against source context.".to_string(),
),

View file

@ -215,12 +215,10 @@ pub fn propose_map_update(input: EpiphanyMapProposalInput) -> Result<EpiphanyMap
code_refs,
};
let understanding_status = proposal_understanding_status(&delta);
let graph_freshness = proposal_graph_freshness(&delta);
let diff_pressure = proposal_diff_pressure(&delta, input.state.churn.as_ref());
let churn = EpiphanyChurnState {
understanding_status,
diff_pressure,
graph_freshness: Some(graph_freshness),
warning: Some(format!(
"Map/churn proposal derived from {selection_summary}; {}; promote only after verifier acceptance.",
proposal_delta_summary(&delta)
@ -988,23 +986,6 @@ fn proposal_understanding_status(delta: &MapDeltaJudgment) -> String {
.to_string()
}
fn proposal_graph_freshness(delta: &MapDeltaJudgment) -> String {
if delta.has_mixed_delta() {
"proposal-updated"
} else if delta.created_nodes > 0 {
"proposal-expanded"
} else if delta.semantic_reuses > 0 {
"proposal-semantically-anchored"
} else if delta.same_path_reuses > 0 {
"proposal-broadened"
} else if delta.reused_nodes() > 0 {
"proposal-refined"
} else {
"proposal"
}
.to_string()
}
fn proposal_diff_pressure(
delta: &MapDeltaJudgment,
existing_churn: Option<&EpiphanyChurnState>,
@ -1224,10 +1205,6 @@ mod tests {
vec!["prompt-renderer".to_string()]
);
assert_eq!(proposal.churn.understanding_status, "proposal_refines_map");
assert_eq!(
proposal.churn.graph_freshness.as_deref(),
Some("proposal-refined")
);
}
#[test]
@ -1310,10 +1287,6 @@ mod tests {
.expect("proposal");
assert_eq!(proposal.churn.diff_pressure, "low");
assert_eq!(
proposal.churn.graph_freshness.as_deref(),
Some("proposal-refined")
);
assert!(
proposal
.churn
@ -1353,10 +1326,6 @@ mod tests {
.expect("proposal");
assert_eq!(proposal.churn.diff_pressure, "medium");
assert_eq!(
proposal.churn.graph_freshness.as_deref(),
Some("proposal-broadened")
);
assert!(
proposal
.churn

View file

@ -38,7 +38,6 @@ pub struct EpiphanyRetrievalFreshness {
#[serde(rename_all = "camelCase")]
pub enum EpiphanyGraphFreshnessStatus {
Missing,
Ready,
Stale,
}
@ -47,8 +46,6 @@ pub enum EpiphanyGraphFreshnessStatus {
pub struct EpiphanyGraphFreshness {
pub status: EpiphanyGraphFreshnessStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub graph_freshness: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub checkpoint_id: Option<String>,
pub dirty_path_count: u32,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
@ -177,7 +174,6 @@ pub(super) fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGr
let Some(state) = state else {
return EpiphanyGraphFreshness {
status: EpiphanyGraphFreshnessStatus::Missing,
graph_freshness: None,
checkpoint_id: None,
dirty_path_count: 0,
dirty_paths: Vec::new(),
@ -198,10 +194,6 @@ pub(super) fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGr
let open_gap_count = frontier
.map(|frontier| frontier.open_gap_ids.len() as u32)
.unwrap_or_default();
let graph_freshness = state
.churn
.as_ref()
.and_then(|churn| churn.graph_freshness.clone());
let has_pressure = dirty_path_count > 0 || open_question_count > 0 || open_gap_count > 0;
let checkpoint_id = state
.graph_checkpoint
@ -223,7 +215,6 @@ pub(super) fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGr
EpiphanyGraphFreshness {
status,
graph_freshness,
checkpoint_id,
dirty_path_count,
dirty_paths,
@ -397,7 +388,6 @@ 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;
@ -434,16 +424,12 @@ mod tests {
}
#[test]
fn legacy_checkpoint_and_current_hint_cannot_authorize_graph_ready() {
fn legacy_checkpoint_cannot_authorize_graph_ready() {
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 {
@ -457,7 +443,7 @@ mod tests {
}
#[test]
fn legacy_checkpoint_or_hint_alone_is_missing() {
fn legacy_checkpoint_alone_is_missing() {
let checkpoint_only = EpiphanyThreadState {
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
checkpoint_id: "graph-1".to_string(),
@ -465,40 +451,8 @@ mod tests {
}),
..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 legacy_noncurrent_hint_does_not_invent_staleness_without_pressure() {
let state = EpiphanyThreadState {
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
checkpoint_id: "graph-1".to_string(),
..Default::default()
}),
churn: Some(EpiphanyChurnState {
graph_freshness: Some("proposal-semantically-anchored".to_string()),
..Default::default()
}),
..Default::default()
};
let view = derive_freshness(EpiphanyFreshnessInput {
state: Some(&state),
state: Some(&checkpoint_only),
retrieval_override: None,
watcher: None,
});
@ -507,16 +461,12 @@ mod tests {
}
#[test]
fn graph_pressure_overrides_current_hint_and_checkpoint() {
fn graph_pressure_makes_legacy_checkpoint_stale() {
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()

View file

@ -1,4 +1,4 @@
use super::freshness::{EpiphanyGraphFreshnessStatus, graph_freshness};
use super::freshness::graph_freshness;
use epiphany_state_model::EpiphanyJobBinding;
use epiphany_state_model::EpiphanyJobKind;
use epiphany_state_model::EpiphanyRetrievalState;
@ -247,8 +247,9 @@ fn remap_job(state: Option<&EpiphanyThreadState>) -> EpiphanyJobView {
};
let freshness = graph_freshness(Some(state));
let needs_work = freshness.status != EpiphanyGraphFreshnessStatus::Ready;
// The legacy thread projection has no Body-generation witness and therefore
// cannot authorize a completed remap. Canonical readiness belongs to the
// future joined RepoModel/Body/retrieval authority.
EpiphanyJobView {
id: "graph-remap".to_string(),
kind: EpiphanyJobKind::Remap,
@ -256,11 +257,7 @@ fn remap_job(state: Option<&EpiphanyThreadState>) -> EpiphanyJobView {
owner_role: "epiphany-core".to_string(),
authority_scope: None,
runtime_job_id: None,
status: if needs_work {
EpiphanyJobStatus::Needed
} else {
EpiphanyJobStatus::Idle
},
status: EpiphanyJobStatus::Needed,
items_processed: None,
items_total: None,
progress_note: Some(freshness.note),
@ -474,7 +471,6 @@ mod tests {
..Default::default()
}),
churn: Some(EpiphanyChurnState {
graph_freshness: Some("ok".to_string()),
..Default::default()
}),
..Default::default()

View file

@ -135,7 +135,6 @@ pub struct EpiphanySceneRecord {
pub struct EpiphanySceneChurn {
pub understanding_status: String,
pub diff_pressure: String,
pub graph_freshness: Option<String>,
pub warning: Option<String>,
pub unexplained_writes: Option<u32>,
}
@ -279,7 +278,6 @@ pub fn derive_scene(input: EpiphanySceneInput<'_>) -> EpiphanyScene {
churn: state.churn.as_ref().map(|churn| EpiphanySceneChurn {
understanding_status: churn.understanding_status.clone(),
diff_pressure: churn.diff_pressure.clone(),
graph_freshness: churn.graph_freshness.clone(),
warning: churn.warning.clone(),
unexplained_writes: churn.unexplained_writes,
}),

View file

@ -250,7 +250,6 @@ pub struct EpiphanyGraphFrontier {
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, TS, Default)]
pub struct EpiphanyGraphCheckpoint {
pub checkpoint_id: String,
pub graph_revision: u64,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub summary: Option<String>,
@ -433,9 +432,6 @@ pub struct EpiphanyChurnState {
pub diff_pressure: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub graph_freshness: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "string | null")]
pub warning: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(type = "number | null")]

View file

@ -335,10 +335,7 @@ fn append_frontier_lines(lines: &mut Vec<String>, frontier: &EpiphanyGraphFronti
}
fn append_checkpoint_lines(lines: &mut Vec<String>, checkpoint: &EpiphanyGraphCheckpoint) {
lines.push(format!(
"- Checkpoint: `{}` (graph revision {})",
checkpoint.checkpoint_id, checkpoint.graph_revision
));
lines.push(format!("- Checkpoint: `{}`", checkpoint.checkpoint_id));
if let Some(summary) = checkpoint.summary.as_deref() {
lines.push(format!("- Checkpoint summary: {}", compact_text(summary)));
}
@ -596,12 +593,6 @@ fn render_churn(churn: Option<&EpiphanyChurnState>) -> Option<String> {
),
format!("- Diff pressure: {}", compact_text(&churn.diff_pressure)),
];
if let Some(graph_freshness) = churn.graph_freshness.as_deref() {
lines.push(format!(
"- Graph freshness: {}",
compact_text(graph_freshness)
));
}
if let Some(warning) = churn.warning.as_deref() {
lines.push(format!("- Warning: {}", compact_text(warning)));
}
@ -884,7 +875,6 @@ mod tests {
}),
graph_checkpoint: Some(EpiphanyGraphCheckpoint {
checkpoint_id: "cp-7".to_string(),
graph_revision: 7,
frontier_node_ids: vec!["arch-session".to_string()],
..Default::default()
}),
@ -912,7 +902,6 @@ mod tests {
churn: Some(EpiphanyChurnState {
understanding_status: "stable".to_string(),
diff_pressure: "low".to_string(),
graph_freshness: Some("fresh".to_string()),
warning: None,
unexplained_writes: Some(0),
}),

View file

@ -1814,10 +1814,11 @@ 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.
The ungrounded legacy freshness fields were deleted. Churn retains only its
understanding, diff, warning, and unexplained-write evidence; graph checkpoints
retain identity and frontier content. Neither structure can publish a revision
or freshness verdict. A future Ready projection requires the exact canonical
RepoModel revision/hash plus matching Mind admission, joined to a separate
continuity-bearing Body observation and retrieval coverage for the same source
generation. Modeling cannot certify its own freshness; Mind derives readiness
from the joined authorities.

View file

@ -756,13 +756,16 @@ 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.
Canonical RepoModel is the Modeling-owned body. Its exact revision/hash and
Mind-issued `RepoModelAdmissionReceipt` are the only coherent identity boundary
for a future Ready projection; the snapshot's typed source/lifecycle freshness
is its pressure basis. `churn.graph_freshness`, the legacy graph checkpoint,
generic thread patches, and unrelated thread revisions are forbidden readiness
writers. Until canonical authority is supplied to a consumer, Unknown is the
truthful result.
Canonical RepoModel is the admitted map, not the repository Body. Its exact
revision/hash and Mind-issued `RepoModelAdmissionReceipt` prove map identity
only. Future Ready additionally requires a nervous-system-owned, continuity-
bearing Body observation and retrieval coverage bound to the same source
generation; Mind derives readiness from that exact join. Legacy graph
checkpoints retain only checkpoint identity and frontier content; churn retains
understanding and diff pressure. Neither can publish graph freshness or a graph
revision. Generic thread patches, watcher silence, snapshot source metadata,
and unrelated thread revisions are forbidden readiness writers. Until every
authority is present and current, Unknown is the truthful result.
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.

View file

@ -1595,8 +1595,8 @@ 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.
The legacy thread graph projection cannot produce `Ready`. Explicit frontier
dirty paths, open questions, or open gaps prove Stale; otherwise it is
Missing/Unknown because checkpoint and `churn.graph_freshness` values have no
legal Modeling writer and cannot see canonical RepoModel admission. A watcher
Missing/Unknown because legacy checkpoint identity cannot see canonical
RepoModel admission. 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
@ -1620,11 +1620,15 @@ 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.
`churn.graph_freshness` and `graph_checkpoint.graph_revision` remain legacy
data but own no readiness decision. Canonical RepoModel revision/hash plus its
exact Mind-issued `RepoModelAdmissionReceipt` is the future Ready identity
boundary; its typed source/lifecycle freshness supplies pressure. Do not build
a bridge unless the canonical model and receipt are actual projection inputs.
The ungrounded `churn.graph_freshness` and
`graph_checkpoint.graph_revision` fields were deleted. Checkpoints retain
identity and frontier content; churn retains understanding, diff, warning, and
unexplained-write evidence. Canonical RepoModel revision/hash plus its exact
Mind-issued `RepoModelAdmissionReceipt` proves only admitted map identity.
Future Ready also requires a separate continuity-bearing Body observation and
retrieval coverage bound to the same source generation; Mind derives the joined
readiness projection. No current artifact proves that Body head. Do not build a
bridge from snapshot metadata, watcher silence, or timestamps.
The deployment next action is unchanged and permission-bound. Do not reboot
without exact live operator approval. With that approval, run the real

Binary file not shown.

View file

@ -192,7 +192,7 @@ 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.
- Native `derive_freshness` is the read-only freshness judgment: canonical retrieval state, explicit legacy frontier pressure, and positive watcher changes are its inputs; retrieval/legacy-graph/watcher judgments are its outputs. Watcher silence, legacy graph checkpoints, `churn.graph_freshness`, MVP adapters, jobs, reorientation, CRRC, and launch projection are forbidden readiness writers. `surfaces/jobs.rs` consumes the same derived graph judgment and therefore keeps remap Needed when only legacy hints claim readiness. Canonical RepoModel revision/hash plus its exact Mind-issued `RepoModelAdmissionReceipt` is the only coherent identity boundary for a future Ready projection; typed snapshot source/lifecycle freshness is its pressure basis.
- Native `derive_freshness` is the read-only freshness judgment: canonical retrieval state, explicit legacy frontier pressure, and positive watcher changes are its inputs; retrieval/legacy-graph/watcher judgments are its outputs. Watcher silence, legacy graph checkpoints, MVP adapters, jobs, reorientation, CRRC, and launch projection are forbidden readiness writers. The ungrounded churn freshness and graph checkpoint revision fields were deleted; checkpoints retain identity/frontier content and churn retains understanding/diff/warning/unexplained-write evidence. `surfaces/jobs.rs` consumes the same derived graph judgment and therefore keeps remap Needed without canonical authority. Canonical RepoModel revision/hash plus its exact Mind-issued `RepoModelAdmissionReceipt` proves admitted map identity only. Future Ready also requires a nervous-system-owned continuity-bearing Body observation and retrieval coverage bound to the same source generation; Mind derives the joined projection. Snapshot metadata, watcher silence, and timestamps cannot substitute for the missing Body head.
- `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.