Type consensus preparation authority
This commit is contained in:
parent
27689867d6
commit
37d261a120
7 changed files with 158 additions and 26 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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<String, bool>,
|
||||
}
|
||||
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<String>,
|
||||
candidate_action_refs: Vec<String>,
|
||||
feedback_source: String,
|
||||
}
|
||||
pub(super) fn parse_repo_consensus_brief(text: &str) -> Result<RepoConsensusBrief> {
|
||||
toml::from_str(text).context("consensus brief is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoInterpreterBrief {
|
||||
pub(super) schema_version: String,
|
||||
|
|
|
|||
|
|
@ -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#"
|
||||
|
|
|
|||
Reference in a new issue