Bind repo work adoption to Mind authority
This commit is contained in:
parent
fcbab316e6
commit
2f22dbbca7
17 changed files with 1174 additions and 4232 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,454 +0,0 @@
|
|||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use chrono::Utc;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let result = run_smoke(args)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Args {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut root = env::current_dir().context("failed to resolve current directory")?;
|
||||
let mut args = env::args().skip(1).peekable();
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--root" => root = take_path(&mut args, "--root")?,
|
||||
other => return Err(anyhow!("unexpected argument {other:?}")),
|
||||
}
|
||||
}
|
||||
Ok(Self { root })
|
||||
}
|
||||
}
|
||||
|
||||
fn run_smoke(args: Args) -> Result<Value> {
|
||||
let root = args
|
||||
.root
|
||||
.canonicalize()
|
||||
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
|
||||
let smoke_root = root.join(".epiphany-smoke");
|
||||
let manifest = root.join("epiphany-core").join("Cargo.toml");
|
||||
if !manifest.exists() {
|
||||
return Err(anyhow!(
|
||||
"could not find epiphany-core manifest at {}",
|
||||
manifest.display()
|
||||
));
|
||||
}
|
||||
fs::create_dir_all(&smoke_root)
|
||||
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
|
||||
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
|
||||
let smoke_dir = smoke_root.join(format!("repo-doctrine-update-request-family-{stamp}"));
|
||||
fs::create_dir(&smoke_dir)
|
||||
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
|
||||
|
||||
let repo = smoke_dir.join("repo-body");
|
||||
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
|
||||
git(["init"], &repo)?;
|
||||
git(
|
||||
["config", "user.email", "epiphany-smoke@example.invalid"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
|
||||
fs::write(
|
||||
repo.join("README.md"),
|
||||
"# Repo Doctrine Update Request Family Smoke\n\nThis repository proves branch-local doctrine update request cargo without direct doctrine mutation authority.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
|
||||
fs::write(
|
||||
repo.join("AGENTS.md"),
|
||||
"# Repo Agent Doctrine\n\nExisting doctrine stays untouched by the request artifact.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("AGENTS.md").display()))?;
|
||||
git(["add", "README.md", "AGENTS.md"], &repo)?;
|
||||
git(
|
||||
[
|
||||
"commit",
|
||||
"-m",
|
||||
"Seed repo doctrine update request smoke body",
|
||||
],
|
||||
&repo,
|
||||
)?;
|
||||
git(
|
||||
[
|
||||
"switch",
|
||||
"-c",
|
||||
"epiphany/repo-doctrine-update-request-family",
|
||||
],
|
||||
&repo,
|
||||
)?;
|
||||
|
||||
let item = "repo-doctrine-update-request-family";
|
||||
let target_path = ".epiphany/doctrine-update-requests/repo-doctrine-update-request-family.toml";
|
||||
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-repo",
|
||||
&[
|
||||
"init",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--swarm-id",
|
||||
"repo-doctrine-update-request-family-smoke",
|
||||
"--topic",
|
||||
"repo-doctrine-update-request-family",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-swarm",
|
||||
&[
|
||||
"online",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--runtime-id",
|
||||
"repo-doctrine-update-request-family-smoke",
|
||||
"--local-verse-store",
|
||||
path_str(&local_verse)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"accept",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--from",
|
||||
"persona",
|
||||
"--item",
|
||||
item,
|
||||
"--summary",
|
||||
"Ask for a reviewed AGENTS.md doctrine update while preserving Mind, Soul, and maintainer gates.",
|
||||
"--candidate-action-ref",
|
||||
"candidate-action://repo-doctrine-update-request-family/agents-update",
|
||||
"--public-discussion-ref",
|
||||
"epiphany-global/persona-collaboration/repo-doctrine-update-request-family",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let plan = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"derive-plan",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--item",
|
||||
item,
|
||||
"--action-family",
|
||||
"repo-doctrine-update-request",
|
||||
"--model-ref",
|
||||
"repo-doctrine-update-request-family-smoke-imagination-v1",
|
||||
"--model-authored",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
for _ in 0..4 {
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"tick",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--cooldown-seconds",
|
||||
"0",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
}
|
||||
|
||||
let close = read_json(
|
||||
&repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join(format!("work-close-{item}.json")),
|
||||
)?;
|
||||
let request_text = fs::read_to_string(repo.join(target_path))
|
||||
.with_context(|| format!("failed to read {}", repo.join(target_path).display()))?;
|
||||
let agents_text = fs::read_to_string(repo.join("AGENTS.md"))
|
||||
.with_context(|| format!("failed to read {}", repo.join("AGENTS.md").display()))?;
|
||||
|
||||
require_eq(
|
||||
&plan,
|
||||
&["derivation", "safeActionFamily"],
|
||||
"repo.doctrine_update_request",
|
||||
)?;
|
||||
require_eq(&close, &["status"], "closed")?;
|
||||
require_eq(&close, &["soul", "verdict"], "passed")?;
|
||||
require_eq(
|
||||
&close,
|
||||
&["closureReview", "familyAssertions", "status"],
|
||||
"passed",
|
||||
)?;
|
||||
require_bool(
|
||||
&close,
|
||||
&["closureReview", "sourceGrounding", "pathScopeMatched"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(&close, &["privateStateExposed"], false)?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"schema_version = \"epiphany.repo_doctrine_update_request.v0\"",
|
||||
)?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"safe_action_family = \"repo.doctrine_update_request\"",
|
||||
)?;
|
||||
require_text(&request_text, "[request]")?;
|
||||
require_text(&request_text, "status = \"awaiting-doctrine-review\"")?;
|
||||
require_text(&request_text, "routing_owner = \"Self\"")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"required_reviewers = [\"Maintainer\", \"Mind\", \"Soul\"]",
|
||||
)?;
|
||||
require_text(&request_text, "doctrine_admission_owner = \"Mind\"")?;
|
||||
require_text(&request_text, "mutation_owner = \"Hands\"")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"requested_effect = \"review-repo-agent-doctrine-update\"",
|
||||
)?;
|
||||
require_text(&request_text, "doctrine_target = \"AGENTS.md\"")?;
|
||||
require_text(&request_text, "requires_source_grounding = true")?;
|
||||
require_text(&request_text, "maintainer_review_required = true")?;
|
||||
require_text(&request_text, "[antecedents]")?;
|
||||
require_text(&request_text, "persona_or_human_feedback_required = true")?;
|
||||
require_text(&request_text, "imagination_plan_required = true")?;
|
||||
require_text(&request_text, "mind_adoption_required = true")?;
|
||||
require_text(&request_text, "soul_review_required = true")?;
|
||||
require_text(&request_text, "maintainer_review_required = true")?;
|
||||
require_text(&request_text, "[required_receipts]")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"imagination_plan = \"epiphany.repo_work_imagination_action_items_receipt.v0\"",
|
||||
)?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"mind_adoption = \"epiphany.repo_work_mind_adoption_decision.v0\"",
|
||||
)?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"soul_review = \"epiphany.repo_work_closure_review.v0\"",
|
||||
)?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"maintainer_review = \"gamecult.maintainer.review_receipt.v0\"",
|
||||
)?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"hands_commit = \"epiphany.hands.commit_receipt\"",
|
||||
)?;
|
||||
require_text(&request_text, "[doctrine_packet]")?;
|
||||
require_text(&request_text, "requires_current_doctrine_ref = true")?;
|
||||
require_text(&request_text, "requires_proposed_change_summary = true")?;
|
||||
require_text(&request_text, "requires_invariant_impact = true")?;
|
||||
require_text(&request_text, "requires_rehydration_impact = true")?;
|
||||
require_text(&request_text, "requires_rollback_plan = true")?;
|
||||
require_text(
|
||||
&request_text,
|
||||
"requires_private_state_redaction_check = true",
|
||||
)?;
|
||||
require_text(&request_text, "[authority]")?;
|
||||
require_text(&request_text, "direct_doctrine_mutation_authority = false")?;
|
||||
require_text(&request_text, "direct_hands_authority = false")?;
|
||||
require_text(&request_text, "direct_mind_state_commit = false")?;
|
||||
require_text(&request_text, "publication_authorized = false")?;
|
||||
require_text(&request_text, "merge_authorized = false")?;
|
||||
require_text(&request_text, "service_lifecycle_authority = false")?;
|
||||
require_text(&request_text, "cross_body_mutation_authorized = false")?;
|
||||
require_text(&request_text, "private_verse_rummaging = false")?;
|
||||
require_text(&request_text, "maintainer_review_required = true")?;
|
||||
require_text(&request_text, "mind_admission_required = true")?;
|
||||
require_text(&request_text, "hands_receipts_required = true")?;
|
||||
require_text(&request_text, "private_state_exposed = false")?;
|
||||
require_text(
|
||||
&agents_text,
|
||||
"Existing doctrine stays untouched by the request artifact.",
|
||||
)?;
|
||||
|
||||
let summary = json!({
|
||||
"schemaVersion": "epiphany.repo_doctrine_update_request_family_smoke.v0",
|
||||
"status": "ok",
|
||||
"smokeDir": smoke_dir,
|
||||
"repo": repo,
|
||||
"branch": git_output(["branch", "--show-current"], &repo)?,
|
||||
"item": item,
|
||||
"safeActionFamily": plan["derivation"]["safeActionFamily"],
|
||||
"targetPath": target_path,
|
||||
"closeStatus": close["status"],
|
||||
"soulVerdict": close["soul"]["verdict"],
|
||||
"familyAssertionsStatus": close["closureReview"]["familyAssertions"]["status"],
|
||||
"pathScopeMatched": close["closureReview"]["sourceGrounding"]["pathScopeMatched"],
|
||||
"awaitingDoctrineReview": true,
|
||||
"doctrineMutationAuthorized": false,
|
||||
"handsAuthorityGranted": false,
|
||||
"publicationAuthorized": false,
|
||||
"mergeAuthorized": false,
|
||||
"serviceLifecycleAuthority": false,
|
||||
"privateStateExposed": false,
|
||||
});
|
||||
write_json(&smoke_dir.join("summary.json"), &summary)?;
|
||||
Ok(summary)
|
||||
}
|
||||
|
||||
fn cargo_json(manifest: &Path, bin: &str, args: &[&str], cwd: &Path) -> Result<Value> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest)
|
||||
.arg("--bin")
|
||||
.arg(bin)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to run cargo bin {bin}"))?;
|
||||
if !output.status.success() {
|
||||
return Err(anyhow!(
|
||||
"{bin} failed with status {:?}\nstdout:\n{}\nstderr:\n{}",
|
||||
output.status.code(),
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
serde_json::from_slice(&output.stdout).with_context(|| {
|
||||
format!(
|
||||
"{bin} did not emit JSON on stdout:\n{}",
|
||||
String::from_utf8_lossy(&output.stdout)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
|
||||
if output.status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
|
||||
cwd.display(),
|
||||
output.status.code(),
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn git_output<const N: usize>(args: [&str; N], cwd: &Path) -> Result<String> {
|
||||
let output = Command::new("git")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
|
||||
if output.status.success() {
|
||||
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
|
||||
cwd.display(),
|
||||
output.status.code(),
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_json(path: &Path) -> Result<Value> {
|
||||
let bytes = fs::read(path).with_context(|| format!("failed to read {}", path.display()))?;
|
||||
serde_json::from_slice(&bytes).with_context(|| format!("failed to parse {}", path.display()))
|
||||
}
|
||||
|
||||
fn write_json(path: &Path, value: &Value) -> Result<()> {
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
fs::write(path, serde_json::to_vec_pretty(value)?)
|
||||
.with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
|
||||
let actual = path
|
||||
.iter()
|
||||
.try_fold(value, |current, key| current.get(*key))
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("<missing>");
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {expected:?}, got {actual:?}",
|
||||
path.join(".")
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
|
||||
let actual = path
|
||||
.iter()
|
||||
.try_fold(value, |current, key| current.get(*key))
|
||||
.and_then(Value::as_bool);
|
||||
if actual == Some(expected) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {expected}, got {:?}",
|
||||
path.join("."),
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_text(haystack: &str, needle: &str) -> Result<()> {
|
||||
if haystack.contains(needle) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected doctrine update request text to contain {needle:?}"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn take_path(
|
||||
args: &mut std::iter::Peekable<impl Iterator<Item = String>>,
|
||||
flag: &str,
|
||||
) -> Result<PathBuf> {
|
||||
args.next()
|
||||
.map(PathBuf::from)
|
||||
.with_context(|| format!("missing value for {flag}"))
|
||||
}
|
||||
|
||||
fn path_str(path: &Path) -> Result<&str> {
|
||||
path.to_str()
|
||||
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
|
||||
}
|
||||
|
|
@ -1,468 +0,0 @@
|
|||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use chrono::Utc;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let result = run_smoke(args)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Args {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut root = env::current_dir().context("failed to resolve current directory")?;
|
||||
let mut args = env::args().skip(1);
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--root" => root = take_path(&mut args, "--root")?,
|
||||
other => return Err(anyhow!("unexpected argument {other:?}")),
|
||||
}
|
||||
}
|
||||
Ok(Self { root })
|
||||
}
|
||||
}
|
||||
|
||||
fn run_smoke(args: Args) -> Result<Value> {
|
||||
let root = args
|
||||
.root
|
||||
.canonicalize()
|
||||
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
|
||||
let smoke_root = root.join(".epiphany-smoke");
|
||||
let manifest = root.join("epiphany-core").join("Cargo.toml");
|
||||
if !manifest.exists() {
|
||||
return Err(anyhow!(
|
||||
"could not find epiphany-core manifest at {}",
|
||||
manifest.display()
|
||||
));
|
||||
}
|
||||
fs::create_dir_all(&smoke_root)
|
||||
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
|
||||
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
|
||||
let smoke_dir = smoke_root.join(format!("repo-mind-evidence-guard-{stamp}"));
|
||||
fs::create_dir(&smoke_dir)
|
||||
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
|
||||
|
||||
let repo = smoke_dir.join("repo-body");
|
||||
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
|
||||
git(["init"], &repo)?;
|
||||
git(
|
||||
["config", "user.email", "epiphany-smoke@example.invalid"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
|
||||
fs::write(
|
||||
repo.join("README.md"),
|
||||
"# Repo Mind Evidence Guard Smoke\n\nThis repository proves Mind refuses proofless action items before Hands authority.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
|
||||
git(["add", "README.md"], &repo)?;
|
||||
git(
|
||||
["commit", "-m", "Seed repo mind evidence guard smoke body"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["switch", "-c", "epiphany/repo-mind-evidence-guard"], &repo)?;
|
||||
|
||||
let item = "repo-mind-evidence-guard";
|
||||
let planned_path = "notes/epiphany-work/repo-mind-evidence-guard.md";
|
||||
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-repo",
|
||||
&[
|
||||
"init",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--swarm-id",
|
||||
"repo-mind-evidence-guard-smoke",
|
||||
"--topic",
|
||||
"repo-mind-evidence-guard",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-swarm",
|
||||
&[
|
||||
"online",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--runtime-id",
|
||||
"repo-mind-evidence-guard-smoke",
|
||||
"--local-verse-store",
|
||||
path_str(&local_verse)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"accept",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--from",
|
||||
"persona",
|
||||
"--item",
|
||||
item,
|
||||
"--summary",
|
||||
"Ask Mind to reject a proofless action item before Hands receives authority.",
|
||||
"--candidate-action-ref",
|
||||
"candidate-action://repo-mind-evidence-guard/proofless-action",
|
||||
"--public-discussion-ref",
|
||||
"epiphany-global/persona-collaboration/repo-mind-evidence-guard",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let plan = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"derive-plan",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--item",
|
||||
item,
|
||||
"--action-family",
|
||||
"planning-note",
|
||||
"--model-ref",
|
||||
"repo-mind-evidence-guard-smoke-imagination-v1",
|
||||
"--model-authored",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let run = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"run",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--path",
|
||||
planned_path,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
|
||||
let plan_path = value_at_path(&plan, &["receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("plan output had no receiptPath"))?;
|
||||
let mut tampered_plan = read_json(Path::new(plan_path))?;
|
||||
tampered_plan["derivation"]["actionItemReceipt"]["verificationAsks"] = json!([]);
|
||||
tampered_plan["derivation"]["actionItemReceipt"]["planningFacets"]["evidenceNeeds"] = json!([]);
|
||||
let tampered_path = smoke_dir.join("tampered-plan.json");
|
||||
write_json(&tampered_path, &tampered_plan)?;
|
||||
|
||||
let adopt_failure = cargo_json_expect_failure(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"adopt",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--run-receipt",
|
||||
value_at_path(&run, &["receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("run output had no receiptPath"))?,
|
||||
"--from-plan",
|
||||
path_str(&tampered_path)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
if !adopt_failure.contains("lacks verification or evidence needs") {
|
||||
return Err(anyhow!(
|
||||
"adopt failure did not name missing evidence needs: {adopt_failure}"
|
||||
));
|
||||
}
|
||||
|
||||
let refusal_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-mind-adopt-repo-mind-evidence-guard.json");
|
||||
let refusal = read_json(&refusal_path)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["schemaVersion"],
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
)?;
|
||||
require_eq(&refusal, &["status"], "refused-missing-evidence-needs")?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["interpretation", "inputSummary", "safeActionFamily"],
|
||||
"repo.markdown_planning_note",
|
||||
)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["interpretation", "inputSummary", "planChangedPaths", "0"],
|
||||
planned_path,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "actionItemAccepted"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "safeFamilyRecognized"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "requestedPathsDeclared"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&[
|
||||
"interpretation",
|
||||
"classification",
|
||||
"requestedPathsMatchPlan",
|
||||
],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&[
|
||||
"interpretation",
|
||||
"classification",
|
||||
"verificationAsksPresent",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "evidenceNeedsPresent"],
|
||||
false,
|
||||
)?;
|
||||
require_text_field(
|
||||
&refusal,
|
||||
&["interpretation", "refusalReasons", "0"],
|
||||
"lacks verification or evidence needs",
|
||||
)?;
|
||||
require_bool(&refusal, &["gates", "safeFamilyRecognized"], true)?;
|
||||
require_bool(&refusal, &["gates", "requestedPathsMatchPlan"], true)?;
|
||||
require_bool(&refusal, &["gates", "verificationAsksPresent"], false)?;
|
||||
require_bool(&refusal, &["gates", "evidenceNeedsPresent"], false)?;
|
||||
require_bool(&refusal, &["gates", "branchLocalOnly"], false)?;
|
||||
require_bool(&refusal, &["authority", "handsAuthorityGranted"], false)?;
|
||||
require_bool(&refusal, &["authority", "durableStateAdmitted"], false)?;
|
||||
require_bool(&refusal, &["authority", "serviceLifecycleAuthority"], false)?;
|
||||
require_bool(&refusal, &["authority", "privateStateExposed"], false)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["authority", "nextGate"],
|
||||
"imagination.replan_with_explicit_soul_evidence_needs",
|
||||
)?;
|
||||
require_bool(&refusal, &["privateStateExposed"], false)?;
|
||||
let adoption_receipt_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-adopt-repo-mind-evidence-guard.json");
|
||||
if adoption_receipt_path.exists() {
|
||||
return Err(anyhow!(
|
||||
"adoption receipt was written despite missing-evidence refusal: {}",
|
||||
adoption_receipt_path.display()
|
||||
));
|
||||
}
|
||||
|
||||
Ok(json!({
|
||||
"schemaVersion": "epiphany.repo_work_mind_evidence_guard_smoke.v0",
|
||||
"status": "ok",
|
||||
"smokeDir": smoke_dir,
|
||||
"repo": repo,
|
||||
"item": item,
|
||||
"planChangedPath": planned_path,
|
||||
"mindDecisionStatus": refusal["status"],
|
||||
"actionItemAccepted": false,
|
||||
"safeFamilyRecognized": true,
|
||||
"requestedPathsMatchPlan": true,
|
||||
"verificationAsksPresent": false,
|
||||
"evidenceNeedsPresent": false,
|
||||
"handsAuthorityGranted": false,
|
||||
"durableStateAdmitted": false,
|
||||
"serviceLifecycleAuthority": false,
|
||||
"adoptionReceiptWritten": false,
|
||||
"privateStateExposed": false
|
||||
}))
|
||||
}
|
||||
|
||||
fn cargo_json(manifest_path: &Path, bin_name: &str, args: &[&str], cwd: &Path) -> Result<Value> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if !output.status.success() {
|
||||
return Err(anyhow!(
|
||||
"cargo run --bin {bin_name} failed:\nstdout:\n{}\nstderr:\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
serde_json::from_slice(&output.stdout)
|
||||
.with_context(|| format!("{bin_name} returned invalid JSON"))
|
||||
}
|
||||
|
||||
fn cargo_json_expect_failure(
|
||||
manifest_path: &Path,
|
||||
bin_name: &str,
|
||||
args: &[&str],
|
||||
cwd: &Path,
|
||||
) -> Result<String> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if output.status.success() {
|
||||
return Err(anyhow!("{bin_name} unexpectedly succeeded"));
|
||||
}
|
||||
Ok(format!(
|
||||
"{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
|
||||
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn git in {}", cwd.display()))?;
|
||||
if output.status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"git failed in {}:\n{}",
|
||||
cwd.display(),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_json(path: &Path) -> Result<Value> {
|
||||
let raw =
|
||||
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
|
||||
serde_json::from_str(&raw).with_context(|| format!("failed to decode {}", path.display()))
|
||||
}
|
||||
|
||||
fn write_json(path: &Path, value: &Value) -> Result<()> {
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
fs::write(path, serde_json::to_vec_pretty(value)?)
|
||||
.with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {:?}, got {:?}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_bool)
|
||||
.ok_or_else(|| anyhow!("missing bool at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {}, got {}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_text_field(value: &Value, path: &[&str], needle: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual.contains(needle) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to contain {:?}, got {:?}",
|
||||
path.join("."),
|
||||
needle,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn value_at_path<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
|
||||
let mut cursor = value;
|
||||
for segment in path {
|
||||
if let Ok(index) = segment.parse::<usize>() {
|
||||
cursor = cursor.as_array()?.get(index)?;
|
||||
} else {
|
||||
cursor = cursor.get(*segment)?;
|
||||
}
|
||||
}
|
||||
Some(cursor)
|
||||
}
|
||||
|
||||
fn path_str(path: &Path) -> Result<&str> {
|
||||
path.to_str()
|
||||
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
|
||||
}
|
||||
|
||||
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
|
||||
Ok(PathBuf::from(
|
||||
args.next()
|
||||
.ok_or_else(|| anyhow!("missing value for {name}"))?,
|
||||
))
|
||||
}
|
||||
|
|
@ -1,457 +0,0 @@
|
|||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use chrono::Utc;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let result = run_smoke(args)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Args {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut root = env::current_dir().context("failed to resolve current directory")?;
|
||||
let mut args = env::args().skip(1);
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--root" => root = take_path(&mut args, "--root")?,
|
||||
other => return Err(anyhow!("unexpected argument {other:?}")),
|
||||
}
|
||||
}
|
||||
Ok(Self { root })
|
||||
}
|
||||
}
|
||||
|
||||
fn run_smoke(args: Args) -> Result<Value> {
|
||||
let root = args
|
||||
.root
|
||||
.canonicalize()
|
||||
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
|
||||
let smoke_root = root.join(".epiphany-smoke");
|
||||
let manifest = root.join("epiphany-core").join("Cargo.toml");
|
||||
if !manifest.exists() {
|
||||
return Err(anyhow!(
|
||||
"could not find epiphany-core manifest at {}",
|
||||
manifest.display()
|
||||
));
|
||||
}
|
||||
fs::create_dir_all(&smoke_root)
|
||||
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
|
||||
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
|
||||
let smoke_dir = smoke_root.join(format!("repo-mind-path-guard-{stamp}"));
|
||||
fs::create_dir(&smoke_dir)
|
||||
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
|
||||
|
||||
let repo = smoke_dir.join("repo-body");
|
||||
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
|
||||
git(["init"], &repo)?;
|
||||
git(
|
||||
["config", "user.email", "epiphany-smoke@example.invalid"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
|
||||
fs::write(
|
||||
repo.join("README.md"),
|
||||
"# Repo Mind Path Guard Smoke\n\nThis repository proves Mind refuses mismatched requested paths before Hands authority.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
|
||||
git(["add", "README.md"], &repo)?;
|
||||
git(
|
||||
["commit", "-m", "Seed repo mind path guard smoke body"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["switch", "-c", "epiphany/repo-mind-path-guard"], &repo)?;
|
||||
|
||||
let item = "repo-mind-path-guard";
|
||||
let planned_path = "notes/epiphany-work/repo-mind-path-guard.md";
|
||||
let tampered_requested_path = "notes/epiphany-work/alien-path.md";
|
||||
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-repo",
|
||||
&[
|
||||
"init",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--swarm-id",
|
||||
"repo-mind-path-guard-smoke",
|
||||
"--topic",
|
||||
"repo-mind-path-guard",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-swarm",
|
||||
&[
|
||||
"online",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--runtime-id",
|
||||
"repo-mind-path-guard-smoke",
|
||||
"--local-verse-store",
|
||||
path_str(&local_verse)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"accept",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--from",
|
||||
"persona",
|
||||
"--item",
|
||||
item,
|
||||
"--summary",
|
||||
"Ask Mind to reject a tampered requested path before Hands receives authority.",
|
||||
"--candidate-action-ref",
|
||||
"candidate-action://repo-mind-path-guard/tampered-path",
|
||||
"--public-discussion-ref",
|
||||
"epiphany-global/persona-collaboration/repo-mind-path-guard",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let plan = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"derive-plan",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--item",
|
||||
item,
|
||||
"--action-family",
|
||||
"planning-note",
|
||||
"--model-ref",
|
||||
"repo-mind-path-guard-smoke-imagination-v1",
|
||||
"--model-authored",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let run = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"run",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--path",
|
||||
planned_path,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
|
||||
let plan_path = value_at_path(&plan, &["receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("plan output had no receiptPath"))?;
|
||||
let mut tampered_plan = read_json(Path::new(plan_path))?;
|
||||
tampered_plan["derivation"]["actionItemReceipt"]["requestedPaths"] =
|
||||
json!([tampered_requested_path]);
|
||||
let tampered_path = smoke_dir.join("tampered-plan.json");
|
||||
write_json(&tampered_path, &tampered_plan)?;
|
||||
|
||||
let adopt_failure = cargo_json_expect_failure(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"adopt",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--run-receipt",
|
||||
value_at_path(&run, &["receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("run output had no receiptPath"))?,
|
||||
"--from-plan",
|
||||
path_str(&tampered_path)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
if !adopt_failure.contains("do not match plan changed paths") {
|
||||
return Err(anyhow!(
|
||||
"adopt failure did not name requested-path mismatch: {adopt_failure}"
|
||||
));
|
||||
}
|
||||
|
||||
let refusal_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-mind-adopt-repo-mind-path-guard.json");
|
||||
let refusal = read_json(&refusal_path)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["schemaVersion"],
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
)?;
|
||||
require_eq(&refusal, &["status"], "refused-requested-path-mismatch")?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["interpretation", "inputSummary", "safeActionFamily"],
|
||||
"repo.markdown_planning_note",
|
||||
)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["interpretation", "inputSummary", "requestedPaths", "0"],
|
||||
tampered_requested_path,
|
||||
)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["interpretation", "inputSummary", "planChangedPaths", "0"],
|
||||
planned_path,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "actionItemAccepted"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "safeFamilyRecognized"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "requestedPathsDeclared"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&[
|
||||
"interpretation",
|
||||
"classification",
|
||||
"requestedPathsMatchPlan",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_text_field(
|
||||
&refusal,
|
||||
&["interpretation", "refusalReasons", "0"],
|
||||
"do not match plan changed paths",
|
||||
)?;
|
||||
require_bool(&refusal, &["gates", "safeFamilyRecognized"], true)?;
|
||||
require_bool(&refusal, &["gates", "requestedPathsMatchPlan"], false)?;
|
||||
require_bool(&refusal, &["gates", "branchLocalOnly"], false)?;
|
||||
require_bool(&refusal, &["authority", "handsAuthorityGranted"], false)?;
|
||||
require_bool(&refusal, &["authority", "durableStateAdmitted"], false)?;
|
||||
require_bool(&refusal, &["authority", "serviceLifecycleAuthority"], false)?;
|
||||
require_bool(&refusal, &["authority", "privateStateExposed"], false)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["authority", "nextGate"],
|
||||
"imagination.replan_with_matching_requested_paths",
|
||||
)?;
|
||||
require_bool(&refusal, &["privateStateExposed"], false)?;
|
||||
let adoption_receipt_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-adopt-repo-mind-path-guard.json");
|
||||
if adoption_receipt_path.exists() {
|
||||
return Err(anyhow!(
|
||||
"adoption receipt was written despite requested-path mismatch refusal: {}",
|
||||
adoption_receipt_path.display()
|
||||
));
|
||||
}
|
||||
|
||||
Ok(json!({
|
||||
"schemaVersion": "epiphany.repo_work_mind_path_guard_smoke.v0",
|
||||
"status": "ok",
|
||||
"smokeDir": smoke_dir,
|
||||
"repo": repo,
|
||||
"item": item,
|
||||
"tamperedRequestedPath": tampered_requested_path,
|
||||
"planChangedPath": planned_path,
|
||||
"mindDecisionStatus": refusal["status"],
|
||||
"actionItemAccepted": false,
|
||||
"safeFamilyRecognized": true,
|
||||
"requestedPathsMatchPlan": false,
|
||||
"handsAuthorityGranted": false,
|
||||
"durableStateAdmitted": false,
|
||||
"serviceLifecycleAuthority": false,
|
||||
"adoptionReceiptWritten": false,
|
||||
"privateStateExposed": false
|
||||
}))
|
||||
}
|
||||
|
||||
fn cargo_json(manifest_path: &Path, bin_name: &str, args: &[&str], cwd: &Path) -> Result<Value> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if !output.status.success() {
|
||||
return Err(anyhow!(
|
||||
"cargo run --bin {bin_name} failed:\nstdout:\n{}\nstderr:\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
serde_json::from_slice(&output.stdout)
|
||||
.with_context(|| format!("{bin_name} returned invalid JSON"))
|
||||
}
|
||||
|
||||
fn cargo_json_expect_failure(
|
||||
manifest_path: &Path,
|
||||
bin_name: &str,
|
||||
args: &[&str],
|
||||
cwd: &Path,
|
||||
) -> Result<String> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if output.status.success() {
|
||||
return Err(anyhow!("{bin_name} unexpectedly succeeded"));
|
||||
}
|
||||
Ok(format!(
|
||||
"{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
|
||||
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn git in {}", cwd.display()))?;
|
||||
if output.status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"git failed in {}:\n{}",
|
||||
cwd.display(),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_json(path: &Path) -> Result<Value> {
|
||||
let raw =
|
||||
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
|
||||
serde_json::from_str(&raw).with_context(|| format!("failed to decode {}", path.display()))
|
||||
}
|
||||
|
||||
fn write_json(path: &Path, value: &Value) -> Result<()> {
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
fs::write(path, serde_json::to_vec_pretty(value)?)
|
||||
.with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {:?}, got {:?}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_bool)
|
||||
.ok_or_else(|| anyhow!("missing bool at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {}, got {}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_text_field(value: &Value, path: &[&str], needle: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual.contains(needle) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to contain {:?}, got {:?}",
|
||||
path.join("."),
|
||||
needle,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn value_at_path<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
|
||||
let mut cursor = value;
|
||||
for segment in path {
|
||||
if let Ok(index) = segment.parse::<usize>() {
|
||||
cursor = cursor.as_array()?.get(index)?;
|
||||
} else {
|
||||
cursor = cursor.get(*segment)?;
|
||||
}
|
||||
}
|
||||
Some(cursor)
|
||||
}
|
||||
|
||||
fn path_str(path: &Path) -> Result<&str> {
|
||||
path.to_str()
|
||||
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
|
||||
}
|
||||
|
||||
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
|
||||
Ok(PathBuf::from(
|
||||
args.next()
|
||||
.ok_or_else(|| anyhow!("missing value for {name}"))?,
|
||||
))
|
||||
}
|
||||
|
|
@ -1,433 +0,0 @@
|
|||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use chrono::Utc;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let result = run_smoke(args)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Args {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut root = env::current_dir().context("failed to resolve current directory")?;
|
||||
let mut args = env::args().skip(1);
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--root" => root = take_path(&mut args, "--root")?,
|
||||
other => return Err(anyhow!("unexpected argument {other:?}")),
|
||||
}
|
||||
}
|
||||
Ok(Self { root })
|
||||
}
|
||||
}
|
||||
|
||||
fn run_smoke(args: Args) -> Result<Value> {
|
||||
let root = args
|
||||
.root
|
||||
.canonicalize()
|
||||
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
|
||||
let smoke_root = root.join(".epiphany-smoke");
|
||||
let manifest = root.join("epiphany-core").join("Cargo.toml");
|
||||
if !manifest.exists() {
|
||||
return Err(anyhow!(
|
||||
"could not find epiphany-core manifest at {}",
|
||||
manifest.display()
|
||||
));
|
||||
}
|
||||
fs::create_dir_all(&smoke_root)
|
||||
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
|
||||
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
|
||||
let smoke_dir = smoke_root.join(format!("repo-mind-safe-family-guard-{stamp}"));
|
||||
fs::create_dir(&smoke_dir)
|
||||
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
|
||||
|
||||
let repo = smoke_dir.join("repo-body");
|
||||
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
|
||||
git(["init"], &repo)?;
|
||||
git(
|
||||
["config", "user.email", "epiphany-smoke@example.invalid"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
|
||||
fs::write(
|
||||
repo.join("README.md"),
|
||||
"# Repo Mind Safe Family Guard Smoke\n\nThis repository proves Mind refuses alien safe-family labels before Hands authority.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
|
||||
git(["add", "README.md"], &repo)?;
|
||||
git(
|
||||
[
|
||||
"commit",
|
||||
"-m",
|
||||
"Seed repo mind safe family guard smoke body",
|
||||
],
|
||||
&repo,
|
||||
)?;
|
||||
git(
|
||||
["switch", "-c", "epiphany/repo-mind-safe-family-guard"],
|
||||
&repo,
|
||||
)?;
|
||||
|
||||
let item = "repo-mind-safe-family-guard";
|
||||
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-repo",
|
||||
&[
|
||||
"init",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--swarm-id",
|
||||
"repo-mind-safe-family-guard-smoke",
|
||||
"--topic",
|
||||
"repo-mind-safe-family-guard",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-swarm",
|
||||
&[
|
||||
"online",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--runtime-id",
|
||||
"repo-mind-safe-family-guard-smoke",
|
||||
"--local-verse-store",
|
||||
path_str(&local_verse)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"accept",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--from",
|
||||
"persona",
|
||||
"--item",
|
||||
item,
|
||||
"--summary",
|
||||
"Ask Mind to reject a tampered safe-family label before Hands receives authority.",
|
||||
"--candidate-action-ref",
|
||||
"candidate-action://repo-mind-safe-family-guard/tampered-family",
|
||||
"--public-discussion-ref",
|
||||
"epiphany-global/persona-collaboration/repo-mind-safe-family-guard",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let plan = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"derive-plan",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--item",
|
||||
item,
|
||||
"--action-family",
|
||||
"planning-note",
|
||||
"--model-ref",
|
||||
"repo-mind-safe-family-guard-smoke-imagination-v1",
|
||||
"--model-authored",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let run = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"run",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--path",
|
||||
"notes/epiphany-work/repo-mind-safe-family-guard.md",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
|
||||
let plan_path = value_at_path(&plan, &["receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("plan output had no receiptPath"))?;
|
||||
let mut tampered_plan = read_json(Path::new(plan_path))?;
|
||||
tampered_plan["derivation"]["actionItemReceipt"]["safeActionFamily"] =
|
||||
json!("idunn.service_lifecycle");
|
||||
let tampered_path = smoke_dir.join("tampered-plan.json");
|
||||
write_json(&tampered_path, &tampered_plan)?;
|
||||
|
||||
let adopt_failure = cargo_json_expect_failure(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"adopt",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--run-receipt",
|
||||
value_at_path(&run, &["receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("run output had no receiptPath"))?,
|
||||
"--from-plan",
|
||||
path_str(&tampered_path)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
if !adopt_failure.contains("unsupported repo-work safe family") {
|
||||
return Err(anyhow!(
|
||||
"adopt failure did not name unsupported safe family: {adopt_failure}"
|
||||
));
|
||||
}
|
||||
|
||||
let refusal_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-mind-adopt-repo-mind-safe-family-guard.json");
|
||||
let refusal = read_json(&refusal_path)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["schemaVersion"],
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
)?;
|
||||
require_eq(&refusal, &["status"], "refused-unsupported-safe-family")?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["interpretation", "inputSummary", "safeActionFamily"],
|
||||
"idunn.service_lifecycle",
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "actionItemAccepted"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&refusal,
|
||||
&["interpretation", "classification", "safeFamilyRecognized"],
|
||||
false,
|
||||
)?;
|
||||
require_text_field(
|
||||
&refusal,
|
||||
&["interpretation", "refusalReasons", "0"],
|
||||
"Unsupported repo-work safe action family idunn.service_lifecycle",
|
||||
)?;
|
||||
require_bool(&refusal, &["authority", "handsAuthorityGranted"], false)?;
|
||||
require_bool(&refusal, &["authority", "durableStateAdmitted"], false)?;
|
||||
require_bool(&refusal, &["authority", "serviceLifecycleAuthority"], false)?;
|
||||
require_bool(&refusal, &["authority", "privateStateExposed"], false)?;
|
||||
require_eq(
|
||||
&refusal,
|
||||
&["authority", "nextGate"],
|
||||
"imagination.replan_with_allowed_safe_family",
|
||||
)?;
|
||||
require_bool(&refusal, &["privateStateExposed"], false)?;
|
||||
let adoption_receipt_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-adopt-repo-mind-safe-family-guard.json");
|
||||
if adoption_receipt_path.exists() {
|
||||
return Err(anyhow!(
|
||||
"adoption receipt was written despite unsupported safe-family refusal: {}",
|
||||
adoption_receipt_path.display()
|
||||
));
|
||||
}
|
||||
|
||||
Ok(json!({
|
||||
"schemaVersion": "epiphany.repo_work_mind_safe_family_guard_smoke.v0",
|
||||
"status": "ok",
|
||||
"smokeDir": smoke_dir,
|
||||
"repo": repo,
|
||||
"item": item,
|
||||
"tamperedSafeActionFamily": "idunn.service_lifecycle",
|
||||
"mindDecisionStatus": refusal["status"],
|
||||
"actionItemAccepted": false,
|
||||
"safeFamilyRecognized": false,
|
||||
"handsAuthorityGranted": false,
|
||||
"durableStateAdmitted": false,
|
||||
"serviceLifecycleAuthority": false,
|
||||
"adoptionReceiptWritten": false,
|
||||
"privateStateExposed": false
|
||||
}))
|
||||
}
|
||||
|
||||
fn cargo_json(manifest_path: &Path, bin_name: &str, args: &[&str], cwd: &Path) -> Result<Value> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if !output.status.success() {
|
||||
return Err(anyhow!(
|
||||
"cargo run --bin {bin_name} failed:\nstdout:\n{}\nstderr:\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
serde_json::from_slice(&output.stdout)
|
||||
.with_context(|| format!("{bin_name} returned invalid JSON"))
|
||||
}
|
||||
|
||||
fn cargo_json_expect_failure(
|
||||
manifest_path: &Path,
|
||||
bin_name: &str,
|
||||
args: &[&str],
|
||||
cwd: &Path,
|
||||
) -> Result<String> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if output.status.success() {
|
||||
return Err(anyhow!("{bin_name} unexpectedly succeeded"));
|
||||
}
|
||||
Ok(format!(
|
||||
"{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
|
||||
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn git in {}", cwd.display()))?;
|
||||
if output.status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"git failed in {}:\n{}",
|
||||
cwd.display(),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_json(path: &Path) -> Result<Value> {
|
||||
let raw =
|
||||
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
|
||||
serde_json::from_str(&raw).with_context(|| format!("failed to decode {}", path.display()))
|
||||
}
|
||||
|
||||
fn write_json(path: &Path, value: &Value) -> Result<()> {
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
fs::write(path, serde_json::to_vec_pretty(value)?)
|
||||
.with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {:?}, got {:?}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_bool)
|
||||
.ok_or_else(|| anyhow!("missing bool at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {}, got {}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_text_field(value: &Value, path: &[&str], needle: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual.contains(needle) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to contain {:?}, got {:?}",
|
||||
path.join("."),
|
||||
needle,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn value_at_path<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
|
||||
let mut cursor = value;
|
||||
for segment in path {
|
||||
if let Ok(index) = segment.parse::<usize>() {
|
||||
cursor = cursor.as_array()?.get(index)?;
|
||||
} else {
|
||||
cursor = cursor.get(*segment)?;
|
||||
}
|
||||
}
|
||||
Some(cursor)
|
||||
}
|
||||
|
||||
fn path_str(path: &Path) -> Result<&str> {
|
||||
path.to_str()
|
||||
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
|
||||
}
|
||||
|
||||
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
|
||||
Ok(PathBuf::from(
|
||||
args.next()
|
||||
.ok_or_else(|| anyhow!("missing value for {name}"))?,
|
||||
))
|
||||
}
|
||||
|
|
@ -1,616 +0,0 @@
|
|||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use chrono::Utc;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let result = run_smoke(args)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Args {
|
||||
root: PathBuf,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut root = env::current_dir().context("failed to resolve current directory")?;
|
||||
let mut args = env::args().skip(1).peekable();
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--root" => root = take_path(&mut args, "--root")?,
|
||||
other => return Err(anyhow!("unexpected argument {other:?}")),
|
||||
}
|
||||
}
|
||||
Ok(Self { root })
|
||||
}
|
||||
}
|
||||
|
||||
fn run_smoke(args: Args) -> Result<Value> {
|
||||
let root = args
|
||||
.root
|
||||
.canonicalize()
|
||||
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
|
||||
let smoke_root = root.join(".epiphany-smoke");
|
||||
let manifest = root.join("epiphany-core").join("Cargo.toml");
|
||||
if !manifest.exists() {
|
||||
return Err(anyhow!(
|
||||
"could not find epiphany-core manifest at {}",
|
||||
manifest.display()
|
||||
));
|
||||
}
|
||||
fs::create_dir_all(&smoke_root)
|
||||
.with_context(|| format!("failed to create {}", smoke_root.display()))?;
|
||||
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
|
||||
let smoke_dir = smoke_root.join(format!("repo-planning-facets-{stamp}"));
|
||||
fs::create_dir(&smoke_dir)
|
||||
.with_context(|| format!("failed to claim fresh smoke dir {}", smoke_dir.display()))?;
|
||||
|
||||
let repo = smoke_dir.join("repo-body");
|
||||
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
|
||||
git(["init"], &repo)?;
|
||||
git(
|
||||
["config", "user.email", "epiphany-smoke@example.invalid"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
|
||||
fs::write(
|
||||
repo.join("README.md"),
|
||||
"# Repo Planning Facets Smoke\n\nThis repository proves richer Imagination planning cargo without command authority.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
|
||||
git(["add", "README.md"], &repo)?;
|
||||
git(
|
||||
["commit", "-m", "Seed repo planning facets smoke body"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["switch", "-c", "epiphany/repo-planning-facets"], &repo)?;
|
||||
|
||||
let item = "repo-planning-facets";
|
||||
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-repo",
|
||||
&[
|
||||
"init",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--swarm-id",
|
||||
"repo-planning-facets-smoke",
|
||||
"--topic",
|
||||
"repo-planning-facets",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-swarm",
|
||||
&[
|
||||
"online",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--runtime-id",
|
||||
"repo-planning-facets-smoke",
|
||||
"--local-verse-store",
|
||||
path_str(&local_verse)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"accept",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--from",
|
||||
"persona",
|
||||
"--item",
|
||||
item,
|
||||
"--summary",
|
||||
"Let Imagination preserve richer planning facets before Self chooses the safe move.",
|
||||
"--candidate-action-ref",
|
||||
"candidate-action://repo-planning-facets/action-items",
|
||||
"--public-discussion-ref",
|
||||
"epiphany-global/persona-collaboration/repo-planning-facets",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
let plan = cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"derive-plan",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--item",
|
||||
item,
|
||||
"--action-family",
|
||||
"planning-note",
|
||||
"--model-ref",
|
||||
"repo-planning-facets-smoke-imagination-v1",
|
||||
"--model-authored",
|
||||
"--assumption",
|
||||
"Persona feedback is public enough to route into Imagination.",
|
||||
"--constraint",
|
||||
"Hands must only write the declared planning note path.",
|
||||
"--non-goal",
|
||||
"Do not publish, merge, deploy, or mutate service lifecycle state.",
|
||||
"--open-question",
|
||||
"Should Self adopt this as the next branch-local move?",
|
||||
"--decision-point",
|
||||
"Self may adopt, defer, or ask Imagination for a narrower safe family.",
|
||||
"--evidence-need",
|
||||
"Soul needs the action-item receipt, plan receipt, changed-path proof, and private-state seal.",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
|
||||
let action_items_path = repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join("work-action-items-repo-planning-facets.json");
|
||||
let action_items = read_json(&action_items_path)?;
|
||||
require_eq(
|
||||
&action_items,
|
||||
&["schemaVersion"],
|
||||
"epiphany.repo_work_imagination_action_items_receipt.v0",
|
||||
)?;
|
||||
require_eq(&action_items, &["status"], "proposed-for-self-mind-review")?;
|
||||
require_eq(
|
||||
&action_items,
|
||||
&["actionItems", "0", "safeActionFamily"],
|
||||
"repo.markdown_planning_note",
|
||||
)?;
|
||||
require_bool(
|
||||
&action_items,
|
||||
&["model", "operatorAuthoredShellDetails"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&action_items,
|
||||
&["authority", "handsAuthorityGranted"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(&action_items, &["authority", "durableStateAdmitted"], false)?;
|
||||
require_bool(&action_items, &["privateStateExposed"], false)?;
|
||||
require_text_field(
|
||||
&action_items,
|
||||
&["actionItems", "0", "planningFacets", "assumptions", "0"],
|
||||
"Persona feedback is public enough",
|
||||
)?;
|
||||
require_text_field(
|
||||
&action_items,
|
||||
&["actionItems", "0", "planningFacets", "constraints", "0"],
|
||||
"declared planning note path",
|
||||
)?;
|
||||
require_text_field(
|
||||
&action_items,
|
||||
&["actionItems", "0", "planningFacets", "nonGoals", "0"],
|
||||
"Do not publish",
|
||||
)?;
|
||||
require_text_field(
|
||||
&action_items,
|
||||
&["actionItems", "0", "planningFacets", "openQuestions", "0"],
|
||||
"Should Self adopt",
|
||||
)?;
|
||||
require_text_field(
|
||||
&action_items,
|
||||
&["actionItems", "0", "planningFacets", "decisionPoints", "0"],
|
||||
"Self may adopt",
|
||||
)?;
|
||||
require_text_field(
|
||||
&action_items,
|
||||
&["actionItems", "0", "planningFacets", "evidenceNeeds", "0"],
|
||||
"Soul needs",
|
||||
)?;
|
||||
require_bool(
|
||||
&action_items,
|
||||
&[
|
||||
"actionItems",
|
||||
"0",
|
||||
"planningFacets",
|
||||
"handsCommandAuthority",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&action_items,
|
||||
&[
|
||||
"actionItems",
|
||||
"0",
|
||||
"planningFacets",
|
||||
"durableStateAuthority",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_eq(
|
||||
&plan,
|
||||
&[
|
||||
"derivation",
|
||||
"actionItemReceipt",
|
||||
"planningFacets",
|
||||
"constraints",
|
||||
"0",
|
||||
],
|
||||
"Hands must only write the declared planning note path.",
|
||||
)?;
|
||||
|
||||
for _ in 0..4 {
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"tick",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--cooldown-seconds",
|
||||
"0",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
}
|
||||
let adoption = read_json(
|
||||
&repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join(format!("work-adopt-{item}.json")),
|
||||
)?;
|
||||
require_eq(
|
||||
&adoption,
|
||||
&["schemaVersion"],
|
||||
"epiphany.repo_work_adoption_receipt.v0",
|
||||
)?;
|
||||
require_eq(
|
||||
&adoption,
|
||||
&["status"],
|
||||
"approved-for-branch-local-hands-action",
|
||||
)?;
|
||||
require_eq(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "schemaVersion"],
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
)?;
|
||||
require_eq(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "status"],
|
||||
"adopted-for-branch-local-hands",
|
||||
)?;
|
||||
require_eq(&adoption, &["mindAdoptionDecision", "owner"], "Mind")?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "gates", "selfPresentedActionItem"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "gates", "mindReviewedEvidence"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "gates", "mindInterpretedActionItem"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "gates", "branchLocalOnly"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "authority", "handsAuthorityGranted"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "authority", "durableStateAdmitted"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "authority", "publicationAuthorized"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&[
|
||||
"mindAdoptionDecision",
|
||||
"authority",
|
||||
"serviceLifecycleAuthority",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["mindAdoptionDecision", "authority", "privateStateExposed"],
|
||||
false,
|
||||
)?;
|
||||
let mind_adoption_path = value_at_path(&adoption, &["mindAdoptionDecision", "receiptPath"])
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing Mind adoption decision receipt path"))?;
|
||||
let mind_adoption = read_json(Path::new(mind_adoption_path))?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["schemaVersion"],
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["interpretation", "schemaVersion"],
|
||||
"epiphany.repo_work_mind_interpretation.v0",
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["interpretation", "classification", "decisionKind"],
|
||||
"branch-local-hands-adoption",
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["interpretation", "inputSummary", "safeActionFamily"],
|
||||
"repo.markdown_planning_note",
|
||||
)?;
|
||||
require_bool(
|
||||
&mind_adoption,
|
||||
&["interpretation", "classification", "actionItemAccepted"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&mind_adoption,
|
||||
&["interpretation", "classification", "safeFamilyRecognized"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&mind_adoption,
|
||||
&["interpretation", "classification", "requestedPathsDeclared"],
|
||||
true,
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["interpretation", "classification", "durableStateAdmission"],
|
||||
"not-admitted",
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["interpretation", "allowedTransitions", "0"],
|
||||
"hands.branch_local_action",
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["interpretation", "forbiddenTransitions", "0"],
|
||||
"mind.durable_state_commit",
|
||||
)?;
|
||||
require_bool(
|
||||
&mind_adoption,
|
||||
&["interpretation", "privateStateExposed"],
|
||||
false,
|
||||
)?;
|
||||
require_eq(
|
||||
&mind_adoption,
|
||||
&["adoptedActionItem", "safeActionFamily"],
|
||||
"repo.markdown_planning_note",
|
||||
)?;
|
||||
require_text_field(&mind_adoption, &["rationale"], "Mind adopted")?;
|
||||
require_bool(&mind_adoption, &["privateStateExposed"], false)?;
|
||||
require_eq(
|
||||
&adoption,
|
||||
&["adoptedActionItem", "safeActionFamily"],
|
||||
"repo.markdown_planning_note",
|
||||
)?;
|
||||
require_text_field(
|
||||
&adoption,
|
||||
&["adoptedActionItem", "planningFacets", "decisionPoints", "0"],
|
||||
"Self may adopt",
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["adoptedActionItem", "handsCommandAuthority"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["adoptedActionItem", "durableStateAuthority"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["adoptedActionItem", "publicationAuthorized"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&adoption,
|
||||
&["adoptedActionItem", "privateStateExposed"],
|
||||
false,
|
||||
)?;
|
||||
require_bool(&adoption, &["authority", "handsAuthorityGranted"], true)?;
|
||||
require_bool(&adoption, &["authority", "durableStateAdmitted"], false)?;
|
||||
require_bool(&adoption, &["privateStateExposed"], false)?;
|
||||
let close = read_json(
|
||||
&repo
|
||||
.join(".epiphany")
|
||||
.join("work")
|
||||
.join(format!("work-close-{item}.json")),
|
||||
)?;
|
||||
require_eq(&close, &["status"], "closed")?;
|
||||
require_eq(&close, &["soul", "verdict"], "passed")?;
|
||||
require_eq(
|
||||
&close,
|
||||
&["closureReview", "familyAssertions", "status"],
|
||||
"passed",
|
||||
)?;
|
||||
require_bool(
|
||||
&close,
|
||||
&["closureReview", "sourceGrounding", "pathScopeMatched"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(&close, &["privateStateExposed"], false)?;
|
||||
|
||||
Ok(json!({
|
||||
"schemaVersion": "epiphany.repo_planning_facets_smoke.v0",
|
||||
"status": "ok",
|
||||
"smokeDir": smoke_dir,
|
||||
"repo": repo,
|
||||
"item": item,
|
||||
"safeActionFamily": "repo.markdown_planning_note",
|
||||
"modelAuthored": true,
|
||||
"assumptionsRecorded": true,
|
||||
"constraintsRecorded": true,
|
||||
"nonGoalsRecorded": true,
|
||||
"openQuestionsRecorded": true,
|
||||
"decisionPointsRecorded": true,
|
||||
"evidenceNeedsRecorded": true,
|
||||
"adoptedActionItemRecorded": true,
|
||||
"mindAdoptionDecisionRecorded": true,
|
||||
"mindInterpretationRecorded": true,
|
||||
"mindDecisionHandsAuthorityGranted": false,
|
||||
"mindDecisionDurableStateAdmitted": false,
|
||||
"adoptionFacetsRecorded": true,
|
||||
"handsAuthorityGranted": false,
|
||||
"durableStateAdmitted": false,
|
||||
"handsCommandAuthority": false,
|
||||
"durableStateAuthority": false,
|
||||
"adoptionHandsAuthorityGranted": true,
|
||||
"adoptionDurableStateAdmitted": false,
|
||||
"closeStatus": "closed",
|
||||
"soulVerdict": "passed",
|
||||
"familyAssertionsStatus": "passed",
|
||||
"pathScopeMatched": true,
|
||||
"privateStateExposed": false
|
||||
}))
|
||||
}
|
||||
|
||||
fn cargo_json(manifest_path: &Path, bin_name: &str, args: &[&str], cwd: &Path) -> Result<Value> {
|
||||
let output = Command::new("cargo")
|
||||
.arg("run")
|
||||
.arg("--quiet")
|
||||
.arg("--manifest-path")
|
||||
.arg(manifest_path)
|
||||
.arg("--bin")
|
||||
.arg(bin_name)
|
||||
.arg("--")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn cargo run --bin {bin_name}"))?;
|
||||
if !output.status.success() {
|
||||
return Err(anyhow!(
|
||||
"cargo run --bin {bin_name} failed:\n{}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
serde_json::from_slice(&output.stdout)
|
||||
.with_context(|| format!("{bin_name} returned invalid JSON"))
|
||||
}
|
||||
|
||||
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
|
||||
let output = Command::new("git")
|
||||
.args(args)
|
||||
.current_dir(cwd)
|
||||
.output()
|
||||
.with_context(|| format!("failed to spawn git in {}", cwd.display()))?;
|
||||
if output.status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"git failed in {}:\n{}",
|
||||
cwd.display(),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn read_json(path: &Path) -> Result<Value> {
|
||||
let raw =
|
||||
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
|
||||
serde_json::from_str(&raw).with_context(|| format!("failed to decode {}", path.display()))
|
||||
}
|
||||
|
||||
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {:?}, got {:?}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_bool)
|
||||
.ok_or_else(|| anyhow!("missing bool at {}", path.join(".")))?;
|
||||
if actual == expected {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to be {}, got {}",
|
||||
path.join("."),
|
||||
expected,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_text_field(value: &Value, path: &[&str], needle: &str) -> Result<()> {
|
||||
let actual = value_at_path(value, path)
|
||||
.and_then(Value::as_str)
|
||||
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
|
||||
if actual.contains(needle) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow!(
|
||||
"expected {} to contain {:?}, got {:?}",
|
||||
path.join("."),
|
||||
needle,
|
||||
actual
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn value_at_path<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
|
||||
let mut cursor = value;
|
||||
for segment in path {
|
||||
if let Ok(index) = segment.parse::<usize>() {
|
||||
cursor = cursor.as_array()?.get(index)?;
|
||||
} else {
|
||||
cursor = cursor.get(*segment)?;
|
||||
}
|
||||
}
|
||||
Some(cursor)
|
||||
}
|
||||
|
||||
fn path_str(path: &Path) -> Result<&str> {
|
||||
path.to_str()
|
||||
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
|
||||
}
|
||||
|
||||
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
|
||||
Ok(PathBuf::from(
|
||||
args.next()
|
||||
.ok_or_else(|| anyhow!("missing value for {name}"))?,
|
||||
))
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -45,7 +45,7 @@ impl RepoDeploymentConfig {
|
|||
|
||||
pub(super) fn has_required_receipt_contract(&self) -> bool {
|
||||
let receipts = &self.required_receipts;
|
||||
receipts.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
receipts.mind_adoption == "epiphany.repo_work_plan_adoption_review.v0"
|
||||
&& receipts.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& receipts.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& receipts.secret_policy == "epiphany.repo_secret_policy_request.v0"
|
||||
|
|
@ -226,7 +226,7 @@ impl RepoSecretPolicyRequest {
|
|||
let receipts = &self.required_receipts;
|
||||
receipts.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& receipts.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& receipts.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& receipts.mind_adoption == "epiphany.repo_work_plan_adoption_review.v0"
|
||||
&& receipts.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& receipts.bifrost_publication_review
|
||||
== "gamecult.bifrost.publication_review_receipt.v0"
|
||||
|
|
@ -382,7 +382,7 @@ impl RepoDependencyPolicyRequest {
|
|||
let value = &self.required_receipts;
|
||||
value.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& value.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& value.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& value.mind_adoption == "epiphany.repo_work_plan_adoption_review.v0"
|
||||
&& value.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& value.bifrost_publication_review == "gamecult.bifrost.publication_review_receipt.v0"
|
||||
&& value.dependency_audit == "gamecult.supply_chain.dependency_audit_receipt.v0"
|
||||
|
|
@ -536,7 +536,7 @@ impl RepoDeploymentRequest {
|
|||
pub(super) fn has_receipt_contract(&self) -> bool {
|
||||
let value = &self.required_receipts;
|
||||
value.source_grounding == "epiphany.eyes.evidence_packet"
|
||||
&& value.mind_adoption == "epiphany.repo_work_mind_adoption_decision.v0"
|
||||
&& value.mind_adoption == "epiphany.repo_work_plan_adoption_review.v0"
|
||||
&& value.soul_review == "epiphany.repo_work_closure_review.v0"
|
||||
&& value.maintainer_review == "gamecult.maintainer.review_receipt.v0"
|
||||
&& value.secret_policy == "epiphany.repo_secret_policy_request.v0"
|
||||
|
|
@ -626,7 +626,7 @@ impl RepoDoctrineUpdateRequest {
|
|||
),
|
||||
(
|
||||
"mind_adoption",
|
||||
"epiphany.repo_work_mind_adoption_decision.v0",
|
||||
"epiphany.repo_work_plan_adoption_review.v0",
|
||||
),
|
||||
("soul_review", "epiphany.repo_work_closure_review.v0"),
|
||||
("maintainer_review", "gamecult.maintainer.review_receipt.v0"),
|
||||
|
|
|
|||
Reference in a new issue