Require source-grounded repo work closure
This commit is contained in:
parent
54f7a1b3e1
commit
2607007d63
6 changed files with 543 additions and 7 deletions
|
|
@ -0,0 +1,421 @@
|
|||
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,
|
||||
smoke_root: PathBuf,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let mut root = env::current_dir().context("failed to resolve current directory")?;
|
||||
let mut smoke_root = root.join(".epiphany-smoke");
|
||||
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")?,
|
||||
"--smoke-root" => smoke_root = take_path(&mut args, "--smoke-root")?,
|
||||
other => return Err(anyhow!("unexpected argument {other:?}")),
|
||||
}
|
||||
}
|
||||
Ok(Self { root, smoke_root })
|
||||
}
|
||||
}
|
||||
|
||||
fn run_smoke(args: Args) -> Result<Value> {
|
||||
let root = args
|
||||
.root
|
||||
.canonicalize()
|
||||
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
|
||||
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(&args.smoke_root)
|
||||
.with_context(|| format!("failed to create {}", args.smoke_root.display()))?;
|
||||
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
|
||||
let smoke_dir = args
|
||||
.smoke_root
|
||||
.join(format!("repo-closure-source-grounding-{stamp}"));
|
||||
if smoke_dir.exists() {
|
||||
fs::remove_dir_all(&smoke_dir)
|
||||
.with_context(|| format!("failed to clear {}", smoke_dir.display()))?;
|
||||
}
|
||||
fs::create_dir_all(&smoke_dir)
|
||||
.with_context(|| format!("failed to create {}", 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"),
|
||||
"# Closure Source Grounding Smoke\n\nThis repository proves Soul can require verification output to cite changed paths.\n",
|
||||
)
|
||||
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
|
||||
git(["add", "README.md"], &repo)?;
|
||||
git(
|
||||
["commit", "-m", "Seed closure source grounding smoke"],
|
||||
&repo,
|
||||
)?;
|
||||
git(["switch", "-c", "epiphany/closure-source-grounding"], &repo)?;
|
||||
|
||||
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",
|
||||
"closure-source-grounding-smoke",
|
||||
"--topic",
|
||||
"closure-source-grounding",
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
cargo_json(
|
||||
&manifest,
|
||||
"epiphany-swarm",
|
||||
&[
|
||||
"online",
|
||||
"--workspace",
|
||||
path_str(&repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(&root)?,
|
||||
"--runtime-id",
|
||||
"closure-source-grounding-smoke",
|
||||
"--local-verse-store",
|
||||
path_str(&local_verse)?,
|
||||
],
|
||||
&root,
|
||||
)?;
|
||||
|
||||
let good = drive_item(
|
||||
&manifest,
|
||||
&root,
|
||||
&repo,
|
||||
"closure-source-grounded",
|
||||
"Prove default closure verification cites the changed path.",
|
||||
None,
|
||||
)?;
|
||||
let bad = drive_item(
|
||||
&manifest,
|
||||
&root,
|
||||
&repo,
|
||||
"closure-proofless-output",
|
||||
"Prove source grounding blocks proofless verification output.",
|
||||
Some("Write-Output 'ok'"),
|
||||
)?;
|
||||
|
||||
require_eq(&good.close, &["status"], "closed")?;
|
||||
require_eq(&good.close, &["soul", "verdict"], "passed")?;
|
||||
require_bool(
|
||||
&good.close,
|
||||
&[
|
||||
"closureReview",
|
||||
"verificationSourceGrounding",
|
||||
"allDeclaredPathsMentionedByVerificationOutput",
|
||||
],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&good.close,
|
||||
&["closureReview", "verificationSourceGrounding", "required"],
|
||||
true,
|
||||
)?;
|
||||
require_eq(&bad.close, &["status"], "verification-failed")?;
|
||||
require_eq(&bad.close, &["soul", "verdict"], "failed")?;
|
||||
require_eq(
|
||||
&bad.close,
|
||||
&["closureReview", "verificationSourceGrounding", "status"],
|
||||
"failed",
|
||||
)?;
|
||||
require_bool(
|
||||
&bad.close,
|
||||
&[
|
||||
"closureReview",
|
||||
"verificationSourceGrounding",
|
||||
"allDeclaredPathsMentionedByVerificationOutput",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_bool(
|
||||
&bad.close,
|
||||
&["closureReview", "sourceGrounding", "pathScopeMatched"],
|
||||
true,
|
||||
)?;
|
||||
require_bool(
|
||||
&bad.close,
|
||||
&[
|
||||
"closureReview",
|
||||
"sourceGrounding",
|
||||
"verificationOutputMentionsChangedPaths",
|
||||
],
|
||||
false,
|
||||
)?;
|
||||
require_eq(
|
||||
&bad.close,
|
||||
&["closureReview", "familyAssertions", "status"],
|
||||
"passed",
|
||||
)?;
|
||||
require_bool(&good.close, &["privateStateExposed"], false)?;
|
||||
require_bool(&bad.close, &["privateStateExposed"], false)?;
|
||||
|
||||
let summary = json!({
|
||||
"schemaVersion": "epiphany.repo_work_closure_source_grounding_smoke.v0",
|
||||
"status": "ok",
|
||||
"smokeDir": smoke_dir,
|
||||
"repo": repo,
|
||||
"branch": git_output(["branch", "--show-current"], &repo)?,
|
||||
"passItem": good.item,
|
||||
"passCloseStatus": good.close["status"],
|
||||
"passSourceGroundingStatus": good.close["closureReview"]["verificationSourceGrounding"]["status"],
|
||||
"passVerificationOutputMentionsChangedPaths": good.close["closureReview"]["sourceGrounding"]["verificationOutputMentionsChangedPaths"],
|
||||
"blockItem": bad.item,
|
||||
"blockCloseStatus": bad.close["status"],
|
||||
"blockSoulVerdict": bad.close["soul"]["verdict"],
|
||||
"blockSourceGroundingStatus": bad.close["closureReview"]["verificationSourceGrounding"]["status"],
|
||||
"blockPathScopeMatched": bad.close["closureReview"]["sourceGrounding"]["pathScopeMatched"],
|
||||
"blockFamilyAssertionsStatus": bad.close["closureReview"]["familyAssertions"]["status"],
|
||||
"privateStateExposed": false,
|
||||
});
|
||||
write_json(&smoke_dir.join("summary.json"), &summary)?;
|
||||
Ok(summary)
|
||||
}
|
||||
|
||||
struct ItemProof {
|
||||
item: String,
|
||||
close: Value,
|
||||
}
|
||||
|
||||
fn drive_item(
|
||||
manifest: &Path,
|
||||
root: &Path,
|
||||
repo: &Path,
|
||||
item: &str,
|
||||
summary: &str,
|
||||
verification_command: Option<&str>,
|
||||
) -> Result<ItemProof> {
|
||||
cargo_json(
|
||||
manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"accept",
|
||||
"--workspace",
|
||||
path_str(repo)?,
|
||||
"--from",
|
||||
"persona",
|
||||
"--item",
|
||||
item,
|
||||
"--summary",
|
||||
summary,
|
||||
],
|
||||
root,
|
||||
)?;
|
||||
cargo_json(
|
||||
manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"derive-plan",
|
||||
"--workspace",
|
||||
path_str(repo)?,
|
||||
"--item",
|
||||
item,
|
||||
"--action-family",
|
||||
"repo-status-section",
|
||||
"--model-ref",
|
||||
"closure-source-grounding-smoke-imagination-v1",
|
||||
"--model-authored",
|
||||
],
|
||||
root,
|
||||
)?;
|
||||
for _ in 0..3 {
|
||||
cargo_json(
|
||||
manifest,
|
||||
"epiphany-work",
|
||||
&[
|
||||
"tick",
|
||||
"--workspace",
|
||||
path_str(repo)?,
|
||||
"--epiphany-root",
|
||||
path_str(root)?,
|
||||
"--item",
|
||||
item,
|
||||
"--cooldown-seconds",
|
||||
"0",
|
||||
],
|
||||
root,
|
||||
)?;
|
||||
}
|
||||
|
||||
let mut close_args = vec![
|
||||
"close".to_string(),
|
||||
"--workspace".to_string(),
|
||||
path_str(repo)?.to_string(),
|
||||
"--item".to_string(),
|
||||
item.to_string(),
|
||||
"--require-source-grounding".to_string(),
|
||||
];
|
||||
if let Some(command) = verification_command {
|
||||
close_args.push("--verification-command".to_string());
|
||||
close_args.push(command.to_string());
|
||||
}
|
||||
let close_arg_refs = close_args.iter().map(String::as_str).collect::<Vec<_>>();
|
||||
let close = cargo_json(manifest, "epiphany-work", &close_arg_refs, root)?;
|
||||
Ok(ItemProof {
|
||||
item: item.to_string(),
|
||||
close,
|
||||
})
|
||||
}
|
||||
|
||||
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 output 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 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 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}"))?,
|
||||
))
|
||||
}
|
||||
|
||||
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
|
||||
let actual = value_at(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 {expected:?}, got {actual:?}",
|
||||
path.join(".")
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
|
||||
let actual = value_at(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 {expected}, got {actual}",
|
||||
path.join(".")
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn value_at<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
|
||||
let mut current = value;
|
||||
for segment in path {
|
||||
current = current.get(*segment)?;
|
||||
}
|
||||
Some(current)
|
||||
}
|
||||
|
|
@ -283,6 +283,7 @@ struct CloseArgs {
|
|||
closure_model_verdict: Option<String>,
|
||||
closure_model_finding: Option<String>,
|
||||
require_closure_model_verdict: bool,
|
||||
require_source_grounding: bool,
|
||||
model_authored: bool,
|
||||
state_revision: u64,
|
||||
}
|
||||
|
|
@ -860,6 +861,7 @@ fn parse_close_args(args: impl Iterator<Item = String>) -> Result<CloseArgs> {
|
|||
let mut closure_model_verdict = None;
|
||||
let mut closure_model_finding = None;
|
||||
let mut require_closure_model_verdict = false;
|
||||
let mut require_source_grounding = false;
|
||||
let mut model_authored = false;
|
||||
let mut state_revision = 0_u64;
|
||||
|
||||
|
|
@ -894,6 +896,7 @@ fn parse_close_args(args: impl Iterator<Item = String>) -> Result<CloseArgs> {
|
|||
"--require-closure-model-verdict" | "--require-model-verdict" => {
|
||||
require_closure_model_verdict = true;
|
||||
}
|
||||
"--require-source-grounding" => require_source_grounding = true,
|
||||
"--model-authored" => model_authored = true,
|
||||
"--state-revision" => state_revision = take_u64(&mut args, "--state-revision")?,
|
||||
other => return Err(anyhow!("unexpected close argument {other:?}")),
|
||||
|
|
@ -912,6 +915,7 @@ fn parse_close_args(args: impl Iterator<Item = String>) -> Result<CloseArgs> {
|
|||
closure_model_verdict,
|
||||
closure_model_finding,
|
||||
require_closure_model_verdict,
|
||||
require_source_grounding,
|
||||
model_authored,
|
||||
state_revision,
|
||||
})
|
||||
|
|
@ -8263,6 +8267,69 @@ fn closure_model_review(
|
|||
))
|
||||
}
|
||||
|
||||
fn closure_verification_source_grounding_review(
|
||||
declared_changed_paths: &[String],
|
||||
verification_stdout: &[u8],
|
||||
verification_stderr: &[u8],
|
||||
commit_stat: &str,
|
||||
required: bool,
|
||||
) -> (Value, bool) {
|
||||
let stdout_text = String::from_utf8_lossy(verification_stdout);
|
||||
let stderr_text = String::from_utf8_lossy(verification_stderr);
|
||||
let verification_output = format!("{stdout_text}\n{stderr_text}");
|
||||
let output_lower = verification_output.to_ascii_lowercase();
|
||||
let commit_stat_lower = commit_stat.to_ascii_lowercase();
|
||||
let mut path_rows = Vec::new();
|
||||
for path in declared_changed_paths {
|
||||
let path_lower = path.to_ascii_lowercase();
|
||||
let slash_variant = path_lower.replace('\\', "/");
|
||||
let backslash_variant = path_lower.replace('/', "\\");
|
||||
let mentioned_in_verification_output = output_lower.contains(&slash_variant)
|
||||
|| output_lower.contains(&backslash_variant)
|
||||
|| output_lower.contains(&path_lower);
|
||||
let present_in_commit_stat = commit_stat_lower.contains(&slash_variant)
|
||||
|| commit_stat_lower.contains(&backslash_variant)
|
||||
|| commit_stat_lower.contains(&path_lower);
|
||||
path_rows.push(json!({
|
||||
"path": path,
|
||||
"mentionedInVerificationOutput": mentioned_in_verification_output,
|
||||
"presentInCommitStat": present_in_commit_stat,
|
||||
"passed": mentioned_in_verification_output && present_in_commit_stat
|
||||
}));
|
||||
}
|
||||
let all_paths_mentioned = !declared_changed_paths.is_empty()
|
||||
&& path_rows
|
||||
.iter()
|
||||
.all(|row| row.get("passed").and_then(Value::as_bool) == Some(true));
|
||||
let passed = !required || all_paths_mentioned;
|
||||
let status = if all_paths_mentioned {
|
||||
"passed"
|
||||
} else if required {
|
||||
"failed"
|
||||
} else {
|
||||
"informational"
|
||||
};
|
||||
(
|
||||
json!({
|
||||
"schemaVersion": "epiphany.repo_work_verification_source_grounding_review.v0",
|
||||
"status": status,
|
||||
"passed": passed,
|
||||
"required": required,
|
||||
"declaredPathCount": declared_changed_paths.len(),
|
||||
"allDeclaredPathsMentionedByVerificationOutput": all_paths_mentioned,
|
||||
"pathRows": path_rows,
|
||||
"reason": if all_paths_mentioned {
|
||||
"verification output and commit stat cite every declared changed path"
|
||||
} else if required {
|
||||
"source-grounded closure required verification output to cite every declared changed path"
|
||||
} else {
|
||||
"verification output did not cite every declared changed path; recorded as advisory source-grounding signal"
|
||||
}
|
||||
}),
|
||||
passed,
|
||||
)
|
||||
}
|
||||
|
||||
fn read_committed_file(
|
||||
workspace: &Path,
|
||||
commit_sha: &str,
|
||||
|
|
@ -9355,6 +9422,19 @@ fn run_close(args: CloseArgs) -> Result<Value> {
|
|||
);
|
||||
let path_scope_matched = declared_changed_paths == actual_changed_paths;
|
||||
let commit_stat = git_output(&workspace, &["show", "--stat", "--oneline", &commit_sha])?;
|
||||
let (verification_source_grounding, verification_source_grounded) =
|
||||
closure_verification_source_grounding_review(
|
||||
&declared_changed_paths,
|
||||
&verification.stdout,
|
||||
&verification.stderr,
|
||||
&commit_stat,
|
||||
args.require_source_grounding,
|
||||
);
|
||||
let verification_output_mentions_changed_paths = bool_from_json(
|
||||
&verification_source_grounding,
|
||||
&["allDeclaredPathsMentionedByVerificationOutput"],
|
||||
)
|
||||
.unwrap_or(false);
|
||||
let (family_assertions, family_assertions_passed) =
|
||||
closure_family_assertions(&workspace, &commit_sha, &execute_receipt, &item)?;
|
||||
let (mind_adoption_review, mind_adoption_passed) =
|
||||
|
|
@ -9398,10 +9478,13 @@ fn run_close(args: CloseArgs) -> Result<Value> {
|
|||
"pathScopeMatched": path_scope_matched,
|
||||
"commitStat": compact_multiline(&commit_stat),
|
||||
"commitReceiptMatchedExecuteReceipt": true,
|
||||
"verificationOutputMentionsChangedPaths": verification_output_mentions_changed_paths,
|
||||
"sourceGroundingRequired": args.require_source_grounding,
|
||||
"mindAdoptionPassed": mind_adoption_passed,
|
||||
"familyAssertionsPassed": family_assertions_passed,
|
||||
"modelClosurePassed": model_closure_passed
|
||||
},
|
||||
"verificationSourceGrounding": verification_source_grounding,
|
||||
"mindAdoptionReview": mind_adoption_review,
|
||||
"familyAssertions": family_assertions,
|
||||
"modelingReview": {
|
||||
|
|
@ -9426,6 +9509,7 @@ fn run_close(args: CloseArgs) -> Result<Value> {
|
|||
write_json(&closure_review_path, &closure_review)?;
|
||||
let verification_passed = verification.status.success()
|
||||
&& path_scope_matched
|
||||
&& verification_source_grounded
|
||||
&& mind_adoption_passed
|
||||
&& family_assertions_passed
|
||||
&& model_closure_passed;
|
||||
|
|
@ -9437,6 +9521,10 @@ fn run_close(args: CloseArgs) -> Result<Value> {
|
|||
format!(
|
||||
"Soul verification failed for branch-local commit {commit_sha}: actual changed paths did not match declared Hands path scope."
|
||||
)
|
||||
} else if !verification_source_grounded {
|
||||
format!(
|
||||
"Soul verification failed for branch-local commit {commit_sha}: verification output did not cite every declared changed path."
|
||||
)
|
||||
} else if !mind_adoption_passed {
|
||||
format!(
|
||||
"Soul verification failed for branch-local commit {commit_sha}: Mind adoption proof did not pass."
|
||||
|
|
@ -9481,6 +9569,11 @@ fn run_close(args: CloseArgs) -> Result<Value> {
|
|||
"Closure refused because actual git changed paths differ from Hands-declared scope."
|
||||
.to_string(),
|
||||
]
|
||||
} else if !verification_source_grounded {
|
||||
vec![
|
||||
"Closure refused because the verification output did not cite every declared changed path while source grounding was required."
|
||||
.to_string(),
|
||||
]
|
||||
} else if !mind_adoption_passed {
|
||||
vec![
|
||||
"Closure refused because the Mind adoption decision was missing, tampered, or non-affirmative."
|
||||
|
|
@ -11726,6 +11819,7 @@ fn run_tick(args: TickArgs) -> Result<Value> {
|
|||
closure_model_verdict: None,
|
||||
closure_model_finding: None,
|
||||
require_closure_model_verdict: false,
|
||||
require_source_grounding: false,
|
||||
model_authored: false,
|
||||
state_revision: 0,
|
||||
})?;
|
||||
|
|
@ -13108,7 +13202,7 @@ fn print_usage() {
|
|||
run --workspace <repo> [--item <id>] [--accept-receipt <path>] [--runtime-store <path>] [--requested-path <path>]\n\
|
||||
adopt --workspace <repo> [--item <id>] [--run-receipt <path>] [--from-plan <path>] [--plan-summary <text>] [--adoption-evidence-ref <ref>] [--mind-adoption-rationale <text>]\n\
|
||||
execute --workspace <repo> [--item <id>] [--from-plan <path>] [--command <command>] [--changed-path <path>] [--commit-message <text>]\n\
|
||||
close --workspace <repo> [--item <id>] [--execute-receipt <path>] [--verification-command <command>] [--closure-model-ref <ref>] [--model-authored] [--closure-model-verdict passed|failed|needs-work|blocked] [--closure-model-finding <text>] [--require-closure-model-verdict]\n\
|
||||
close --workspace <repo> [--item <id>] [--execute-receipt <path>] [--verification-command <command>] [--closure-model-ref <ref>] [--model-authored] [--closure-model-verdict passed|failed|needs-work|blocked] [--closure-model-finding <text>] [--require-closure-model-verdict] [--require-source-grounding]\n\
|
||||
publish --workspace <repo> [--item <id>] --change-summary <text> --justification <text> --verification-receipt <ref> --review-receipt <ref> --ledger-entry-id <id> --pull-request-url <url> --pull-request-title <text>\n\
|
||||
sync --workspace <repo> [--item <id>] [--publish-receipt <path>] [--upstream-ref origin/main] --merge-receipt <ref>\n\
|
||||
overview --workspace <repo> [--item <id>] [--accept-receipt <path>] [--no-write]\n\
|
||||
|
|
|
|||
|
|
@ -1154,7 +1154,8 @@ optional model-review provenance from `--closure-model-ref` / `--model-authored`
|
|||
optional hard model closure verdicts from `--closure-model-verdict`, safe-family
|
||||
assertions for known Imagination families, the cited
|
||||
`epiphany.repo_work_mind_adoption_decision.v0` snapshot plus standalone receipt
|
||||
match, and authority seals. Soul passes only
|
||||
match, verification-output source-grounding against declared changed paths, and
|
||||
authority seals. Soul passes only
|
||||
when the verification command succeeds, actual git changed paths match the
|
||||
Hands-declared path scope, the accepted Mind adoption proof is present and
|
||||
affirmative, the committed target content satisfies the deterministic
|
||||
|
|
@ -1162,7 +1163,11 @@ safe-family assertions when the plan family is known, and any supplied or
|
|||
required model-authored closure verdict passes.
|
||||
`--require-closure-model-verdict` turns missing model verdicts into a closure
|
||||
refusal; without that flag, older provenance-only model refs remain
|
||||
compatibility evidence instead of a hard gate. Soul
|
||||
compatibility evidence instead of a hard gate. `--require-source-grounding`
|
||||
turns proofless custom verification output into a closure refusal unless the
|
||||
verification stdout/stderr cite every declared changed path that appears in the
|
||||
commit stat. Without that flag, the source-grounding packet is advisory
|
||||
evidence. Soul
|
||||
then writes `epiphany.soul.verdict_receipt`, Modeling records the
|
||||
execution/commit/closure-review summary, and Mind writes gateway review plus
|
||||
state-commit receipts into runtime-spine. On successful closure, Mind also
|
||||
|
|
@ -1235,6 +1240,18 @@ one with `--closure-model-verdict needs-work`. The pass item returned
|
|||
`familyAssertions.status=passed` and `pathScopeMatched=true`; private state
|
||||
remained sealed.
|
||||
|
||||
A source-grounded closure smoke proved Soul can reject proofless verifier output
|
||||
without confusing that failure with path scope or family assertions:
|
||||
`.epiphany-smoke\repo-closure-source-grounding-20260620-230626` ran two
|
||||
`repo-status-section` items through init -> online -> accept -> derive-plan ->
|
||||
tick run/adopt/execute. The default close with `--require-source-grounding`
|
||||
closed successfully because `git show --stat` cited the changed `README.md`.
|
||||
The custom close with `--verification-command "Write-Output 'ok'"`
|
||||
also exited successfully, kept `pathScopeMatched=true` and
|
||||
`familyAssertions.status=passed`, but returned `verification-failed`, Soul
|
||||
`failed`, and `verificationSourceGrounding.status=failed` because the verifier
|
||||
output did not cite the changed path; `privateStateExposed=false`.
|
||||
|
||||
A Mind-adoption closure guard smoke proved Soul now verifies that the Hands
|
||||
commit being closed still descends from an accepted Mind adoption decision:
|
||||
`.epiphany-smoke\repo-close-mind-adoption-guard-20260620-201153` ran a
|
||||
|
|
@ -1639,7 +1656,7 @@ temptation wearing clean robes.
|
|||
| Imagination planning | `derive-plan` now writes a typed `epiphany.repo_work_imagination_action_items_receipt.v0` before the executable plan receipt. The action-item receipt can carry model provenance, allowed safe family, requested paths, verification asks, stop conditions, escalation reasons, planning facets (assumptions, constraints, non-goals, open questions, decision points, and evidence needs), and private-state seals; command text remains deterministic safe-family lowering for `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `repo-status-section` / `repo.status_section`, `task-card` / `repo.task_card`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo-doctrine-update-request` / `repo.doctrine_update_request`, `repo-secret-policy-request` / `repo.secret_policy_request`, `repo-deployment-config` / `repo.deployment_config`, and `repo-deployment-request` / `repo.deployment_request`. `adopt` now writes `epiphany.repo_work_mind_adoption_decision.v0` before the main adoption receipt cites the decision and grants branch-local Hands authority, and refuses plan-derived items that lack explicit verification asks or planning evidence needs. `plan` remains manual quarantine scaffolding. | Deepen further interpreter behavior and useful repo-owned configuration/action classes without turning model text into arbitrary shell authority. |
|
||||
| Self scheduling | `tick` and `serve` prove one-step branch-local advancement, brake refusal, active-turn refusal, cooldown, and stale-turn recovery; `tick` now routes executed branch-local work through the existing Soul/Modeling/Mind `close` gate; `queue-run` selects tick-actionable rows from the typed repo-work queue and delegates to `tick`; `epiphany-swarm run` is the bounded operator mouth over that queue/tick physiology; `repo-work-service-plan` and `repo-work-service-runbook` write Idunn lifecycle receipts/artifacts for the same queue-run command without launching it. | Keep any future queue-run service launch/install behind Idunn and explicit operator authority. |
|
||||
| Branch-local Hands work | `adopt` and `execute` create approved Hands gates, run planned commands, stage declared paths, commit on `epiphany/*`, and write receipts. | Keep mutation branch-contained and receipt-backed; broaden only through typed plan families, not ad hoc shell freedom. |
|
||||
| Soul/Modeling/Mind closure | `close` verifies the Hands commit, writes `epiphany.repo_work_closure_review.v0`, refuses path-scope mismatches, refuses missing/tampered/non-affirmative Mind adoption proof, runs known safe-family content assertions, optionally gates on model-authored closure verdicts, writes Soul/Modeling/Mind receipts, admits a compact typed repo map entry into `.epiphany/state/repo-work-map.msgpack`, and mirrors that admitted fact into local Verse as `epiphany.cultmesh.repo_work_map_entry.v0`. | Keep extending closure toward source-grounded semantic review and richer semantic map lenses, while preserving deterministic local closure for simple mechanical work. |
|
||||
| Soul/Modeling/Mind closure | `close` verifies the Hands commit, writes `epiphany.repo_work_closure_review.v0`, refuses path-scope mismatches, refuses missing/tampered/non-affirmative Mind adoption proof, runs known safe-family content assertions, optionally gates on model-authored closure verdicts, can require verification output to cite declared changed paths with `--require-source-grounding`, writes Soul/Modeling/Mind receipts, admits a compact typed repo map entry into `.epiphany/state/repo-work-map.msgpack`, and mirrors that admitted fact into local Verse as `epiphany.cultmesh.repo_work_map_entry.v0`. | Keep extending closure toward source-grounded semantic review and richer semantic map lenses, while preserving deterministic local closure for simple mechanical work. |
|
||||
| Repo work sight | `overview` emits compact proof rows and mirrors typed `epiphany.cultmesh.repo_work_overview.v0` event documents plus a latest key; `close` mirrors Mind-admitted map facts as `epiphany.cultmesh.repo_work_map_entry.v0`; Gjallar enumerates overview history, map rows, family lens rows, path lens rows, branch lens rows, and public-proof rows without private-state exposure; Persona's Eve surface and Eve connection readbacks expose peer-readable gate/blocker/next-action rows; `queue-run` consumes the same overview queue for branch-local scheduler pulses. | Deepen the Persona-to-plan loop and semantic map readback without moving action authority out of Hands/Self/Bifrost. |
|
||||
| Publication | `publish` routes Bifrost/GitHub receipts from closure or explicit Soul/Mind refs. | Keep publication Bifrost-owned; do not let scheduler publish. |
|
||||
| Upstream main sync | `sync` proves the published commit is contained by upstream main after explicit merge/sync authority. | Treat upstream-main sync as a required final proof for published work. |
|
||||
|
|
@ -1727,7 +1744,9 @@ Build the remaining MVP in this order:
|
|||
5. **Execute-to-close handoff.** Let the scheduler route from branch-local
|
||||
Hands execution into Soul/Modeling/Mind closure when the required execute
|
||||
receipts exist. The closure may be deterministic for mechanical work and
|
||||
model-authored for source-grounded review, but the Mind admission receipt is
|
||||
model-authored for source-grounded review, and `--require-source-grounding`
|
||||
now lets Soul reject verification output that does not cite the changed Body
|
||||
paths even when the command exits successfully. The Mind admission receipt is
|
||||
still the durable-state gate.
|
||||
6. **Operator-safe proof bundles.** Package each work item as compact
|
||||
maintainer evidence: item, branch, changed paths, Hands receipts, Soul
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- 2026-06-20: `epiphany-work deployment-aftercare-audit` is live as the post-operator Idunn receipt ingestion mouth, and now reads sealed Idunn receipt projections from repo-local CultMesh refs. It reads the deployment runbook receipt plus `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0` via `--local-verse-store`, `--idunn-deployment-receipt-ref`, and `--aftercare-audit-receipt-ref`, emits `epiphany.repo_deployment_aftercare_audit.v0`, reports `complete` only when both Idunn receipts have successful statuses and private-state seals, and remains non-mutating with deployment/SSH/git-push/service/Hands/publication/merge authority false. The older explicit receipt-file flags remain compatibility reliquaries. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-221205` proved the CultMesh ref path with `idunnDeploymentReceiptSource=cultmesh`, `idunnAftercareAuditReceiptSource=cultmesh`, `deploymentAftercareAuditStatus=complete`, `deploymentComplete=true`, and `privateStateExposed=false`.
|
||||
- 2026-06-20: Gjallar/Odin sight now exposes Idunn deployment proof coordinates without taking over deployment. `EpiphanyLocalVerseContext`, `receipt-directory`, `swarm-overview`, `swarm-triage`, and `gjallar` include compact `idunnDeploymentReceiptRows` / `IDUNN-DEPLOYMENT` rows for latest `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0`, carrying owner `Idunn`, watched/checked refs, result refs, deployment/aftercare ids, follow-up readback command, and private-state seal. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-223203` proved the CultMesh aftercare path plus Gjallar readback with `gjallarIdunnDeploymentReceiptCount=2`, latest deployment receipt `fixture-idunn-deployment`, latest aftercare receipt `fixture-idunn-aftercare`, and `privateStateExposed=false`.
|
||||
- 2026-06-20: Deeper model-authored closure review is now live. `epiphany-work close` accepts `--closure-model-verdict passed|failed|needs-work|blocked`, `--closure-model-finding`, and `--require-closure-model-verdict`; the close review embeds `epiphany.repo_work_model_closure_review.v0` under `modelingReview.closureReview`, records reviewed inputs and gate enforcement, and Soul refuses closure when a supplied or required model verdict does not pass. Focused smoke `.epiphany-smoke\closure-model-gate-20260620-135103` created a disposable repo, ran two `repo.status_section` items through public front doors, closed one with required model verdict `passed`, and blocked one with `needs-work` while `familyAssertions.status=passed`, `pathScopeMatched=true`, and `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter/adoption semantics, more useful repo-owned configuration/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority.
|
||||
- 2026-06-20: Soul closure now has an explicit source-grounding gate for verifier output. `epiphany-work close` records `epiphany.repo_work_verification_source_grounding_review.v0` in the closure review, checking whether verification stdout/stderr cite every declared changed path that appears in the commit stat; `--require-source-grounding` makes missing path citations a hard closure refusal. Focused smoke `.epiphany-smoke\repo-closure-source-grounding-20260620-230626` proved default `git show --stat` close passes with source grounding required, while custom `Write-Output 'ok'` verification exits successfully but fails closure with `verificationSourceGrounding.status=failed`, `pathScopeMatched=true`, `familyAssertions.status=passed`, Soul `failed`, and `privateStateExposed=false`.
|
||||
- 2026-06-20: Mind adoption/interpreter depth now has a concrete interpretation packet. `epiphany-work adopt` writes `epiphany.repo_work_mind_adoption_decision.v0` before the main adoption receipt, embeds `epiphany.repo_work_mind_interpretation.v0` with input summary, safe-family recognition, requested-path classification, allowed branch-local Hands transition, and forbidden durable-state/publication/service/private transitions, then records Self presentation, Mind evidence review, safe-family requirement, branch-local scope, Bifrost publication gate, Soul closure requirement, and no Hands/durable-state/publication/merge/service/cross-body/private authority inside the Mind decision; the main adoption receipt cites that decision before granting branch-local Hands authority. Focused smoke `.epiphany-smoke\repo-planning-facets-20260620-175503` proves model-authored planning facets survive into Imagination, plan derivation, Mind interpretation, Mind decision, and adoption, while close still passes Soul/family/path checks with `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter semantics beyond the first Mind interpretation packet, more useful repo-owned configuration/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority.
|
||||
- 2026-06-20: `repo-manifest` is now the next non-planning safe family. `epiphany-work derive-plan --action-family repo-manifest` lowers accepted pressure into a structured `epiphany.toml` Body manifest with safe family `repo.body_manifest`, body domain, private/local/public Verse ids, Eve surface id, receipt-required capability hints, arbitrary shell sealed false, and private-state seals. Soul closure assertions now inspect the committed manifest for schema, safe family, summary, body domain, Verse ids, Eve surface, receipt requirement, no arbitrary shell, and private-state seals. Focused smoke `.epiphany-smoke\repo-manifest-family-20260620-141552` ran a disposable repo through init -> online -> accept -> repo-manifest derive-plan -> tick run/adopt/execute/close; Hands committed only `epiphany.toml`, Soul passed with `pathScopeMatched=true`, `familyAssertions.status=passed`, and `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter/adoption semantics, additional useful repo-owned config/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority.
|
||||
- 2026-06-20: `repo-tool-capabilities` is now live as repo-owned tool capability configuration cargo. `epiphany-work derive-plan --action-family repo-tool-capabilities` writes `.epiphany/repo-tool-capabilities.toml` with safe family `repo.tool_capabilities`, local CultMesh/Odin discovery flags, daemon tool invocation intent/receipt contracts, expected repo-swarm capability ids, host-daemon execution ownership, Idunn lifecycle ownership, and authority seals for no shell/deploy/service/private-rummaging authority. Soul closure assertions inspect schema, family, summary, tool directory, contracts, expected capability ids, host receipt requirement, authority seals, and private-state seal. Focused smoke `.epiphany-smoke\repo-tool-capabilities-family-20260620-142430` ran init -> online -> accept -> repo-tool-capabilities derive-plan -> tick run/adopt/execute/close; Hands committed only `.epiphany/repo-tool-capabilities.toml`, Soul passed with `pathScopeMatched=true`, `familyAssertions.status=passed`, `hostDaemonOwnsExecution=true`, `idunnOwnsLifecycle=true`, and `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter/adoption semantics, more useful repo-owned configuration/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority.
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
Reference in a new issue