diff --git a/epiphany-core/src/bin/epiphany-verse-query.rs b/epiphany-core/src/bin/epiphany-verse-query.rs index 0c7e7575..c6fd1736 100644 --- a/epiphany-core/src/bin/epiphany-verse-query.rs +++ b/epiphany-core/src/bin/epiphany-verse-query.rs @@ -100,7 +100,7 @@ use sha2::Sha256; use std::collections::BTreeMap; use std::env; use std::fs; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; const WRAPPER_OVERVIEW_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode swarm-overview"; const WRAPPER_SWARM_ONLINE_RUNBOOK_COMMAND: &str = @@ -188,6 +188,38 @@ fn require_query_bootstrap(args: &Args) -> Result<()> { Ok(()) } +fn reset_quarantined_smoke_store(base: &Path, store: &Path) -> Result<()> { + let expected_store = Path::new(".epiphany-smoke/verse-query-default/local-verse.ccmp"); + if store != expected_store { + anyhow::bail!( + "refusing to reset non-default verse-query smoke store {}", + store.display() + ); + } + let quarantine = base.join(".epiphany-smoke"); + fs::create_dir_all(&quarantine)?; + let resolved_quarantine = quarantine.canonicalize()?; + let target = base.join( + store + .parent() + .context("default verse-query smoke store has no parent")?, + ); + if target.exists() { + let resolved_target = target.canonicalize()?; + if resolved_target == resolved_quarantine + || !resolved_target.starts_with(&resolved_quarantine) + { + anyhow::bail!( + "refusing to delete verse-query smoke target outside quarantine: {} -> {}", + target.display(), + resolved_target.display() + ); + } + fs::remove_dir_all(&target)?; + } + Ok(()) +} + fn seed_quarantined_smoke_daemon_statuses(args: &Args) -> Result<()> { if !args.smoke_default_store { anyhow::bail!("synthetic daemon readiness is confined to the built-in smoke store"); @@ -1351,9 +1383,7 @@ fn run_cli() -> Result<()> { "verse-query smoke fixtures may use only the built-in .epiphany-smoke quarantine store; --store and --runtime-id overrides are forbidden" ); } - if let Some(parent) = args.store.parent() { - fs::remove_dir_all(parent).ok(); - } + reset_quarantined_smoke_store(&env::current_dir()?, &args.store)?; seed_epiphany_local_verse_context( &args.store, args.runtime_id.clone(), @@ -9441,6 +9471,34 @@ fn required_list(values: &Option>, message: &str) -> Result Result<()> { + let temp = tempfile::tempdir()?; + let target = temp + .path() + .join(".epiphany-smoke") + .join("verse-query-default"); + fs::create_dir_all(&target)?; + fs::write(target.join("sentinel"), "delete me")?; + reset_quarantined_smoke_store( + temp.path(), + Path::new(".epiphany-smoke/verse-query-default/local-verse.ccmp"), + )?; + assert!(!target.exists()); + + let outside = temp.path().join("outside"); + fs::create_dir_all(&outside)?; + fs::write(outside.join("sentinel"), "preserve me")?; + assert!( + reset_quarantined_smoke_store(temp.path(), Path::new("outside/local-verse.ccmp")) + .unwrap_err() + .to_string() + .contains("non-default") + ); + assert!(outside.join("sentinel").exists()); + Ok(()) + } + fn directory_row(service_id: &str, route: &str) -> ReceiptDirectoryRow { ReceiptDirectoryRow { family: "service-execution-runbook".to_string(), diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index e5f1b7c2..5cd49418 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -768,6 +768,25 @@ accepted-summary equality and semantic section values. Commented SSH or deployment denials cannot conceal real grants, and the branch contains no substring authority. +## Default-argument provenance substituted for deletion scope + +`epiphany-verse-query smoke` recursively deleted the parent of its store when a +boolean said the CLI had used default arguments. That proved how the path was +chosen, not where it resolved. The reset now requires the exact built-in store +path and independently canonicalizes both `.epiphany-smoke` and the deletion +target at actuation time. The target must be a strict descendant of the +quarantine; junctions or other resolution escapes are refused. An outside +sentinel survives a counterfeit store path. + +## Structural pressure: closure contracts need extraction + +The typed deployment, deployment-request, secret-policy, and dependency-policy +models now form a contiguous contract organ inside the 16k-line `epiphany-work` +binary. Do not add another family validator there. Extract these models and +semantic predicates into a dedicated repo-work closure-contract module before +continuing the conversion campaign; an inline namespace or generic policy blob +would merely rearrange the monolith. + ## 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 7ed53fcc..19a0efc6 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -194,6 +194,11 @@ The confirmed conceptual substitutions have been cut: - Deployment-request closure parses typed TOML for Idunn ownership, antecedents, receipts, deployment packet, and authority seals; comment prose cannot counterfeit SSH/push/deployment denials. +- Verse-query smoke reset proves the exact built-in path and canonical strict + containment beneath `.epiphany-smoke` immediately before recursive deletion. +- The four typed closure contract families now form a contiguous organ inside + `epiphany-work`; extract them to a dedicated module before adding more typed + families. Do not replace this with an inline namespace or generic policy blob. - Bifrost provider receipt contracts still lack provider timestamp/revision. Do not invent consumer-side ordering; repair that in a Bifrost-owned schema. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 5ae39ca6..a983a452 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 8f1f70ae..b81a085d 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 modeling pass beyond receipt writers. Operational/evidence/self-state and operator surfaces with owned clocks are event-time ordered; operator receipts bind intents by run identity rather than global chronology; Eve/tool/Bifrost/collaboration projections join chains only by typed identity; repo-work scheduling and service-runbook selection use typed rows/IDs rather than reparsed presentation prose; deployment config/request, secret-policy, and dependency-policy closure use typed TOML semantics; writerless readiness-review is deleted. Bifrost provider receipts still need provider-owned chronology, and artifact/metrics receipts need explicit repo-work request identity; accounting refuses closure until those contracts exist. Continue converting remaining authority-bearing closure validators, then audit evidence/security mirrors, service configuration claims, adapters, and destructive path consumers for borrowed authority. + next_action: Extract the contiguous typed deployment config/request, secret-policy, and dependency-policy closure contracts from the 16k-line epiphany-work binary into a dedicated repo-work closure-contract module before adding more family validators. Preserve their family-specific semantic predicates; do not create generic policy mush. Then continue the conceptual-substitution pass. 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 and artifact/metrics request identity.