diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index e0a31e86..773ff4ea 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -6898,70 +6898,66 @@ fn closure_family_assertions( ); } "repo.consensus_brief" => { + let brief = parse_repo_consensus_brief(&content).ok(); push_assertion( &mut assertions, "consensus-brief-schema-present", - content.contains("schema_version = \"epiphany.repo_consensus_brief.v0\""), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::has_canonical_identity), "Committed consensus brief carries the schema version.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-family-present", - content.contains("safe_action_family = \"repo.consensus_brief\""), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::has_canonical_identity), "Committed consensus brief carries the safe action family.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-summary-present", - content.contains(&compact_summary), + brief + .as_ref() + .is_some_and(|value| value.summary == compact_summary), "Committed consensus brief contains the accepted pressure summary.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-draft-state", - content.contains("[consensus]") - && content.contains("status = \"draft\"") - && content.contains("converged = false") - && content.contains("conflicts_remaining = true") - && content.contains("requires_human_or_persona_review = true"), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::remains_unconverged_draft), "Committed consensus brief remains a draft requiring review.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-imagination-route", - content.contains("[imagination]") - && content.contains("role = \"consensus-discovery\"") - && content.contains("candidate_actions_non_authoritative = true") - && content.contains("may_emit_action_items_receipt = true") - && content.contains("must_not_read_private_verses = true"), + brief.as_ref().is_some_and(RepoConsensusBrief::has_imagination_route), "Committed consensus brief routes through Imagination without private Verse rummaging.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-inputs-present", - content.contains("[inputs]") - && content.contains("public_discussion_refs = [") - && content.contains("candidate_action_refs = [") - && content.contains("feedback_source = \"Persona public discussion\""), + brief + .as_ref() + .is_some_and(RepoConsensusBrief::has_input_contract), "Committed consensus brief preserves public feedback and candidate-action inputs." .to_string(), ); push_assertion( &mut assertions, "consensus-brief-authority-seals", - content.contains("[authority]") - && content.contains("objective_adoption_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"), + brief.as_ref().is_some_and(RepoConsensusBrief::has_authority_seals), "Committed consensus brief denies adoption/action/publication/cross-body authority and requires Mind/Bifrost gates.".to_string(), ); push_assertion( &mut assertions, "consensus-brief-private-seal", - content.contains("private_state_exposed = false"), + brief + .as_ref() + .is_some_and(|value| !value.private_state_exposed), "Committed consensus brief preserves the private-state seal.".to_string(), ); } @@ -15245,6 +15241,7 @@ idunn_deployment_authority_required = true "repo.sync_request", "repo.pr_request", "repo.maintainer_review_request", + "repo.consensus_brief", "repo.interpreter_brief", "repo.objective_draft", "repo.adoption_request", diff --git a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs index a06a1bd1..de2e7d26 100644 --- a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation.rs @@ -1,3 +1,84 @@ +#[derive(Debug, Deserialize)] +pub(super) struct RepoConsensusBrief { + pub(super) schema_version: String, + pub(super) safe_action_family: String, + pub(super) summary: String, + pub(super) private_state_exposed: bool, + consensus: RepoConsensusState, + imagination: RepoConsensusImagination, + inputs: RepoConsensusInputs, + authority: std::collections::BTreeMap, +} +impl RepoConsensusBrief { + pub(super) fn has_canonical_identity(&self) -> bool { + self.schema_version == "epiphany.repo_consensus_brief.v0" + && self.safe_action_family == "repo.consensus_brief" + } + pub(super) fn remains_unconverged_draft(&self) -> bool { + self.consensus.status == "draft" + && !self.consensus.converged + && self.consensus.conflicts_remaining + && self.consensus.requires_human_or_persona_review + } + pub(super) fn has_imagination_route(&self) -> bool { + let i = &self.imagination; + i.role == "consensus-discovery" + && i.candidate_actions_non_authoritative + && i.may_emit_action_items_receipt + && i.must_preserve_public_refs + && i.must_not_read_private_verses + } + pub(super) fn has_input_contract(&self) -> bool { + self.inputs.feedback_source == "Persona public discussion" + && 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 { + [ + "objective_adoption_authorized", + "hands_action_authorized", + "publication_authorized", + "cross_body_mutation_authorized", + ] + .iter() + .all(|key| self.authority.get(*key) == Some(&false)) + && self.authority.get("mind_adoption_required") == Some(&true) + && self.authority.get("bifrost_publication_required") == Some(&true) + } +} +#[derive(Debug, Deserialize)] +struct RepoConsensusState { + status: String, + converged: bool, + conflicts_remaining: bool, + requires_human_or_persona_review: bool, +} +#[derive(Debug, Deserialize)] +struct RepoConsensusImagination { + role: String, + candidate_actions_non_authoritative: bool, + may_emit_action_items_receipt: bool, + must_preserve_public_refs: bool, + must_not_read_private_verses: bool, +} +#[derive(Debug, Deserialize)] +struct RepoConsensusInputs { + public_discussion_refs: Vec, + candidate_action_refs: Vec, + feedback_source: String, +} +pub(super) fn parse_repo_consensus_brief(text: &str) -> Result { + toml::from_str(text).context("consensus brief is not valid typed TOML") +} + #[derive(Debug, Deserialize)] pub(super) struct RepoInterpreterBrief { pub(super) schema_version: String, 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 index 486fc4ce..c3376d0d 100644 --- a/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs +++ b/epiphany-core/src/bin/epiphany_work/closure_contracts/preparation_tests.rs @@ -2,6 +2,41 @@ mod preparation_tests { use super::*; + #[test] + fn consensus_comment_cannot_counterfeit_adoption_seal() { + let text = r#" +schema_version = "epiphany.repo_consensus_brief.v0" +safe_action_family = "repo.consensus_brief" +summary = "summary" +private_state_exposed = false +[consensus] +status = "draft" +converged = false +conflicts_remaining = true +requires_human_or_persona_review = true +[imagination] +role = "consensus-discovery" +candidate_actions_non_authoritative = true +may_emit_action_items_receipt = true +must_preserve_public_refs = true +must_not_read_private_verses = true +[inputs] +public_discussion_refs = [] +candidate_action_refs = [] +feedback_source = "Persona public discussion" +[authority] +# objective_adoption_authorized = false +objective_adoption_authorized = true +hands_action_authorized = false +publication_authorized = false +cross_body_mutation_authorized = false +mind_adoption_required = true +bifrost_publication_required = true +"#; + let brief = parse_repo_consensus_brief(text).expect("fixture is typed TOML"); + assert!(!brief.has_authority_seals()); + } + #[test] fn interpreter_comment_cannot_counterfeit_state_authority_seal() { let text = r#" diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 1615d3b6..c7f397ca 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -1119,6 +1119,18 @@ the class guard prevents the family returning to substring truth. Nineteen high-authority closure families are typed. Direct source inventory now reports 303 substring occurrences across fourteen remaining families. +## Consensus state as nearby prose + +`repo.consensus_brief` was semantically honest—it remained draft, +unconverged, conflict-bearing, and review-required—but closure inferred those +facts and its authority seals by substring. Typed preparation closure now reads +the actual consensus, Imagination route, public inputs, downstream gates, and +privacy state. The counterfeit-adoption fixture proves comments cannot turn a +real grant into an apparent denial. + +Twenty high-authority closure families are typed. Direct source inventory now +reports 278 substring occurrences across thirteen remaining 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 286f4062..32e37458 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -368,6 +368,13 @@ counterfeit-state-authority fixture. Nineteen high-authority families are typed; direct source inventory reports 303 substring occurrences across fourteen remaining families. +Consensus Brief keeps its honest draft/unconverged semantics but no longer +proves them with substring presence. Preparation owns its typed consensus, +Imagination route, inputs, authority, and privacy closure; a malicious comment +cannot counterfeit adoption denial. Twenty high-authority families are typed; +direct source inventory reports 278 substring occurrences across thirteen +remaining families. + 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 2099c7b3..5a0281f0 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 9a00cc92..e4077b63 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. Nineteen high-authority closure families are typed and guarded. Direct source inventory reports 303 content.contains occurrences across fourteen remaining families. Workflow owns adoption, scheduling, work-order, and verification. Preparation owns Objective Draft and Interpreter Brief; the latter is now honestly Imagination-authored request cargo awaiting Mind interpretation, not fake Mind-owned state. Readiness routing remains Self-owned with independent reviewers and no local approval owner. Next map consensus and planning brief authority before another preparation cut. 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. Twenty high-authority closure families are typed and guarded. Direct source inventory reports 278 content.contains occurrences across thirteen remaining families. Workflow owns adoption, scheduling, work-order, and verification. Preparation owns Consensus Brief, Interpreter Brief, and Objective Draft with honest Imagination-to-Mind boundaries. Readiness routing remains Self-owned with independent reviewers and no local approval owner. Next dissect the sprawling planning brief rather than mechanically encoding its 95 substring checks; determine whether its safe-family matrix is one preparation contract or several authorities glued together. 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.