Repair legacy semantic successes through Idunn
This commit is contained in:
parent
360dcb433d
commit
3f5aab427b
6 changed files with 195 additions and 36 deletions
|
|
@ -2,8 +2,8 @@ use super::{
|
|||
MEMORY_SEMANTIC_PROJECTION_ATTEMPT_SCHEMA_VERSION, MemorySemanticIndexReceipt,
|
||||
MemorySemanticProjectionAttempt, MemorySemanticProjectionObligation,
|
||||
MemorySemanticProjectionSourceHead, bind_memory_semantic_index_receipt,
|
||||
memory_semantic_projection_terminal_success,
|
||||
validate_memory_semantic_projection_attempt, validate_memory_semantic_projection_obligation,
|
||||
memory_semantic_projection_terminal_success, validate_memory_semantic_projection_attempt,
|
||||
validate_memory_semantic_projection_obligation,
|
||||
};
|
||||
use anyhow::{Result, anyhow};
|
||||
use cultcache_rs::{
|
||||
|
|
@ -413,7 +413,7 @@ mod authority_tests {
|
|||
));
|
||||
assert_eq!(
|
||||
classify_memory_semantic_projection_for_pulse(&store, &input)?,
|
||||
crate::MemorySemanticProjectorPulseClassification::Succeeded
|
||||
crate::MemorySemanticProjectorPulseClassification::Ready
|
||||
);
|
||||
assert!(
|
||||
idunn_acquire_memory_semantic_projection(
|
||||
|
|
@ -427,6 +427,87 @@ mod authority_tests {
|
|||
)
|
||||
.is_err()
|
||||
);
|
||||
let mut legacy = readiness.receipt;
|
||||
legacy.schema_version = "gamecult.epiphany.memory_semantic_index_receipt.v1".into();
|
||||
legacy.observed_vector_binding_root_sha256.clear();
|
||||
let mut cache = semantic_projector_cache(&store)?;
|
||||
cache.put(&legacy.receipt_id, &legacy)?;
|
||||
assert_eq!(
|
||||
classify_memory_semantic_projection_for_pulse(&store, &input)?,
|
||||
crate::MemorySemanticProjectorPulseClassification::Repair
|
||||
);
|
||||
let scope_id = projection_scope_id(&obligation.swarm_id, &obligation.partition)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
let current = cache
|
||||
.get::<MemorySemanticProjectionClaim>(&scope_id)?
|
||||
.expect("succeeded predecessor");
|
||||
let mut forged = current.clone();
|
||||
forged.authority_id = "missing-consumed-authority".into();
|
||||
cache.put(&scope_id, &forged)?;
|
||||
assert!(classify_memory_semantic_projection_for_pulse(&store, &input).is_err());
|
||||
assert!(
|
||||
idunn_acquire_memory_semantic_projection(
|
||||
&store,
|
||||
&input,
|
||||
"executor-b",
|
||||
"executor-incarnation-b",
|
||||
"repair",
|
||||
"idunn-b",
|
||||
"2026-07-15T04:03:00Z",
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
cache.put(&scope_id, ¤t)?;
|
||||
let repair = idunn_acquire_memory_semantic_projection(
|
||||
&store,
|
||||
&input,
|
||||
"executor-b",
|
||||
"executor-incarnation-b",
|
||||
"repair",
|
||||
"idunn-b",
|
||||
"2026-07-15T04:03:00Z",
|
||||
)?;
|
||||
assert_eq!(repair.claim.epoch, acquisition.claim.epoch + 1);
|
||||
fail_memory_semantic_projection_claim(
|
||||
&store,
|
||||
&repair.claim.claim_id,
|
||||
"2026-07-15T04:04:00Z",
|
||||
"transient embedding failure",
|
||||
)?;
|
||||
assert_eq!(
|
||||
classify_memory_semantic_projection_for_pulse(&store, &input)?,
|
||||
crate::MemorySemanticProjectorPulseClassification::Failed
|
||||
);
|
||||
let retry = idunn_acquire_memory_semantic_projection(
|
||||
&store,
|
||||
&input,
|
||||
"executor-c",
|
||||
"executor-incarnation-c",
|
||||
"execute",
|
||||
"idunn-c",
|
||||
"2026-07-15T04:05:00Z",
|
||||
)?;
|
||||
assert_eq!(retry.claim.epoch, repair.claim.epoch + 1);
|
||||
let migrated = MemorySemanticIndexReceipt {
|
||||
schema_version: crate::MEMORY_SEMANTIC_INDEX_RECEIPT_SCHEMA_VERSION.to_string(),
|
||||
receipt_id: "empty-receipt-v2".into(),
|
||||
indexed_at: "2026-07-15T04:06:00Z".into(),
|
||||
claim_id: retry.claim.claim_id.clone(),
|
||||
claim_epoch: retry.claim.epoch,
|
||||
observed_vector_binding_root_sha256: format!("{:x}", Sha256::digest([])),
|
||||
..legacy
|
||||
};
|
||||
succeed_memory_semantic_projection_claim(
|
||||
&store,
|
||||
&retry.claim.claim_id,
|
||||
&input.authority,
|
||||
migrated,
|
||||
"2026-07-15T04:06:01Z",
|
||||
)?;
|
||||
assert_eq!(
|
||||
classify_memory_semantic_projection_for_pulse(&store, &input)?,
|
||||
crate::MemorySemanticProjectorPulseClassification::Ready
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -1384,7 +1465,8 @@ pub(crate) fn classify_memory_semantic_projection_for_pulse(
|
|||
}
|
||||
}
|
||||
let scope_id = projection_scope_id(&input.obligation.swarm_id, &input.obligation.partition)?;
|
||||
if let Some(claim) = decode_one::<MemorySemanticProjectionClaim>(&envelopes, &scope_id)? {
|
||||
let current_claim = decode_one::<MemorySemanticProjectionClaim>(&envelopes, &scope_id)?;
|
||||
if let Some(claim) = ¤t_claim {
|
||||
validate_memory_semantic_projection_claim(&claim)?;
|
||||
if claim.scope_id != scope_id {
|
||||
return Err(anyhow!("semantic projector pulse claim key disagrees"));
|
||||
|
|
@ -1392,9 +1474,6 @@ pub(crate) fn classify_memory_semantic_projection_for_pulse(
|
|||
if claim.obligation_id == input.obligation.obligation_id {
|
||||
match claim.status.as_str() {
|
||||
"running" => return Ok(super::MemorySemanticProjectorPulseClassification::Running),
|
||||
"succeeded" => {
|
||||
return Ok(super::MemorySemanticProjectorPulseClassification::Succeeded);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -1405,12 +1484,27 @@ pub(crate) fn classify_memory_semantic_projection_for_pulse(
|
|||
&decode_all::<MemorySemanticProjectionAttempt>(&envelopes)?,
|
||||
&decode_all::<MemorySemanticIndexReceipt>(&envelopes)?,
|
||||
)?;
|
||||
let succeeded_predecessor = current_claim
|
||||
.as_ref()
|
||||
.map(|claim| {
|
||||
authenticated_succeeded_predecessor(&envelopes, claim, &input.obligation.obligation_id)
|
||||
})
|
||||
.transpose()?
|
||||
.unwrap_or(false);
|
||||
Ok(match health.status {
|
||||
super::MemorySemanticProjectionHealthStatus::Pending => {
|
||||
super::MemorySemanticProjectorPulseClassification::Pending
|
||||
if succeeded_predecessor {
|
||||
super::MemorySemanticProjectorPulseClassification::Repair
|
||||
} else {
|
||||
super::MemorySemanticProjectorPulseClassification::Pending
|
||||
}
|
||||
}
|
||||
super::MemorySemanticProjectionHealthStatus::Failed => {
|
||||
super::MemorySemanticProjectorPulseClassification::Failed
|
||||
if succeeded_predecessor {
|
||||
super::MemorySemanticProjectorPulseClassification::Repair
|
||||
} else {
|
||||
super::MemorySemanticProjectorPulseClassification::Failed
|
||||
}
|
||||
}
|
||||
super::MemorySemanticProjectionHealthStatus::Ready => {
|
||||
super::MemorySemanticProjectorPulseClassification::Ready
|
||||
|
|
@ -1498,7 +1592,7 @@ pub(crate) fn idunn_acquire_memory_semantic_projection(
|
|||
let attempt = decode_one::<MemorySemanticProjectionAttempt>(&opening, &claim.attempt_id)?
|
||||
.ok_or_else(|| anyhow!("semantic projector scope attempt disappeared"))?;
|
||||
validate_memory_semantic_projection_attempt(&attempt)?;
|
||||
if attempt.obligation_id != claim.obligation_id || attempt.status != claim.status {
|
||||
if !attempt_authenticates_claim(&attempt, claim) || attempt.status != claim.status {
|
||||
return Err(anyhow!(
|
||||
"semantic projector scope claim and attempt disagree"
|
||||
));
|
||||
|
|
@ -1512,19 +1606,18 @@ pub(crate) fn idunn_acquire_memory_semantic_projection(
|
|||
"acquisition before predecessor",
|
||||
)?;
|
||||
}
|
||||
let succeeded_predecessor = current
|
||||
.as_ref()
|
||||
.map(|claim| {
|
||||
authenticated_succeeded_predecessor(&opening, claim, &obligation.obligation_id)
|
||||
})
|
||||
.transpose()?
|
||||
.unwrap_or(false);
|
||||
match purpose {
|
||||
"execute"
|
||||
if current.as_ref().is_some_and(|claim| {
|
||||
claim.status == "succeeded" && claim.obligation_id == obligation.obligation_id
|
||||
}) =>
|
||||
{
|
||||
"execute" if succeeded_predecessor => {
|
||||
return Err(anyhow!("execute grant cannot authorize succeeded repair"));
|
||||
}
|
||||
"repair"
|
||||
if !current.as_ref().is_some_and(|claim| {
|
||||
claim.status == "succeeded" && claim.obligation_id == obligation.obligation_id
|
||||
}) =>
|
||||
{
|
||||
"repair" if !succeeded_predecessor => {
|
||||
return Err(anyhow!("repair grant requires exact succeeded claim"));
|
||||
}
|
||||
_ => {}
|
||||
|
|
@ -2407,6 +2500,26 @@ fn attempt_authenticates_claim(
|
|||
}
|
||||
}
|
||||
|
||||
fn authenticated_succeeded_predecessor(
|
||||
envelopes: &[CultCacheEnvelope],
|
||||
claim: &MemorySemanticProjectionClaim,
|
||||
obligation_id: &str,
|
||||
) -> Result<bool> {
|
||||
if claim.status != "succeeded" || claim.obligation_id != obligation_id {
|
||||
return Ok(false);
|
||||
}
|
||||
authenticate_claim_authority_from_envelopes(envelopes, claim)?;
|
||||
let attempt = decode_one::<MemorySemanticProjectionAttempt>(envelopes, &claim.attempt_id)?
|
||||
.ok_or_else(|| anyhow!("succeeded semantic predecessor lost its exact attempt"))?;
|
||||
validate_memory_semantic_projection_attempt(&attempt)?;
|
||||
if attempt.status != "succeeded" || !attempt_authenticates_claim(&attempt, claim) {
|
||||
return Err(anyhow!(
|
||||
"succeeded semantic predecessor is not authenticated by its exact attempt"
|
||||
));
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
fn terminal_or_recovery_cas(
|
||||
store_path: &Path,
|
||||
opening: &[CultCacheEnvelope],
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||
pub enum MemorySemanticProjectorPulseClassification {
|
||||
Pending,
|
||||
Failed,
|
||||
Repair,
|
||||
Ready,
|
||||
Running,
|
||||
RunningOwned { claim_id: String },
|
||||
Succeeded,
|
||||
Stale,
|
||||
}
|
||||
|
||||
|
|
@ -17,11 +17,8 @@ impl MemorySemanticProjectorPulseClassification {
|
|||
fn automatic_purpose(&self) -> Option<&'static str> {
|
||||
match self {
|
||||
Self::Pending | Self::Failed => Some("execute"),
|
||||
Self::Ready
|
||||
| Self::Running
|
||||
| Self::RunningOwned { .. }
|
||||
| Self::Succeeded
|
||||
| Self::Stale => None,
|
||||
Self::Repair => Some("repair"),
|
||||
Self::Ready | Self::Running | Self::RunningOwned { .. } | Self::Stale => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -288,7 +285,7 @@ mod tests {
|
|||
Vec<std::result::Result<MemorySemanticProjectorPulseClassification, &'static str>>,
|
||||
>,
|
||||
acquire_result: Mutex<Option<Option<String>>>,
|
||||
acquisitions: Mutex<Vec<String>>,
|
||||
acquisitions: Mutex<Vec<(String, String)>>,
|
||||
executions: Mutex<Vec<String>>,
|
||||
execute_barriers: Option<(Arc<Barrier>, Arc<Barrier>)>,
|
||||
}
|
||||
|
|
@ -322,8 +319,10 @@ mod tests {
|
|||
input: &MemorySemanticProjectionInput,
|
||||
purpose: &str,
|
||||
) -> Result<Option<String>> {
|
||||
assert_eq!(purpose, "execute");
|
||||
self.acquisitions.lock().unwrap().push(scope_key(input));
|
||||
self.acquisitions
|
||||
.lock()
|
||||
.unwrap()
|
||||
.push((scope_key(input), purpose.to_string()));
|
||||
Ok(self.acquire_result.lock().unwrap().take().unwrap_or(None))
|
||||
}
|
||||
|
||||
|
|
@ -338,11 +337,10 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn decision_table_never_runs_ready_running_succeeded_or_stale() {
|
||||
fn decision_table_never_runs_ready_running_or_stale() {
|
||||
for classification in [
|
||||
MemorySemanticProjectorPulseClassification::Ready,
|
||||
MemorySemanticProjectorPulseClassification::Running,
|
||||
MemorySemanticProjectorPulseClassification::Succeeded,
|
||||
MemorySemanticProjectorPulseClassification::Stale,
|
||||
] {
|
||||
let pulser = MemorySemanticProjectorPulser::new(MockPort::new(vec![classification]));
|
||||
|
|
@ -353,6 +351,19 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repair_classification_acquires_the_typed_repair_path() {
|
||||
let pulser = MemorySemanticProjectorPulser::new(MockPort::new(vec![
|
||||
MemorySemanticProjectorPulseClassification::Repair,
|
||||
]));
|
||||
let outcome = pulser.pulse(&[input("modeling")], None);
|
||||
assert_eq!(outcome.status, MemorySemanticProjectorPulseStatus::Executed);
|
||||
assert_eq!(
|
||||
pulser.port.acquisitions.lock().unwrap().as_slice(),
|
||||
&[("swarm-a:modeling".to_string(), "repair".to_string())]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_classification_refuses_an_advanced_sealed_input_as_stale() -> Result<()> {
|
||||
let temp = tempdir()?;
|
||||
|
|
|
|||
|
|
@ -1260,8 +1260,11 @@ receipts; they merely share one survival body.
|
|||
|
||||
Every pulse reloads both canonical inputs. It stores no open-obligation queue
|
||||
and allows at most one global action, rotating fairly between actionable
|
||||
partitions. Ready, foreign-running, succeeded, and stale inputs never execute.
|
||||
Pending and failed inputs acquire exact Idunn authority before using the one
|
||||
partitions. Ready, foreign-running, and stale inputs never execute. A succeeded
|
||||
claim is not itself terminal evidence: valid receipt-v2 health derives Ready,
|
||||
while an exact authority-authenticated succeeded claim whose receipt is legacy
|
||||
or invalid derives Repair and acquires the typed Idunn repair path. Pending and
|
||||
failed inputs acquire exact Idunn execute authority before using the one
|
||||
crate-private executor. A running claim owned by the current provider
|
||||
incarnation resumes directly without minting a second grant; a foreign running
|
||||
claim remains pressure until exact recovery. Overlapping pulses return busy,
|
||||
|
|
@ -2027,6 +2030,34 @@ The installed sibling-generation gate is closed for the current boot. Next:
|
|||
build Mind's whole-repository observed-readiness join. Reboot/logon remains
|
||||
permission-bound.
|
||||
|
||||
## Semantic receipt-v2 live migration wound (2026-07-16)
|
||||
|
||||
The first readiness release exposed an honest migration failure. Receipt v2
|
||||
correctly made the old v1 Mind/Modeling receipts ineligible, but pulse
|
||||
classification returned `Succeeded` from claim status before deriving receipt
|
||||
health. Both partitions therefore stayed idle and packaged queries fell back to
|
||||
canonical BM25. `Succeeded` is removed as a pulse state. Valid v2 terminal
|
||||
evidence derives `Ready`; a same-obligation succeeded predecessor with missing,
|
||||
legacy, or invalid receipt evidence derives `Repair`.
|
||||
|
||||
Repair is not opened by claim shape alone. Classification and acquisition share
|
||||
one predicate that authenticates the consumed executor grant or recovery
|
||||
authorization plus the exact succeeded attempt/claim binding. The repair grant
|
||||
advances the epoch. A failed repair becomes a failed current claim and retries
|
||||
through the ordinary execute path at the next epoch. Tests cover forged
|
||||
authority refusal, v1 repair acquisition, failed repair, execute retry, v2
|
||||
terminal success, final Ready, and empty-v2 Ready/nonqueryable stability. Soul
|
||||
approved; the full library suite is 466 passed, 2 intentionally ignored.
|
||||
|
||||
Operational evidence before the fix: release
|
||||
`sha256-6f9ab4848207a110e7e3836f41e6a74c0f463369ad4b04ce2d0d3831a6b262ae`
|
||||
from commit `360dcb43` launched witnessed Idunn PID `29476` and direct child
|
||||
projector PID `22840`, but both packaged semantic queries fell back because the
|
||||
v1 receipts had no migration path. The next action is to commit this repair,
|
||||
package/deploy a successor witnessed release, observe v2 semantic ranking, then
|
||||
derive the first live whole-repository readiness projection. Reboot/logon still
|
||||
requires explicit live operator approval.
|
||||
|
||||
## Mind whole-repository readiness join (2026-07-16)
|
||||
|
||||
The missing join now exists in source. `repository_readiness.rs` is Mind's sole
|
||||
|
|
|
|||
|
|
@ -436,8 +436,11 @@ the canonical locator point id, and payload `pointId` remains the canonical
|
|||
locator identity. Empty synchronization, upsert, observation, deletion, and
|
||||
query therefore address one claim incarnation only.
|
||||
|
||||
Success receipts use schema v1 and bind `claim_id` and `claim_epoch`. Legacy
|
||||
receipts decode with empty/zero defaults but cannot become query eligible.
|
||||
Success receipts use schema v2 and bind `claim_id`, `claim_epoch`, and the exact
|
||||
post-scroll vector-binding root. Legacy receipts decode with empty/zero defaults
|
||||
but cannot become query eligible. An authority-authenticated succeeded claim
|
||||
with legacy or invalid receipt evidence derives the typed repair posture; claim
|
||||
status alone never opens repair.
|
||||
Opaque readiness carries the exact successful receipt, and query derives its
|
||||
Qdrant filter only from that receipt. Activation is consequently the CultCache
|
||||
terminal-success CAS selecting an already-observed physical namespace; a
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -734,4 +734,5 @@ current_status:
|
|||
- The feature-gated native `epiphany-workspace-coverage-recovery-smoke` proves the real packaged supervisor/projector boundary in GUID-scoped repo/runtime/Body/Verse state. It warms local Ollama, derives only its exact fenced Qdrant collection names, publishes reserved policy, launches the initial child through fixed bootstrap, observes epoch 1 claim, kills only after exact native launch-incarnation revalidation, invokes Idunn reconcile, authenticates epoch 2 successor authority plus the immutable recovery receipt through freshly reopened stores, kills the replacement under the same identity fence, and verifies only its owned collections absent before success. Live proof `C:\Users\Meta\AppData\Local\Temp\epiphany-workspace-coverage-a577f820-b0e2-4733-b628-529ee3bdb143\proof.json` passed with receipt `2b44f28f-7c0f-4ad2-aefe-d7c8222e8642` and binds the executed binary, exact embedded smoke source, source head, and tracked-source diff digests. Operator orchestration, not the harness, restored local Qdrant to its prior stopped state. The run also repaired normal-user Windows boot identity and exact recovered-owner claim resumption.
|
||||
- The 2026-07-16 deployability audit replaced `notes/epiphany-swarm-readiness-plan.md`'s obsolete June queue with the live evidence matrix. Brake, initiative recovery, Persona speech eligibility, memory lifecycle, CultNet-first operation, and branch-local Hands/Soul/Mind gates are landed. The installed after-login host is operational and real Mind/Modeling semantic queries pass against Yggdrasil, but it is not yet deployable as one proven machine: installed binaries predate recovery commit `34802407`; mutable sibling lookup permits mixed build generations; Mind lacks the race-bounded whole-repository readiness join; and reboot/logon lineage remains permission-bound. Health, heartbeat, Task Scheduler state, Qdrant existence, legacy retrieval Ready, and Eve/Gjallar rows cannot substitute for either query admission or repository readiness. Sight surfaces no longer publish the foreign constant `queryAdmission=false`; they report only facts they observe.
|
||||
- Release `sha256-c94109f94ee42c1257089830f399cb87cd5ad672772c274194371995ce4df923` is the first deployed immutable sibling generation. Native packaging builds from detached exact source commit `dd80f4a51c18425a6665710698a357be61154abf`, initializes pinned submodules, uses the tracked lockfile under `--locked`, and publishes four exact binaries plus a typed CultCache witness/head only after atomic directory publication and byte verification. Task Scheduler pins release id/digest and the witnessed supervisor path; Idunn reauthenticates the complete set and reserved policy role paths. Current-boot proof: reconciler PID 21228 launched direct child 22736; witnessed Mind/Modeling queries ranked semantically; killing that exact-path child caused Idunn to launch PID 19748 with receipt `86a42d51-9930-4b5d-9e61-e74c82a0d808`, ready heartbeat `4fc91977-b635-474b-812b-c364847e2b4b`, and witnessed executable digest `sha256-1060dd64e8c2b520ec8744b67e8306db04a6618d463fc2117c352adf9e30e6b0`. This closes current-boot artifact generation and recurrence, not reboot/logon survival.
|
||||
next_action: Implement Mind's repository-readiness join with fresh Body R1/R2, exact Body-grounded RepoModel admission, live Modeling semantic eligibility, and a new live workspace-coverage Qdrant evidence reader over the sealed plan/receipt. Stored coverage `Current` is forbidden as a substitute. Then perform Soul review and update the evidence matrix. Do not run the final reboot/logon proof without explicit live operator approval.
|
||||
- Release `sha256-6f9ab4848207a110e7e3836f41e6a74c0f463369ad4b04ce2d0d3831a6b262ae` packages repository-readiness source commit `360dcb433dda9599fca14282592608d26b8b6cc8`; witnessed Idunn PID 29476 directly owns witnessed projector PID 22840 with launch receipt `50879209-b65f-4411-ae3f-6f647d37bf42` and ready heartbeat `134df620-9e20-4220-ad4e-117ea4ca8188`. Deployment exposed receipt-v2 migration pressure: v1 receipts became correctly ineligible, but the old Succeeded pulse shortcut kept both partitions idle. The shortcut is now cut in source. Valid v2 terminal evidence derives Ready; an exact same-obligation succeeded claim opens Repair only after its consumed grant/recovery authority and exact succeeded attempt are authenticated. Failed repair retries through execute at the next epoch. Forged predecessor authority cannot be laundered by a repair grant.
|
||||
next_action: Commit and package the authenticated semantic receipt-v2 repair, deploy the successor witnessed release, prove Mind/Modeling semantic ranking, then derive the first live Mind repository-readiness projection. Also repair Idunn's alive-child reconciliation so policy/release path drift forces typed replacement instead of requiring an operator exact-PID termination. Do not run the final reboot/logon proof without explicit live operator approval.
|
||||
|
|
|
|||
Reference in a new issue