Delete counterfeit readiness approval

This commit is contained in:
Meta Vens 2026-07-12 22:56:48 +01:00
commit e57509e804
13 changed files with 30 additions and 1543 deletions

View file

@ -51,7 +51,6 @@ struct Args {
root: PathBuf,
smoke_root: PathBuf,
fresh_repo_summary: Option<PathBuf>,
readiness_summary: Option<PathBuf>,
daemon_survival_summary: Option<PathBuf>,
}
@ -60,7 +59,6 @@ impl Args {
let mut root = env::current_dir().context("failed to resolve current directory")?;
let mut smoke_root = root.join(".epiphany-smoke");
let mut fresh_repo_summary = None;
let mut readiness_summary = None;
let mut daemon_survival_summary = None;
let mut args = env::args().skip(1).peekable();
while let Some(arg) = args.next() {
@ -70,9 +68,6 @@ impl Args {
"--fresh-repo-summary" => {
fresh_repo_summary = Some(take_path(&mut args, "--fresh-repo-summary")?)
}
"--readiness-summary" => {
readiness_summary = Some(take_path(&mut args, "--readiness-summary")?)
}
"--daemon-survival-summary" => {
daemon_survival_summary =
Some(take_path(&mut args, "--daemon-survival-summary")?)
@ -84,7 +79,6 @@ impl Args {
root,
smoke_root,
fresh_repo_summary,
readiness_summary,
daemon_survival_summary,
})
}
@ -116,19 +110,14 @@ fn run_smoke(args: Args) -> Result<Value> {
let fresh_repo_summary = args
.fresh_repo_summary
.unwrap_or_else(|| latest_summary(&args.smoke_root, "fresh-repo-mvp-"));
let readiness_summary = args
.readiness_summary
.unwrap_or_else(|| latest_summary(&args.smoke_root, "repo-work-readiness-"));
let daemon_survival_summary = args
.daemon_survival_summary
.unwrap_or_else(|| latest_summary(&args.smoke_root, "daemon-survival-rehearsal-"));
let fresh = read_json(&fresh_repo_summary)?;
let readiness = read_json(&readiness_summary)?;
let daemon_survival = read_json(&daemon_survival_summary)?;
verify_fresh_repo(&fresh)?;
verify_readiness(&readiness)?;
verify_daemon_survival(&daemon_survival)?;
let weksa_interlingua = verify_weksa_interlingua()?;
let persona_memory_recall = verify_persona_memory_recall()?;
@ -176,16 +165,6 @@ fn run_smoke(args: Args) -> Result<Value> {
"Bifrost",
"operator-safe public proof exported without private state",
),
green(
"readiness-review",
"Soul",
"readiness report and review receipt are present",
),
green(
"receipt-directory",
"Bifrost",
"readiness review is queryable through the receipt directory",
),
green(
"long-running-daemon-proof",
"Idunn",
@ -227,10 +206,8 @@ fn run_smoke(args: Args) -> Result<Value> {
"status": "mvp-demo-ready-with-known-operator-gates",
"smokeDir": smoke_dir,
"freshRepoSummary": fresh_repo_summary,
"readinessSummary": readiness_summary,
"daemonSurvivalSummary": daemon_survival_summary,
"freshRepoSmokeDir": fresh["smokeDir"],
"readinessSmokeDir": readiness["smokeDir"],
"daemonSurvivalSmokeDir": daemon_survival["smokeDir"],
"weksaInterlingua": weksa_interlingua,
"personaMemoryRecall": persona_memory_recall,
@ -285,35 +262,6 @@ fn verify_fresh_repo(value: &Value) -> Result<()> {
require_bool(value, &["privateStateExposed"], false)
}
fn verify_readiness(value: &Value) -> Result<()> {
require_eq(
value,
&["schemaVersion"],
"epiphany.repo_work_readiness_smoke.v0",
)?;
require_eq(value, &["status"], "ok")?;
require_eq(value, &["readinessStatus"], "ready")?;
require_eq(value, &["readinessReviewStatus"], "readiness-approved")?;
require_eq(value, &["publishStatus"], "publication-receipts-recorded")?;
require_eq(value, &["syncStatus"], "upstream-main-synced")?;
require_bool(value, &["upstreamMainSynced"], true)?;
require_bool(value, &["privateStateExposed"], false)?;
require_bool(value, &["sightOnly"], true)?;
require_bool(value, &["readinessApprovalAuthorized"], false)?;
require_bool(value, &["publicationAuthorized"], false)?;
require_bool(value, &["deploymentAuthority"], false)?;
require_bool(value, &["serviceLifecycleAuthority"], false)?;
require_bool(value, &["handsActionAuthorized"], false)?;
require_row(
value,
&["bifrostReadinessReviewAccountingRow"],
"repo-work-readiness-review",
"closed",
4,
1,
)
}
fn verify_daemon_survival(value: &Value) -> Result<()> {
require_eq(
value,
@ -810,53 +758,6 @@ fn require_contains(haystack: &str, needle: &str, label: &str) -> Result<()> {
}
}
fn require_row(
value: &Value,
path: &[&str],
lane: &str,
status: &str,
review_receipt_count: u64,
public_artifact_count: u64,
) -> Result<()> {
let row = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.ok_or_else(|| anyhow!("missing accounting row {}", path.join(".")))?;
let actual_lane = row
.get("lane")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_status = row
.get("status")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_review_receipt_count = row
.get("reviewReceiptCount")
.and_then(Value::as_u64)
.unwrap_or(0);
let actual_public_artifact_count = row
.get("publicArtifactCount")
.and_then(Value::as_u64)
.unwrap_or(0);
let actual_private = row
.get("privateStateExposed")
.and_then(Value::as_bool)
.unwrap_or(true);
if actual_lane == lane
&& actual_status == status
&& actual_review_receipt_count == review_receipt_count
&& actual_public_artifact_count == public_artifact_count
&& !actual_private
{
Ok(())
} else {
Err(anyhow!(
"accounting row {} mismatch: lane={actual_lane:?}, status={actual_status:?}, reviewReceiptCount={actual_review_receipt_count}, publicArtifactCount={actual_public_artifact_count}, privateStateExposed={actual_private}",
path.join(".")
))
}
}
fn take_path(
args: &mut std::iter::Peekable<impl Iterator<Item = String>>,
flag: &str,

View file

@ -1,957 +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,
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-work-readiness-{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"),
"# Repo Work Readiness Smoke\n\nThis repository proves readiness sight without readiness approval.\n",
)
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
git(["add", "README.md"], &repo)?;
git(
["commit", "-m", "Seed repo work readiness smoke body"],
&repo,
)?;
git(["switch", "-c", "epiphany/repo-work-readiness"], &repo)?;
let item = "repo-work-readiness";
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
let work_dir = repo.join(".epiphany").join("work");
cargo_json(
&manifest,
"epiphany-repo",
&[
"init",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--swarm-id",
"repo-work-readiness-smoke",
"--topic",
"repo-work-readiness",
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-swarm",
&[
"online",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--runtime-id",
"repo-work-readiness-smoke",
"--local-verse-store",
path_str(&local_verse)?,
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-work",
&[
"accept",
"--workspace",
path_str(&repo)?,
"--from",
"persona",
"--item",
item,
"--summary",
"Prove repo-work readiness sight can name safe-family planning depth and missing publication and lifecycle gates without granting authority.",
"--local-verse-store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
"--candidate-action-ref",
"candidate-action://repo-work-readiness/safe-family-planning",
"--public-discussion-ref",
"epiphany-global/persona-collaboration/repo-work-readiness",
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-work",
&[
"derive-plan",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--action-family",
"repo-planning-brief",
"--model-ref",
"repo-work-readiness-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,
)?;
}
cargo_json(
&manifest,
"epiphany-work",
&[
"queue-run",
"--workspace",
path_str(&repo)?,
"--local-verse-store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
"--max-items",
"1",
"--dry-run",
],
&root,
)?;
let public_proof = cargo_json(
&manifest,
"epiphany-work",
&[
"export-proof",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--local-verse-store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
],
&root,
)?;
let close_receipt = repo
.join(".epiphany")
.join("work")
.join(format!("work-close-{item}.json"));
let publish = cargo_json(
&manifest,
"epiphany-work",
&[
"publish",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--artifact-dir",
path_str(&work_dir)?,
"--closure-receipt",
path_str(&close_receipt)?,
"--local-verse-store",
path_str(&local_verse)?,
"--change-summary",
"Repo-work readiness smoke Bifrost publication proof.",
"--justification",
"Disposable Bifrost publication proof for the repo-work readiness smoke.",
"--verification-receipt",
"soul-verdict:repo-work-readiness-smoke",
"--review-receipt",
"mind-review:repo-work-readiness-smoke",
"--author-agent",
"epiphany.Hands",
"--credit-subject",
"epiphany.Hands",
"--ledger-entry-id",
"repo-work-readiness-smoke-ledger",
"--pull-request-url",
"https://example.invalid/GameCult/repo-work-readiness-smoke/pull/1",
"--pull-request-number",
"1",
"--pull-request-title",
"Repo work readiness smoke proof",
],
&root,
)?;
git(["branch", "-f", "main", "HEAD"], &repo)?;
let sync = cargo_json(
&manifest,
"epiphany-work",
&[
"sync",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--publish-receipt",
publish
.get("receiptPath")
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("publish result missing receiptPath"))?,
"--artifact-dir",
path_str(&work_dir)?,
"--upstream-ref",
"main",
"--merge-receipt",
"maintainer-merge:repo-work-readiness-smoke",
],
&root,
)?;
let deployment_aftercare_fixture = repo
.join(".epiphany")
.join("work")
.join("deployment-aftercare-audit.json");
write_json(
&deployment_aftercare_fixture,
&json!({
"schemaVersion": "epiphany.repo_deployment_aftercare_audit.v0",
"status": "complete",
"deploymentComplete": true,
"deploymentAuthority": false,
"gitPushAuthority": false,
"serviceLifecycleAuthority": false,
"privateStateExposed": false
}),
)?;
let idunn_lifecycle_fixture = repo
.join(".epiphany")
.join("work")
.join("repo-work-service-audit.json");
write_json(
&idunn_lifecycle_fixture,
&json!({
"schemaVersion": "epiphany.repo_work_service_audit.v0",
"status": "complete",
"serviceId": "epiphany-repo-work-queue-runner",
"schedulerId": "epiphany-repo-work-queue-runner",
"receiptId": "repo-work-readiness-smoke-idunn-audit",
"planStatus": "present",
"runbookStatus": "present",
"runbookArtifactStatus": "present",
"runbookArtifactRef": "artifact://repo-work-readiness-smoke/repo-work-service-runbook.ps1",
"runbookSha256": "readiness-smoke-fixture",
"launchStatus": "ok",
"launchExitCode": 0,
"missingChecks": [],
"failedChecks": [],
"lifecycleOwner": "Idunn",
"hostedBody": "repo-work",
"mutatesServiceManager": false,
"requiresElevatedAuthority": false,
"privateStateExposed": false,
"nextSafeMove": "continue repo-swarm MVP planner/interpreter hardening"
}),
)?;
let tool_directory = cargo_json(
&manifest,
"epiphany-verse-query",
&[
"tool-directory",
"--store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
],
&root,
)?;
write_json(
&repo
.join(".epiphany")
.join("work")
.join("tool-directory.json"),
&tool_directory,
)?;
let readiness = cargo_json(
&manifest,
"epiphany-work",
&["readiness", "--workspace", path_str(&repo)?, "--item", item],
&root,
)?;
require_eq(
&readiness,
&["schemaVersion"],
"epiphany.repo_work_readiness.v0",
)?;
require_eq(&readiness, &["status"], "ready")?;
require_u64(&readiness, &["missingRequiredCount"], 0)?;
require_bool(&readiness, &["authority", "sightOnly"], true)?;
require_bool(
&readiness,
&["authority", "readinessApprovalAuthorized"],
false,
)?;
require_bool(&readiness, &["authority", "publicationAuthorized"], false)?;
require_bool(&readiness, &["authority", "deploymentAuthority"], false)?;
require_bool(
&readiness,
&["authority", "serviceLifecycleAuthority"],
false,
)?;
require_bool(&readiness, &["authority", "handsActionAuthorized"], false)?;
require_bool(&readiness, &["authority", "privateStateExposed"], false)?;
require_eq(
&readiness,
&["verseProjection", "documentType"],
"epiphany.cultmesh.repo_work_readiness",
)?;
require_eq(
&readiness,
&["verseProjection", "readinessId"],
"repo-work-readiness-repo-work-readiness",
)?;
require_bool(
&readiness,
&["verseProjection", "privateStateExposed"],
false,
)?;
require_row(&readiness, "repo-init", true)?;
require_row(&readiness, "swarm-online", true)?;
require_row(&readiness, "persona-intake", true)?;
require_row(&readiness, "imagination-plan", true)?;
require_row(&readiness, "self-queue-run", true)?;
require_row(&readiness, "hands-branch-work", true)?;
require_row(&readiness, "soul-closure", true)?;
require_row(&readiness, "modeling-mind-admission", true)?;
require_row(&readiness, "safe-family-planning", true)?;
require_row_field_u64(
&readiness,
"safe-family-planning",
"candidateNextSafeFamilyCount",
21,
)?;
require_row(&readiness, "public-proof", true)?;
require_row(&readiness, "bifrost-publication", true)?;
require_row_field_u64(&readiness, "bifrost-publication", "creditReceiptCount", 1)?;
require_row_field_u64(&readiness, "bifrost-publication", "changedPathCount", 1)?;
require_row(&readiness, "upstream-main-sync", true)?;
require_row_field_u64(&readiness, "upstream-main-sync", "mergeReceiptCount", 1)?;
require_row_field_bool(&readiness, "upstream-main-sync", "ancestryProved", true)?;
require_row_field_bool(
&readiness,
"upstream-main-sync",
"publishReceiptMatches",
true,
)?;
require_row(&readiness, "idunn-lifecycle", true)?;
require_row(&readiness, "deployment-aftercare", true)?;
require_row(&readiness, "tool-directory", true)?;
require_row(&readiness, "private-state-redaction", true)?;
let readiness_review = cargo_json(
&manifest,
"epiphany-work",
&[
"readiness-review",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--readiness-receipt",
readiness
.get("receiptPath")
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("readiness result missing receiptPath"))?,
"--maintainer-review-receipt",
"maintainer-review:repo-work-readiness-smoke",
"--soul-review-receipt",
"soul-review:repo-work-readiness-smoke",
"--mind-review-receipt",
"mind-review:repo-work-readiness-smoke",
"--bifrost-review-receipt",
"bifrost-review:repo-work-readiness-smoke",
"--review-summary",
"Smoke reviewers approve the ready readiness sight receipt without granting action authority.",
],
&root,
)?;
require_eq(
&readiness_review,
&["schemaVersion"],
"epiphany.repo_work_readiness_review.v0",
)?;
require_eq(&readiness_review, &["status"], "readiness-approved")?;
require_u64(&readiness_review, &["missingRequiredCount"], 0)?;
require_bool(
&readiness_review,
&["authority", "readinessApprovalAuthorized"],
true,
)?;
require_bool(
&readiness_review,
&["authority", "durableStateCommitAuthorized"],
false,
)?;
require_bool(
&readiness_review,
&["authority", "publicationAuthorized"],
false,
)?;
require_bool(&readiness_review, &["authority", "mergeAuthorized"], false)?;
require_bool(
&readiness_review,
&["authority", "serviceLifecycleAuthority"],
false,
)?;
require_bool(
&readiness_review,
&["authority", "handsActionAuthorized"],
false,
)?;
require_eq(
&readiness_review,
&["verseProjection", "documentType"],
"epiphany.cultmesh.repo_work_readiness_review",
)?;
require_eq(
&readiness_review,
&["verseProjection", "reviewId"],
"repo-work-readiness-review-repo-work-readiness",
)?;
require_bool(
&readiness_review,
&["verseProjection", "privateStateExposed"],
false,
)?;
require_bool(&readiness_review, &["privateStateExposed"], false)?;
let swarm_overview = cargo_json(
&manifest,
"epiphany-verse-query",
&[
"swarm-overview",
"--store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
],
&root,
)?;
require_u64(&swarm_overview, &["repoWorkReadinessCount"], 1)?;
require_eq(
&swarm_overview,
&["latestRepoWorkReadiness"],
"repo-work-readiness-repo-work-readiness",
)?;
require_bool(&swarm_overview, &["privateStateExposed"], false)?;
require_tui_row_contains(
&swarm_overview,
&["repoWorkReadinessTuiRows"],
"REPO-WORK-READINESS",
)?;
require_tui_row_contains(
&swarm_overview,
&["swarmActionTuiRows"],
"repo-work-readiness",
)?;
require_u64(&swarm_overview, &["repoWorkReadinessReviewCount"], 1)?;
require_eq(
&swarm_overview,
&["latestRepoWorkReadinessReview"],
"repo-work-readiness-review-repo-work-readiness",
)?;
require_tui_row_contains(
&swarm_overview,
&["repoWorkReadinessReviewTuiRows"],
"REPO-WORK-READINESS-REVIEW",
)?;
require_tui_row_contains(
&swarm_overview,
&["swarmActionTuiRows"],
"repo-work-readiness-review",
)?;
let receipt_directory = cargo_json(
&manifest,
"epiphany-verse-query",
&[
"receipt-directory",
"--store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
],
&root,
)?;
require_receipt_directory_row(
&receipt_directory,
"repo-work-readiness-review",
"repo-work-readiness-review-repo-work-readiness",
"readiness-approved",
"present",
)?;
require_tui_row_contains(
&receipt_directory,
&["tuiRows"],
"repo-work-readiness-review",
)?;
require_tui_row_contains(&receipt_directory, &["tuiRows"], "artifact=present")?;
require_bool(&receipt_directory, &["privateStateExposed"], false)?;
let bifrost_ledger = cargo_json(
&manifest,
"epiphany-verse-query",
&[
"bifrost-ledger",
"--store",
path_str(&local_verse)?,
"--runtime-id",
"repo-work-readiness-smoke",
],
&root,
)?;
require_bifrost_accounting_row(
&bifrost_ledger,
"repo-work-readiness-review",
"closed",
"repo-work-readiness-review-repo-work-readiness",
4,
1,
)?;
require_tui_row_contains(
&bifrost_ledger,
&["accountingTuiRows"],
"BIFROST-ACCOUNTING | repo-work-readiness-review",
)?;
require_tui_row_contains(&bifrost_ledger, &["accountingTuiRows"], "status=closed")?;
require_bool(&bifrost_ledger, &["privateStateExposed"], false)?;
let summary = json!({
"schemaVersion": "epiphany.repo_work_readiness_smoke.v0",
"status": "ok",
"smokeDir": smoke_dir,
"repo": repo,
"branch": git_output(["branch", "--show-current"], &repo)?,
"item": item,
"publicProofOutput": public_proof["outputPath"],
"publishStatus": publish["status"],
"syncStatus": sync["status"],
"upstreamMainSynced": sync["authority"]["upstreamMainSynced"],
"readinessStatus": readiness["status"],
"readinessReviewStatus": readiness_review["status"],
"readinessReviewReceiptPath": readiness_review["receiptPath"],
"readinessReviewVerseProjection": readiness_review["verseProjection"],
"missingRequiredCount": readiness["missingRequiredCount"],
"readinessVerseProjection": readiness["verseProjection"],
"swarmOverviewRepoWorkReadinessCount": swarm_overview["repoWorkReadinessCount"],
"swarmOverviewLatestRepoWorkReadiness": swarm_overview["latestRepoWorkReadiness"],
"swarmOverviewRepoWorkReadinessReviewCount": swarm_overview["repoWorkReadinessReviewCount"],
"swarmOverviewLatestRepoWorkReadinessReview": swarm_overview["latestRepoWorkReadinessReview"],
"receiptDirectoryRowCount": receipt_directory["rowCount"],
"receiptDirectoryReadinessReviewRow": receipt_directory_row_value(&receipt_directory, "repo-work-readiness-review")?,
"bifrostLedgerAccountingRowCount": bifrost_ledger["accountingRowCount"],
"bifrostReadinessReviewAccountingRow": bifrost_accounting_row_value(&bifrost_ledger, "repo-work-readiness-review")?,
"sightOnly": readiness["authority"]["sightOnly"],
"readinessApprovalAuthorized": readiness["authority"]["readinessApprovalAuthorized"],
"publicationAuthorized": readiness["authority"]["publicationAuthorized"],
"deploymentAuthority": readiness["authority"]["deploymentAuthority"],
"serviceLifecycleAuthority": readiness["authority"]["serviceLifecycleAuthority"],
"handsActionAuthorized": readiness["authority"]["handsActionAuthorized"],
"privateStateExposed": readiness["privateStateExposed"],
});
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 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_u64(value: &Value, path: &[&str], expected: u64) -> Result<()> {
let actual = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_u64)
.unwrap_or(u64::MAX);
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)
.unwrap_or(!expected);
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {expected:?}, got {actual:?}",
path.join(".")
))
}
}
fn require_row(value: &Value, kind: &str, expected_satisfied: bool) -> Result<()> {
let rows = value
.get("rows")
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("readiness output did not include rows"))?;
let row = rows
.iter()
.find(|row| row.get("kind").and_then(Value::as_str) == Some(kind))
.ok_or_else(|| anyhow!("missing readiness row {kind:?}"))?;
let actual = row
.get("satisfied")
.and_then(Value::as_bool)
.unwrap_or(!expected_satisfied);
if actual == expected_satisfied {
Ok(())
} else {
Err(anyhow!(
"expected readiness row {kind:?} satisfied={expected_satisfied}, got {actual}"
))
}
}
fn require_row_field_u64(value: &Value, kind: &str, field: &str, expected: u64) -> Result<()> {
let rows = value
.get("rows")
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("readiness output did not include rows"))?;
let row = rows
.iter()
.find(|row| row.get("kind").and_then(Value::as_str) == Some(kind))
.ok_or_else(|| anyhow!("missing readiness row {kind:?}"))?;
let actual = row.get(field).and_then(Value::as_u64).unwrap_or(u64::MAX);
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected readiness row {kind:?} field {field:?} to be {expected}, got {actual}"
))
}
}
fn require_row_field_bool(value: &Value, kind: &str, field: &str, expected: bool) -> Result<()> {
let rows = value
.get("rows")
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("readiness output did not include rows"))?;
let row = rows
.iter()
.find(|row| row.get("kind").and_then(Value::as_str) == Some(kind))
.ok_or_else(|| anyhow!("missing readiness row {kind:?}"))?;
let actual = row.get(field).and_then(Value::as_bool).unwrap_or(!expected);
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected readiness row {kind:?} field {field:?} to be {expected}, got {actual}"
))
}
}
fn require_tui_row_contains(value: &Value, path: &[&str], needle: &str) -> Result<()> {
let rows = path
.iter()
.try_fold(value, |current, key| current.get(*key))
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("{} did not contain TUI rows", path.join(".")))?;
if rows
.iter()
.filter_map(Value::as_str)
.any(|row| row.contains(needle))
{
Ok(())
} else {
Err(anyhow!(
"expected {} to contain row fragment {needle:?}",
path.join(".")
))
}
}
fn receipt_directory_row_value<'a>(value: &'a Value, family: &str) -> Result<&'a Value> {
value
.get("rows")
.and_then(Value::as_array)
.and_then(|rows| {
rows.iter()
.find(|row| row.get("family").and_then(Value::as_str) == Some(family))
})
.ok_or_else(|| anyhow!("missing receipt-directory row {family:?}"))
}
fn require_receipt_directory_row(
value: &Value,
family: &str,
latest_id: &str,
status: &str,
artifact_status: &str,
) -> Result<()> {
let row = receipt_directory_row_value(value, family)?;
let actual_latest_id = row
.get("latestId")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_status = row
.get("status")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_artifact_status = row
.get("artifactStatus")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_private = row
.get("privateStateExposed")
.and_then(Value::as_bool)
.unwrap_or(true);
let artifact_sha = row
.get("artifactSha256")
.and_then(Value::as_str)
.unwrap_or("none");
if actual_latest_id == latest_id
&& actual_status == status
&& actual_artifact_status == artifact_status
&& artifact_sha != "none"
&& !actual_private
{
Ok(())
} else {
Err(anyhow!(
"receipt-directory row {family:?} mismatch: latestId={actual_latest_id:?}, status={actual_status:?}, artifactStatus={actual_artifact_status:?}, artifactSha256={artifact_sha:?}, privateStateExposed={actual_private}"
))
}
}
fn bifrost_accounting_row_value<'a>(value: &'a Value, lane: &str) -> Result<&'a Value> {
value
.get("accountingRows")
.and_then(Value::as_array)
.and_then(|rows| {
rows.iter()
.find(|row| row.get("lane").and_then(Value::as_str) == Some(lane))
})
.ok_or_else(|| anyhow!("missing Bifrost accounting row {lane:?}"))
}
fn require_bifrost_accounting_row(
value: &Value,
lane: &str,
status: &str,
latest_receipt_id: &str,
review_receipt_count: u64,
public_artifact_count: u64,
) -> Result<()> {
let row = bifrost_accounting_row_value(value, lane)?;
let actual_status = row
.get("status")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_latest_receipt_id = row
.get("latestReceiptId")
.and_then(Value::as_str)
.unwrap_or("<missing>");
let actual_review_receipt_count = row
.get("reviewReceiptCount")
.and_then(Value::as_u64)
.unwrap_or(0);
let actual_public_artifact_count = row
.get("publicArtifactCount")
.and_then(Value::as_u64)
.unwrap_or(0);
let actual_private = row
.get("privateStateExposed")
.and_then(Value::as_bool)
.unwrap_or(true);
if actual_status == status
&& actual_latest_receipt_id == latest_receipt_id
&& actual_review_receipt_count == review_receipt_count
&& actual_public_artifact_count == public_artifact_count
&& !actual_private
{
Ok(())
} else {
Err(anyhow!(
"Bifrost accounting row {lane:?} mismatch: status={actual_status:?}, latestReceiptId={actual_latest_receipt_id:?}, reviewReceiptCount={actual_review_receipt_count}, publicArtifactCount={actual_public_artifact_count}, privateStateExposed={actual_private}"
))
}
}
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()))
}

View file

@ -126,8 +126,6 @@ const WRAPPER_BIFROST_METRICS_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mod
const WRAPPER_BIFROST_LEDGER_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode bifrost-ledger";
const WRAPPER_RECEIPT_DIRECTORY_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode receipt-directory";
const WRAPPER_REPO_WORK_READINESS_REVIEW_COMMAND: &str =
"tools/epiphany_local_run.ps1 -Mode repo-work-readiness-review";
const DIRECT_IDUNN_DEPLOYMENT_AFTERCARE_AUDIT_COMMAND: &str = "epiphany-work deployment-aftercare-audit --workspace <repo> --local-verse-store <store> --idunn-deployment-receipt-ref latest --aftercare-audit-receipt-ref latest";
const WRAPPER_SERVICE_TICK_COMMAND: &str = "tools/epiphany_local_run.ps1 -Mode service-tick";
const WRAPPER_SERVICE_POLICY_DIRECTORY_COMMAND: &str =
@ -3346,7 +3344,6 @@ fn run_cli() -> Result<()> {
&[],
&[],
&[],
&[],
);
if !missing_artifact_rows.iter().any(|row| {
row.priority == 50
@ -3398,7 +3395,6 @@ fn run_cli() -> Result<()> {
&[],
&[],
&[],
&[],
);
if !synthetic_artifact_rows.iter().any(|row| {
row.priority == 50
@ -4958,7 +4954,6 @@ fn swarm_action_rows(
repo_work_overviews: &[EpiphanyCultMeshRepoWorkOverviewEntry],
repo_work_public_proofs: &[EpiphanyCultMeshRepoWorkPublicProofEntry],
repo_work_readiness_reports: &[EpiphanyCultMeshRepoWorkReadinessEntry],
repo_work_readiness_reviews: &[EpiphanyCultMeshRepoWorkReadinessReviewEntry],
) -> (Vec<SwarmActionRow>, Vec<String>) {
let mut rows = Vec::new();
let mut service_execution_check_counts = BTreeMap::<String, (usize, usize)>::new();
@ -5215,12 +5210,6 @@ fn swarm_action_rows(
for (index, readiness) in repo_work_readiness_reports.iter().take(5).enumerate() {
rows.push(repo_work_readiness_action_row(readiness, 70 + index as u32));
}
for (index, review) in repo_work_readiness_reviews.iter().take(5).enumerate() {
rows.push(repo_work_readiness_review_action_row(
review,
75 + index as u32,
));
}
if rows.is_empty() {
rows.push(SwarmActionRow {
priority: 100,
@ -6315,60 +6304,6 @@ fn repo_work_readiness_action_row(
}
}
fn repo_work_readiness_review_action_row(
review: &EpiphanyCultMeshRepoWorkReadinessReviewEntry,
priority: u32,
) -> SwarmActionRow {
SwarmActionRow {
priority,
family: "repo-work-readiness-review".to_string(),
status: review.status.clone(),
lifecycle_owner: "none".to_string(),
hosted_body: "repo-work".to_string(),
action: format!(
"Read repo work readiness review {} for item {}; Bifrost/GitHub/Idunn/Hands still own publication, sync, deployment, service lifecycle, and branch consequences.",
review.review_id, review.item
),
wrapper_mode: "repo-work-readiness-review".to_string(),
wrapper_command: format!(
"epiphany-work readiness-review --workspace \"{}\" --item \"{}\" --readiness-receipt \"{}\" --maintainer-review-receipt <ref> --soul-review-receipt <ref> --mind-review-receipt <ref> --bifrost-review-receipt <ref>",
review.workspace, review.item, review.readiness_receipt_ref
),
operator_artifact_ref: review.readiness_review_receipt_ref.clone(),
operator_artifact_status: if review.readiness_review_receipt_ref == "none" {
"none".to_string()
} else {
"external-ref".to_string()
},
operator_artifact_sha256: "none".to_string(),
operator_artifact_execution_command: "none".to_string(),
operator_aftercare_command: "none".to_string(),
completion_audit_wrapper_mode: "none".to_string(),
completion_audit_wrapper_command: "none".to_string(),
authority_gate: "repo.work.readiness_review_readback".to_string(),
effect_class: "repo-work-readiness-review-readback".to_string(),
mutates_state: false,
requires_elevated_authority: false,
service_execution_failed_check_count: 0,
service_execution_missing_check_count: 0,
service_id: "none".to_string(),
service_route: "none".to_string(),
reason: format!(
"Readiness review status={} approval={}, durableState={}, publication={}, merge={}, sync={}, deployment={}, service={}, hands={}",
review.status,
review.readiness_approval_authorized,
review.durable_state_commit_authorized,
review.publication_authorized,
review.merge_authorized,
review.upstream_sync_authorized,
review.deployment_authority,
review.service_lifecycle_authority,
review.hands_action_authorized
),
private_state_exposed: review.private_state_exposed,
}
}
fn swarm_action_tui_row(row: &SwarmActionRow) -> String {
format!(
"{:03} | {} | {} | {} | {} | owner={} | hostedBody={} | service={} | route={} | command={} | mutates={} | elevated={} | failedChecks={} | missingChecks={} | artifact={} | sha256={} | exec={} | audit={} | aftercare={}",
@ -7156,7 +7091,6 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
&repo_work_overviews,
&repo_work_public_proofs,
&repo_work_readiness_reports,
&repo_work_readiness_reviews,
);
let private_state_exposed = daemon_report
.rows
@ -7915,7 +7849,7 @@ fn receipt_directory_report(
.unwrap_or_else(|| "none".to_string()),
service_id: "none".to_string(),
service_route: "none".to_string(),
follow_up_command: WRAPPER_REPO_WORK_READINESS_REVIEW_COMMAND.to_string(),
follow_up_command: WRAPPER_RECEIPT_DIRECTORY_COMMAND.to_string(),
artifact_ref: readiness_review_artifact_ref.clone(),
artifact_status: readiness_review_artifact_status.clone(),
artifact_sha256: operator_artifact_sha256(

View file

@ -8,14 +8,12 @@ use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_LATEST_KEY;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_MAP_ENTRY_SCHEMA_VERSION;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_OVERVIEW_SCHEMA_VERSION;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_PUBLIC_PROOF_SCHEMA_VERSION;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_READINESS_REVIEW_SCHEMA_VERSION;
use epiphany_core::EPIPHANY_CULTMESH_REPO_WORK_READINESS_SCHEMA_VERSION;
use epiphany_core::EPIPHANY_CULTMESH_WEKSA_LOWERING_RECEIPT_SCHEMA_VERSION;
use epiphany_core::EpiphanyCultMeshRepoWorkMapEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkOverviewEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkPublicProofEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkReadinessEntry;
use epiphany_core::EpiphanyCultMeshRepoWorkReadinessReviewEntry;
use epiphany_core::EpiphanyCultMeshWeksaLoweringReceiptEntry;
use epiphany_core::EpiphanyRepoWorkModelingLaunchDocument;
use epiphany_core::EpiphanyWorkerLaunchDocument;
@ -95,7 +93,6 @@ use epiphany_core::write_epiphany_cultmesh_repo_work_map_entry;
use epiphany_core::write_epiphany_cultmesh_repo_work_overview;
use epiphany_core::write_epiphany_cultmesh_repo_work_public_proof;
use epiphany_core::write_epiphany_cultmesh_repo_work_readiness;
use epiphany_core::write_epiphany_cultmesh_repo_work_readiness_review;
use epiphany_core::write_epiphany_cultmesh_weksa_lowering_receipt;
use epiphany_state_model::EpiphanyMemoryContextQuery;
use epiphany_state_model::EpiphanyMemoryProfile;
@ -138,9 +135,6 @@ fn main() -> Result<()> {
"readiness" | "readiness-report" | "mvp-readiness" => {
run_readiness(parse_readiness_args(args)?)
}
"readiness-review" | "review-readiness" | "mvp-readiness-review" => {
run_readiness_review(parse_readiness_review_args(args)?)
}
"deployment-config-audit" | "audit-deployment-config" | "idunn-deployment-audit" => {
run_deployment_config_audit(parse_deployment_config_audit_args(args)?)
}
@ -379,19 +373,6 @@ struct ReadinessArgs {
write_receipt: bool,
}
#[derive(Clone, Debug)]
struct ReadinessReviewArgs {
workspace: PathBuf,
item: Option<String>,
readiness_receipt: Option<PathBuf>,
artifact_dir: Option<PathBuf>,
maintainer_review_receipt: String,
soul_review_receipt: String,
mind_review_receipt: String,
bifrost_review_receipt: String,
review_summary: Option<String>,
}
#[derive(Clone, Debug)]
struct DeploymentConfigAuditArgs {
workspace: PathBuf,
@ -1271,61 +1252,6 @@ fn parse_readiness_args(args: impl Iterator<Item = String>) -> Result<ReadinessA
})
}
fn parse_readiness_review_args(args: impl Iterator<Item = String>) -> Result<ReadinessReviewArgs> {
let mut workspace = None;
let mut item = None;
let mut readiness_receipt = None;
let mut artifact_dir = None;
let mut maintainer_review_receipt = None;
let mut soul_review_receipt = None;
let mut mind_review_receipt = None;
let mut bifrost_review_receipt = None;
let mut review_summary = None;
let mut args = args.peekable();
while let Some(arg) = args.next() {
match arg.as_str() {
"--workspace" => workspace = Some(take_path(&mut args, "--workspace")?),
"--item" => item = Some(take_string(&mut args, "--item")?),
"--readiness-receipt" => {
readiness_receipt = Some(take_path(&mut args, "--readiness-receipt")?);
}
"--artifact-dir" => artifact_dir = Some(take_path(&mut args, "--artifact-dir")?),
"--maintainer-review-receipt" | "--maintainer-review" => {
maintainer_review_receipt =
Some(take_string(&mut args, "--maintainer-review-receipt")?);
}
"--soul-review-receipt" | "--soul-review" => {
soul_review_receipt = Some(take_string(&mut args, "--soul-review-receipt")?);
}
"--mind-review-receipt" | "--mind-review" => {
mind_review_receipt = Some(take_string(&mut args, "--mind-review-receipt")?);
}
"--bifrost-review-receipt" | "--bifrost-review" => {
bifrost_review_receipt = Some(take_string(&mut args, "--bifrost-review-receipt")?);
}
"--review-summary" | "--summary" => {
review_summary = Some(take_string(&mut args, "--review-summary")?);
}
other => return Err(anyhow!("unexpected readiness-review argument {other:?}")),
}
}
Ok(ReadinessReviewArgs {
workspace: workspace.context("missing --workspace")?,
item,
readiness_receipt,
artifact_dir,
maintainer_review_receipt: maintainer_review_receipt
.context("missing --maintainer-review-receipt")?,
soul_review_receipt: soul_review_receipt.context("missing --soul-review-receipt")?,
mind_review_receipt: mind_review_receipt.context("missing --mind-review-receipt")?,
bifrost_review_receipt: bifrost_review_receipt
.context("missing --bifrost-review-receipt")?,
review_summary,
})
}
fn parse_deployment_config_audit_args(
args: impl Iterator<Item = String>,
) -> Result<DeploymentConfigAuditArgs> {
@ -13174,244 +13100,6 @@ fn run_readiness(args: ReadinessArgs) -> Result<Value> {
}))
}
fn run_readiness_review(args: ReadinessReviewArgs) -> Result<Value> {
let workspace = args
.workspace
.canonicalize()
.with_context(|| format!("failed to resolve {}", args.workspace.display()))?;
ensure_git_repo(&workspace)?;
let artifact_dir = args
.artifact_dir
.unwrap_or_else(|| workspace.join(".epiphany").join("work"));
fs::create_dir_all(&artifact_dir)
.with_context(|| format!("failed to create {}", artifact_dir.display()))?;
let item = args.item.unwrap_or_else(|| "first-request".to_string());
let item_slug = sanitize(&item);
let readiness_receipt_path = args
.readiness_receipt
.unwrap_or_else(|| artifact_dir.join(format!("work-readiness-{item_slug}.json")));
let readiness_receipt = read_json(&readiness_receipt_path)?;
let readiness_item = string_from_json(&readiness_receipt, &["item"]).unwrap_or(item);
let readiness_item_slug = sanitize(&readiness_item);
let schema_ok = string_from_json(&readiness_receipt, &["schemaVersion"]).as_deref()
== Some("epiphany.repo_work_readiness_report.v0");
let status_ready =
string_from_json(&readiness_receipt, &["status"]).as_deref() == Some("ready");
let missing_required_count = readiness_receipt
.get("missingRequiredCount")
.and_then(Value::as_u64)
.unwrap_or(u64::MAX);
let rows = readiness_receipt
.get("rows")
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("readiness receipt has no rows"))?;
let row_count = rows.len();
let unsatisfied_kinds: Vec<String> = rows
.iter()
.filter(|row| row.get("satisfied").and_then(Value::as_bool) != Some(true))
.filter_map(|row| row.get("kind").and_then(Value::as_str).map(str::to_string))
.collect();
let authority = readiness_receipt
.get("authority")
.ok_or_else(|| anyhow!("readiness receipt has no authority"))?;
let sight_only = authority
.get("sightOnly")
.and_then(Value::as_bool)
.unwrap_or(false);
let readiness_did_not_approve = authority
.get("readinessApprovalAuthorized")
.and_then(Value::as_bool)
== Some(false);
let dangerous_authority_denied = [
"durableStateCommitAuthorized",
"publicationAuthorized",
"bifrostPublicationAuthorized",
"githubPrAuthorized",
"mergeAuthorized",
"upstreamSyncAuthorized",
"deploymentAuthority",
"serviceLifecycleAuthority",
"handsActionAuthorized",
"crossBodyMutationAuthorized",
"privateVerseRummaging",
"privateStateExposed",
]
.iter()
.all(|key| authority.get(*key).and_then(Value::as_bool) == Some(false));
let private_sealed = readiness_receipt
.get("privateStateExposed")
.and_then(Value::as_bool)
== Some(false);
let review_refs = vec![
args.maintainer_review_receipt.clone(),
args.soul_review_receipt.clone(),
args.mind_review_receipt.clone(),
args.bifrost_review_receipt.clone(),
];
let review_refs_present = review_refs.iter().all(|receipt| !receipt.trim().is_empty());
let approved = schema_ok
&& status_ready
&& missing_required_count == 0
&& row_count > 0
&& unsatisfied_kinds.is_empty()
&& sight_only
&& readiness_did_not_approve
&& dangerous_authority_denied
&& private_sealed
&& review_refs_present;
if !approved {
return Err(anyhow!(
"readiness review refused: schemaOk={schema_ok}, statusReady={status_ready}, missingRequiredCount={missing_required_count}, rowCount={row_count}, unsatisfiedKinds={:?}, sightOnly={sight_only}, readinessDidNotApprove={readiness_did_not_approve}, dangerousAuthorityDenied={dangerous_authority_denied}, privateSealed={private_sealed}, reviewRefsPresent={review_refs_present}",
unsatisfied_kinds
));
}
let now = Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
let review_id = format!("repo-work-readiness-review-{readiness_item_slug}");
let receipt_path =
artifact_dir.join(format!("work-readiness-review-{readiness_item_slug}.json"));
let review_summary = args.review_summary.unwrap_or_else(|| {
"Maintainer/Soul/Mind/Bifrost reviewed a ready repo-work readiness sight receipt."
.to_string()
});
let readiness_receipt_ref = readiness_receipt_path.display().to_string();
let review_receipt_ref = receipt_path.display().to_string();
let review_tui_rows = vec![
format!(
"REPO-WORK-READINESS-REVIEW | item={} | status=readiness-approved | missing={} | satisfied={} | readiness={} | review={} | approvalAuth=true | publicationAuth=false | serviceAuth=false | handsAuth=false | private=false",
readiness_item,
missing_required_count,
row_count,
readiness_receipt_ref,
review_receipt_ref
),
format!(
"REPO-WORK-READINESS-REVIEW-REFS | item={} | maintainer={} | soul={} | mind={} | bifrost={} | private=false",
readiness_item,
args.maintainer_review_receipt,
args.soul_review_receipt,
args.mind_review_receipt,
args.bifrost_review_receipt
),
];
let mut verse_projection = Value::Null;
let accept_receipt_path = work_receipt_path(&workspace, "accept", &readiness_item);
if let Some(accept_receipt) = read_json_if_exists(&accept_receipt_path)? {
if let Some(store) = path_from_json(&accept_receipt, &["localVerseStore"])
.or_else(|| path_from_json(&accept_receipt, &["localVerseStorePath"]))
{
let runtime_id = string_from_json(&accept_receipt, &["runtimeId"])
.unwrap_or_else(|| "repo-swarm-local".to_string());
let entry = EpiphanyCultMeshRepoWorkReadinessReviewEntry {
schema_version: EPIPHANY_CULTMESH_REPO_WORK_READINESS_REVIEW_SCHEMA_VERSION
.to_string(),
runtime_id: runtime_id.clone(),
verse_id: EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID.to_string(),
review_id: review_id.clone(),
generated_at: now.clone(),
workspace: workspace.display().to_string(),
item: readiness_item.clone(),
status: "readiness-approved".to_string(),
readiness_receipt_ref: readiness_receipt_ref.clone(),
readiness_review_receipt_ref: review_receipt_ref.clone(),
missing_required_count: missing_required_count as u32,
satisfied_row_count: row_count as u32,
maintainer_review_receipt: args.maintainer_review_receipt.clone(),
soul_review_receipt: args.soul_review_receipt.clone(),
mind_review_receipt: args.mind_review_receipt.clone(),
bifrost_review_receipt: args.bifrost_review_receipt.clone(),
readiness_approval_authorized: true,
durable_state_commit_authorized: false,
publication_authorized: false,
merge_authorized: false,
upstream_sync_authorized: false,
deployment_authority: false,
service_lifecycle_authority: false,
hands_action_authorized: false,
private_state_exposed: false,
tui_rows: review_tui_rows.clone(),
notes: vec![
"Readiness review approval is review evidence only; it does not publish, merge, deploy, sync upstream, mutate services, or grant Hands authority.".to_string(),
"Maintainer, Soul, Mind, and Bifrost receipts remain the approval authorities; The provider sight projection only publishes this compact row.".to_string(),
],
};
let written = write_epiphany_cultmesh_repo_work_readiness_review(&store, entry)?;
verse_projection = json!({
"localVerseStore": store,
"runtimeId": runtime_id,
"documentType": "epiphany.cultmesh.repo_work_readiness_review",
"reviewId": written.review_id,
"latestKey": "gamecult-local/repo-work-readiness-review/latest",
"tuiRows": written.tui_rows,
"privateStateExposed": written.private_state_exposed
});
}
}
let receipt = json!({
"schemaVersion": "epiphany.repo_work_readiness_review_receipt.v0",
"createdAt": now,
"workspace": workspace,
"item": readiness_item,
"reviewId": review_id,
"status": "readiness-approved",
"readinessReceiptPath": readiness_receipt_path,
"readinessStatus": "ready",
"missingRequiredCount": missing_required_count,
"satisfiedRowCount": row_count,
"unsatisfiedKinds": unsatisfied_kinds,
"reviewSummary": review_summary,
"reviewReceipts": {
"maintainer": args.maintainer_review_receipt,
"soul": args.soul_review_receipt,
"mind": args.mind_review_receipt,
"bifrost": args.bifrost_review_receipt
},
"adoption": {
"readinessAdopted": true,
"adoptedBy": "Maintainer/Soul/Mind/Bifrost",
"mindReadinessAdoption": true,
"durableStateCommit": false
},
"authority": {
"owner": "Maintainer/Soul/Mind/Bifrost",
"readinessApprovalAuthorized": true,
"readinessApproved": true,
"durableStateCommitAuthorized": false,
"publicationAuthorized": false,
"bifrostPublicationAuthorized": false,
"githubPrAuthorized": false,
"mergeAuthorized": false,
"upstreamSyncAuthorized": false,
"deploymentAuthority": false,
"serviceLifecycleAuthority": false,
"handsActionAuthorized": false,
"crossBodyMutationAuthorized": false,
"privateVerseRummaging": false,
"privateStateExposed": false
},
"tuiRows": review_tui_rows,
"verseProjection": verse_projection,
"privateStateExposed": false,
"nextSafeMove": "Use this readiness approval as review evidence for operator release decisions; do not treat it as publication, deployment, service lifecycle, Hands, merge, or cross-body authority."
});
write_json(&receipt_path, &receipt)?;
Ok(json!({
"schemaVersion": "epiphany.repo_work_readiness_review.v0",
"status": receipt["status"],
"workspace": receipt["workspace"],
"item": receipt["item"],
"reviewId": receipt["reviewId"],
"receiptPath": receipt_path,
"readinessReceiptPath": receipt["readinessReceiptPath"],
"missingRequiredCount": receipt["missingRequiredCount"],
"satisfiedRowCount": receipt["satisfiedRowCount"],
"verseProjection": receipt["verseProjection"],
"authority": receipt["authority"],
"privateStateExposed": false,
"nextSafeMove": receipt["nextSafeMove"]
}))
}
fn run_deployment_config_audit(args: DeploymentConfigAuditArgs) -> Result<Value> {
let workspace = args
.workspace
@ -17754,7 +17442,7 @@ fn sanitize(value: &str) -> String {
fn print_usage() {
eprintln!(
"usage: epiphany-work <persona-intake|accept|derive-plan|plan|run|adopt|execute|close|publish|sync|overview|readiness|readiness-review|deployment-config-audit|deployment-execution-runbook|deployment-aftercare-audit|export-proof|tick|queue-run|serve> ...\n\
"usage: epiphany-work <persona-intake|accept|derive-plan|plan|run|adopt|execute|close|publish|sync|overview|readiness|deployment-config-audit|deployment-execution-runbook|deployment-aftercare-audit|export-proof|tick|queue-run|serve> ...\n\
persona-intake --workspace <repo> --item <id> --message <text> [--topic <topic>] [--store <local-verse.ccmp>] [--runtime-id <id>]\n\
accept --workspace <repo> --from <persona|bifrost|persona-or-bifrost> --item <id> [--summary <text>] [--topic <topic>] [--store <local-verse.ccmp>] [--runtime-id <id>] [--online-receipt <path>] [--public-discussion-ref <ref>] [--candidate-action-ref <ref>]\n\
derive-plan --workspace <repo> [--item <id>] [--accept-receipt <path>] [--action-family append-worklog|planning-note|checklist-note|section-note|repo-status-section|task-card|repo-manifest|repo-tool-capabilities|repo-tool-request|repo-eve-surface|repo-collaboration-policy|repo-collaboration-topic|repo-consensus-brief|repo-planning-brief|repo-interpreter-brief|repo-objective-draft|repo-adoption-request|repo-scheduling-request|repo-work-order|repo-verification-request|repo-publication-request|repo-sync-request|repo-maintainer-review-request|repo-pr-request|repo-credit-request|repo-artifact-acceptance-request|repo-metrics-request|repo-readiness-review-request|repo-doctrine-update-request|repo-secret-policy-request|repo-dependency-policy-request|repo-deployment-config|repo-deployment-request] [--target-path <path>] [--model-ref <ref>] [--model-authored] [--action-summary <text>] [--verification-ask <text>] [--stop-condition <text>] [--escalation-reason <text>] [--assumption <text>] [--constraint <text>] [--non-goal <text>] [--open-question <text>] [--decision-point <text>] [--evidence-need <text>]\n\
@ -17767,7 +17455,6 @@ fn print_usage() {
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\
readiness --workspace <repo> [--item <id>] [--accept-receipt <path>] [--public-proof <path>] [--idunn-lifecycle-receipt <path>] [--deployment-aftercare-audit-receipt <path>|--deployment-aftercare-audit-receipt-ref <ref>] [--tool-directory-receipt <path>] [--no-write]\n\
readiness-review --workspace <repo> [--item <id>] [--readiness-receipt <path>] --maintainer-review-receipt <ref> --soul-review-receipt <ref> --mind-review-receipt <ref> --bifrost-review-receipt <ref> [--review-summary <text>]\n\
deployment-config-audit --workspace <repo> [--artifact-dir <path>] [--no-write]\n\
deployment-execution-runbook --workspace <repo> [--artifact-dir <path>] [--remote origin] [--no-write]\n\
deployment-aftercare-audit --workspace <repo> [--artifact-dir <path>] [--local-verse-store <path>] [--runtime-id <id>] [--runbook-receipt <path>] [--idunn-deployment-receipt-ref <ref>|--idunn-deployment-receipt <path>] [--aftercare-audit-receipt-ref <ref>|--aftercare-audit-receipt <path>] [--no-write]\n\

View file

@ -5254,21 +5254,6 @@ pub fn load_epiphany_cultmesh_repo_work_readiness_reports(
Ok(reports)
}
pub fn write_epiphany_cultmesh_repo_work_readiness_review(
store_path: impl AsRef<Path>,
review: EpiphanyCultMeshRepoWorkReadinessReviewEntry,
) -> Result<EpiphanyCultMeshRepoWorkReadinessReviewEntry> {
validate_repo_work_readiness_review(&review)?;
let mut node = open_epiphany_cultmesh_node(&store_path, review.runtime_id.clone())?;
let written = node.put(review.review_id.clone(), &review)?;
node.put(
EPIPHANY_CULTMESH_REPO_WORK_READINESS_REVIEW_LATEST_KEY,
&written,
)?;
node.flush()?;
Ok(written)
}
pub fn load_latest_epiphany_cultmesh_repo_work_readiness_review(
store_path: impl AsRef<Path>,
runtime_id: impl Into<String>,
@ -5456,60 +5441,6 @@ fn validate_repo_work_readiness(readiness: &EpiphanyCultMeshRepoWorkReadinessEnt
Ok(())
}
fn validate_repo_work_readiness_review(
review: &EpiphanyCultMeshRepoWorkReadinessReviewEntry,
) -> Result<()> {
if review.private_state_exposed {
return Err(anyhow!(
"repo work readiness review must not expose private state"
));
}
if review.schema_version != EPIPHANY_CULTMESH_REPO_WORK_READINESS_REVIEW_SCHEMA_VERSION {
return Err(anyhow!(
"repo work readiness review schema_version must be {:?}",
EPIPHANY_CULTMESH_REPO_WORK_READINESS_REVIEW_SCHEMA_VERSION
));
}
if review.verse_id != EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID {
return Err(anyhow!(
"repo work readiness review belongs in local-area Verse {:?}",
EPIPHANY_CULTMESH_LOCAL_AREA_VERSE_ID
));
}
if review.review_id.trim().is_empty() || review.item.trim().is_empty() {
return Err(anyhow!(
"repo work readiness review requires review_id and item"
));
}
if !review.readiness_approval_authorized
|| review.durable_state_commit_authorized
|| review.publication_authorized
|| review.merge_authorized
|| review.upstream_sync_authorized
|| review.deployment_authority
|| review.service_lifecycle_authority
|| review.hands_action_authorized
{
return Err(anyhow!(
"repo work readiness review may grant readiness approval only; it must deny durable-state, publication, merge, sync, deployment, service, and Hands authority"
));
}
if review.tui_rows.is_empty() {
return Err(anyhow!(
"repo work readiness review requires compact TUI rows"
));
}
if review.tui_rows.iter().any(|row| {
let lower = row.to_ascii_lowercase();
lower.contains("rawresult") || lower.contains("receipt body") || lower.contains("thought")
}) {
return Err(anyhow!(
"repo work readiness review rows must not expose raw worker payload names"
));
}
Ok(())
}
fn validate_repo_work_map_entry(entry: &EpiphanyCultMeshRepoWorkMapEntry) -> Result<()> {
if entry.private_state_exposed {
return Err(anyhow!("repo work map entry must not expose private state"));

View file

@ -512,7 +512,6 @@ pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_map_entry;
pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_overview;
pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_public_proof;
pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_readiness;
pub use cultmesh_integration::write_epiphany_cultmesh_repo_work_readiness_review;
pub use cultmesh_integration::write_epiphany_cultmesh_role_review_event;
pub use cultmesh_integration::write_epiphany_cultmesh_soul_contracts;
pub use cultmesh_integration::write_epiphany_cultmesh_status;