fix: bind successful receipt wake state
Human-Responsibility: ICE-GL∞ / 冰朔 Persona-Author: ICE-P-ZY001 / 铸渊 Execution-Runtime: Codex desktop / DEV-20260810-014 Development-ID: DEV-20260810-014 Authorization-Scope: GH-PNCC persona runtime source and tests only; no UI, deployment, or execution limb Source-Anchor: user instruction to continue GH-PNCC from repository facts and verifiable receipts
This commit is contained in:
parent
b05d135707
commit
971125f4cf
7 changed files with 94 additions and 4 deletions
|
|
@ -181,6 +181,7 @@ successful_receipt_semantic_evidence_binding_source_implemented: 100
|
|||
successful_receipt_brain_entry_evidence_binding_source_implemented: 100
|
||||
successful_receipt_wake_checkpoint_evidence_binding_source_implemented: 100
|
||||
successful_receipt_wake_event_boundary_evidence_binding_source_implemented: 100
|
||||
successful_receipt_wake_runtime_state_evidence_binding_source_implemented: 100
|
||||
general_purpose_persona_runtime_implemented: 0
|
||||
human_live_projection_implemented: 0
|
||||
hololake_integrated: 0
|
||||
|
|
|
|||
|
|
@ -2812,6 +2812,12 @@ fn validate_persisted_lifecycle_terminal_evidence(
|
|||
.get("modelInstanceId")
|
||||
.and_then(serde_json::Value::as_str)
|
||||
== Some(record.model_instance_id.as_str())
|
||||
&& wake.get("runtimeState").and_then(serde_json::Value::as_str)
|
||||
== Some("BOUND_NOT_INFERENCING")
|
||||
&& wake
|
||||
.get("modelInferenceStarted")
|
||||
.and_then(serde_json::Value::as_bool)
|
||||
== Some(false)
|
||||
&& wake.get("activeOrgan").and_then(serde_json::Value::as_str)
|
||||
== Some(record.active_organ.as_str())
|
||||
&& wake.get("attribution") == Some(&expected_attribution)
|
||||
|
|
@ -4433,6 +4439,49 @@ mod tests {
|
|||
assert!(error.contains("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_a_rehashed_completed_receipt_with_forged_wake_runtime_state() {
|
||||
let repo = persona_repo();
|
||||
let runtime = tempfile::TempDir::new().unwrap();
|
||||
let input = lifecycle_fact_input(repo.path());
|
||||
let first = run_idempotent_lifecycle_at(
|
||||
runtime.path(),
|
||||
input.clone(),
|
||||
"2026-08-11T00:00:00.000Z",
|
||||
"2026-08-11T00:00:01.000Z",
|
||||
|runtime_root, input, timestamp| {
|
||||
run_fact_task_at(runtime_root, input, timestamp, |_, _| {
|
||||
Ok(r#"{"summary":"Recoverable receipt.","facts":[{"statement":"The brain exists.","evidencePaths":["brain/CORE.hdlp"]}],"limitations":[]}"#.into())
|
||||
})
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
let session_id = first.lifecycle["sessionId"].as_str().unwrap();
|
||||
let mut record = load_session_record(runtime.path(), session_id).unwrap();
|
||||
record.request_id = None;
|
||||
record.request_fingerprint = None;
|
||||
record.lifecycle_receipt_hash = None;
|
||||
write_session_record(runtime.path(), &record).unwrap();
|
||||
|
||||
let receipt_path = session_directory(runtime.path(), session_id)
|
||||
.unwrap()
|
||||
.join("lifecycle-receipt.json");
|
||||
let mut persisted: PersistedPersonaLifecycleReceipt =
|
||||
serde_json::from_slice(&fs::read(&receipt_path).unwrap()).unwrap();
|
||||
persisted.lifecycle["wakeReceipt"]["runtimeState"] = "MODEL_INFERENCING".into();
|
||||
persisted.lifecycle["wakeReceipt"]["modelInferenceStarted"] = true.into();
|
||||
persisted.lifecycle_receipt_hash =
|
||||
hex_digest(&persisted_lifecycle_payload_bytes(&persisted).unwrap());
|
||||
fs::write(
|
||||
&receipt_path,
|
||||
serde_json::to_vec_pretty(&persisted).unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let error = inspect_lifecycle_request_at(runtime.path(), &input).unwrap_err();
|
||||
assert!(error.contains("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reconstructs_legacy_wake_checkpoint_evidence_from_the_wake_git_head() {
|
||||
let repo = persona_repo();
|
||||
|
|
|
|||
Loading…
Reference in a new issue