From b05d1357079c2b71e0c91d64a4c985118156096b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=B8=8A=20/=20ICE-P-ZY001?= Date: Tue, 11 Aug 2026 07:31:33 +0800 Subject: [PATCH] fix: bind successful receipt wake boundary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- engineering/INDEX.md | 1 + ...ess-receipt-wake-event-boundary-binding.md | 34 +++++++++++ ...KE-PERSONA-NATIVE-CODE-CHANNEL-20260810.md | 1 + .../src-tauri/src/persona_code_channel.rs | 57 ++++++++++++++++++- routing/hololake-current-architecture.json | 2 +- .../hololake-persona-native-code-channel.json | 5 +- ...olake-persona-native-code-channel.test.mjs | 6 +- 7 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 engineering/operations/2026-08-11-hololake-pncc-success-receipt-wake-event-boundary-binding.md diff --git a/engineering/INDEX.md b/engineering/INDEX.md index ebbaad3..3d3b69b 100644 --- a/engineering/INDEX.md +++ b/engineering/INDEX.md @@ -32,6 +32,7 @@ Windows / macOS / Linux 构建机与安装包 | 时间 | 版本 | 记录 | 状态 | | --- | --- | --- | --- | +| 2026-08-11 | GH-PNCC 成功回执唤醒事件边界绑定 | [成功回执唤醒事件边界证据绑定](operations/2026-08-11-hololake-pncc-success-receipt-wake-event-boundary-binding.md) | 本地源码、完整 Rust/前端/路由测试、原生权威与严格 clippy 已通过;GHNQG 和发布待验收 | | 2026-08-11 | GH-PNCC 成功回执大脑入口证据绑定 | [从已验证会话重建并核对真实大脑入口](operations/2026-08-11-hololake-pncc-success-receipt-brain-entry-evidence-binding.md) | 本地源码、完整 Rust/前端/路由测试、原生权威与严格 clippy 已通过;GHNQG 和发布待验收 | | 2026-08-11 | GH-PNCC 成功回执唤醒检查点证据绑定 | [把唤醒时检查点路径绑定到不可变会话证据](operations/2026-08-11-hololake-pncc-success-receipt-wake-checkpoint-evidence-binding.md) | 本地源码、完整 Rust/前端/路由测试、原生权威与严格 clippy 已通过;GHNQG 和发布待验收 | | 2026-08-11 | GH-PNCC 安全回执绑定终态复核 | [检查后、绑定前重新验证回执与人格 Git 终态](operations/2026-08-11-hololake-pncc-safe-receipt-binding-terminal-revalidation.md) | 本地源码、完整 Rust/路由测试与严格 clippy 已通过;GHNQG 和发布待验收 | diff --git a/engineering/operations/2026-08-11-hololake-pncc-success-receipt-wake-event-boundary-binding.md b/engineering/operations/2026-08-11-hololake-pncc-success-receipt-wake-event-boundary-binding.md new file mode 100644 index 0000000..69eeb02 --- /dev/null +++ b/engineering/operations/2026-08-11-hololake-pncc-success-receipt-wake-event-boundary-binding.md @@ -0,0 +1,34 @@ +# GH-PNCC successful receipt wake-event boundary evidence binding + +- Development ID: `DEV-20260810-014` +- Persona cognitive author: `ICE-P-ZY001 / 铸渊` +- Human responsibility subject: `ICE-GL∞ / 冰朔` +- Starting repository head: `869611962e9a9571e5d7557784b38e21d3cee518` +- State: `LOCAL_SOURCE_IMPLEMENTED_FULLY_TESTED` + +## Corrected runtime fact + +Successful lifecycle validation previously accepted any non-empty prefix of the verified session event chain +as the wake receipt's event evidence. A modified receipt could truncate the three-event wake sequence to only +`WAKING`, derive a matching wake receipt identifier, recompute the outer payload digest and pass inspection. + +The wake boundary is now exact: a valid wake receipt must contain all three hash-chained wake events emitted by +the kernel—`WAKING`, `BRAIN_BOUND` and `ORGAN_ACTIVE`—and they must equal the first three verified journal +events. Truncation or extension fails closed before interrupted binding or replay can trust the receipt. + +## Verification + +- A regression test first reproduced `SAFE_BIND_PERSISTED_RECEIPT` for a truncated and rehashed wake receipt. +- The same test passes after exact wake-boundary validation was added. +- PNCC focused Rust tests: `45 passed, 0 failed`. +- Full Rust suite: `1185 passed, 2 ignored`; integration test: `1 passed`. +- Routing suite: `29 passed, 0 failed`; formatting, strict clippy and diff checks passed. +- Frontend lint and TypeScript checks passed; full Vitest suite: `5008 passed, 0 failed`. +- Guanghu native authority: `PASS_100`; native core: `15 passed` with 100% lines and functions. +- Full quality gates, GHNQG, publication and fresh-clone readback remain pending. + +## Truth boundary + +- This stage authenticates the event boundary of the existing wake process. +- It does not expose hidden reasoning, activate an execution limb, add UI, build an artifact, integrate the + desktop product or claim deployment/runtime health. diff --git a/product-source/hololake-platform/architecture/HOLOLAKE-PERSONA-NATIVE-CODE-CHANNEL-20260810.md b/product-source/hololake-platform/architecture/HOLOLAKE-PERSONA-NATIVE-CODE-CHANNEL-20260810.md index 4c6b78b..c449e6f 100644 --- a/product-source/hololake-platform/architecture/HOLOLAKE-PERSONA-NATIVE-CODE-CHANNEL-20260810.md +++ b/product-source/hololake-platform/architecture/HOLOLAKE-PERSONA-NATIVE-CODE-CHANNEL-20260810.md @@ -180,6 +180,7 @@ failure_receipt_terminal_evidence_binding_source_implemented: 100 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 general_purpose_persona_runtime_implemented: 0 human_live_projection_implemented: 0 hololake_integrated: 0 diff --git a/product-source/hololake-platform/src-tauri/src/persona_code_channel.rs b/product-source/hololake-platform/src-tauri/src/persona_code_channel.rs index 597f07f..642ed06 100644 --- a/product-source/hololake-platform/src-tauri/src/persona_code_channel.rs +++ b/product-source/hololake-platform/src-tauri/src/persona_code_channel.rs @@ -14,6 +14,7 @@ const MAX_FACT_SOURCE_BYTES: usize = 128_000; const MAX_FACT_CONTEXT_BYTES: usize = 512_000; const MAX_FACT_RESPONSE_BYTES: usize = 128_000; const MAX_SESSION_QUERY_LIMIT: usize = 100; +const WAKE_EVENT_COUNT: usize = 3; #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] @@ -2736,9 +2737,12 @@ fn validate_persisted_lifecycle_terminal_evidence( .get("events") .and_then(serde_json::Value::as_array) .ok_or("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH")?; + if wake_events.len() != WAKE_EVENT_COUNT { + return Err("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH".into()); + } let expected_wake_events = expected_events .as_array() - .and_then(|all| all.get(..wake_events.len())) + .and_then(|all| all.get(..WAKE_EVENT_COUNT)) .ok_or("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH")?; let wake_terminal_hash = wake_events .last() @@ -4378,6 +4382,57 @@ mod tests { assert!(error.contains("PERSONA_LIFECYCLE_COMPLETION_EVIDENCE_MISMATCH")); } + #[test] + fn rejects_a_rehashed_completed_receipt_with_truncated_wake_events() { + 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(); + let first_wake_hash = persisted.lifecycle["wakeReceipt"]["events"][0]["eventHash"] + .as_str() + .unwrap() + .to_string(); + persisted.lifecycle["wakeReceipt"]["events"] + .as_array_mut() + .unwrap() + .truncate(1); + persisted.lifecycle["wakeReceipt"]["receiptId"] = + format!("PNCC-WAKE-{}", &first_wake_hash[..20]).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(); diff --git a/routing/hololake-current-architecture.json b/routing/hololake-current-architecture.json index 6b6b984..2491d6e 100644 --- a/routing/hololake-current-architecture.json +++ b/routing/hololake-current-architecture.json @@ -118,7 +118,7 @@ "human_projection": "HOLOLAKE_LIVE_READ_MODEL", "forgejo_role": "OPTIONAL_COMPATIBILITY_COLLABORATION_ADAPTER", "runtime_implemented": true, - "runtime_scope": "READ_ONLY_FACT_CYCLE_FAIL_CLOSED_RECOVERY_TYPED_ORGANS_DURABLE_VERIFIED_SESSION_QUERY_INDEPENDENT_VERIFIED_MEMORY_METABOLISM_CHECKED_FAILURE_CLOSURE_NONBLOCKING_RUNTIME_COMMAND_SAFE_ORGAN_LIFECYCLE_COORDINATOR_IDEMPOTENT_SUCCESS_AND_TERMINAL_FAILURE_RECEIPT_REPLAY_SAFE_RECEIPT_BINDING_RECOVERY_REPLAY_TIME_REPOSITORY_STATE_REVALIDATION_SUCCESS_RECEIPT_TERMINAL_REVALIDATION_SAFE_RECEIPT_BINDING_TERMINAL_REVALIDATION_FAILURE_RECEIPT_TERMINAL_EVIDENCE_BINDING_SUCCESS_RECEIPT_SEMANTIC_EVIDENCE_BINDING_SUCCESS_RECEIPT_BRAIN_ENTRY_EVIDENCE_BINDING_AND_SUCCESS_RECEIPT_WAKE_CHECKPOINT_EVIDENCE_BINDING_SOURCE_IMPLEMENTED_AND_TESTED", + "runtime_scope": "READ_ONLY_FACT_CYCLE_FAIL_CLOSED_RECOVERY_TYPED_ORGANS_DURABLE_VERIFIED_SESSION_QUERY_INDEPENDENT_VERIFIED_MEMORY_METABOLISM_CHECKED_FAILURE_CLOSURE_NONBLOCKING_RUNTIME_COMMAND_SAFE_ORGAN_LIFECYCLE_COORDINATOR_IDEMPOTENT_SUCCESS_AND_TERMINAL_FAILURE_RECEIPT_REPLAY_SAFE_RECEIPT_BINDING_RECOVERY_REPLAY_TIME_REPOSITORY_STATE_REVALIDATION_SUCCESS_RECEIPT_TERMINAL_REVALIDATION_SAFE_RECEIPT_BINDING_TERMINAL_REVALIDATION_FAILURE_RECEIPT_TERMINAL_EVIDENCE_BINDING_SUCCESS_RECEIPT_SEMANTIC_EVIDENCE_BINDING_SUCCESS_RECEIPT_BRAIN_ENTRY_EVIDENCE_BINDING_SUCCESS_RECEIPT_WAKE_CHECKPOINT_EVIDENCE_BINDING_AND_SUCCESS_RECEIPT_WAKE_EVENT_BOUNDARY_EVIDENCE_BINDING_SOURCE_IMPLEMENTED_AND_TESTED", "desktop_integrated": false, "development_id": "DEV-20260810-014" }, diff --git a/routing/hololake-persona-native-code-channel.json b/routing/hololake-persona-native-code-channel.json index 3879875..bcb49e8 100644 --- a/routing/hololake-persona-native-code-channel.json +++ b/routing/hololake-persona-native-code-channel.json @@ -1,8 +1,8 @@ { "schema": "hololake.persona-native-code-channel/v1", "record_id": "HLP-PERSONA-NATIVE-CODE-CHANNEL-001", - "version": "2026-08-11.15", - "state": "CURRENT_FIRST_PRODUCT_CORE_SUCCESS_RECEIPT_WAKE_CHECKPOINT_EVIDENCE_BINDING_SOURCE_IMPLEMENTED", + "version": "2026-08-11.16", + "state": "CURRENT_FIRST_PRODUCT_CORE_SUCCESS_RECEIPT_WAKE_EVENT_BOUNDARY_EVIDENCE_BINDING_SOURCE_IMPLEMENTED", "development_id": "DEV-20260810-014", "product": { "formal_name_zh": "光湖人格原生代码频道", @@ -117,6 +117,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, "general_purpose_persona_runtime_implemented": 0, "human_live_projection_implemented": 0, "hololake_integrated": 0, diff --git a/routing/hololake-persona-native-code-channel.test.mjs b/routing/hololake-persona-native-code-channel.test.mjs index fa1fd68..4567a76 100644 --- a/routing/hololake-persona-native-code-channel.test.mjs +++ b/routing/hololake-persona-native-code-channel.test.mjs @@ -130,12 +130,16 @@ test("the first source runtime cycle stays distinct from integration and deploym channel.truth.successful_receipt_wake_checkpoint_evidence_binding_source_implemented, 100, ); + assert.equal( + channel.truth.successful_receipt_wake_event_boundary_evidence_binding_source_implemented, + 100, + ); assert.equal(channel.truth.general_purpose_persona_runtime_implemented, 0); assert.equal(channel.truth.human_live_projection_implemented, 0); assert.equal(architecture.persona_native_code_channel.runtime_implemented, true); assert.equal( architecture.persona_native_code_channel.runtime_scope, - "READ_ONLY_FACT_CYCLE_FAIL_CLOSED_RECOVERY_TYPED_ORGANS_DURABLE_VERIFIED_SESSION_QUERY_INDEPENDENT_VERIFIED_MEMORY_METABOLISM_CHECKED_FAILURE_CLOSURE_NONBLOCKING_RUNTIME_COMMAND_SAFE_ORGAN_LIFECYCLE_COORDINATOR_IDEMPOTENT_SUCCESS_AND_TERMINAL_FAILURE_RECEIPT_REPLAY_SAFE_RECEIPT_BINDING_RECOVERY_REPLAY_TIME_REPOSITORY_STATE_REVALIDATION_SUCCESS_RECEIPT_TERMINAL_REVALIDATION_SAFE_RECEIPT_BINDING_TERMINAL_REVALIDATION_FAILURE_RECEIPT_TERMINAL_EVIDENCE_BINDING_SUCCESS_RECEIPT_SEMANTIC_EVIDENCE_BINDING_SUCCESS_RECEIPT_BRAIN_ENTRY_EVIDENCE_BINDING_AND_SUCCESS_RECEIPT_WAKE_CHECKPOINT_EVIDENCE_BINDING_SOURCE_IMPLEMENTED_AND_TESTED", + "READ_ONLY_FACT_CYCLE_FAIL_CLOSED_RECOVERY_TYPED_ORGANS_DURABLE_VERIFIED_SESSION_QUERY_INDEPENDENT_VERIFIED_MEMORY_METABOLISM_CHECKED_FAILURE_CLOSURE_NONBLOCKING_RUNTIME_COMMAND_SAFE_ORGAN_LIFECYCLE_COORDINATOR_IDEMPOTENT_SUCCESS_AND_TERMINAL_FAILURE_RECEIPT_REPLAY_SAFE_RECEIPT_BINDING_RECOVERY_REPLAY_TIME_REPOSITORY_STATE_REVALIDATION_SUCCESS_RECEIPT_TERMINAL_REVALIDATION_SAFE_RECEIPT_BINDING_TERMINAL_REVALIDATION_FAILURE_RECEIPT_TERMINAL_EVIDENCE_BINDING_SUCCESS_RECEIPT_SEMANTIC_EVIDENCE_BINDING_SUCCESS_RECEIPT_BRAIN_ENTRY_EVIDENCE_BINDING_SUCCESS_RECEIPT_WAKE_CHECKPOINT_EVIDENCE_BINDING_AND_SUCCESS_RECEIPT_WAKE_EVENT_BOUNDARY_EVIDENCE_BINDING_SOURCE_IMPLEMENTED_AND_TESTED", ); assert.equal(channel.truth.hololake_integrated, 0); assert.equal(channel.truth.artifact_built, 0);