Extract repo closure contracts
This commit is contained in:
parent
69d55a7fad
commit
df08dfe3ed
6 changed files with 571 additions and 561 deletions
|
|
@ -87,7 +87,6 @@ use epiphany_core::write_epiphany_cultmesh_repo_work_readiness;
|
|||
use epiphany_core::write_epiphany_cultmesh_weksa_lowering_receipt;
|
||||
use epiphany_state_model::EpiphanyMemoryContextQuery;
|
||||
use epiphany_state_model::EpiphanyMemoryProfile;
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use sha2::Digest;
|
||||
|
|
@ -98,6 +97,10 @@ use std::path::Path;
|
|||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
#[path = "epiphany_work/closure_contracts.rs"]
|
||||
mod closure_contracts;
|
||||
use closure_contracts::*;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut args = env::args().skip(1);
|
||||
let Some(command) = args.next() else {
|
||||
|
|
@ -12102,556 +12105,6 @@ fn run_readiness(args: ReadinessArgs) -> Result<Value> {
|
|||
}))
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentConfig {
|
||||
schema_version: String,
|
||||
safe_action_family: String,
|
||||
summary: String,
|
||||
private_state_exposed: bool,
|
||||
deployment: RepoDeploymentSettings,
|
||||
cultmesh: RepoDeploymentCultMesh,
|
||||
required_receipts: RepoDeploymentRequiredReceipts,
|
||||
authority: RepoDeploymentAuthority,
|
||||
}
|
||||
|
||||
impl RepoDeploymentConfig {
|
||||
fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_deployment_config.v0"
|
||||
&& self.safe_action_family == "repo.deployment_config"
|
||||
}
|
||||
|
||||
fn has_idunn_trigger_contract(&self) -> bool {
|
||||
let deployment = &self.deployment;
|
||||
!deployment.enabled
|
||||
&& deployment.owner == "Idunn"
|
||||
&& deployment.trigger == "git-push-observed-by-idunn"
|
||||
&& deployment.watched_ref == "refs/heads/main"
|
||||
&& deployment.deployment_script_ref == "deploy/idunn-deploy.ps1"
|
||||
&& deployment.deployment_script_hash_required
|
||||
&& deployment.deployment_script_review_required
|
||||
&& deployment.host_access_policy_ref_required
|
||||
&& !deployment.secret_values_embedded
|
||||
&& deployment.rollback_plan_ref_required
|
||||
&& deployment.aftercare_checks_required
|
||||
&& deployment.idunn_receipt_required
|
||||
&& deployment.aftercare_audit_required
|
||||
}
|
||||
|
||||
fn has_cultmesh_contract(&self) -> bool {
|
||||
let cultmesh = &self.cultmesh;
|
||||
cultmesh.local_verse == "gamecult-local"
|
||||
&& cultmesh.capability_family == "gamecult.idunn.deployment"
|
||||
&& cultmesh.intent_contract == "gamecult.idunn.deployment_intent.v0"
|
||||
&& cultmesh.receipt_contract == "gamecult.idunn.deployment_receipt.v0"
|
||||
&& cultmesh.aftercare_contract == "gamecult.idunn.deployment_aftercare_audit.v0"
|
||||
&& cultmesh.daemon_owns_execution
|
||||
}
|
||||
|
||||
fn has_required_receipt_contract(&self) -> bool {
|
||||
let receipts = &self.required_receipts;
|
||||
receipts.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& receipts.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& receipts.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& receipts.secret_policy == "epiphany.repo_secret_policy_request.v0"
|
||||
&& receipts.idunn_deployment == "gamecult.idunn.deployment_receipt.v0"
|
||||
&& receipts.aftercare_audit == "gamecult.idunn.deployment_aftercare_audit.v0"
|
||||
}
|
||||
|
||||
fn has_authority_seals(&self) -> bool {
|
||||
let authority = &self.authority;
|
||||
authority.configuration_only
|
||||
&& !authority.direct_deployment_authority
|
||||
&& !authority.direct_ssh_authority
|
||||
&& !authority.direct_git_push_authority
|
||||
&& !authority.direct_service_lifecycle_authority
|
||||
&& !authority.direct_hands_authority
|
||||
&& !authority.publication_authorized
|
||||
&& !authority.merge_authorized
|
||||
&& !authority.cross_body_mutation_authorized
|
||||
&& !authority.private_verse_rummaging
|
||||
&& authority.idunn_deployment_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentSettings {
|
||||
enabled: bool,
|
||||
owner: String,
|
||||
trigger: String,
|
||||
watched_ref: String,
|
||||
deployment_script_ref: String,
|
||||
deployment_script_hash_required: bool,
|
||||
deployment_script_review_required: bool,
|
||||
host_access_policy_ref_required: bool,
|
||||
secret_values_embedded: bool,
|
||||
rollback_plan_ref_required: bool,
|
||||
aftercare_checks_required: bool,
|
||||
idunn_receipt_required: bool,
|
||||
aftercare_audit_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentCultMesh {
|
||||
local_verse: String,
|
||||
capability_family: String,
|
||||
intent_contract: String,
|
||||
receipt_contract: String,
|
||||
aftercare_contract: String,
|
||||
daemon_owns_execution: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequiredReceipts {
|
||||
mind_adoption: String,
|
||||
soul_review: String,
|
||||
maintainer_review: String,
|
||||
secret_policy: String,
|
||||
idunn_deployment: String,
|
||||
aftercare_audit: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentAuthority {
|
||||
configuration_only: bool,
|
||||
direct_deployment_authority: bool,
|
||||
direct_ssh_authority: bool,
|
||||
direct_git_push_authority: bool,
|
||||
direct_service_lifecycle_authority: bool,
|
||||
direct_hands_authority: bool,
|
||||
publication_authorized: bool,
|
||||
merge_authorized: bool,
|
||||
cross_body_mutation_authorized: bool,
|
||||
private_verse_rummaging: bool,
|
||||
idunn_deployment_authority_required: bool,
|
||||
}
|
||||
|
||||
fn parse_repo_deployment_config(text: &str) -> Result<RepoDeploymentConfig> {
|
||||
toml::from_str(text).context("deployment config is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoSecretPolicyRequest {
|
||||
schema_version: String,
|
||||
safe_action_family: String,
|
||||
summary: String,
|
||||
private_state_exposed: bool,
|
||||
request: RepoSecretPolicyRequestBody,
|
||||
antecedents: RepoSecretPolicyAntecedents,
|
||||
required_receipts: RepoSecretPolicyReceipts,
|
||||
security_packet: RepoSecretPolicyPacket,
|
||||
authority: RepoSecretPolicyAuthority,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoSecretPolicyRequestBody {
|
||||
status: String,
|
||||
requested_owner: String,
|
||||
requested_effect: String,
|
||||
requires_secret_inventory_without_values: bool,
|
||||
requires_write_permission_scope: bool,
|
||||
requires_public_private_export_boundary: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoSecretPolicyAntecedents {
|
||||
source_grounding_required: bool,
|
||||
soul_review_required: bool,
|
||||
mind_adoption_required: bool,
|
||||
maintainer_review_required: bool,
|
||||
bifrost_publication_review_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoSecretPolicyReceipts {
|
||||
source_grounding: String,
|
||||
soul_review: String,
|
||||
mind_adoption: String,
|
||||
maintainer_review: String,
|
||||
bifrost_publication_review: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoSecretPolicyPacket {
|
||||
requires_secret_locations_without_values: bool,
|
||||
requires_credential_owner: bool,
|
||||
requires_write_scope_matrix: bool,
|
||||
requires_public_export_redaction_rules: bool,
|
||||
requires_deployment_authority_owner: bool,
|
||||
requires_incident_rollback_plan: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoSecretPolicyAuthority {
|
||||
direct_secret_access_authority: bool,
|
||||
secret_value_materialization: bool,
|
||||
write_permission_authority: bool,
|
||||
deployment_authority: bool,
|
||||
publication_authorized: bool,
|
||||
merge_authorized: bool,
|
||||
service_lifecycle_authority: bool,
|
||||
cross_body_mutation_authorized: bool,
|
||||
private_verse_rummaging: bool,
|
||||
maintainer_or_soul_security_authority_required: bool,
|
||||
}
|
||||
|
||||
impl RepoSecretPolicyRequest {
|
||||
fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_secret_policy_request.v0"
|
||||
&& self.safe_action_family == "repo.secret_policy_request"
|
||||
}
|
||||
|
||||
fn awaits_security_review(&self) -> bool {
|
||||
let request = &self.request;
|
||||
request.status == "awaiting-security-review"
|
||||
&& request.requested_owner == "Maintainer/Soul/Bifrost"
|
||||
&& request.requested_effect == "review-repo-secret-and-write-permission-policy"
|
||||
&& request.requires_secret_inventory_without_values
|
||||
&& request.requires_write_permission_scope
|
||||
&& request.requires_public_private_export_boundary
|
||||
}
|
||||
|
||||
fn has_review_antecedents(&self) -> bool {
|
||||
let antecedents = &self.antecedents;
|
||||
antecedents.source_grounding_required
|
||||
&& antecedents.soul_review_required
|
||||
&& antecedents.mind_adoption_required
|
||||
&& antecedents.maintainer_review_required
|
||||
&& antecedents.bifrost_publication_review_required
|
||||
}
|
||||
|
||||
fn has_receipt_contract(&self) -> bool {
|
||||
let receipts = &self.required_receipts;
|
||||
receipts.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& receipts.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& receipts.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& receipts.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& receipts.bifrost_publication_review
|
||||
== "gamecult.bifrost.publication_review_receipt.v0"
|
||||
}
|
||||
|
||||
fn has_security_packet_contract(&self) -> bool {
|
||||
let packet = &self.security_packet;
|
||||
packet.requires_secret_locations_without_values
|
||||
&& packet.requires_credential_owner
|
||||
&& packet.requires_write_scope_matrix
|
||||
&& packet.requires_public_export_redaction_rules
|
||||
&& packet.requires_deployment_authority_owner
|
||||
&& packet.requires_incident_rollback_plan
|
||||
}
|
||||
|
||||
fn has_authority_seals(&self) -> bool {
|
||||
let authority = &self.authority;
|
||||
!authority.direct_secret_access_authority
|
||||
&& !authority.secret_value_materialization
|
||||
&& !authority.write_permission_authority
|
||||
&& !authority.deployment_authority
|
||||
&& !authority.publication_authorized
|
||||
&& !authority.merge_authorized
|
||||
&& !authority.service_lifecycle_authority
|
||||
&& !authority.cross_body_mutation_authorized
|
||||
&& !authority.private_verse_rummaging
|
||||
&& authority.maintainer_or_soul_security_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_repo_secret_policy_request(text: &str) -> Result<RepoSecretPolicyRequest> {
|
||||
toml::from_str(text).context("secret policy request is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDependencyPolicyRequest {
|
||||
schema_version: String,
|
||||
safe_action_family: String,
|
||||
summary: String,
|
||||
private_state_exposed: bool,
|
||||
request: RepoDependencyPolicyRequestBody,
|
||||
antecedents: RepoDependencyPolicyAntecedents,
|
||||
required_receipts: RepoDependencyPolicyReceipts,
|
||||
dependency_packet: RepoDependencyPolicyPacket,
|
||||
authority: RepoDependencyPolicyAuthority,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDependencyPolicyRequestBody {
|
||||
status: String,
|
||||
requested_owner: String,
|
||||
requested_effect: String,
|
||||
requires_manifest_inventory: bool,
|
||||
requires_lockfile_policy: bool,
|
||||
requires_package_manager_command_review: bool,
|
||||
requires_network_fetch_policy: bool,
|
||||
requires_vulnerability_review: bool,
|
||||
requires_license_review: bool,
|
||||
requires_rollback_plan: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDependencyPolicyAntecedents {
|
||||
source_grounding_required: bool,
|
||||
eyes_evidence_required: bool,
|
||||
soul_review_required: bool,
|
||||
mind_adoption_required: bool,
|
||||
maintainer_review_required: bool,
|
||||
bifrost_publication_review_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDependencyPolicyReceipts {
|
||||
source_grounding: String,
|
||||
soul_review: String,
|
||||
mind_adoption: String,
|
||||
maintainer_review: String,
|
||||
bifrost_publication_review: String,
|
||||
dependency_audit: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDependencyPolicyPacket {
|
||||
requires_manifest_paths: bool,
|
||||
requires_lockfile_paths: bool,
|
||||
requires_package_manager_commands: bool,
|
||||
requires_vulnerability_sources: bool,
|
||||
requires_license_constraints: bool,
|
||||
requires_vendored_code_policy: bool,
|
||||
requires_update_cadence: bool,
|
||||
requires_private_state_redaction_check: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDependencyPolicyAuthority {
|
||||
direct_dependency_update_authority: bool,
|
||||
direct_package_install_authority: bool,
|
||||
direct_lockfile_mutation_authority: bool,
|
||||
direct_network_fetch_authority: bool,
|
||||
direct_ci_mutation_authority: bool,
|
||||
direct_hands_authority: bool,
|
||||
publication_authorized: bool,
|
||||
merge_authorized: bool,
|
||||
deployment_authority: bool,
|
||||
service_lifecycle_authority: bool,
|
||||
cross_body_mutation_authorized: bool,
|
||||
private_verse_rummaging: bool,
|
||||
maintainer_or_soul_dependency_authority_required: bool,
|
||||
}
|
||||
|
||||
impl RepoDependencyPolicyRequest {
|
||||
fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_dependency_policy_request.v0"
|
||||
&& self.safe_action_family == "repo.dependency_policy_request"
|
||||
}
|
||||
|
||||
fn awaits_review(&self) -> bool {
|
||||
let request = &self.request;
|
||||
request.status == "awaiting-dependency-policy-review"
|
||||
&& request.requested_owner == "Maintainer/Soul/Bifrost"
|
||||
&& request.requested_effect == "review-repo-dependency-and-supply-chain-policy"
|
||||
&& request.requires_manifest_inventory
|
||||
&& request.requires_lockfile_policy
|
||||
&& request.requires_package_manager_command_review
|
||||
&& request.requires_network_fetch_policy
|
||||
&& request.requires_vulnerability_review
|
||||
&& request.requires_license_review
|
||||
&& request.requires_rollback_plan
|
||||
}
|
||||
|
||||
fn has_antecedents(&self) -> bool {
|
||||
let value = &self.antecedents;
|
||||
value.source_grounding_required
|
||||
&& value.eyes_evidence_required
|
||||
&& value.soul_review_required
|
||||
&& value.mind_adoption_required
|
||||
&& value.maintainer_review_required
|
||||
&& value.bifrost_publication_review_required
|
||||
}
|
||||
|
||||
fn has_receipt_contract(&self) -> bool {
|
||||
let value = &self.required_receipts;
|
||||
value.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& value.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& value.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& value.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& value.bifrost_publication_review == "gamecult.bifrost.publication_review_receipt.v0"
|
||||
&& value.dependency_audit == "gamecult.supply_chain.dependency_audit_receipt.v0"
|
||||
}
|
||||
|
||||
fn has_packet_contract(&self) -> bool {
|
||||
let value = &self.dependency_packet;
|
||||
value.requires_manifest_paths
|
||||
&& value.requires_lockfile_paths
|
||||
&& value.requires_package_manager_commands
|
||||
&& value.requires_vulnerability_sources
|
||||
&& value.requires_license_constraints
|
||||
&& value.requires_vendored_code_policy
|
||||
&& value.requires_update_cadence
|
||||
&& value.requires_private_state_redaction_check
|
||||
}
|
||||
|
||||
fn has_authority_seals(&self) -> bool {
|
||||
let value = &self.authority;
|
||||
!value.direct_dependency_update_authority
|
||||
&& !value.direct_package_install_authority
|
||||
&& !value.direct_lockfile_mutation_authority
|
||||
&& !value.direct_network_fetch_authority
|
||||
&& !value.direct_ci_mutation_authority
|
||||
&& !value.direct_hands_authority
|
||||
&& !value.publication_authorized
|
||||
&& !value.merge_authorized
|
||||
&& !value.deployment_authority
|
||||
&& !value.service_lifecycle_authority
|
||||
&& !value.cross_body_mutation_authorized
|
||||
&& !value.private_verse_rummaging
|
||||
&& value.maintainer_or_soul_dependency_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_repo_dependency_policy_request(text: &str) -> Result<RepoDependencyPolicyRequest> {
|
||||
toml::from_str(text).context("dependency policy request is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequest {
|
||||
schema_version: String,
|
||||
safe_action_family: String,
|
||||
summary: String,
|
||||
private_state_exposed: bool,
|
||||
request: RepoDeploymentRequestBody,
|
||||
antecedents: RepoDeploymentRequestAntecedents,
|
||||
required_receipts: RepoDeploymentRequestReceipts,
|
||||
deployment_packet: RepoDeploymentRequestPacket,
|
||||
authority: RepoDeploymentRequestAuthority,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequestBody {
|
||||
status: String,
|
||||
requested_owner: String,
|
||||
requested_effect: String,
|
||||
deployment_trigger: String,
|
||||
deployment_owner: String,
|
||||
requires_explicit_deployment_policy: bool,
|
||||
requires_idunn_receipt: bool,
|
||||
requires_aftercare_audit: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequestAntecedents {
|
||||
source_grounding_required: bool,
|
||||
mind_adoption_required: bool,
|
||||
soul_review_required: bool,
|
||||
maintainer_review_required: bool,
|
||||
secret_policy_review_required: bool,
|
||||
bifrost_publication_review_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequestReceipts {
|
||||
source_grounding: String,
|
||||
mind_adoption: String,
|
||||
soul_review: String,
|
||||
maintainer_review: String,
|
||||
secret_policy: String,
|
||||
bifrost_publication_review: String,
|
||||
idunn_deployment: String,
|
||||
aftercare_audit: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequestPacket {
|
||||
requires_target_environment: bool,
|
||||
requires_git_ref_or_branch: bool,
|
||||
requires_deployment_script_ref: bool,
|
||||
requires_script_hash_or_review_ref: bool,
|
||||
requires_host_access_policy_ref: bool,
|
||||
requires_secret_policy_ref: bool,
|
||||
requires_rollback_plan: bool,
|
||||
requires_aftercare_checks: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct RepoDeploymentRequestAuthority {
|
||||
direct_deployment_authority: bool,
|
||||
direct_ssh_authority: bool,
|
||||
direct_git_push_authority: bool,
|
||||
direct_service_lifecycle_authority: bool,
|
||||
direct_hands_authority: bool,
|
||||
publication_authorized: bool,
|
||||
merge_authorized: bool,
|
||||
cross_body_mutation_authorized: bool,
|
||||
private_verse_rummaging: bool,
|
||||
idunn_deployment_authority_required: bool,
|
||||
}
|
||||
|
||||
impl RepoDeploymentRequest {
|
||||
fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_deployment_request.v0"
|
||||
&& self.safe_action_family == "repo.deployment_request"
|
||||
}
|
||||
|
||||
fn awaits_idunn_review(&self) -> bool {
|
||||
let value = &self.request;
|
||||
value.status == "awaiting-idunn-review"
|
||||
&& value.requested_owner == "Idunn/Maintainer"
|
||||
&& value.requested_effect == "review-repo-deployment-trigger-and-script"
|
||||
&& value.deployment_trigger == "git-push-observed-by-idunn"
|
||||
&& value.deployment_owner == "Idunn"
|
||||
&& value.requires_explicit_deployment_policy
|
||||
&& value.requires_idunn_receipt
|
||||
&& value.requires_aftercare_audit
|
||||
}
|
||||
|
||||
fn has_antecedents(&self) -> bool {
|
||||
let value = &self.antecedents;
|
||||
value.source_grounding_required
|
||||
&& value.mind_adoption_required
|
||||
&& value.soul_review_required
|
||||
&& value.maintainer_review_required
|
||||
&& value.secret_policy_review_required
|
||||
&& value.bifrost_publication_review_required
|
||||
}
|
||||
|
||||
fn has_receipt_contract(&self) -> bool {
|
||||
let value = &self.required_receipts;
|
||||
value.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& value.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& value.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& value.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& value.secret_policy == "epiphany.repo_secret_policy_request.v0"
|
||||
&& value.bifrost_publication_review == "gamecult.bifrost.publication_review_receipt.v0"
|
||||
&& value.idunn_deployment == "gamecult.idunn.deployment_receipt.v0"
|
||||
&& value.aftercare_audit == "gamecult.idunn.deployment_aftercare_audit.v0"
|
||||
}
|
||||
|
||||
fn has_packet_contract(&self) -> bool {
|
||||
let value = &self.deployment_packet;
|
||||
value.requires_target_environment
|
||||
&& value.requires_git_ref_or_branch
|
||||
&& value.requires_deployment_script_ref
|
||||
&& value.requires_script_hash_or_review_ref
|
||||
&& value.requires_host_access_policy_ref
|
||||
&& value.requires_secret_policy_ref
|
||||
&& value.requires_rollback_plan
|
||||
&& value.requires_aftercare_checks
|
||||
}
|
||||
|
||||
fn has_authority_seals(&self) -> bool {
|
||||
let value = &self.authority;
|
||||
!value.direct_deployment_authority
|
||||
&& !value.direct_ssh_authority
|
||||
&& !value.direct_git_push_authority
|
||||
&& !value.direct_service_lifecycle_authority
|
||||
&& !value.direct_hands_authority
|
||||
&& !value.publication_authorized
|
||||
&& !value.merge_authorized
|
||||
&& !value.cross_body_mutation_authorized
|
||||
&& !value.private_verse_rummaging
|
||||
&& value.idunn_deployment_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_repo_deployment_request(text: &str) -> Result<RepoDeploymentRequest> {
|
||||
toml::from_str(text).context("deployment request is not valid typed TOML")
|
||||
}
|
||||
|
||||
fn run_deployment_config_audit(args: DeploymentConfigAuditArgs) -> Result<Value> {
|
||||
let workspace = args
|
||||
.workspace
|
||||
|
|
|
|||
554
epiphany-core/src/bin/epiphany_work/closure_contracts.rs
Normal file
554
epiphany-core/src/bin/epiphany_work/closure_contracts.rs
Normal file
|
|
@ -0,0 +1,554 @@
|
|||
use anyhow::{Context, Result};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentConfig {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
pub(super) deployment: RepoDeploymentSettings,
|
||||
pub(super) cultmesh: RepoDeploymentCultMesh,
|
||||
pub(super) required_receipts: RepoDeploymentRequiredReceipts,
|
||||
pub(super) authority: RepoDeploymentAuthority,
|
||||
}
|
||||
|
||||
impl RepoDeploymentConfig {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_deployment_config.v0"
|
||||
&& self.safe_action_family == "repo.deployment_config"
|
||||
}
|
||||
|
||||
pub(super) fn has_idunn_trigger_contract(&self) -> bool {
|
||||
let deployment = &self.deployment;
|
||||
!deployment.enabled
|
||||
&& deployment.owner == "Idunn"
|
||||
&& deployment.trigger == "git-push-observed-by-idunn"
|
||||
&& deployment.watched_ref == "refs/heads/main"
|
||||
&& deployment.deployment_script_ref == "deploy/idunn-deploy.ps1"
|
||||
&& deployment.deployment_script_hash_required
|
||||
&& deployment.deployment_script_review_required
|
||||
&& deployment.host_access_policy_ref_required
|
||||
&& !deployment.secret_values_embedded
|
||||
&& deployment.rollback_plan_ref_required
|
||||
&& deployment.aftercare_checks_required
|
||||
&& deployment.idunn_receipt_required
|
||||
&& deployment.aftercare_audit_required
|
||||
}
|
||||
|
||||
pub(super) fn has_cultmesh_contract(&self) -> bool {
|
||||
let cultmesh = &self.cultmesh;
|
||||
cultmesh.local_verse == "gamecult-local"
|
||||
&& cultmesh.capability_family == "gamecult.idunn.deployment"
|
||||
&& cultmesh.intent_contract == "gamecult.idunn.deployment_intent.v0"
|
||||
&& cultmesh.receipt_contract == "gamecult.idunn.deployment_receipt.v0"
|
||||
&& cultmesh.aftercare_contract == "gamecult.idunn.deployment_aftercare_audit.v0"
|
||||
&& cultmesh.daemon_owns_execution
|
||||
}
|
||||
|
||||
pub(super) fn has_required_receipt_contract(&self) -> bool {
|
||||
let receipts = &self.required_receipts;
|
||||
receipts.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& receipts.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& receipts.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& receipts.secret_policy == "epiphany.repo_secret_policy_request.v0"
|
||||
&& receipts.idunn_deployment == "gamecult.idunn.deployment_receipt.v0"
|
||||
&& receipts.aftercare_audit == "gamecult.idunn.deployment_aftercare_audit.v0"
|
||||
}
|
||||
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
let authority = &self.authority;
|
||||
authority.configuration_only
|
||||
&& !authority.direct_deployment_authority
|
||||
&& !authority.direct_ssh_authority
|
||||
&& !authority.direct_git_push_authority
|
||||
&& !authority.direct_service_lifecycle_authority
|
||||
&& !authority.direct_hands_authority
|
||||
&& !authority.publication_authorized
|
||||
&& !authority.merge_authorized
|
||||
&& !authority.cross_body_mutation_authorized
|
||||
&& !authority.private_verse_rummaging
|
||||
&& authority.idunn_deployment_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentSettings {
|
||||
pub(super) enabled: bool,
|
||||
pub(super) owner: String,
|
||||
pub(super) trigger: String,
|
||||
pub(super) watched_ref: String,
|
||||
pub(super) deployment_script_ref: String,
|
||||
pub(super) deployment_script_hash_required: bool,
|
||||
pub(super) deployment_script_review_required: bool,
|
||||
pub(super) host_access_policy_ref_required: bool,
|
||||
pub(super) secret_values_embedded: bool,
|
||||
pub(super) rollback_plan_ref_required: bool,
|
||||
pub(super) aftercare_checks_required: bool,
|
||||
pub(super) idunn_receipt_required: bool,
|
||||
pub(super) aftercare_audit_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentCultMesh {
|
||||
pub(super) local_verse: String,
|
||||
pub(super) capability_family: String,
|
||||
pub(super) intent_contract: String,
|
||||
pub(super) receipt_contract: String,
|
||||
pub(super) aftercare_contract: String,
|
||||
pub(super) daemon_owns_execution: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequiredReceipts {
|
||||
pub(super) mind_adoption: String,
|
||||
pub(super) soul_review: String,
|
||||
pub(super) maintainer_review: String,
|
||||
pub(super) secret_policy: String,
|
||||
pub(super) idunn_deployment: String,
|
||||
pub(super) aftercare_audit: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentAuthority {
|
||||
pub(super) configuration_only: bool,
|
||||
pub(super) direct_deployment_authority: bool,
|
||||
pub(super) direct_ssh_authority: bool,
|
||||
pub(super) direct_git_push_authority: bool,
|
||||
pub(super) direct_service_lifecycle_authority: bool,
|
||||
pub(super) direct_hands_authority: bool,
|
||||
pub(super) publication_authorized: bool,
|
||||
pub(super) merge_authorized: bool,
|
||||
pub(super) cross_body_mutation_authorized: bool,
|
||||
pub(super) private_verse_rummaging: bool,
|
||||
pub(super) idunn_deployment_authority_required: bool,
|
||||
}
|
||||
|
||||
pub(super) fn parse_repo_deployment_config(text: &str) -> Result<RepoDeploymentConfig> {
|
||||
toml::from_str(text).context("deployment config is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoSecretPolicyRequest {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
pub(super) request: RepoSecretPolicyRequestBody,
|
||||
pub(super) antecedents: RepoSecretPolicyAntecedents,
|
||||
pub(super) required_receipts: RepoSecretPolicyReceipts,
|
||||
pub(super) security_packet: RepoSecretPolicyPacket,
|
||||
pub(super) authority: RepoSecretPolicyAuthority,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoSecretPolicyRequestBody {
|
||||
pub(super) status: String,
|
||||
pub(super) requested_owner: String,
|
||||
pub(super) requested_effect: String,
|
||||
pub(super) requires_secret_inventory_without_values: bool,
|
||||
pub(super) requires_write_permission_scope: bool,
|
||||
pub(super) requires_public_private_export_boundary: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoSecretPolicyAntecedents {
|
||||
pub(super) source_grounding_required: bool,
|
||||
pub(super) soul_review_required: bool,
|
||||
pub(super) mind_adoption_required: bool,
|
||||
pub(super) maintainer_review_required: bool,
|
||||
pub(super) bifrost_publication_review_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoSecretPolicyReceipts {
|
||||
pub(super) source_grounding: String,
|
||||
pub(super) soul_review: String,
|
||||
pub(super) mind_adoption: String,
|
||||
pub(super) maintainer_review: String,
|
||||
pub(super) bifrost_publication_review: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoSecretPolicyPacket {
|
||||
pub(super) requires_secret_locations_without_values: bool,
|
||||
pub(super) requires_credential_owner: bool,
|
||||
pub(super) requires_write_scope_matrix: bool,
|
||||
pub(super) requires_public_export_redaction_rules: bool,
|
||||
pub(super) requires_deployment_authority_owner: bool,
|
||||
pub(super) requires_incident_rollback_plan: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoSecretPolicyAuthority {
|
||||
pub(super) direct_secret_access_authority: bool,
|
||||
pub(super) secret_value_materialization: bool,
|
||||
pub(super) write_permission_authority: bool,
|
||||
pub(super) deployment_authority: bool,
|
||||
pub(super) publication_authorized: bool,
|
||||
pub(super) merge_authorized: bool,
|
||||
pub(super) service_lifecycle_authority: bool,
|
||||
pub(super) cross_body_mutation_authorized: bool,
|
||||
pub(super) private_verse_rummaging: bool,
|
||||
pub(super) maintainer_or_soul_security_authority_required: bool,
|
||||
}
|
||||
|
||||
impl RepoSecretPolicyRequest {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_secret_policy_request.v0"
|
||||
&& self.safe_action_family == "repo.secret_policy_request"
|
||||
}
|
||||
|
||||
pub(super) fn awaits_security_review(&self) -> bool {
|
||||
let request = &self.request;
|
||||
request.status == "awaiting-security-review"
|
||||
&& request.requested_owner == "Maintainer/Soul/Bifrost"
|
||||
&& request.requested_effect == "review-repo-secret-and-write-permission-policy"
|
||||
&& request.requires_secret_inventory_without_values
|
||||
&& request.requires_write_permission_scope
|
||||
&& request.requires_public_private_export_boundary
|
||||
}
|
||||
|
||||
pub(super) fn has_review_antecedents(&self) -> bool {
|
||||
let antecedents = &self.antecedents;
|
||||
antecedents.source_grounding_required
|
||||
&& antecedents.soul_review_required
|
||||
&& antecedents.mind_adoption_required
|
||||
&& antecedents.maintainer_review_required
|
||||
&& antecedents.bifrost_publication_review_required
|
||||
}
|
||||
|
||||
pub(super) fn has_receipt_contract(&self) -> bool {
|
||||
let receipts = &self.required_receipts;
|
||||
receipts.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& receipts.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& receipts.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& receipts.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& receipts.bifrost_publication_review
|
||||
== "gamecult.bifrost.publication_review_receipt.v0"
|
||||
}
|
||||
|
||||
pub(super) fn has_security_packet_contract(&self) -> bool {
|
||||
let packet = &self.security_packet;
|
||||
packet.requires_secret_locations_without_values
|
||||
&& packet.requires_credential_owner
|
||||
&& packet.requires_write_scope_matrix
|
||||
&& packet.requires_public_export_redaction_rules
|
||||
&& packet.requires_deployment_authority_owner
|
||||
&& packet.requires_incident_rollback_plan
|
||||
}
|
||||
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
let authority = &self.authority;
|
||||
!authority.direct_secret_access_authority
|
||||
&& !authority.secret_value_materialization
|
||||
&& !authority.write_permission_authority
|
||||
&& !authority.deployment_authority
|
||||
&& !authority.publication_authorized
|
||||
&& !authority.merge_authorized
|
||||
&& !authority.service_lifecycle_authority
|
||||
&& !authority.cross_body_mutation_authorized
|
||||
&& !authority.private_verse_rummaging
|
||||
&& authority.maintainer_or_soul_security_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn parse_repo_secret_policy_request(text: &str) -> Result<RepoSecretPolicyRequest> {
|
||||
toml::from_str(text).context("secret policy request is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDependencyPolicyRequest {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
pub(super) request: RepoDependencyPolicyRequestBody,
|
||||
pub(super) antecedents: RepoDependencyPolicyAntecedents,
|
||||
pub(super) required_receipts: RepoDependencyPolicyReceipts,
|
||||
pub(super) dependency_packet: RepoDependencyPolicyPacket,
|
||||
pub(super) authority: RepoDependencyPolicyAuthority,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDependencyPolicyRequestBody {
|
||||
pub(super) status: String,
|
||||
pub(super) requested_owner: String,
|
||||
pub(super) requested_effect: String,
|
||||
pub(super) requires_manifest_inventory: bool,
|
||||
pub(super) requires_lockfile_policy: bool,
|
||||
pub(super) requires_package_manager_command_review: bool,
|
||||
pub(super) requires_network_fetch_policy: bool,
|
||||
pub(super) requires_vulnerability_review: bool,
|
||||
pub(super) requires_license_review: bool,
|
||||
pub(super) requires_rollback_plan: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDependencyPolicyAntecedents {
|
||||
pub(super) source_grounding_required: bool,
|
||||
pub(super) eyes_evidence_required: bool,
|
||||
pub(super) soul_review_required: bool,
|
||||
pub(super) mind_adoption_required: bool,
|
||||
pub(super) maintainer_review_required: bool,
|
||||
pub(super) bifrost_publication_review_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDependencyPolicyReceipts {
|
||||
pub(super) source_grounding: String,
|
||||
pub(super) soul_review: String,
|
||||
pub(super) mind_adoption: String,
|
||||
pub(super) maintainer_review: String,
|
||||
pub(super) bifrost_publication_review: String,
|
||||
pub(super) dependency_audit: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDependencyPolicyPacket {
|
||||
pub(super) requires_manifest_paths: bool,
|
||||
pub(super) requires_lockfile_paths: bool,
|
||||
pub(super) requires_package_manager_commands: bool,
|
||||
pub(super) requires_vulnerability_sources: bool,
|
||||
pub(super) requires_license_constraints: bool,
|
||||
pub(super) requires_vendored_code_policy: bool,
|
||||
pub(super) requires_update_cadence: bool,
|
||||
pub(super) requires_private_state_redaction_check: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDependencyPolicyAuthority {
|
||||
pub(super) direct_dependency_update_authority: bool,
|
||||
pub(super) direct_package_install_authority: bool,
|
||||
pub(super) direct_lockfile_mutation_authority: bool,
|
||||
pub(super) direct_network_fetch_authority: bool,
|
||||
pub(super) direct_ci_mutation_authority: bool,
|
||||
pub(super) direct_hands_authority: bool,
|
||||
pub(super) publication_authorized: bool,
|
||||
pub(super) merge_authorized: bool,
|
||||
pub(super) deployment_authority: bool,
|
||||
pub(super) service_lifecycle_authority: bool,
|
||||
pub(super) cross_body_mutation_authorized: bool,
|
||||
pub(super) private_verse_rummaging: bool,
|
||||
pub(super) maintainer_or_soul_dependency_authority_required: bool,
|
||||
}
|
||||
|
||||
impl RepoDependencyPolicyRequest {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_dependency_policy_request.v0"
|
||||
&& self.safe_action_family == "repo.dependency_policy_request"
|
||||
}
|
||||
|
||||
pub(super) fn awaits_review(&self) -> bool {
|
||||
let request = &self.request;
|
||||
request.status == "awaiting-dependency-policy-review"
|
||||
&& request.requested_owner == "Maintainer/Soul/Bifrost"
|
||||
&& request.requested_effect == "review-repo-dependency-and-supply-chain-policy"
|
||||
&& request.requires_manifest_inventory
|
||||
&& request.requires_lockfile_policy
|
||||
&& request.requires_package_manager_command_review
|
||||
&& request.requires_network_fetch_policy
|
||||
&& request.requires_vulnerability_review
|
||||
&& request.requires_license_review
|
||||
&& request.requires_rollback_plan
|
||||
}
|
||||
|
||||
pub(super) fn has_antecedents(&self) -> bool {
|
||||
let value = &self.antecedents;
|
||||
value.source_grounding_required
|
||||
&& value.eyes_evidence_required
|
||||
&& value.soul_review_required
|
||||
&& value.mind_adoption_required
|
||||
&& value.maintainer_review_required
|
||||
&& value.bifrost_publication_review_required
|
||||
}
|
||||
|
||||
pub(super) fn has_receipt_contract(&self) -> bool {
|
||||
let value = &self.required_receipts;
|
||||
value.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& value.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& value.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& value.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& value.bifrost_publication_review == "gamecult.bifrost.publication_review_receipt.v0"
|
||||
&& value.dependency_audit == "gamecult.supply_chain.dependency_audit_receipt.v0"
|
||||
}
|
||||
|
||||
pub(super) fn has_packet_contract(&self) -> bool {
|
||||
let value = &self.dependency_packet;
|
||||
value.requires_manifest_paths
|
||||
&& value.requires_lockfile_paths
|
||||
&& value.requires_package_manager_commands
|
||||
&& value.requires_vulnerability_sources
|
||||
&& value.requires_license_constraints
|
||||
&& value.requires_vendored_code_policy
|
||||
&& value.requires_update_cadence
|
||||
&& value.requires_private_state_redaction_check
|
||||
}
|
||||
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
let value = &self.authority;
|
||||
!value.direct_dependency_update_authority
|
||||
&& !value.direct_package_install_authority
|
||||
&& !value.direct_lockfile_mutation_authority
|
||||
&& !value.direct_network_fetch_authority
|
||||
&& !value.direct_ci_mutation_authority
|
||||
&& !value.direct_hands_authority
|
||||
&& !value.publication_authorized
|
||||
&& !value.merge_authorized
|
||||
&& !value.deployment_authority
|
||||
&& !value.service_lifecycle_authority
|
||||
&& !value.cross_body_mutation_authorized
|
||||
&& !value.private_verse_rummaging
|
||||
&& value.maintainer_or_soul_dependency_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn parse_repo_dependency_policy_request(
|
||||
text: &str,
|
||||
) -> Result<RepoDependencyPolicyRequest> {
|
||||
toml::from_str(text).context("dependency policy request is not valid typed TOML")
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequest {
|
||||
pub(super) schema_version: String,
|
||||
pub(super) safe_action_family: String,
|
||||
pub(super) summary: String,
|
||||
pub(super) private_state_exposed: bool,
|
||||
pub(super) request: RepoDeploymentRequestBody,
|
||||
pub(super) antecedents: RepoDeploymentRequestAntecedents,
|
||||
pub(super) required_receipts: RepoDeploymentRequestReceipts,
|
||||
pub(super) deployment_packet: RepoDeploymentRequestPacket,
|
||||
pub(super) authority: RepoDeploymentRequestAuthority,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequestBody {
|
||||
pub(super) status: String,
|
||||
pub(super) requested_owner: String,
|
||||
pub(super) requested_effect: String,
|
||||
pub(super) deployment_trigger: String,
|
||||
pub(super) deployment_owner: String,
|
||||
pub(super) requires_explicit_deployment_policy: bool,
|
||||
pub(super) requires_idunn_receipt: bool,
|
||||
pub(super) requires_aftercare_audit: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequestAntecedents {
|
||||
pub(super) source_grounding_required: bool,
|
||||
pub(super) mind_adoption_required: bool,
|
||||
pub(super) soul_review_required: bool,
|
||||
pub(super) maintainer_review_required: bool,
|
||||
pub(super) secret_policy_review_required: bool,
|
||||
pub(super) bifrost_publication_review_required: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequestReceipts {
|
||||
pub(super) source_grounding: String,
|
||||
pub(super) mind_adoption: String,
|
||||
pub(super) soul_review: String,
|
||||
pub(super) maintainer_review: String,
|
||||
pub(super) secret_policy: String,
|
||||
pub(super) bifrost_publication_review: String,
|
||||
pub(super) idunn_deployment: String,
|
||||
pub(super) aftercare_audit: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequestPacket {
|
||||
pub(super) requires_target_environment: bool,
|
||||
pub(super) requires_git_ref_or_branch: bool,
|
||||
pub(super) requires_deployment_script_ref: bool,
|
||||
pub(super) requires_script_hash_or_review_ref: bool,
|
||||
pub(super) requires_host_access_policy_ref: bool,
|
||||
pub(super) requires_secret_policy_ref: bool,
|
||||
pub(super) requires_rollback_plan: bool,
|
||||
pub(super) requires_aftercare_checks: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(super) struct RepoDeploymentRequestAuthority {
|
||||
pub(super) direct_deployment_authority: bool,
|
||||
pub(super) direct_ssh_authority: bool,
|
||||
pub(super) direct_git_push_authority: bool,
|
||||
pub(super) direct_service_lifecycle_authority: bool,
|
||||
pub(super) direct_hands_authority: bool,
|
||||
pub(super) publication_authorized: bool,
|
||||
pub(super) merge_authorized: bool,
|
||||
pub(super) cross_body_mutation_authorized: bool,
|
||||
pub(super) private_verse_rummaging: bool,
|
||||
pub(super) idunn_deployment_authority_required: bool,
|
||||
}
|
||||
|
||||
impl RepoDeploymentRequest {
|
||||
pub(super) fn has_canonical_identity(&self) -> bool {
|
||||
self.schema_version == "epiphany.repo_deployment_request.v0"
|
||||
&& self.safe_action_family == "repo.deployment_request"
|
||||
}
|
||||
|
||||
pub(super) fn awaits_idunn_review(&self) -> bool {
|
||||
let value = &self.request;
|
||||
value.status == "awaiting-idunn-review"
|
||||
&& value.requested_owner == "Idunn/Maintainer"
|
||||
&& value.requested_effect == "review-repo-deployment-trigger-and-script"
|
||||
&& value.deployment_trigger == "git-push-observed-by-idunn"
|
||||
&& value.deployment_owner == "Idunn"
|
||||
&& value.requires_explicit_deployment_policy
|
||||
&& value.requires_idunn_receipt
|
||||
&& value.requires_aftercare_audit
|
||||
}
|
||||
|
||||
pub(super) fn has_antecedents(&self) -> bool {
|
||||
let value = &self.antecedents;
|
||||
value.source_grounding_required
|
||||
&& value.mind_adoption_required
|
||||
&& value.soul_review_required
|
||||
&& value.maintainer_review_required
|
||||
&& value.secret_policy_review_required
|
||||
&& value.bifrost_publication_review_required
|
||||
}
|
||||
|
||||
pub(super) fn has_receipt_contract(&self) -> bool {
|
||||
let value = &self.required_receipts;
|
||||
value.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& value.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& value.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& value.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& value.secret_policy == "epiphany.repo_secret_policy_request.v0"
|
||||
&& value.bifrost_publication_review == "gamecult.bifrost.publication_review_receipt.v0"
|
||||
&& value.idunn_deployment == "gamecult.idunn.deployment_receipt.v0"
|
||||
&& value.aftercare_audit == "gamecult.idunn.deployment_aftercare_audit.v0"
|
||||
}
|
||||
|
||||
pub(super) fn has_packet_contract(&self) -> bool {
|
||||
let value = &self.deployment_packet;
|
||||
value.requires_target_environment
|
||||
&& value.requires_git_ref_or_branch
|
||||
&& value.requires_deployment_script_ref
|
||||
&& value.requires_script_hash_or_review_ref
|
||||
&& value.requires_host_access_policy_ref
|
||||
&& value.requires_secret_policy_ref
|
||||
&& value.requires_rollback_plan
|
||||
&& value.requires_aftercare_checks
|
||||
}
|
||||
|
||||
pub(super) fn has_authority_seals(&self) -> bool {
|
||||
let value = &self.authority;
|
||||
!value.direct_deployment_authority
|
||||
&& !value.direct_ssh_authority
|
||||
&& !value.direct_git_push_authority
|
||||
&& !value.direct_service_lifecycle_authority
|
||||
&& !value.direct_hands_authority
|
||||
&& !value.publication_authorized
|
||||
&& !value.merge_authorized
|
||||
&& !value.cross_body_mutation_authorized
|
||||
&& !value.private_verse_rummaging
|
||||
&& value.idunn_deployment_authority_required
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn parse_repo_deployment_request(text: &str) -> Result<RepoDeploymentRequest> {
|
||||
toml::from_str(text).context("deployment request is not valid typed TOML")
|
||||
}
|
||||
Reference in a new issue