diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 4c972a72..861441c2 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -9903,6 +9903,8 @@ fn record_repo_work_map_admission( closure_review: &Value, modeling_summary: &str, modeling_finding_receipt_id: &str, + modeling_route_id: &str, + modeling_generation: u64, soul_verdict_receipt_id: &str, mind_gateway_review_id: &str, mind_state_commit_receipt_id: &str, @@ -9936,6 +9938,8 @@ fn record_repo_work_map_admission( publication_gate: "Bifrost".to_string(), durable_state_admitted: true, private_state_exposed: false, + modeling_route_id: modeling_route_id.to_string(), + modeling_generation, }; commit_repo_work_map_admission(runtime_store, &entry, mind_review, mind_commit)?; runtime_repo_work_map_entry(runtime_store, &entry.map_entry_id)? @@ -9993,6 +9997,8 @@ fn project_repo_work_map_entry_to_local_verse( format!("commit {}", entry.commit_sha), format!("family {}", entry.safe_action_family), format!("modeling {}", entry.modeling_finding_receipt_id), + format!("modelingRoute {}", entry.modeling_route_id), + format!("modelingGeneration {}", entry.modeling_generation), format!("mind {}", entry.mind_state_commit_receipt_id), format!("publicationGate {}", entry.publication_gate), "private false".to_string(), @@ -10012,6 +10018,8 @@ fn project_repo_work_map_entry_to_local_verse( safe_action_family: entry.safe_action_family.clone(), modeling_summary: entry.modeling_summary.clone(), modeling_finding_receipt_id: entry.modeling_finding_receipt_id.clone(), + modeling_route_id: entry.modeling_route_id.clone(), + modeling_generation: entry.modeling_generation, soul_verdict_receipt_id: entry.soul_verdict_receipt_id.clone(), mind_gateway_review_id: entry.mind_gateway_review_id.clone(), mind_state_commit_receipt_id: entry.mind_state_commit_receipt_id.clone(), @@ -10051,6 +10059,8 @@ fn repo_work_map_entry_json(entry: &RepoWorkMapEntry) -> Value { "safeActionFamily": entry.safe_action_family, "modelingSummary": entry.modeling_summary, "modelingFindingReceiptId": entry.modeling_finding_receipt_id, + "modelingRouteId": entry.modeling_route_id, + "modelingGeneration": entry.modeling_generation, "soulVerdictReceiptId": entry.soul_verdict_receipt_id, "mindGatewayReviewId": entry.mind_gateway_review_id, "mindStateCommitReceiptId": entry.mind_state_commit_receipt_id, @@ -11837,6 +11847,8 @@ fn run_closure_pipeline(args: CloseArgs, phase: ClosurePhase) -> Result { &closure_review, &modeling_finding.summary, &modeling_finding.receipt_id, + &modeling_route.route_id, + modeling_route.generation, &soul_verdict.receipt_id, &mind_review.gateway_id, &mind_commit.receipt_id, @@ -17069,6 +17081,8 @@ mod authority_tests { publication_gate: "Bifrost".to_string(), durable_state_admitted: true, private_state_exposed: false, + modeling_route_id: route.route_id.clone(), + modeling_generation: route.generation, }; assert!(commit_repo_work_map_admission(&store, &map, &review, &commit).is_err()); assert!(epiphany_core::runtime_mind_gateway_review(&store, &review.gateway_id)?.is_none()); @@ -17165,6 +17179,56 @@ mod authority_tests { request_id: request0.request_id.clone(), }; put_repo_work_modeling_finding(&store, &finding0)?; + let stale_map_review = MindGatewayReview { + schema_version: MIND_GATEWAY_REVIEW_SCHEMA_VERSION.to_string(), + gateway_id: "stale-map-review".to_string(), + source_kind: "repo_work_closure".to_string(), + source_role_id: "modeling".to_string(), + decision: MindGatewayDecision::Accept, + allowed_effects: vec!["repoWork.map".to_string()], + refused_effects: Vec::new(), + reasons: vec!["attempt stale admission".to_string()], + contract: "test".to_string(), + }; + let stale_map_commit = mind_state_commit_receipt( + "stale-map-commit".to_string(), + &stale_map_review, + 1, + vec!["repoWork.map".to_string()], + "2026-07-12T00:00:02Z".to_string(), + ); + let stale_map = RepoWorkMapEntry { + schema_version: REPO_WORK_MAP_ENTRY_SCHEMA_VERSION.to_string(), + map_entry_id: "stale-map".to_string(), + admitted_at: "2026-07-12T00:00:02Z".to_string(), + item: request0.item.clone(), + branch: "test".to_string(), + changed_paths: request0.changed_paths.clone(), + commit_sha: request0.commit_sha.clone(), + safe_action_family: "repo.status_section".to_string(), + modeling_summary: finding0.summary.clone(), + modeling_finding_receipt_id: finding0.receipt_id.clone(), + soul_verdict_receipt_id: soul.receipt_id.clone(), + mind_gateway_review_id: stale_map_review.gateway_id.clone(), + mind_state_commit_receipt_id: stale_map_commit.receipt_id.clone(), + execute_receipt_path: "execute.json".to_string(), + closure_review_path: "review.json".to_string(), + closure_receipt_path: "close.json".to_string(), + publication_gate: "Bifrost".to_string(), + durable_state_admitted: true, + private_state_exposed: false, + modeling_route_id: route0.route_id.clone(), + modeling_generation: 0, + }; + assert!( + commit_repo_work_map_admission( + &store, + &stale_map, + &stale_map_review, + &stale_map_commit, + ) + .is_err() + ); let review = MindGatewayReview { schema_version: MIND_GATEWAY_REVIEW_SCHEMA_VERSION.to_string(), gateway_id: "route-g1-mind-review".to_string(), diff --git a/epiphany-core/src/cultmesh_integration.rs b/epiphany-core/src/cultmesh_integration.rs index 1e14296d..f2804950 100644 --- a/epiphany-core/src/cultmesh_integration.rs +++ b/epiphany-core/src/cultmesh_integration.rs @@ -965,6 +965,10 @@ pub struct EpiphanyCultMeshRepoWorkMapEntry { pub notes: Vec, #[cultcache(key = 22)] pub modeling_finding_receipt_id: String, + #[cultcache(key = 23)] + pub modeling_route_id: String, + #[cultcache(key = 24)] + pub modeling_generation: u64, } #[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] diff --git a/epiphany-core/src/modeling_gateway.rs b/epiphany-core/src/modeling_gateway.rs index e28c2b74..6a9c98b0 100644 --- a/epiphany-core/src/modeling_gateway.rs +++ b/epiphany-core/src/modeling_gateway.rs @@ -148,4 +148,8 @@ pub struct RepoWorkMapEntry { pub durable_state_admitted: bool, #[cultcache(key = 18)] pub private_state_exposed: bool, + #[cultcache(key = 19)] + pub modeling_route_id: String, + #[cultcache(key = 20)] + pub modeling_generation: u64, } diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index e69377ce..256b72e9 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -2056,6 +2056,7 @@ pub fn commit_repo_work_map_admission( &entry.modeling_finding_receipt_id, "repo-work map Modeling finding receipt id", )?; + validate_non_empty(&entry.modeling_route_id, "repo-work map Modeling route id")?; if !entry.durable_state_admitted || entry.private_state_exposed { return Err(anyhow!( "repo-work map admission requires admitted, private-state-sealed state" @@ -2075,14 +2076,21 @@ pub fn commit_repo_work_map_admission( let modeling = cache .get::(&entry.modeling_finding_receipt_id)? .ok_or_else(|| anyhow!("repo-work map admission requires typed Modeling finding"))?; + let route = cache + .get::(&entry.modeling_route_id)? + .ok_or_else(|| anyhow!("repo-work map admission requires current Modeling route"))?; if modeling.item != entry.item || modeling.soul_verdict_receipt_id != entry.soul_verdict_receipt_id || modeling.commit_sha != entry.commit_sha || modeling.changed_paths != entry.changed_paths || modeling.summary != entry.modeling_summary + || modeling.verdict.trim().to_ascii_lowercase() != "passed" + || route.item != entry.item + || route.generation != entry.modeling_generation + || route.request_id != modeling.request_id { return Err(anyhow!( - "repo-work map entry does not match its typed Modeling finding" + "repo-work map entry does not match its passing current-generation Modeling finding" )); } if let Some(existing) = cache.get::(&entry.map_entry_id)? { diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 0314362e..6611d9e5 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -289,6 +289,13 @@ checks in native launch/coordinator code reject renewed Codex route authority. | Verse privacy/authority | CultMesh/Verse focused smokes and typed receipt readbacks | | Public crossings | Persona/Bifrost bridge smokes with private-state seals | +Repo-work map admission is a canonical generation-bound transaction. A map +entry names its `RepoWorkModelingRoute` and generation; the runtime spine loads +that route and admits only a passing immutable finding selected by the route's +current request. CLI closure is a caller of this invariant, not its owner. +Non-passing findings and stale generations therefore cannot become durable Mind +state even through a forged-looking admission call. + ## Current Cut Line Keep: diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index f4ea45f9..0c587dd3 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -2130,6 +2130,15 @@ type-check. Next add a native end-to-end generation-one smoke that begins with a non-passing runtime finding, exercises `revise-modeling`, launches `g1` through Idunn/preflight, and proves generation zero cannot close or regain current authority. +Map admission is now generation-bound at the canonical transaction boundary. +`RepoWorkMapEntry` carries the stable Modeling route id and generation, and +`commit_repo_work_map_admission` loads the current route and requires the +referenced immutable finding to be passing, current, and selected by that +route. The CLI is no longer the only thing preventing a non-passing or stale +finding from entering durable Mind state. The authority suite includes the +negative non-passing admission path and remains 4/4 green. The next move is +still the native generation-one workflow smoke; it must exercise these gates, +not recreate them in orchestration code. ## Immediate Re-entry Instruction diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 37b34e6d..4a4e2dfd 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 2633c63e..f7588d4b 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -659,4 +659,4 @@ current_status: - Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass. - `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure. last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. Gjallar readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync. - next_action: Add a native end-to-end generation-one repo-work Modeling smoke. Begin with a non-passing runtime-authored generation-zero finding, exercise the explicit Mind-reviewed revise-modeling mouth, launch generation one through Idunn plus runtime-schema preflight, admit only generation one, and prove generation zero cannot close or regain current authority. + next_action: Add a native end-to-end generation-one repo-work Modeling smoke. Begin with a non-passing runtime-authored generation-zero finding, exercise the explicit Mind-reviewed revise-modeling mouth, launch generation one through Idunn plus runtime-schema preflight, admit only generation one through the canonical generation-bound map transaction, and prove generation zero cannot close or regain current authority.