From 37d261a120728532dc40f339edae8f71b7c74bac Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 03:51:34 +0100 Subject: [PATCH] Type consensus preparation authority --- epiphany-core/src/bin/epiphany-work.rs | 47 +++++----- .../closure_contracts/preparation.rs | 81 ++++++++++++++++++ .../closure_contracts/preparation_tests.rs | 35 ++++++++ ...onceptual-substitution-audit-2026-07-12.md | 12 +++ notes/fresh-workspace-handoff.md | 7 ++ state/ledgers.msgpack | Bin 471520 -> 471847 bytes state/map.yaml | 2 +- 7 files changed, 158 insertions(+), 26 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index e0a31e86..773ff4ea 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -6898,70 +6898,66 @@ fn closure_family_assertions( ); } "repo.consensus_brief" => { + let brief = parse_repo_consensus_brief(&content).ok(); push_assertion( &mut assertions, "consensus-brief-schema-present", - content.contains("schema_version = \"epiphany.repo_consensus_brief.v0\""), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::has_canonical_identity), "Committed consensus brief carries the schema version.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-family-present", - content.contains("safe_action_family = \"repo.consensus_brief\""), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::has_canonical_identity), "Committed consensus brief carries the safe action family.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-summary-present", - content.contains(&compact_summary), + brief + .as_ref() + .is_some_and(|value| value.summary == compact_summary), "Committed consensus brief contains the accepted pressure summary.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-draft-state", - content.contains("[consensus]") - && content.contains("status = \"draft\"") - && content.contains("converged = false") - && content.contains("conflicts_remaining = true") - && content.contains("requires_human_or_persona_review = true"), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::remains_unconverged_draft), "Committed consensus brief remains a draft requiring review.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-imagination-route", - content.contains("[imagination]") - && content.contains("role = \"consensus-discovery\"") - && content.contains("candidate_actions_non_authoritative = true") - && content.contains("may_emit_action_items_receipt = true") - && content.contains("must_not_read_private_verses = true"), + brief.as_ref().is_some_and(RepoConsensusBrief::has_imagination_route), "Committed consensus brief routes through Imagination without private Verse rummaging.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-inputs-present", - content.contains("[inputs]") - && content.contains("public_discussion_refs = [") - && content.contains("candidate_action_refs = [") - && content.contains("feedback_source = \"Persona public discussion\""), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::has_input_contract), "Committed consensus brief preserves public feedback and candidate-action inputs." .to_string(), ); push_assertion( &mut assertions, "consensus-brief-authority-seals", - content.contains("[authority]") - && content.contains("objective_adoption_authorized = false") - && content.contains("hands_action_authorized = false") - && content.contains("publication_authorized = false") - && content.contains("cross_body_mutation_authorized = false") - && content.contains("mind_adoption_required = true") - && content.contains("bifrost_publication_required = true"), + brief.as_ref().is_some_and(RepoConsensusBrief::has_authority_seals), "Committed consensus brief denies adoption/action/publication/cross-body authority and requires Mind/Bifrost gates.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-private-seal", - content.contains("private_state_exposed = false"), + brief + .as_ref() + .is_some_and(|value| !value.private_state_exposed), "Committed consensus brief preserves the private-state seal.".to_string(), ); } @@ -15245,6 +15241,7 @@ idunn_deployment_authority_required = true "repo.sync_request", "repo.pr_request", "repo.maintainer_review_request", + "repo.consensus_brief", "repo.interpreter_brief", "repo.objective_draft", "repo.adoption_request", diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs index a06a1bd1..de2e7d26 100644 --- a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs @@ -1,3 +1,84 @@ +#[derive(Debug, Deserialize)] +pub(super) struct RepoConsensusBrief { + pub(super) schema_version: String, + pub(super) safe_action_family: String, + pub(super) summary: String, + pub(super) private_state_exposed: bool, + consensus: RepoConsensusState, + imagination: RepoConsensusImagination, + inputs: RepoConsensusInputs, + authority: std::collections::BTreeMap, +} +impl RepoConsensusBrief { + pub(super) fn has_canonical_identity(&self) -> bool { + self.schema_version == "epiphany.repo_consensus_brief.v0" + && self.safe_action_family == "repo.consensus_brief" + } + pub(super) fn remains_unconverged_draft(&self) -> bool { + self.consensus.status == "draft" + && !self.consensus.converged + && self.consensus.conflicts_remaining + && self.consensus.requires_human_or_persona_review + } + pub(super) fn has_imagination_route(&self) -> bool { + let i = &self.imagination; + i.role == "consensus-discovery" + && i.candidate_actions_non_authoritative + && i.may_emit_action_items_receipt + && i.must_preserve_public_refs + && i.must_not_read_private_verses + } + pub(super) fn has_input_contract(&self) -> bool { + self.inputs.feedback_source == "Persona public discussion" + && self + .inputs + .public_discussion_refs + .iter() + .all(|v| !v.trim().is_empty()) + && self + .inputs + .candidate_action_refs + .iter() + .all(|v| !v.trim().is_empty()) + } + pub(super) fn has_authority_seals(&self) -> bool { + [ + "objective_adoption_authorized", + "hands_action_authorized", + "publication_authorized", + "cross_body_mutation_authorized", + ] + .iter() + .all(|key| self.authority.get(*key) == Some(&false)) + && self.authority.get("mind_adoption_required") == Some(&true) + && self.authority.get("bifrost_publication_required") == Some(&true) + } +} +#[derive(Debug, Deserialize)] +struct RepoConsensusState { + status: String, + converged: bool, + conflicts_remaining: bool, + requires_human_or_persona_review: bool, +} +#[derive(Debug, Deserialize)] +struct RepoConsensusImagination { + role: String, + candidate_actions_non_authoritative: bool, + may_emit_action_items_receipt: bool, + must_preserve_public_refs: bool, + must_not_read_private_verses: bool, +} +#[derive(Debug, Deserialize)] +struct RepoConsensusInputs { + public_discussion_refs: Vec, + candidate_action_refs: Vec, + feedback_source: String, +} +pub(super) fn parse_repo_consensus_brief(text: &str) -> Result { + toml::from_str(text).context("consensus brief is not valid typed TOML") +} + #[derive(Debug, Deserialize)] pub(super) struct RepoInterpreterBrief { pub(super) schema_version: String, diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs index 486fc4ce..c3376d0d 100644 --- a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs @@ -2,6 +2,41 @@ mod preparation_tests { use super::*; + #[test] + fn consensus_comment_cannot_counterfeit_adoption_seal() { + let text = r#" +schema_version = "epiphany.repo_consensus_brief.v0" +safe_action_family = "repo.consensus_brief" +summary = "summary" +private_state_exposed = false +[consensus] +status = "draft" +converged = false +conflicts_remaining = true +requires_human_or_persona_review = true +[imagination] +role = "consensus-discovery" +candidate_actions_non_authoritative = true +may_emit_action_items_receipt = true +must_preserve_public_refs = true +must_not_read_private_verses = true +[inputs] +public_discussion_refs = [] +candidate_action_refs = [] +feedback_source = "Persona public discussion" +[authority] +# objective_adoption_authorized = false +objective_adoption_authorized = true +hands_action_authorized = false +publication_authorized = false +cross_body_mutation_authorized = false +mind_adoption_required = true +bifrost_publication_required = true +"#; + let brief = parse_repo_consensus_brief(text).expect("fixture is typed TOML"); + assert!(!brief.has_authority_seals()); + } + #[test] fn interpreter_comment_cannot_counterfeit_state_authority_seal() { let text = r#" diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 1615d3b6..c7f397ca 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -1119,6 +1119,18 @@ the class guard prevents the family returning to substring truth. Nineteen high-authority closure families are typed. Direct source inventory now reports 303 substring occurrences across fourteen remaining families. +## Consensus state as nearby prose + +`repo.consensus_brief` was semantically honest—it remained draft, +unconverged, conflict-bearing, and review-required—but closure inferred those +facts and its authority seals by substring. Typed preparation closure now reads +the actual consensus, Imagination route, public inputs, downstream gates, and +privacy state. The counterfeit-adoption fixture proves comments cannot turn a +real grant into an apparent denial. + +Twenty high-authority closure families are typed. Direct source inventory now +reports 278 substring occurrences across thirteen remaining families. + The same inspection found 33 consecutive duplicate `#[cfg(test)]` attributes on provider constructors/writers and their re-exports. One gate already makes each item test-only; the second owned nothing. The duplicates are removed. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 286f4062..32e37458 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -368,6 +368,13 @@ counterfeit-state-authority fixture. Nineteen high-authority families are typed; direct source inventory reports 303 substring occurrences across fourteen remaining families. +Consensus Brief keeps its honest draft/unconverged semantics but no longer +proves them with substring presence. Preparation owns its typed consensus, +Imagination route, inputs, authority, and privacy closure; a malicious comment +cannot counterfeit adoption denial. Twenty high-authority families are typed; +direct source inventory reports 278 substring occurrences across thirteen +remaining families. + The latest structural count is 32 closure family branches, 744 remaining substring assertions in the closure region, and 1,284 lines in `closure_contracts.rs`. Do not blindly generate a struct forest for every diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 2099c7b3e44f666fa1187e8bc377d5c317a151d5..5a0281f000d3268e3ea5d1e42cfe211c0bf48684 100644 GIT binary patch delta 265 zcmWm7u}Z`+90qVxub06|5G;7gU&PIxZAv}4)k(z7NfC@`+6H?`O;UXT5nsTPM{rbd z5JwlELlB$=U%=e(<6Azy@9TT?^fP*i&{CdGv+VS90h7V&7P>~Lx$A?6K0w|)7rlWO zdc(Iqz(>2wkMATQdvP*})9fT6)7*Xhh8yAPF>PCSaUVu!)IhByHx@d{l)T}(;sqSe zXeA`ILP;nzEiEvrE42f*<`Oh-8_Il5SOX*n(_I>?g{*+poLw2X6}ATJHd7p}jp0Cb y(sEsLVSyH^ov+4*)5e`|