Separate doctrine update authority
This commit is contained in:
parent
b0291d27cd
commit
e48e2ad521
8 changed files with 193 additions and 59 deletions
|
|
@ -222,7 +222,13 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
)?;
|
||||
require_text(&request_text, "[request]")?;
|
||||
require_text(&request_text, "status = \"awaiting-doctrine-review\"")?;
|
||||
require_text(&request_text, "requested_owner = \"Maintainer/Mind\"")?;
|
||||
require_text(&request_text, "routing_owner = \"Self\"")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"required_reviewers = [\"Maintainer\", \"Mind\", \"Soul\"]",
|
||||
)?;
|
||||
require_text(&request_text, "doctrine_admission_owner = \"Mind\"")?;
|
||||
require_text(&request_text, "mutation_owner = \"Hands\"")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"requested_effect = \"review-repo-agent-doctrine-update\"",
|
||||
|
|
@ -276,10 +282,9 @@ fn run_smoke(args: Args) -> Result<Value> {
|
|||
require_text(&request_text, "service_lifecycle_authority = false")?;
|
||||
require_text(&request_text, "cross_body_mutation_authorized = false")?;
|
||||
require_text(&request_text, "private_verse_rummaging = false")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"maintainer_or_mind_doctrine_authority_required = true",
|
||||
)?;
|
||||
require_text(&request_text, "maintainer_review_required = true")?;
|
||||
require_text(&request_text, "mind_admission_required = true")?;
|
||||
require_text(&request_text, "hands_receipts_required = true")?;
|
||||
require_text(&request_text, "private_state_exposed = false")?;
|
||||
require_text(
|
||||
&agents_text,
|
||||
|
|
|
|||
|
|
@ -5123,7 +5123,10 @@ fn derive_repo_doctrine_update_request_plan(
|
|||
"[request]".to_string(),
|
||||
format!("id = {}", toml_basic_string(&request_id)),
|
||||
"status = \"awaiting-doctrine-review\"".to_string(),
|
||||
"requested_owner = \"Maintainer/Mind\"".to_string(),
|
||||
"routing_owner = \"Self\"".to_string(),
|
||||
"required_reviewers = [\"Maintainer\", \"Mind\", \"Soul\"]".to_string(),
|
||||
"doctrine_admission_owner = \"Mind\"".to_string(),
|
||||
"mutation_owner = \"Hands\"".to_string(),
|
||||
"requested_effect = \"review-repo-agent-doctrine-update\"".to_string(),
|
||||
format!("doctrine_target = {}", toml_basic_string(doctrine_target)),
|
||||
"change_surface = \"repo-local agent instructions and operating doctrine\"".to_string(),
|
||||
|
|
@ -5163,7 +5166,9 @@ fn derive_repo_doctrine_update_request_plan(
|
|||
"service_lifecycle_authority = false".to_string(),
|
||||
"cross_body_mutation_authorized = false".to_string(),
|
||||
"private_verse_rummaging = false".to_string(),
|
||||
"maintainer_or_mind_doctrine_authority_required = true".to_string(),
|
||||
"maintainer_review_required = true".to_string(),
|
||||
"mind_admission_required = true".to_string(),
|
||||
"hands_receipts_required = true".to_string(),
|
||||
String::new(),
|
||||
"[verification]".to_string(),
|
||||
"asks = [".to_string(),
|
||||
|
|
@ -7194,106 +7199,73 @@ fn closure_family_assertions(
|
|||
);
|
||||
}
|
||||
"repo.doctrine_update_request" => {
|
||||
let request = parse_repo_doctrine_update_request(&content).ok();
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-schema-present",
|
||||
content.contains("schema_version = \"epiphany.repo_doctrine_update_request.v0\""),
|
||||
request
|
||||
.as_ref()
|
||||
.is_some_and(RepoDoctrineUpdateRequest::has_canonical_identity),
|
||||
"Committed doctrine update request carries the schema version.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-family-present",
|
||||
content.contains("safe_action_family = \"repo.doctrine_update_request\""),
|
||||
request
|
||||
.as_ref()
|
||||
.is_some_and(RepoDoctrineUpdateRequest::has_canonical_identity),
|
||||
"Committed doctrine update request carries the safe action family.".to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-summary-present",
|
||||
content.contains(&compact_summary),
|
||||
request
|
||||
.as_ref()
|
||||
.is_some_and(|value| value.summary == compact_summary),
|
||||
"Committed doctrine update request contains the accepted pressure summary."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-awaits-review",
|
||||
content.contains("[request]")
|
||||
&& content.contains("status = \"awaiting-doctrine-review\"")
|
||||
&& content.contains("requested_owner = \"Maintainer/Mind\"")
|
||||
&& content.contains(
|
||||
"requested_effect = \"review-repo-agent-doctrine-update\"",
|
||||
)
|
||||
&& content.contains("doctrine_target = \"AGENTS.md\"")
|
||||
&& content.contains("requires_source_grounding = true")
|
||||
&& content.contains("requires_human_or_maintainer_review = true"),
|
||||
request.as_ref().is_some_and(RepoDoctrineUpdateRequest::has_coherent_routing),
|
||||
"Committed doctrine update request waits for Mind/maintainer review before doctrine consequence."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-antecedents-present",
|
||||
content.contains("[antecedents]")
|
||||
&& content.contains("persona_or_human_feedback_required = true")
|
||||
&& content.contains("imagination_plan_required = true")
|
||||
&& content.contains("mind_adoption_required = true")
|
||||
&& content.contains("soul_review_required = true")
|
||||
&& content.contains("maintainer_review_required = true"),
|
||||
request.as_ref().is_some_and(RepoDoctrineUpdateRequest::has_antecedent_contract),
|
||||
"Committed doctrine update request requires feedback, Imagination, Mind, Soul, and maintainer antecedents."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-receipt-contract",
|
||||
content.contains("[required_receipts]")
|
||||
&& content.contains(
|
||||
"imagination_plan = \"epiphany.repo_work_imagination_action_items_receipt.v0\"",
|
||||
)
|
||||
&& content.contains(
|
||||
"mind_adoption = \"epiphany.repo_work_mind_adoption_decision.v0\"",
|
||||
)
|
||||
&& content.contains(
|
||||
"soul_review = \"epiphany.repo_work_closure_review.v0\"",
|
||||
)
|
||||
&& content.contains(
|
||||
"maintainer_review = \"gamecult.maintainer.review_receipt.v0\"",
|
||||
)
|
||||
&& content.contains("hands_commit = \"epiphany.hands.commit_receipt\""),
|
||||
request.as_ref().is_some_and(RepoDoctrineUpdateRequest::has_receipt_contract),
|
||||
"Committed doctrine update request names Imagination, Mind, Soul, maintainer, and Hands receipts."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-packet-contract",
|
||||
content.contains("[doctrine_packet]")
|
||||
&& content.contains("requires_current_doctrine_ref = true")
|
||||
&& content.contains("requires_proposed_change_summary = true")
|
||||
&& content.contains("requires_invariant_impact = true")
|
||||
&& content.contains("requires_rehydration_impact = true")
|
||||
&& content.contains("requires_rollback_plan = true")
|
||||
&& content.contains("requires_private_state_redaction_check = true"),
|
||||
request.as_ref().is_some_and(RepoDoctrineUpdateRequest::has_packet_contract),
|
||||
"Committed doctrine update request names doctrine diff, invariant, rehydration, rollback, and redaction requirements."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-authority-seals",
|
||||
content.contains("[authority]")
|
||||
&& content.contains("direct_doctrine_mutation_authority = false")
|
||||
&& content.contains("direct_hands_authority = false")
|
||||
&& content.contains("direct_mind_state_commit = false")
|
||||
&& content.contains("publication_authorized = false")
|
||||
&& content.contains("merge_authorized = false")
|
||||
&& content.contains("service_lifecycle_authority = false")
|
||||
&& content.contains("cross_body_mutation_authorized = false")
|
||||
&& content.contains("private_verse_rummaging = false")
|
||||
&& content
|
||||
.contains("maintainer_or_mind_doctrine_authority_required = true"),
|
||||
request.as_ref().is_some_and(RepoDoctrineUpdateRequest::has_authority_seals),
|
||||
"Committed doctrine update request denies doctrine/action/state/publication/service/cross-body authority."
|
||||
.to_string(),
|
||||
);
|
||||
push_assertion(
|
||||
&mut assertions,
|
||||
"doctrine-update-request-private-seal",
|
||||
content.contains("private_state_exposed = false"),
|
||||
request
|
||||
.as_ref()
|
||||
.is_some_and(|value| !value.private_state_exposed),
|
||||
"Committed doctrine update request preserves the private-state seal.".to_string(),
|
||||
);
|
||||
}
|
||||
|
|
@ -13978,6 +13950,7 @@ idunn_deployment_authority_required = true
|
|||
"repo.artifact_acceptance_request",
|
||||
"repo.metrics_request",
|
||||
"repo.readiness_review_request",
|
||||
"repo.doctrine_update_request",
|
||||
"repo.secret_policy_request",
|
||||
"repo.dependency_policy_request",
|
||||
"repo.deployment_config",
|
||||
|
|
@ -14032,6 +14005,35 @@ idunn_deployment_authority_required = true
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn doctrine_comment_cannot_counterfeit_hands_authority_seal() {
|
||||
let text = r#"
|
||||
schema_version = "epiphany.repo_doctrine_update_request.v0"
|
||||
safe_action_family = "repo.doctrine_update_request"
|
||||
summary = "summary"
|
||||
private_state_exposed = false
|
||||
[request]
|
||||
status = "awaiting-doctrine-review"
|
||||
routing_owner = "Self"
|
||||
required_reviewers = ["Maintainer", "Mind", "Soul"]
|
||||
doctrine_admission_owner = "Mind"
|
||||
mutation_owner = "Hands"
|
||||
requested_effect = "review-repo-agent-doctrine-update"
|
||||
doctrine_target = "AGENTS.md"
|
||||
requires_source_grounding = true
|
||||
requires_human_or_maintainer_review = true
|
||||
[antecedents]
|
||||
[required_receipts]
|
||||
[doctrine_packet]
|
||||
[authority]
|
||||
direct_doctrine_mutation_authority = false
|
||||
# direct_hands_authority = false
|
||||
direct_hands_authority = true
|
||||
"#;
|
||||
let request = parse_repo_doctrine_update_request(text).expect("fixture is typed TOML");
|
||||
assert!(!request.has_authority_seals());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modeling_finding_round_trips_and_refuses_private_state() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
|
|
|
|||
|
|
@ -549,3 +549,110 @@ impl RepoDeploymentRequest {
|
|||
pub(super) fn parse_repo_deployment_request(text: &str) -> Result<RepoDeploymentRequest> {
|
||||
toml::from_str(text).context("deployment request is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDoctrineUpdateRequest {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
request: RepoDoctrineRequestBody,
|
||||
antecedents: std::collections::BTreeMap<String, bool>,
|
||||
required_receipts: std::collections::BTreeMap<String, String>,
|
||||
doctrine_packet: std::collections::BTreeMap<String, bool>,
|
||||
authority: std::collections::BTreeMap<String, bool>,
|
||||
}
|
||||
impl RepoDoctrineUpdateRequest {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_doctrine_update_request.v0"
|
||||
&& self.safe_action_family == "repo.doctrine_update_request"
|
||||
}
|
||||
pub(super) fn has_coherent_routing(&self) -> bool {
|
||||
let r = &self.request;
|
||||
r.status == "awaiting-doctrine-review"
|
||||
&& r.routing_owner == "Self"
|
||||
&& r.required_reviewers == ["Maintainer", "Mind", "Soul"]
|
||||
&& r.doctrine_admission_owner == "Mind"
|
||||
&& r.mutation_owner == "Hands"
|
||||
&& r.requested_effect == "review-repo-agent-doctrine-update"
|
||||
&& r.doctrine_target == "AGENTS.md"
|
||||
&& r.requires_source_grounding
|
||||
&& r.requires_human_or_maintainer_review
|
||||
}
|
||||
pub(super) fn has_antecedent_contract(&self) -> bool {
|
||||
[
|
||||
"persona_or_human_feedback_required",
|
||||
"imagination_plan_required",
|
||||
"mind_adoption_required",
|
||||
"soul_review_required",
|
||||
"maintainer_review_required",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.antecedents.get(*key) == Some(&true))
|
||||
}
|
||||
pub(super) fn has_receipt_contract(&self) -> bool {
|
||||
[
|
||||
(
|
||||
"imagination_plan",
|
||||
"epiphany.repo_work_imagination_action_items_receipt.v0",
|
||||
),
|
||||
(
|
||||
"mind_adoption",
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
),
|
||||
("soul_review", "epiphany.repo_work_closure_review.v0"),
|
||||
("maintainer_review", "gamecult.maintainer.review_receipt.v0"),
|
||||
("hands_commit", "epiphany.hands.commit_receipt"),
|
||||
]
|
||||
.iter()
|
||||
.all(|(key, value)| self.required_receipts.get(*key).is_some_and(|v| v == value))
|
||||
}
|
||||
pub(super) fn has_packet_contract(&self) -> bool {
|
||||
[
|
||||
"requires_current_doctrine_ref",
|
||||
"requires_proposed_change_summary",
|
||||
"requires_invariant_impact",
|
||||
"requires_rehydration_impact",
|
||||
"requires_rollback_plan",
|
||||
"requires_private_state_redaction_check",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.doctrine_packet.get(*key) == Some(&true))
|
||||
}
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
[
|
||||
"direct_doctrine_mutation_authority",
|
||||
"direct_hands_authority",
|
||||
"direct_mind_state_commit",
|
||||
"publication_authorized",
|
||||
"merge_authorized",
|
||||
"service_lifecycle_authority",
|
||||
"cross_body_mutation_authorized",
|
||||
"private_verse_rummaging",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.authority.get(*key) == Some(&false))
|
||||
&& [
|
||||
"maintainer_review_required",
|
||||
"mind_admission_required",
|
||||
"hands_receipts_required",
|
||||
]
|
||||
.iter()
|
||||
.all(|key| self.authority.get(*key) == Some(&true))
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDoctrineRequestBody {
|
||||
status: String,
|
||||
routing_owner: String,
|
||||
required_reviewers: Vec<String>,
|
||||
doctrine_admission_owner: String,
|
||||
mutation_owner: String,
|
||||
requested_effect: String,
|
||||
doctrine_target: String,
|
||||
requires_source_grounding: bool,
|
||||
requires_human_or_maintainer_review: bool,
|
||||
}
|
||||
pub(super) fn parse_repo_doctrine_update_request(text: &str) -> Result<RepoDoctrineUpdateRequest> {
|
||||
toml::from_str(text).context("doctrine update request is not valid typed TOML")
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue