From 0d8afc94f2fd821379256be661d90e730b08114c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 02:18:42 +0100 Subject: [PATCH] Type artifact acceptance closure semantics --- epiphany-core/src/bin/epiphany-work.rs | 87 +++----- .../bin/epiphany_work/closure_contracts.rs | 198 ++++++++++++++++++ ...onceptual-substitution-audit-2026-07-12.md | 9 + notes/fresh-workspace-handoff.md | 7 +- state/ledgers.msgpack | Bin 460624 -> 460959 bytes state/map.yaml | 2 +- 6 files changed, 240 insertions(+), 63 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 52c543e4..2584d0f3 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -8166,114 +8166,83 @@ fn closure_family_assertions( ); } "repo.artifact_acceptance_request" => { + let request = parse_repo_artifact_acceptance_request(&content).ok(); push_assertion( &mut assertions, "artifact-acceptance-request-schema-present", - content - .contains("schema_version = \"epiphany.repo_artifact_acceptance_request.v0\""), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::has_canonical_identity), "Committed artifact acceptance request carries the schema version.".to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-family-present", - content.contains("safe_action_family = \"repo.artifact_acceptance_request\""), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::has_canonical_identity), "Committed artifact acceptance request carries the safe action family.".to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-summary-present", - content.contains(&compact_summary), + request + .as_ref() + .is_some_and(|request| request.summary == compact_summary), "Committed artifact acceptance request contains the accepted pressure summary." .to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-awaits-review", - content.contains("[request]") - && content.contains("status = \"awaiting-artifact-acceptance-review\"") - && content.contains("requested_owner = \"Maintainer/Bifrost\"") - && content.contains( - "requested_effect = \"record-accepted-artifact-for-reviewed-branch-work\"", - ) - && content.contains("verification_request_ref = ") - && content.contains("maintainer_review_request_ref = ") - && content.contains("publication_request_ref = "), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::awaits_owned_review), "Committed artifact acceptance request waits for maintainer/Bifrost review before consequence." .to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-antecedents-present", - content.contains("[antecedents]") - && content.contains("closure_review_required = true") - && content.contains("soul_verdict_required = true") - && content.contains("mind_commit_required = true") - && content.contains("public_proof_required = true") - && content.contains("maintainer_review_required = true") - && content.contains("hands_commit_required = true"), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::has_antecedent_contract), "Committed artifact acceptance request requires closure, Soul, Mind, proof, review, and Hands commit antecedents." .to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-receipt-contract", - content.contains("[required_receipts]") - && content.contains( - "closure_review = \"epiphany.repo_work_closure_review.v0\"", - ) - && content.contains( - "soul_verdict = \"epiphany.soul.verification_verdict\"", - ) - && content.contains("mind_commit = \"epiphany.mind.state_commit_receipt\"") - && content.contains( - "public_proof = \"epiphany.repo_work_public_proof_bundle.v0\"", - ) - && content.contains( - "maintainer_review = \"gamecult.maintainer.review_receipt.v0\"", - ) - && content.contains("hands_commit = \"epiphany.hands.commit_receipt\"") - && content.contains( - "accepted_artifact = \"gamecult.artifact.acceptance_receipt.v0\"", - ), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::has_receipt_contract), "Committed artifact acceptance request names closure, proof, review, Hands commit, and accepted artifact receipts." .to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-packet-contract", - content.contains("[artifact_packet]") - && content.contains("requires_artifact_ref = true") - && content.contains("requires_commit_sha = true") - && content.contains("requires_changed_path_list = true") - && content.contains("requires_review_verdict = true") - && content.contains("requires_public_proof_ref = true") - && content.contains("requires_acceptance_rationale = true") - && content.contains("requires_private_state_redaction_check = true"), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::has_artifact_packet), "Committed artifact acceptance request names artifact, commit, path, review, proof, rationale, and redaction requirements." .to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-authority-seals", - content.contains("[authority]") - && content.contains("artifact_acceptance_authorized = false") - && content.contains("credit_ledger_authorized = false") - && content.contains("github_pr_authorized = false") - && content.contains("merge_authorized = false") - && content.contains("publication_authorized = false") - && content.contains("upstream_sync_authorized = false") - && content.contains("hands_action_authorized = false") - && content.contains("cross_body_mutation_authorized = false") - && content.contains( - "maintainer_or_bifrost_acceptance_authority_required = true", - ), + request + .as_ref() + .is_some_and(RepoArtifactAcceptanceRequest::has_authority_seals), "Committed artifact acceptance request denies acceptance/credit/PR/merge/publication/sync/action/cross-body authority." .to_string(), ); push_assertion( &mut assertions, "artifact-acceptance-request-private-seal", - content.contains("private_state_exposed = false"), + request + .as_ref() + .is_some_and(|request| !request.private_state_exposed), "Committed artifact acceptance request preserves the private-state seal." .to_string(), ); diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts.rs index db455bfd..1088e3b5 100644 --- a/epiphany-core/src/bin/epiphany_work/closure_contracts.rs +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts.rs @@ -238,6 +238,148 @@ pub(super) fn parse_repo_metrics_request(text: &str) -> Result bool { + self.schema_version == "epiphany.repo_artifact_acceptance_request.v0" + && self.safe_action_family == "repo.artifact_acceptance_request" + } + + pub(super) fn awaits_owned_review(&self) -> bool { + let r = &self.request; + r.status == "awaiting-artifact-acceptance-review" + && r.requested_owner == "Maintainer/Bifrost" + && r.requested_effect == "record-accepted-artifact-for-reviewed-branch-work" + && !r.verification_request_ref.is_empty() + && !r.maintainer_review_request_ref.is_empty() + && !r.publication_request_ref.is_empty() + } + + pub(super) fn has_antecedent_contract(&self) -> bool { + let a = &self.antecedents; + a.closure_review_required + && a.soul_verdict_required + && a.mind_commit_required + && a.public_proof_required + && a.maintainer_review_required + && a.hands_commit_required + } + + pub(super) fn has_receipt_contract(&self) -> bool { + let r = &self.required_receipts; + r.closure_review == "epiphany.repo_work_closure_review.v0" + && r.soul_verdict == "epiphany.soul.verification_verdict" + && r.mind_commit == "epiphany.mind.state_commit_receipt" + && r.public_proof == "epiphany.repo_work_public_proof_bundle.v0" + && r.maintainer_review == "gamecult.maintainer.review_receipt.v0" + && r.hands_commit == "epiphany.hands.commit_receipt" + && r.accepted_artifact == "gamecult.artifact.acceptance_receipt.v0" + } + + pub(super) fn has_artifact_packet(&self) -> bool { + let p = &self.artifact_packet; + p.requires_artifact_ref + && p.requires_commit_sha + && p.requires_changed_path_list + && p.requires_review_verdict + && p.requires_public_proof_ref + && p.requires_acceptance_rationale + && p.requires_private_state_redaction_check + } + + pub(super) fn has_authority_seals(&self) -> bool { + let a = &self.authority; + a.branch_local_only + && !a.artifact_acceptance_authorized + && !a.credit_ledger_authorized + && !a.github_pr_authorized + && !a.merge_authorized + && !a.publication_authorized + && !a.upstream_sync_authorized + && !a.hands_action_authorized + && !a.service_lifecycle_authority + && !a.cross_body_mutation_authorized + && !a.private_verse_rummaging + && a.maintainer_or_bifrost_acceptance_authority_required + } +} + +#[derive(Debug, Deserialize)] +struct RepoArtifactAcceptanceRequestBody { + status: String, + requested_owner: String, + requested_effect: String, + verification_request_ref: String, + maintainer_review_request_ref: String, + publication_request_ref: String, +} + +#[derive(Debug, Deserialize)] +struct RepoArtifactAcceptanceAntecedents { + closure_review_required: bool, + soul_verdict_required: bool, + mind_commit_required: bool, + public_proof_required: bool, + maintainer_review_required: bool, + hands_commit_required: bool, +} + +#[derive(Debug, Deserialize)] +struct RepoArtifactAcceptanceReceipts { + closure_review: String, + soul_verdict: String, + mind_commit: String, + public_proof: String, + maintainer_review: String, + hands_commit: String, + accepted_artifact: String, +} + +#[derive(Debug, Deserialize)] +struct RepoArtifactAcceptancePacket { + requires_artifact_ref: bool, + requires_commit_sha: bool, + requires_changed_path_list: bool, + requires_review_verdict: bool, + requires_public_proof_ref: bool, + requires_acceptance_rationale: bool, + requires_private_state_redaction_check: bool, +} + +#[derive(Debug, Deserialize)] +struct RepoArtifactAcceptanceAuthority { + branch_local_only: bool, + artifact_acceptance_authorized: bool, + credit_ledger_authorized: bool, + github_pr_authorized: bool, + merge_authorized: bool, + publication_authorized: bool, + upstream_sync_authorized: bool, + hands_action_authorized: bool, + service_lifecycle_authority: bool, + cross_body_mutation_authorized: bool, + private_verse_rummaging: bool, + maintainer_or_bifrost_acceptance_authority_required: bool, +} + +pub(super) fn parse_repo_artifact_acceptance_request( + text: &str, +) -> Result { + toml::from_str(text).context("artifact acceptance request is not valid typed TOML") +} + #[cfg(test)] mod tool_request_tests { use super::*; @@ -338,6 +480,62 @@ bifrost_or_maintainer_metrics_authority_required = true let request = parse_repo_metrics_request(text).expect("fixture is typed TOML"); assert!(!request.has_authority_seals()); } + + #[test] + fn artifact_comment_cannot_counterfeit_acceptance_seal() { + let text = r#" +schema_version = "epiphany.repo_artifact_acceptance_request.v0" +safe_action_family = "repo.artifact_acceptance_request" +summary = "summary" +private_state_exposed = false +[request] +status = "awaiting-artifact-acceptance-review" +requested_owner = "Maintainer/Bifrost" +requested_effect = "record-accepted-artifact-for-reviewed-branch-work" +verification_request_ref = "verification" +maintainer_review_request_ref = "review" +publication_request_ref = "publication" +[antecedents] +closure_review_required = true +soul_verdict_required = true +mind_commit_required = true +public_proof_required = true +maintainer_review_required = true +hands_commit_required = true +[required_receipts] +closure_review = "epiphany.repo_work_closure_review.v0" +soul_verdict = "epiphany.soul.verification_verdict" +mind_commit = "epiphany.mind.state_commit_receipt" +public_proof = "epiphany.repo_work_public_proof_bundle.v0" +maintainer_review = "gamecult.maintainer.review_receipt.v0" +hands_commit = "epiphany.hands.commit_receipt" +accepted_artifact = "gamecult.artifact.acceptance_receipt.v0" +[artifact_packet] +requires_artifact_ref = true +requires_commit_sha = true +requires_changed_path_list = true +requires_review_verdict = true +requires_public_proof_ref = true +requires_acceptance_rationale = true +requires_private_state_redaction_check = true +[authority] +branch_local_only = true +# artifact_acceptance_authorized = false +artifact_acceptance_authorized = true +credit_ledger_authorized = false +github_pr_authorized = false +merge_authorized = false +publication_authorized = false +upstream_sync_authorized = false +hands_action_authorized = false +service_lifecycle_authority = false +cross_body_mutation_authorized = false +private_verse_rummaging = false +maintainer_or_bifrost_acceptance_authority_required = true +"#; + let request = parse_repo_artifact_acceptance_request(text).expect("fixture is typed TOML"); + assert!(!request.has_authority_seals()); + } } #[derive(Debug, Deserialize)] diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 158e01ad..f83d42a1 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -808,6 +808,15 @@ exact fields and accepted-summary equality; a comment claiming `spend_authorized = false` cannot conceal an actual spend grant. Bifrost or the Maintainer remains the required accounting authority. +## Artifact-request prose substituted for acceptance contracts + +`repo.artifact_acceptance_request` closure previously accepted matching prose +as request identity, evidence contracts, packet requirements, and denied +acceptance authority. The family now parses typed TOML and checks exact +semantics. A commented denial cannot conceal +`artifact_acceptance_authorized = true`; Maintainer/Bifrost remains the only +named acceptance owner. + ## Unresolved: provider receipts without chronology Bifrost body-change/GitHub publication receipts are externally owned and their diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index cbd13c07..726184be 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -234,9 +234,10 @@ Historical implementation detail belongs in git history, smoke artifacts, and th ## Next real move -Continue the modeling pass beyond receipt writers. Tool-request and -metrics-request closure now use typed family contracts and cannot accept -comment-counterfeit execution or spend seals. +Continue the modeling pass beyond receipt writers. Tool-request, +metrics-request, and artifact-acceptance-request closure now use typed family +contracts and cannot accept comment-counterfeit execution, spend, or acceptance +seals. Inventory remaining substring closure families and production paths where a projection, cache, adapter, scheduler, coordinator, or compatibility surface asserts a fact owned elsewhere. For each candidate, name the owner, allowed diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 0147368cd6514c8c68e1f80e0503a1ca4d80b812..8285b8a0b04c8172832318c5a14388b76a621b29 100644 GIT binary patch delta 146 zcmcc6Co_Md%mztDE(RwPd;=2dn7xmu&1}Tu3Te*x7vmlYK0x delta 60 zcmbO~QRYIQ%mztDE>kNLgQ#N+>}