Add launch receipt proof profiles
This commit is contained in:
parent
93577e8532
commit
82091d704e
8 changed files with 184 additions and 33 deletions
|
|
@ -334,10 +334,13 @@ pub use organ_dependencies::EPIPHANY_ORGAN_DEPENDENCY_SCHEMA_VERSION;
|
|||
pub use organ_dependencies::EPIPHANY_STANDING_ORGANS;
|
||||
pub use organ_dependencies::EpiphanyLaunchOrganContract;
|
||||
pub use organ_dependencies::EpiphanyOrganDependency;
|
||||
pub use organ_dependencies::EpiphanyReceiptEffectKind;
|
||||
pub use organ_dependencies::EpiphanyReceiptProofProfile;
|
||||
pub use organ_dependencies::default_launch_organ_contract;
|
||||
pub use organ_dependencies::default_launch_required_receipts;
|
||||
pub use organ_dependencies::default_organ_dependencies_for;
|
||||
pub use organ_dependencies::default_organ_dependency_matrix;
|
||||
pub use organ_dependencies::default_receipt_proof_profiles;
|
||||
pub use organ_dependencies::render_organ_dependencies;
|
||||
pub use organ_dependencies::render_organ_dependency;
|
||||
pub use promotion::EpiphanyPromotionDecision;
|
||||
|
|
|
|||
|
|
@ -52,10 +52,33 @@ pub struct EpiphanyLaunchOrganContract {
|
|||
pub output_contract_id: String,
|
||||
pub owner_organ: String,
|
||||
pub dependencies: Vec<EpiphanyOrganDependency>,
|
||||
#[serde(default)]
|
||||
pub receipt_proof_profiles: Vec<EpiphanyReceiptProofProfile>,
|
||||
pub required_receipt_document_types: Vec<String>,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum EpiphanyReceiptEffectKind {
|
||||
#[default]
|
||||
StateAdmission,
|
||||
EvidencePromotion,
|
||||
RepoAction,
|
||||
Verification,
|
||||
ContinuityRecovery,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EpiphanyReceiptProofProfile {
|
||||
pub effect_kind: EpiphanyReceiptEffectKind,
|
||||
pub owner_organ: String,
|
||||
pub required_before_promotion_document_types: Vec<String>,
|
||||
pub terminal_receipt_document_types: Vec<String>,
|
||||
pub contract: String,
|
||||
}
|
||||
|
||||
pub fn default_organ_dependencies_for(organ_id: &str) -> EpiphanyOrganDependency {
|
||||
let normalized = organ_id.trim().to_ascii_lowercase();
|
||||
EpiphanyOrganDependency {
|
||||
|
|
@ -89,11 +112,93 @@ pub fn default_launch_organ_contract(
|
|||
output_contract_id: output_contract_id.to_string(),
|
||||
owner_organ: owner_organ_for_authority_scope(authority_scope).to_string(),
|
||||
dependencies: default_organ_dependency_matrix(),
|
||||
receipt_proof_profiles: default_receipt_proof_profiles(),
|
||||
required_receipt_document_types: default_launch_required_receipts(),
|
||||
contract: "A worker launch is not naked task cargo: it carries the sub-agent dependency matrix and the receipts expected before worker output may affect durable state. Mind gates state effects, Substrate Gate gates repo access, Eyes supplies evidence, Proprioception models the Body, Hands records action, Soul verifies, and Continuity protocols preserve recovery across rupture.".to_string(),
|
||||
contract: "A worker launch is not naked task cargo: it carries the sub-agent dependency matrix, a receipt document catalogue, and effect-specific proof profiles. Mind gates state effects, Substrate Gate gates repo access, Eyes supplies evidence, Proprioception models the Body, Hands records action, Soul verifies, and Continuity protocols preserve recovery across rupture.".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_receipt_proof_profiles() -> Vec<EpiphanyReceiptProofProfile> {
|
||||
vec![
|
||||
EpiphanyReceiptProofProfile {
|
||||
effect_kind: EpiphanyReceiptEffectKind::StateAdmission,
|
||||
owner_organ: "mind".to_string(),
|
||||
required_before_promotion_document_types: vec![MIND_GATEWAY_REVIEW_TYPE.to_string()],
|
||||
terminal_receipt_document_types: vec![
|
||||
MIND_STATE_COMMIT_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_REJECTION_RECEIPT_TYPE.to_string(),
|
||||
],
|
||||
contract: "Durable state admission requires Mind review before promotion and a Mind commit or rejection receipt after the decision resolves.".to_string(),
|
||||
},
|
||||
EpiphanyReceiptProofProfile {
|
||||
effect_kind: EpiphanyReceiptEffectKind::EvidencePromotion,
|
||||
owner_organ: "eyes".to_string(),
|
||||
required_before_promotion_document_types: vec![
|
||||
SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_TYPE.to_string(),
|
||||
EYES_EVIDENCE_PACKET_TYPE.to_string(),
|
||||
MIND_GATEWAY_REVIEW_TYPE.to_string(),
|
||||
],
|
||||
terminal_receipt_document_types: vec![
|
||||
MIND_STATE_COMMIT_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_REJECTION_RECEIPT_TYPE.to_string(),
|
||||
EYES_EVIDENCE_REFUSAL_RECEIPT_TYPE.to_string(),
|
||||
],
|
||||
contract: "A source-dependent truth claim needs scoped substrate access, an Eyes evidence packet, and Mind admission before it becomes durable state.".to_string(),
|
||||
},
|
||||
EpiphanyReceiptProofProfile {
|
||||
effect_kind: EpiphanyReceiptEffectKind::RepoAction,
|
||||
owner_organ: "hands".to_string(),
|
||||
required_before_promotion_document_types: vec![
|
||||
SUBSTRATE_GATE_REPO_ACCESS_GRANT_RECEIPT_TYPE.to_string(),
|
||||
HANDS_PATCH_RECEIPT_TYPE.to_string(),
|
||||
SOUL_VERDICT_RECEIPT_TYPE.to_string(),
|
||||
MIND_GATEWAY_REVIEW_TYPE.to_string(),
|
||||
],
|
||||
terminal_receipt_document_types: vec![
|
||||
SUBSTRATE_GATE_REPO_MUTATION_RECEIPT_TYPE.to_string(),
|
||||
HANDS_COMMIT_RECEIPT_TYPE.to_string(),
|
||||
HANDS_ROLLBACK_RECEIPT_TYPE.to_string(),
|
||||
HANDS_ACTION_REFUSAL_RECEIPT_TYPE.to_string(),
|
||||
SOUL_REGRESSION_RECEIPT_TYPE.to_string(),
|
||||
SOUL_VERIFICATION_REFUSAL_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_COMMIT_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_REJECTION_RECEIPT_TYPE.to_string(),
|
||||
],
|
||||
contract: "A repository mutation needs substrate grant, Hands action proof, Soul verification, and Mind state admission before it can be called true.".to_string(),
|
||||
},
|
||||
EpiphanyReceiptProofProfile {
|
||||
effect_kind: EpiphanyReceiptEffectKind::Verification,
|
||||
owner_organ: "soul".to_string(),
|
||||
required_before_promotion_document_types: vec![
|
||||
SOUL_VERDICT_RECEIPT_TYPE.to_string(),
|
||||
MIND_GATEWAY_REVIEW_TYPE.to_string(),
|
||||
],
|
||||
terminal_receipt_document_types: vec![
|
||||
SOUL_REVIEW_RECEIPT_TYPE.to_string(),
|
||||
SOUL_REGRESSION_RECEIPT_TYPE.to_string(),
|
||||
SOUL_VERIFICATION_REFUSAL_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_COMMIT_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_REJECTION_RECEIPT_TYPE.to_string(),
|
||||
],
|
||||
contract: "Verification claims require Soul verdict proof before Mind admits the claim into durable state.".to_string(),
|
||||
},
|
||||
EpiphanyReceiptProofProfile {
|
||||
effect_kind: EpiphanyReceiptEffectKind::ContinuityRecovery,
|
||||
owner_organ: "continuity".to_string(),
|
||||
required_before_promotion_document_types: vec![
|
||||
CONTINUITY_RECOVERY_RECEIPT_TYPE.to_string(),
|
||||
MIND_GATEWAY_REVIEW_TYPE.to_string(),
|
||||
],
|
||||
terminal_receipt_document_types: vec![
|
||||
MIND_STATE_COMMIT_RECEIPT_TYPE.to_string(),
|
||||
MIND_STATE_REJECTION_RECEIPT_TYPE.to_string(),
|
||||
CONTINUITY_REFUSAL_RECEIPT_TYPE.to_string(),
|
||||
],
|
||||
contract: "Recovery and rupture-crossing claims require Continuity proof plus Mind admission; transcript residue is not durable memory.".to_string(),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
pub fn default_launch_required_receipts() -> Vec<String> {
|
||||
unique_strings(vec![
|
||||
MIND_GATEWAY_REVIEW_TYPE,
|
||||
|
|
@ -224,6 +329,24 @@ mod tests {
|
|||
.required_receipt_document_types
|
||||
.contains(&SOUL_VERDICT_RECEIPT_TYPE.to_string())
|
||||
);
|
||||
assert!(contract.receipt_proof_profiles.iter().any(|profile| {
|
||||
profile.effect_kind == EpiphanyReceiptEffectKind::StateAdmission
|
||||
&& profile
|
||||
.required_before_promotion_document_types
|
||||
.contains(&MIND_GATEWAY_REVIEW_TYPE.to_string())
|
||||
&& profile
|
||||
.terminal_receipt_document_types
|
||||
.contains(&MIND_STATE_COMMIT_RECEIPT_TYPE.to_string())
|
||||
}));
|
||||
assert!(contract.receipt_proof_profiles.iter().any(|profile| {
|
||||
profile.effect_kind == EpiphanyReceiptEffectKind::RepoAction
|
||||
&& profile
|
||||
.required_before_promotion_document_types
|
||||
.contains(&HANDS_PATCH_RECEIPT_TYPE.to_string())
|
||||
&& profile
|
||||
.required_before_promotion_document_types
|
||||
.contains(&SOUL_VERDICT_RECEIPT_TYPE.to_string())
|
||||
}));
|
||||
assert!(contract.contract.contains("not naked task cargo"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2768,6 +2768,11 @@ fn validate_launch_organ_contract(
|
|||
"epiphany launch organ contract must carry required receipt document types"
|
||||
));
|
||||
}
|
||||
if contract.receipt_proof_profiles.is_empty() {
|
||||
return Err(anyhow!(
|
||||
"epiphany launch organ contract must carry effect-specific receipt proof profiles"
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -3204,6 +3209,17 @@ mod tests {
|
|||
.required_receipt_document_types
|
||||
.contains(&crate::MIND_GATEWAY_REVIEW_TYPE.to_string())
|
||||
);
|
||||
assert!(
|
||||
launch_request
|
||||
.organ_launch_contract
|
||||
.receipt_proof_profiles
|
||||
.iter()
|
||||
.any(|profile| profile.effect_kind
|
||||
== crate::EpiphanyReceiptEffectKind::StateAdmission
|
||||
&& profile
|
||||
.required_before_promotion_document_types
|
||||
.contains(&crate::MIND_GATEWAY_REVIEW_TYPE.to_string()))
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue