From 874604f928382e6d68567c709739a70596b6b7ac Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 02:23:53 +0100 Subject: [PATCH] Guard typed closure authority boundaries --- epiphany-core/src/bin/epiphany-work.rs | 27 ++++++++++++++++++ ...onceptual-substitution-audit-2026-07-12.md | 17 +++++++++++ notes/fresh-workspace-handoff.md | 7 +++++ state/ledgers.msgpack | Bin 461256 -> 461661 bytes state/map.yaml | 2 +- 5 files changed, 52 insertions(+), 1 deletion(-) diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index c10ebc82..d9c0d6d6 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -15500,6 +15500,33 @@ idunn_deployment_authority_required = true assert!(!source.contains(&["repo-work-map", ".msgpack"].concat())); } + #[test] + fn typed_closure_families_have_no_substring_authority() { + let source = include_str!("epiphany-work.rs"); + for family in [ + "repo.tool_request", + "repo.credit_request", + "repo.artifact_acceptance_request", + "repo.metrics_request", + "repo.secret_policy_request", + "repo.dependency_policy_request", + "repo.deployment_config", + "repo.deployment_request", + ] { + let marker = format!("\"{family}\" => {{"); + let start = source + .find(&marker) + .unwrap_or_else(|| panic!("missing {family}")); + let remainder = &source[start + marker.len()..]; + let end = remainder.find("\n \"").unwrap_or(remainder.len()); + let branch = &remainder[..end]; + assert!( + !branch.contains("content.contains"), + "{family} closure regained substring authority" + ); + } + } + #[test] fn modeling_finding_round_trips_and_refuses_private_state() -> Result<()> { let temp = tempfile::tempdir()?; diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 82f38d95..71952038 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -825,6 +825,23 @@ fragments. It now parses a family-specific typed contract and checks exact semantics. A comment cannot conceal `credit_ledger_authorized = true`; Bifrost remains the sole credit consequence owner. +## Closure-family structural inventory + +The closure matcher currently has 32 `repo.*` family branches and 744 remaining +`content.contains(...)` assertions in the measured closure region. The typed +contract organ is already 1,284 lines. Therefore “add one struct forest per +family” is not itself the target architecture; typed syntax without earned +family ownership would merely rename the Jenga. + +Eight high-authority families currently have explicit typed semantic owners: +tool request, credit request, artifact acceptance, metrics, secret policy, +dependency policy, deployment config, and deployment request. A source-level +negative proof now prevents any of those converted branches from regaining +substring authority. Future cuts should prioritize consequence-bearing request +families, while collapsing shared envelope syntax only where the shared owner +and invariant can be named. Presentation-only markdown checks do not deserve a +policy framework merely because they also use strings. + ## 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 ae940d39..59ed0d87 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -245,6 +245,13 @@ inputs, emitted state, forbidden writers, and negative proof before changing code. Also audit remaining non-receipt smoke binaries for path escape or destructive scope. +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 +presentation-only family. The eight converted high-authority families are +covered by `typed_closure_families_have_no_substring_authority`; prioritize the +next consequence-bearing request and require a named owner. + ## Verification baseline The last completed code pass had 258 library tests passing and all binaries compiling. Re-run focused checks for the next touched surface; use the full library/binary baseline before committing a new architectural cut. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 7368afd43d808529be939258652a1845bd1e6bfd..bb5bbffd1a95f776598cd8469a04b66f11e165b3 100644 GIT binary patch delta 414 zcmYjNJxjzu5H;t=!d14y6$6%Dj+i@9&PoJJu@mg}Hj`wzWar%7L{eE;_ygp;-pW$2 z@E?f3LGZsgiwYKRKiv zweNnCYIKlWsySlu8}agA#=quct}C*^U9lLgmLP+`d6@D4WWcX#l#g?=$XsFR#+M^F OBh@$-c_vpNMDh*PO_BHj delta 61 zcmcaRP3FX8nGKSR(>HLiv#>=SV_@f4x>=dAkde{1c`8%;R3=6s2GPtw%mT!$K+Lv% JDigagI{;tT5)J?W diff --git a/state/map.yaml b/state/map.yaml index 48d15b2c..b1c0aac1 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. Typed deployment config/request, secret-policy, dependency-policy, tool-request, metrics-request, artifact-acceptance-request, and credit-request contracts now live in parent-private epiphany_work/closure_contracts.rs; comments cannot counterfeit execution, spend, acceptance, or credit-denial seals. Add future family validators there only when they protect named invariants, never as generic policy mush. Operational/evidence/self-state and operator mirrors follow owned clocks; identity chains are typed; scheduling/runbook selection do not parse prose; verse-query smoke deletion is canonically confined; writerless readiness-review is deleted. Bifrost provider receipts still need provider chronology. Continue auditing remaining substring closure families, destructive path consumers, evidence/security mirrors, and adapters for borrowed authority. + next_action: Continue the conceptual-substitution pass. Eight high-authority closure families are typed and guarded against regaining substring authority. The closure region still has 32 family branches and 744 substring assertions while closure_contracts.rs is 1,284 lines; do not substitute a blind struct forest for coherent ownership. Prioritize consequence-bearing request families, collapse shared syntax only when a named invariant earns it, and leave presentation-only markdown checks out of policy machinery. Operational/evidence/self-state and operator mirrors follow owned clocks; identity chains are typed; scheduling/runbook selection do not parse prose; verse-query smoke deletion is canonically confined; writerless readiness-review is deleted. Bifrost provider receipts still need provider chronology. Continue auditing destructive path consumers, evidence/security mirrors, and adapters for borrowed authority.