From 9657e89f9be7f003ca33f001ed89ebc6d3b1ee1e Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 01:27:48 +0100 Subject: [PATCH] Bind consensus accounting to feedback --- epiphany-core/src/bin/epiphany-verse-query.rs | 87 +++++++++++++++++- ...onceptual-substitution-audit-2026-07-12.md | 19 ++++ notes/fresh-workspace-handoff.md | 5 + state/ledgers.msgpack | Bin 455479 -> 455907 bytes state/map.yaml | 2 +- 5 files changed, 107 insertions(+), 6 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-verse-query.rs b/epiphany-core/src/bin/epiphany-verse-query.rs index ea902be2..cd9d989a 100644 --- a/epiphany-core/src/bin/epiphany-verse-query.rs +++ b/epiphany-core/src/bin/epiphany-verse-query.rs @@ -8055,20 +8055,23 @@ fn bifrost_accounting_rows( latest_metrics, ); + let matching_consensus = latest_feedback.and_then(|feedback| { + latest_consensus.filter(|receipt| receipt.feedback_id == feedback.feedback_id) + }); let collaboration_private = latest_feedback .map(|feedback| feedback.private_state_included) .unwrap_or(false) - || latest_consensus + || matching_consensus .map(|receipt| receipt.private_state_exposed) .unwrap_or(false); let collaboration_public_count = latest_feedback .map(|feedback| feedback.public_discussion_refs.len()) .unwrap_or(0) - + latest_consensus + + matching_consensus .map(|receipt| receipt.public_feedback_refs.len()) .unwrap_or(0); let collaboration_closed = - latest_feedback.is_some() && latest_consensus.is_some() && !collaboration_private; + latest_feedback.is_some() && matching_consensus.is_some() && !collaboration_private; push_bifrost_accounting_row( &mut rows, &mut tui_rows, @@ -8083,11 +8086,11 @@ fn bifrost_accounting_rows( closure: format!( "feedback={} consensus={} publicRefs={}", present_word(latest_feedback.is_some()), - present_word(latest_consensus.is_some()), + present_word(matching_consensus.is_some()), collaboration_public_count ), ledger_entry_id: "none".to_string(), - latest_receipt_id: latest_consensus + latest_receipt_id: matching_consensus .map(|receipt| receipt.receipt_id.clone()) .or_else(|| latest_feedback.map(|feedback| feedback.feedback_id.clone())) .unwrap_or_else(|| "none".to_string()), @@ -9501,6 +9504,45 @@ mod lifecycle_projection_tests { } } + fn collaboration_feedback(id: &str) -> EpiphanyCultMeshBifrostCollaborationFeedbackEntry { + EpiphanyCultMeshBifrostCollaborationFeedbackEntry { + schema_version: + epiphany_core::EPIPHANY_CULTMESH_BIFROST_COLLABORATION_FEEDBACK_SCHEMA_VERSION + .to_string(), + feedback_id: id.to_string(), + source_persona_id: "persona-1".to_string(), + source_cluster_id: "persona".to_string(), + public_room_id: "room-1".to_string(), + eve_connection_receipt_id: "eve-1".to_string(), + collaboration_topic: "test".to_string(), + feedback_summary: "test".to_string(), + public_discussion_refs: vec!["discussion-1".to_string()], + requested_consensus_route: "imagination.consensus".to_string(), + candidate_action_refs: Vec::new(), + private_state_included: false, + notes: Vec::new(), + } + } + + fn consensus(feedback_id: &str) -> EpiphanyCultMeshImaginationConsensusReceiptEntry { + EpiphanyCultMeshImaginationConsensusReceiptEntry { + schema_version: + epiphany_core::EPIPHANY_CULTMESH_IMAGINATION_CONSENSUS_RECEIPT_SCHEMA_VERSION + .to_string(), + receipt_id: "consensus-1".to_string(), + feedback_id: feedback_id.to_string(), + source_persona_id: "persona-1".to_string(), + consensus_route: "imagination.consensus".to_string(), + status: "accepted".to_string(), + imagination_agent_ids: vec!["imagination-1".to_string()], + consensus_packet_ref: "packet-1".to_string(), + adoption_gate: "mind-review".to_string(), + public_feedback_refs: vec!["public-feedback-1".to_string()], + private_state_exposed: false, + notes: Vec::new(), + } + } + fn receipt( id: &str, status: &str, @@ -9591,4 +9633,39 @@ mod lifecycle_projection_tests { assert!(mismatched[0].closure.contains("publication=missing")); assert!(mismatched[0].closure.contains("github=missing")); } + + #[test] + fn collaboration_accounting_closes_only_matching_feedback_consensus() { + let feedback = collaboration_feedback("feedback-1"); + let matching_consensus = consensus("feedback-1"); + let (matching, _) = bifrost_accounting_rows( + None, + None, + None, + None, + None, + None, + Some(&feedback), + Some(&matching_consensus), + &[], + ); + assert_eq!(matching.last().unwrap().status, "closed"); + + let unrelated_consensus = consensus("another-feedback"); + let (mismatched, _) = bifrost_accounting_rows( + None, + None, + None, + None, + None, + None, + Some(&feedback), + Some(&unrelated_consensus), + &[], + ); + let row = mismatched.last().unwrap(); + assert_eq!(row.status, "open"); + assert!(row.closure.contains("consensus=missing")); + assert_eq!(row.public_artifact_count, 1); + } } diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 47928b48..b3074421 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -671,6 +671,25 @@ Composition now follows the existing typed edges: publication omits unmatched descendants, and accounting reports the lane open with missing links instead of blessing adjacency as completion. +## Independent collaboration mirrors substituted for consensus + +The collaboration accounting lane closed whenever any latest Persona feedback +and any latest Imagination consensus receipt coexisted. It ignored the typed +`consensus.feedback_id -> feedback.feedback_id` edge, so consensus for another +conversation could complete the current lane and donate unrelated public refs. +Closure and consensus-derived counts now use only a receipt whose feedback ID +matches the displayed feedback. An unmatched receipt remains visible to raw +diagnostics but the lane stays open and names the missing consensus link. + +## Unresolved: artifact and metrics receipts lack request identity + +Bifrost artifact-acceptance and metrics accounting combine latest repo-work +requests with latest provider receipts, but those receipt contracts carry no +repo-work map/request ID. Item, workspace, branch, and commit fields are not a +stable causal identity and must not be promoted into one by consumer inference. +The provider contracts need an explicit request/map identity edge before these +lanes can truthfully claim request-to-receipt closure under concurrency. + ## Unresolved: provider receipts without chronology Bifrost body-change/GitHub publication receipts are externally owned and their diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 708c8c3c..b58ff8de 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -168,6 +168,11 @@ The confirmed conceptual substitutions have been cut: - Bifrost prompt/accounting chains follow typed intent -> publication -> GitHub receipt identity. Independent latest documents cannot close publication, lend review/credit counts, or supply a counterfeit public reference. +- Collaboration accounting follows consensus `feedback_id`; unrelated latest + consensus cannot close another Persona feedback lane or lend public refs. +- Artifact-acceptance and metrics receipts still lack an explicit repo-work + request/map identity. Do not infer it from item/workspace/branch/commit; + repair the Bifrost-owned contracts before claiming concurrent-safe closure. - Bifrost provider receipt contracts still lack provider timestamp/revision. Do not invent consumer-side ordering; repair that in a Bifrost-owned schema. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 2ffea42932248bf01ccd602d6439ef5d385856d1..4ee2005134b7929cedf50d062e69b4b6a62cba1f 100644 GIT binary patch delta 412 zcmYjNyGlbr5cNjAg;tglgaKPk3X6aiqJoe*olV&6&W%epJ2$&?69gfJg&!axyzlA8<*>h&*oW*DT@%xd}ba^7C%ds*vg**TcrUy*aFM?tYA4@zsQJX_xf?I@xFDONt9Q!I~k zMuq~>^pqYnHTj4>RuK&8YKWd=1KJFpCQwLYnnd`;G=6AZYk+CpWt!Uj|2Px8EP$av z%YR%5I8@e0pb}+EZ$K;WiNT@dWz}<53#O3q7nKpFa*?E