From 26db5f405d6c323b00b73966f1fe0b5d43548da3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 03:40:10 +0100 Subject: [PATCH] Separate preparation closure authority --- epiphany-core/src/bin/epiphany-work.rs | 49 ++++----- .../bin/epiphany_work/closure_contracts.rs | 1 + .../closure_contracts/preparation.rs | 101 ++++++++++++++++++ .../closure_contracts/preparation_tests.rs | 39 +++++++ ...onceptual-substitution-audit-2026-07-12.md | 22 ++++ notes/fresh-workspace-handoff.md | 9 ++ state/ledgers.msgpack | Bin 470245 -> 470633 bytes state/map.yaml | 2 +- 8 files changed, 195 insertions(+), 28 deletions(-) create mode 100644 epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs create mode 100644 epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index c8bc9b2f..94896a66 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -7253,73 +7253,67 @@ fn closure_family_assertions( ); } "repo.objective_draft" => { + let draft = parse_repo_objective_draft(&content).ok(); push_assertion( &mut assertions, "objective-draft-schema-present", - content.contains("schema_version = \"epiphany.repo_objective_draft.v0\""), + draft + .as_ref() + .is_some_and(RepoObjectiveDraft::has_canonical_identity), "Committed Objective Draft carries the schema version.".to_string(), ); push_assertion( &mut assertions, "objective-draft-family-present", - content.contains("safe_action_family = \"repo.objective_draft\""), + draft + .as_ref() + .is_some_and(RepoObjectiveDraft::has_canonical_identity), "Committed Objective Draft carries the safe action family.".to_string(), ); push_assertion( &mut assertions, "objective-draft-summary-present", - content.contains(&compact_summary), + draft + .as_ref() + .is_some_and(|value| value.summary == compact_summary), "Committed Objective Draft contains the accepted pressure summary.".to_string(), ); push_assertion( &mut assertions, "objective-draft-review-state", - content.contains("[draft]") - && content.contains("status = \"review-required\"") - && content.contains("adoption_gate = \"Mind\"") - && content.contains("scheduler_gate = \"Self\"") - && content.contains("publication_gate = \"Bifrost\"") - && content.contains("objective_adopted = false"), + draft + .as_ref() + .is_some_and(RepoObjectiveDraft::remains_imagination_draft), "Committed Objective Draft remains review-required and unadopted.".to_string(), ); push_assertion( &mut assertions, "objective-draft-acceptance-criteria", - content.contains("[acceptance]") - && content.contains("Mind explicitly accepts or rejects") - && content.contains("Self schedules only after Mind adoption") - && content.contains("Hands acts only through a later receipt-backed plan") - && content.contains("Bifrost gates publication"), + draft + .as_ref() + .is_some_and(RepoObjectiveDraft::has_acceptance_contract), "Committed Objective Draft names acceptance criteria and downstream gates." .to_string(), ); push_assertion( &mut assertions, "objective-draft-inputs-present", - content.contains("[inputs]") - && content.contains("public_discussion_refs = [") - && content.contains("candidate_action_refs = [") - && content.contains("consensus_brief_required = true"), + draft.as_ref().is_some_and(RepoObjectiveDraft::has_input_contract), "Committed Objective Draft preserves discussion/action refs and requires consensus." .to_string(), ); push_assertion( &mut assertions, "objective-draft-authority-seals", - content.contains("[authority]") - && content.contains("objective_adoption_authorized = false") - && content.contains("self_scheduling_authorized = false") - && content.contains("hands_action_authorized = false") - && content.contains("publication_authorized = false") - && content.contains("cross_body_mutation_authorized = false") - && content.contains("mind_adoption_required = true") - && content.contains("bifrost_publication_required = true"), + draft.as_ref().is_some_and(RepoObjectiveDraft::has_authority_seals), "Committed Objective Draft denies adoption/scheduling/action/publication/cross-body authority and requires Mind/Bifrost gates.".to_string(), ); push_assertion( &mut assertions, "objective-draft-private-seal", - content.contains("private_state_exposed = false"), + draft + .as_ref() + .is_some_and(|value| !value.private_state_exposed), "Committed Objective Draft preserves the private-state seal.".to_string(), ); } @@ -15346,6 +15340,7 @@ idunn_deployment_authority_required = true "repo.sync_request", "repo.pr_request", "repo.maintainer_review_request", + "repo.objective_draft", "repo.adoption_request", "repo.scheduling_request", "repo.work_order", diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts.rs index 6e54f43c..efe4944a 100644 --- a/epiphany-core/src/bin/epiphany_work/closure_contracts.rs +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts.rs @@ -1,3 +1,4 @@ include!("closure_contracts/external_governance.rs"); +include!("closure_contracts/preparation.rs"); include!("closure_contracts/workflow.rs"); include!("closure_contracts/operations.rs"); diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs new file mode 100644 index 00000000..5ed7a009 --- /dev/null +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs @@ -0,0 +1,101 @@ +#[derive(Debug, Deserialize)] +pub(super) struct RepoObjectiveDraft { + pub(super) schema_version: String, + pub(super) safe_action_family: String, + pub(super) summary: String, + pub(super) private_state_exposed: bool, + draft: RepoObjectiveDraftState, + acceptance: RepoObjectiveDraftAcceptance, + inputs: RepoObjectiveDraftInputs, + authority: RepoObjectiveDraftAuthority, +} + +impl RepoObjectiveDraft { + pub(super) fn has_canonical_identity(&self) -> bool { + self.schema_version == "epiphany.repo_objective_draft.v0" + && self.safe_action_family == "repo.objective_draft" + } + + pub(super) fn remains_imagination_draft(&self) -> bool { + let d = &self.draft; + d.status == "review-required" + && d.owner == "Imagination" + && d.adoption_gate == "Mind" + && d.scheduler_gate == "Self" + && d.publication_gate == "Bifrost" + && !d.objective_adopted + } + + pub(super) fn has_acceptance_contract(&self) -> bool { + self.acceptance.criteria + == [ + "Mind explicitly accepts or rejects this Objective Draft before Self schedules it.", + "Self schedules only after Mind adoption and a safe-family action plan exist.", + "Hands acts only through a later receipt-backed plan and declared path scope.", + "Bifrost gates publication, credit, and upstream-main sync.", + ] + } + + pub(super) fn has_input_contract(&self) -> bool { + self.inputs.consensus_brief_required + && self + .inputs + .public_discussion_refs + .iter() + .all(|v| !v.trim().is_empty()) + && self + .inputs + .candidate_action_refs + .iter() + .all(|v| !v.trim().is_empty()) + } + + pub(super) fn has_authority_seals(&self) -> bool { + let a = &self.authority; + a.branch_local_only + && !a.objective_adoption_authorized + && !a.self_scheduling_authorized + && !a.hands_action_authorized + && !a.publication_authorized + && !a.cross_body_mutation_authorized + && a.mind_adoption_required + && a.bifrost_publication_required + } +} + +#[derive(Debug, Deserialize)] +struct RepoObjectiveDraftState { + status: String, + owner: String, + adoption_gate: String, + scheduler_gate: String, + publication_gate: String, + objective_adopted: bool, +} +#[derive(Debug, Deserialize)] +struct RepoObjectiveDraftAcceptance { + criteria: Vec, +} +#[derive(Debug, Deserialize)] +struct RepoObjectiveDraftInputs { + public_discussion_refs: Vec, + candidate_action_refs: Vec, + consensus_brief_required: bool, +} +#[derive(Debug, Deserialize)] +struct RepoObjectiveDraftAuthority { + branch_local_only: bool, + objective_adoption_authorized: bool, + self_scheduling_authorized: bool, + hands_action_authorized: bool, + publication_authorized: bool, + cross_body_mutation_authorized: bool, + mind_adoption_required: bool, + bifrost_publication_required: bool, +} + +pub(super) fn parse_repo_objective_draft(text: &str) -> Result { + toml::from_str(text).context("objective draft is not valid typed TOML") +} + +include!("preparation_tests.rs"); diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs new file mode 100644 index 00000000..bb135647 --- /dev/null +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs @@ -0,0 +1,39 @@ +#[cfg(test)] +mod preparation_tests { + use super::*; + + #[test] + fn objective_draft_comment_cannot_counterfeit_adoption_seal() { + let text = r#" +schema_version = "epiphany.repo_objective_draft.v0" +safe_action_family = "repo.objective_draft" +summary = "summary" +private_state_exposed = false +[draft] +status = "review-required" +owner = "Imagination" +adoption_gate = "Mind" +scheduler_gate = "Self" +publication_gate = "Bifrost" +objective_adopted = false +[acceptance] +criteria = ["Mind explicitly accepts or rejects this Objective Draft before Self schedules it.", "Self schedules only after Mind adoption and a safe-family action plan exist.", "Hands acts only through a later receipt-backed plan and declared path scope.", "Bifrost gates publication, credit, and upstream-main sync."] +[inputs] +public_discussion_refs = [] +candidate_action_refs = [] +consensus_brief_required = true +[authority] +branch_local_only = true +# objective_adoption_authorized = false +objective_adoption_authorized = true +self_scheduling_authorized = false +hands_action_authorized = false +publication_authorized = false +cross_body_mutation_authorized = false +mind_adoption_required = true +bifrost_publication_required = true +"#; + let draft = parse_repo_objective_draft(text).expect("fixture is typed TOML"); + assert!(!draft.has_authority_seals()); + } +} diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 0983e407..7db985ed 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -1068,6 +1068,28 @@ Sixteen high-authority closure families are typed; 447 substring assertions remain. The adoption/scheduling/work-order/verification workflow chain is now typed under one physical owner. +## Source-derived residual inventory + +The running residual count above was inferred from diff deletions and is not a +sound metric. A direct parse of the closure match arms finds 426 +`content.contains` occurrences across sixteen remaining families. That is the +canonical baseline; future counts must be regenerated from source. The +families separate into presentation helpers, Body/interface descriptions, +collaboration/preparation cargo, readiness publication/accounting, and doctrine +policy. They do not share an owner merely because they share an assertion +mechanism. + +## Objective draft physically owned by preparation + +`repo.objective_draft` is Imagination-owned preparation cargo, not workflow +authority and not external governance. A new `preparation.rs` closure domain +owns its typed draft state, acceptance contract, input references, and +authority seals. A commented adoption denial cannot conceal a real adoption +grant. Mind, Self, Hands, and Bifrost remain downstream gates. + +Seventeen high-authority closure families are typed. The source-derived +residual is 426 substring occurrences across sixteen families. + The same inspection found 33 consecutive duplicate `#[cfg(test)]` attributes on provider constructors/writers and their re-exports. One gate already makes each item test-only; the second owned nothing. The duplicates are removed. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 361fcf1d..ba90bc03 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -344,6 +344,15 @@ and adoption is in the class guard. Sixteen high-authority families are typed and 447 substring assertions remain. The complete adoption/scheduling/work- order/verification chain now has one physical workflow owner. +The old residual counter was diff-derived and has been retired. Direct source +inventory now reports 426 `content.contains` occurrences across sixteen +remaining closure families. Objective Draft has moved into a new physical +`preparation.rs` owner because it is Imagination cargo, not workflow or +external governance. Its typed closure and malicious fixture prevent a +commented adoption denial from hiding a real grant. Seventeen high-authority +families are typed. Continue from the source-derived family inventory, not the +historical counter. + The latest structural count is 32 closure family branches, 744 remaining substring assertions in the closure region, and 1,284 lines in `closure_contracts.rs`. Do not blindly generate a struct forest for every diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 65fa49a5a10a7b36f2d2e575d8e84dd2748d57ca..2a6494ec1e97bdf58c9793ee80e0aa009d59dcb4 100644 GIT binary patch delta 403 zcmXYsze)o^5XQZz36d8Ol48J4%n@T^kya4wRIF@dvNxBETz1ddz5J;xEPMb7V&?-` z2o}D9@1WRP_!iE^6dwaSzxnq2emzTMy2dLWHa#4`{@B z51wylfyjc;SefM)ne&AZq&Vh`$;WUcgh6BELOBWsb{5Qva#KsM+lhQ_RI~ zaIMia{#7EF1}&y-;AD(Lwo8k>{}R1brIa`TCN3}STb?k3lxLw#QaYOqHSVxLNn+^q O9?zbujhcsCU*kU$agi4Q delta 61 zcmaEPN9O5GnGF(*+{R{BrUp^R7}&KBZB}M1WMs@}p32ldm5C9EK{PWEvj8zG5VLKc J%ETU^1ptMy6A%CZ diff --git a/state/map.yaml b/state/map.yaml index 472d37b6..8c06ac10 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -660,4 +660,4 @@ current_status: - Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass. - `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure. last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. swarm overview readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync. - next_action: Continue the conceptual-substitution pass. Sixteen high-authority closure families are typed and guarded; 447 substring assertions remain. Workflow physically owns typed adoption, scheduling, work-order, and verification closure plus counterfeit-authority fixtures. Presentation comments can no longer impersonate Mind admission, Self queue, Hands work-order, or Soul verification authority in this chain. Direct rustfmt is required because Cargo fmt misses the lexically included files. Next remap the remaining untyped closure families by owner and consequence before selecting another cut; do not assume the residual families belong in workflow. External governance should converge on tooling plus publication/accounting; operations retains policy/deployment. Provider chronology is explicitly external and guarded as arrival order. Continue auditing evidence/security mirrors and adapters for borrowed authority. + next_action: Continue the conceptual-substitution pass. Seventeen high-authority closure families are typed and guarded. The old diff-derived residual counter was unsound; direct source inventory is authoritative and reports 426 content.contains occurrences across sixteen remaining families. Workflow physically owns adoption, scheduling, work-order, and verification. Preparation now physically owns typed Objective Draft and its counterfeit-adoption fixture. Next map the remaining preparation/collaboration families before typing another one; readiness review has unresolved composite reviewer ownership and must not be mechanically typed until that authority is clarified. External governance should converge on tooling plus publication/accounting; operations retains policy/deployment. Provider chronology is explicitly external and guarded as arrival order. Continue auditing evidence/security mirrors and adapters for borrowed authority.