Separate collaboration proposal authority
This commit is contained in:
parent
c04b5f1a31
commit
59c64e1925
10 changed files with 330 additions and 64 deletions
|
|
@ -208,11 +208,11 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
require_text(&topic_text, "[topic]")?;
|
||||
require_text(
|
||||
&topic_text,
|
||||
"public_room = \"epiphany-global/persona-collaboration/repo-collaboration-topic-family\"",
|
||||
"requested_public_room = \"epiphany-global/persona-collaboration/repo-collaboration-topic-family\"",
|
||||
)?;
|
||||
require_text(
|
||||
&topic_text,
|
||||
"eve_surface = \"eve://epiphany/repo/repo-collaboration-topic-family/collaboration\"",
|
||||
"requested_eve_surface = \"eve://epiphany/repo/repo-collaboration-topic-family/collaboration\"",
|
||||
)?;
|
||||
require_text(&topic_text, "persona_discussion_allowed = true")?;
|
||||
require_text(&topic_text, "human_discussion_allowed = true")?;
|
||||
|
|
|
|||
|
|
@ -2727,6 +2727,13 @@ fn derive_repo_manifest_plan(
|
|||
format!("candidate_action_refs = {}", toml_array(&candidate_refs)),
|
||||
format!("public_discussion_refs = {}", toml_array(&public_refs)),
|
||||
String::new(),
|
||||
"[policy]".to_string(),
|
||||
"status = \"proposed\"".to_string(),
|
||||
"authoring_owner = \"Imagination\"".to_string(),
|
||||
"required_reviewers = [\"Persona\", \"Mind\"]".to_string(),
|
||||
"policy_admitted = false".to_string(),
|
||||
"publication_owner = \"Bifrost\"".to_string(),
|
||||
String::new(),
|
||||
"[body]".to_string(),
|
||||
format!("domain = {}", toml_basic_string(&body_domain)),
|
||||
"authority_owner = \"Epiphany Self\"".to_string(),
|
||||
|
|
@ -3319,8 +3326,15 @@ fn derive_repo_collaboration_topic_plan(
|
|||
String::new(),
|
||||
"[topic]".to_string(),
|
||||
format!("id = {}", toml_basic_string(&topic_id)),
|
||||
format!("public_room = {}", toml_basic_string(&public_room)),
|
||||
format!("eve_surface = {}", toml_basic_string(&eve_surface)),
|
||||
"status = \"proposed\"".to_string(),
|
||||
"authoring_owner = \"Imagination\"".to_string(),
|
||||
"discussion_owner = \"Persona\"".to_string(),
|
||||
"publication_owner = \"Bifrost\"".to_string(),
|
||||
format!("requested_public_room = {}", toml_basic_string(&public_room)),
|
||||
format!("requested_eve_surface = {}", toml_basic_string(&eve_surface)),
|
||||
"public_room_published = false".to_string(),
|
||||
"eve_surface_published = false".to_string(),
|
||||
"provider_receipt_required = true".to_string(),
|
||||
"persona_discussion_allowed = true".to_string(),
|
||||
"human_discussion_allowed = true".to_string(),
|
||||
"agent_friendly_tui = true".to_string(),
|
||||
|
|
@ -6529,152 +6543,137 @@ fn closure_family_assertions(
|
|||
);
|
||||
}
|
||||
"repo.collaboration_policy" => {
|
||||
let policy = parse_repo_collaboration_policy(&content).ok();
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-schema-present",
|
||||
content.contains("schema_version = \"epiphany.repo_collaboration_policy.v0\""),
|
||||
policy
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationPolicy::has_canonical_identity),
|
||||
"Committed collaboration policy carries the schema version.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-family-present",
|
||||
content.contains("safe_action_family = \"repo.collaboration_policy\""),
|
||||
policy
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationPolicy::has_canonical_identity),
|
||||
"Committed collaboration policy carries the safe action family.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-summary-present",
|
||||
content.contains(&compact_summary),
|
||||
policy
|
||||
.as_ref()
|
||||
.is_some_and(|value| value.summary == compact_summary),
|
||||
"Committed collaboration policy contains the accepted pressure summary."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-body-truth",
|
||||
content.contains("[body]")
|
||||
&& content.contains("provider_owns_truth = true")
|
||||
&& content.contains("renderer_owns_truth = false"),
|
||||
policy
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationPolicy::preserves_provider_truth)
|
||||
&& policy
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationPolicy::remains_proposal),
|
||||
"Committed collaboration policy preserves provider ownership.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-verse-boundaries",
|
||||
content.contains("[verses]")
|
||||
&& content.contains("private = \"epiphany-internal\"")
|
||||
&& content.contains("local = \"gamecult-local\"")
|
||||
&& content.contains("public = \"epiphany-global\"")
|
||||
&& content.contains("private_state_may_leave_repo = false")
|
||||
&& content.contains("odin_discoverable = true"),
|
||||
policy.as_ref().is_some_and(RepoCollaborationPolicy::has_verse_boundaries),
|
||||
"Committed collaboration policy names private/local/public Verse boundaries and Odin discovery.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-eve-connection",
|
||||
content.contains("[eve]")
|
||||
&& content.contains("surface = \"eve://epiphany/repo/")
|
||||
&& content.contains("compact_tui_required = true")
|
||||
&& content.contains("connection_receipt_required = true")
|
||||
&& content.contains("\"submit-feedback\""),
|
||||
policy
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationPolicy::has_eve_request),
|
||||
"Committed collaboration policy names the Eve connection contract.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-persona-feedback",
|
||||
content.contains("[persona]")
|
||||
&& content.contains("public_discussion_allowed = true")
|
||||
&& content.contains("human_discussion_allowed = true")
|
||||
&& content.contains("peer_persona_discussion_allowed = true")
|
||||
&& content.contains("speech_audit_required = true")
|
||||
&& content.contains("feedback_must_route_to_imagination = true"),
|
||||
policy.as_ref().is_some_and(RepoCollaborationPolicy::has_persona_route),
|
||||
"Committed collaboration policy routes Persona/human/peer feedback through audited public discussion.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-imagination-route",
|
||||
content.contains("[imagination]")
|
||||
&& content.contains("feedback_route = \"imagination://repo/")
|
||||
&& content.contains("consensus_required_before_adoption = true")
|
||||
&& content.contains("candidate_actions_non_authoritative = true")
|
||||
&& content.contains("mind_adoption_required = true")
|
||||
&& content.contains("bifrost_publication_required = true"),
|
||||
policy.as_ref().is_some_and(RepoCollaborationPolicy::has_imagination_route),
|
||||
"Committed collaboration policy routes feedback to Imagination before Mind/Bifrost gates.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-authority-seals",
|
||||
content.contains("[authority]")
|
||||
&& content.contains("direct_hands_authority = false")
|
||||
&& content.contains("direct_mind_state_commit = false")
|
||||
&& content.contains("direct_publication_authority = false")
|
||||
&& content.contains("direct_merge_authority = false")
|
||||
&& content.contains("service_lifecycle_authority = false")
|
||||
&& content.contains("cross_body_mutation_authority = false")
|
||||
&& content.contains("private_verse_rummaging = false")
|
||||
&& content.contains("requires_cultmesh_receipts = true"),
|
||||
policy.as_ref().is_some_and(RepoCollaborationPolicy::has_authority_seals),
|
||||
"Committed collaboration policy denies direct action/state/publication/service/cross-body authority.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-policy-private-seal",
|
||||
content.contains("private_state_exposed = false"),
|
||||
policy
|
||||
.as_ref()
|
||||
.is_some_and(|value| !value.private_state_exposed),
|
||||
"Committed collaboration policy preserves the private-state seal.".to_string(),
|
||||
);
|
||||
}
|
||||
"repo.collaboration_topic" => {
|
||||
let topic = parse_repo_collaboration_topic(&content).ok();
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-schema-present",
|
||||
content.contains("schema_version = \"epiphany.repo_collaboration_topic.v0\""),
|
||||
topic
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationTopic::has_canonical_identity),
|
||||
"Committed collaboration topic carries the schema version.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-family-present",
|
||||
content.contains("safe_action_family = \"repo.collaboration_topic\""),
|
||||
topic
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationTopic::has_canonical_identity),
|
||||
"Committed collaboration topic carries the safe action family.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-summary-present",
|
||||
content.contains(&compact_summary),
|
||||
topic
|
||||
.as_ref()
|
||||
.is_some_and(|value| value.summary == compact_summary),
|
||||
"Committed collaboration topic contains the accepted pressure summary.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-public-surface",
|
||||
content.contains("[topic]")
|
||||
&& content.contains("public_room = \"epiphany-global/persona-collaboration/")
|
||||
&& content.contains("eve_surface = \"eve://epiphany/repo/")
|
||||
&& content.contains("persona_discussion_allowed = true")
|
||||
&& content.contains("human_discussion_allowed = true"),
|
||||
topic
|
||||
.as_ref()
|
||||
.is_some_and(RepoCollaborationTopic::remains_unpublished_proposal),
|
||||
"Committed collaboration topic names public discussion and Eve surfaces."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-imagination-route",
|
||||
content.contains("[imagination]")
|
||||
&& content.contains("consensus_route = \"imagination://repo/")
|
||||
&& content.contains("consensus_required_before_action = true")
|
||||
&& content.contains("candidate_actions_are_non_authoritative = true")
|
||||
&& content.contains("mind_adoption_required = true"),
|
||||
topic.as_ref().is_some_and(RepoCollaborationTopic::has_imagination_route),
|
||||
"Committed collaboration topic routes feedback to Imagination consensus before adoption.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-authority-seals",
|
||||
content.contains("[authority]")
|
||||
&& content.contains("adoption_authorized = false")
|
||||
&& content.contains("hands_action_authorized = false")
|
||||
&& content.contains("publication_authorized = false")
|
||||
&& content.contains("cross_body_mutation_authorized = false")
|
||||
&& content.contains("private_verse_rummaging = false"),
|
||||
topic.as_ref().is_some_and(RepoCollaborationTopic::has_authority_seals),
|
||||
"Committed collaboration topic denies action, publication, cross-body, and private-rummaging authority.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"collaboration-topic-private-seal",
|
||||
content.contains("private_state_exposed = false"),
|
||||
topic
|
||||
.as_ref()
|
||||
.is_some_and(|value| !value.private_state_exposed),
|
||||
"Committed collaboration topic preserves the private-state seal.".to_string(),
|
||||
);
|
||||
}
|
||||
|
|
@ -14533,6 +14532,8 @@ idunn_deployment_authority_required = true
|
|||
"repo.sync_request",
|
||||
"repo.pr_request",
|
||||
"repo.maintainer_review_request",
|
||||
"repo.collaboration_policy",
|
||||
"repo.collaboration_topic",
|
||||
"repo.consensus_brief",
|
||||
"repo.interpreter_brief",
|
||||
"repo.objective_draft",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
include!("closure_contracts/external_governance.rs");
|
||||
include!("closure_contracts/collaboration.rs");
|
||||
include!("closure_contracts/preparation.rs");
|
||||
include!("closure_contracts/workflow.rs");
|
||||
include!("closure_contracts/operations.rs");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,196 @@
|
|||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoCollaborationPolicy {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
policy: CollaborationPolicyProposal,
|
||||
body: CollaborationBody,
|
||||
verses: std::collections::BTreeMap<String, toml::Value>,
|
||||
eve: CollaborationEve,
|
||||
persona: std::collections::BTreeMap<String, bool>,
|
||||
imagination: CollaborationImagination,
|
||||
authority: std::collections::BTreeMap<String, bool>,
|
||||
}
|
||||
impl RepoCollaborationPolicy {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_collaboration_policy.v0"
|
||||
&& self.safe_action_family == "repo.collaboration_policy"
|
||||
}
|
||||
pub(super) fn remains_proposal(&self) -> bool {
|
||||
self.policy.status == "proposed"
|
||||
&& self.policy.authoring_owner == "Imagination"
|
||||
&& self.policy.required_reviewers == ["Persona", "Mind"]
|
||||
&& !self.policy.policy_admitted
|
||||
&& self.policy.publication_owner == "Bifrost"
|
||||
}
|
||||
pub(super) fn preserves_provider_truth(&self) -> bool {
|
||||
self.body.provider_owns_truth && !self.body.renderer_owns_truth
|
||||
}
|
||||
pub(super) fn has_verse_boundaries(&self) -> bool {
|
||||
self.verses.get("private").and_then(toml::Value::as_str) == Some("epiphany-internal")
|
||||
&& self.verses.get("local").and_then(toml::Value::as_str) == Some("gamecult-local")
|
||||
&& self.verses.get("public").and_then(toml::Value::as_str) == Some("epiphany-global")
|
||||
&& self
|
||||
.verses
|
||||
.get("private_state_may_leave_repo")
|
||||
.and_then(toml::Value::as_bool)
|
||||
== Some(false)
|
||||
&& self
|
||||
.verses
|
||||
.get("odin_discoverable")
|
||||
.and_then(toml::Value::as_bool)
|
||||
== Some(true)
|
||||
}
|
||||
pub(super) fn has_eve_request(&self) -> bool {
|
||||
self.eve.surface.starts_with("eve://epiphany/repo/")
|
||||
&& self.eve.compact_tui_required
|
||||
&& self.eve.connection_receipt_required
|
||||
&& self.eve.supported_actions == ["read-queue", "discuss", "submit-feedback"]
|
||||
}
|
||||
pub(super) fn has_persona_route(&self) -> bool {
|
||||
[
|
||||
"public_discussion_allowed",
|
||||
"human_discussion_allowed",
|
||||
"peer_persona_discussion_allowed",
|
||||
"speech_audit_required",
|
||||
"feedback_must_route_to_imagination",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.persona.get(*key) == Some(&true))
|
||||
}
|
||||
pub(super) fn has_imagination_route(&self) -> bool {
|
||||
self.imagination
|
||||
.feedback_route
|
||||
.starts_with("imagination://repo/")
|
||||
&& self.imagination.consensus_required_before_adoption
|
||||
&& self.imagination.candidate_actions_non_authoritative
|
||||
&& self.imagination.mind_adoption_required
|
||||
&& self.imagination.bifrost_publication_required
|
||||
}
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
[
|
||||
"direct_hands_authority",
|
||||
"direct_mind_state_commit",
|
||||
"direct_publication_authority",
|
||||
"direct_merge_authority",
|
||||
"service_lifecycle_authority",
|
||||
"cross_body_mutation_authority",
|
||||
"private_verse_rummaging",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.authority.get(*key) == Some(&false))
|
||||
&& self.authority.get("requires_cultmesh_receipts") == Some(&true)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CollaborationPolicyProposal {
|
||||
status: String,
|
||||
authoring_owner: String,
|
||||
required_reviewers: Vec<String>,
|
||||
policy_admitted: bool,
|
||||
publication_owner: String,
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CollaborationBody {
|
||||
provider_owns_truth: bool,
|
||||
renderer_owns_truth: bool,
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CollaborationEve {
|
||||
surface: String,
|
||||
compact_tui_required: bool,
|
||||
connection_receipt_required: bool,
|
||||
supported_actions: Vec<String>,
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CollaborationImagination {
|
||||
feedback_route: String,
|
||||
consensus_required_before_adoption: bool,
|
||||
candidate_actions_non_authoritative: bool,
|
||||
mind_adoption_required: bool,
|
||||
bifrost_publication_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoCollaborationTopic {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
topic: CollaborationTopicProposal,
|
||||
imagination: CollaborationTopicImagination,
|
||||
authority: std::collections::BTreeMap<String, bool>,
|
||||
}
|
||||
impl RepoCollaborationTopic {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_collaboration_topic.v0"
|
||||
&& self.safe_action_family == "repo.collaboration_topic"
|
||||
}
|
||||
pub(super) fn remains_unpublished_proposal(&self) -> bool {
|
||||
let t = &self.topic;
|
||||
t.status == "proposed"
|
||||
&& t.authoring_owner == "Imagination"
|
||||
&& t.discussion_owner == "Persona"
|
||||
&& t.publication_owner == "Bifrost"
|
||||
&& t.requested_public_room
|
||||
.starts_with("epiphany-global/persona-collaboration/")
|
||||
&& t.requested_eve_surface.starts_with("eve://epiphany/repo/")
|
||||
&& !t.public_room_published
|
||||
&& !t.eve_surface_published
|
||||
&& t.provider_receipt_required
|
||||
&& t.persona_discussion_allowed
|
||||
&& t.human_discussion_allowed
|
||||
}
|
||||
pub(super) fn has_imagination_route(&self) -> bool {
|
||||
self.imagination
|
||||
.consensus_route
|
||||
.starts_with("imagination://repo/")
|
||||
&& self.imagination.consensus_required_before_action
|
||||
&& self.imagination.candidate_actions_are_non_authoritative
|
||||
&& self.imagination.mind_adoption_required
|
||||
&& self.imagination.bifrost_publication_required
|
||||
}
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
[
|
||||
"adoption_authorized",
|
||||
"hands_action_authorized",
|
||||
"publication_authorized",
|
||||
"cross_body_mutation_authorized",
|
||||
"private_verse_rummaging",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.authority.get(*key) == Some(&false))
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CollaborationTopicProposal {
|
||||
status: String,
|
||||
authoring_owner: String,
|
||||
discussion_owner: String,
|
||||
publication_owner: String,
|
||||
requested_public_room: String,
|
||||
requested_eve_surface: String,
|
||||
public_room_published: bool,
|
||||
eve_surface_published: bool,
|
||||
provider_receipt_required: bool,
|
||||
persona_discussion_allowed: bool,
|
||||
human_discussion_allowed: bool,
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CollaborationTopicImagination {
|
||||
consensus_route: String,
|
||||
consensus_required_before_action: bool,
|
||||
candidate_actions_are_non_authoritative: bool,
|
||||
mind_adoption_required: bool,
|
||||
bifrost_publication_required: bool,
|
||||
}
|
||||
|
||||
pub(super) fn parse_repo_collaboration_policy(text: &str) -> Result<RepoCollaborationPolicy> {
|
||||
toml::from_str(text).context("collaboration policy is not valid typed TOML")
|
||||
}
|
||||
pub(super) fn parse_repo_collaboration_topic(text: &str) -> Result<RepoCollaborationTopic> {
|
||||
toml::from_str(text).context("collaboration topic is not valid typed TOML")
|
||||
}
|
||||
|
||||
include!("collaboration_tests.rs");
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#[cfg(test)]
|
||||
mod collaboration_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn topic_comment_cannot_counterfeit_publication_state() {
|
||||
let text = r#"
|
||||
schema_version = "epiphany.repo_collaboration_topic.v0"
|
||||
safe_action_family = "repo.collaboration_topic"
|
||||
summary = "summary"
|
||||
private_state_exposed = false
|
||||
[topic]
|
||||
status = "proposed"
|
||||
authoring_owner = "Imagination"
|
||||
discussion_owner = "Persona"
|
||||
publication_owner = "Bifrost"
|
||||
requested_public_room = "epiphany-global/persona-collaboration/item"
|
||||
requested_eve_surface = "eve://epiphany/repo/item/collaboration"
|
||||
# public_room_published = false
|
||||
public_room_published = true
|
||||
eve_surface_published = false
|
||||
provider_receipt_required = true
|
||||
persona_discussion_allowed = true
|
||||
human_discussion_allowed = true
|
||||
[imagination]
|
||||
consensus_route = "imagination://repo/item/consensus-discovery"
|
||||
consensus_required_before_action = true
|
||||
candidate_actions_are_non_authoritative = true
|
||||
mind_adoption_required = true
|
||||
bifrost_publication_required = true
|
||||
[authority]
|
||||
adoption_authorized = false
|
||||
hands_action_authorized = false
|
||||
publication_authorized = false
|
||||
cross_body_mutation_authorized = false
|
||||
private_verse_rummaging = false
|
||||
"#;
|
||||
let topic = parse_repo_collaboration_topic(text).expect("fixture is typed TOML");
|
||||
assert!(!topic.remains_unpublished_proposal());
|
||||
}
|
||||
}
|
||||
Reference in a new issue