Delete caller-transcribed PR proof

This commit is contained in:
Meta Vens 2026-07-12 23:18:13 +01:00
commit f0e0a1cb7b
9 changed files with 17 additions and 210 deletions

View file

@ -6,20 +6,17 @@ use epiphany_core::hands_action_review_for_intent;
use epiphany_core::hands_command_receipt_for_review;
use epiphany_core::hands_commit_receipt_for_review;
use epiphany_core::hands_patch_receipt_for_review;
use epiphany_core::hands_pr_receipt_for_review;
use epiphany_core::initialize_runtime_spine;
use epiphany_core::put_hands_action_intent;
use epiphany_core::put_hands_action_review;
use epiphany_core::put_hands_command_receipt;
use epiphany_core::put_hands_commit_receipt;
use epiphany_core::put_hands_patch_receipt;
use epiphany_core::put_hands_pr_receipt;
use epiphany_core::runtime_hands_action_intent;
use epiphany_core::runtime_hands_action_review;
use epiphany_core::runtime_hands_command_receipt;
use epiphany_core::runtime_hands_commit_receipt;
use epiphany_core::runtime_hands_patch_receipt;
use epiphany_core::runtime_hands_pr_receipt;
use serde_json::json;
use std::path::PathBuf;
@ -105,20 +102,6 @@ fn main() -> Result<()> {
);
put_hands_commit_receipt(&store, &commit)?;
let pr = hands_pr_receipt_for_review(
"hands-pr-smoke".to_string(),
&intent,
&review,
&commit,
"https://github.com/GameCult/EpiphanyAgent/pull/smoke".to_string(),
"smoke".to_string(),
"Smoke Hands PR publication receipt".to_string(),
"bifrost-publication-receipt-smoke".to_string(),
"Recorded a typed PR receipt shape for Bifrost-blessed GitHub publication.".to_string(),
"2026-06-02T00:01:00Z".to_string(),
);
put_hands_pr_receipt(&store, &pr)?;
let stored_intent =
runtime_hands_action_intent(&store, "hands-intent-smoke")?.expect("stored Hands intent");
let stored_review =
@ -129,7 +112,6 @@ fn main() -> Result<()> {
.expect("stored Hands command");
let stored_commit =
runtime_hands_commit_receipt(&store, "hands-commit-smoke")?.expect("stored Hands commit");
let stored_pr = runtime_hands_pr_receipt(&store, "hands-pr-smoke")?.expect("stored Hands PR");
if stored_review.intent_id != stored_intent.intent_id {
anyhow::bail!("Hands review lost its intent edge");
@ -149,13 +131,6 @@ fn main() -> Result<()> {
{
anyhow::bail!("Hands commit receipt lost its intent/review edge");
}
if stored_pr.intent_id != stored_intent.intent_id
|| stored_pr.review_id != stored_review.review_id
|| stored_pr.commit_receipt_id != stored_commit.receipt_id
{
anyhow::bail!("Hands PR receipt lost its intent/review/commit edge");
}
println!(
"{}",
serde_json::to_string_pretty(&json!({
@ -166,8 +141,6 @@ fn main() -> Result<()> {
"patchReceiptId": stored_patch.receipt_id,
"commandReceiptId": stored_command.receipt_id,
"commitReceiptId": stored_commit.receipt_id,
"prReceiptId": stored_pr.receipt_id,
"bifrostPublicationReceiptId": stored_pr.bifrost_publication_receipt_id,
"changedPaths": stored_patch.changed_paths,
}))?
);

View file

@ -7,14 +7,11 @@ use epiphany_core::HandsActionReview;
use epiphany_core::hands_command_receipt_for_review;
use epiphany_core::hands_commit_receipt_for_review;
use epiphany_core::hands_patch_receipt_for_review;
use epiphany_core::hands_pr_receipt_for_review;
use epiphany_core::put_hands_command_receipt;
use epiphany_core::put_hands_commit_receipt;
use epiphany_core::put_hands_patch_receipt;
use epiphany_core::put_hands_pr_receipt;
use epiphany_core::runtime_hands_action_intent;
use epiphany_core::runtime_hands_action_review;
use epiphany_core::runtime_hands_commit_receipt;
use serde_json::json;
use std::env;
use std::fs;
@ -28,7 +25,6 @@ fn main() -> Result<()> {
Command::RecordPatch(command) => record_patch(&args.store, command)?,
Command::RecordCommand(command) => record_command(&args.store, command)?,
Command::RecordCommit(command) => record_commit(&args.store, command)?,
Command::RecordPr(command) => record_pr(&args.store, command)?,
Command::RecordPass(command) => record_pass(&args.store, command)?,
};
println!("{}", serde_json::to_string_pretty(&output)?);
@ -46,7 +42,6 @@ enum Command {
RecordPatch(RecordPatchArgs),
RecordCommand(RecordCommandArgs),
RecordCommit(RecordCommitArgs),
RecordPr(RecordPrArgs),
RecordPass(RecordPassArgs),
}
@ -83,16 +78,6 @@ struct RecordCommitArgs {
validate_commit_sha: bool,
}
#[derive(Debug)]
struct RecordPrArgs {
gate: GateArgs,
commit_receipt_id: String,
pull_request_url: String,
pull_request_number: String,
pull_request_title: String,
bifrost_publication_receipt_id: String,
}
#[derive(Debug)]
struct RecordPassArgs {
gate: GateArgs,
@ -119,7 +104,6 @@ impl Args {
"record-patch" => Command::RecordPatch(parse_record_patch(tokens)?),
"record-command" => Command::RecordCommand(parse_record_command(tokens)?),
"record-commit" => Command::RecordCommit(parse_record_commit(tokens)?),
"record-pr" => Command::RecordPr(parse_record_pr(tokens)?),
"record-pass" => Command::RecordPass(parse_record_pass(tokens)?),
_ => return Err(anyhow!("unknown command {command_name}\n{}", usage())),
};
@ -179,26 +163,6 @@ fn parse_record_commit(tokens: impl Iterator<Item = String>) -> Result<RecordCom
})
}
fn parse_record_pr(tokens: impl Iterator<Item = String>) -> Result<RecordPrArgs> {
let mut options = ParsedOptions::parse(tokens)?;
let gate = options.take_gate()?;
let commit_receipt_id = options.take_required("--commit-receipt-id")?;
let pull_request_url = options.take_required("--pull-request-url")?;
let pull_request_number = options.take_required("--pull-request-number")?;
let pull_request_title = options.take_required("--pull-request-title")?;
let bifrost_publication_receipt_id =
options.take_required("--bifrost-publication-receipt-id")?;
options.finish()?;
Ok(RecordPrArgs {
gate,
commit_receipt_id,
pull_request_url,
pull_request_number,
pull_request_title,
bifrost_publication_receipt_id,
})
}
fn parse_record_pass(tokens: impl Iterator<Item = String>) -> Result<RecordPassArgs> {
let mut options = ParsedOptions::parse(tokens)?;
let gate = options.take_gate()?;
@ -398,60 +362,6 @@ fn record_commit(store: &PathBuf, args: RecordCommitArgs) -> Result<serde_json::
}))
}
fn record_pr(store: &PathBuf, args: RecordPrArgs) -> Result<serde_json::Value> {
let (intent, review) = load_gate(store, &args.gate, "pr")?;
let commit_receipt =
runtime_hands_commit_receipt(store, &args.commit_receipt_id)?.ok_or_else(|| {
anyhow!(
"Hands commit receipt {} was not found",
args.commit_receipt_id
)
})?;
if commit_receipt.intent_id != intent.intent_id || commit_receipt.review_id != review.review_id
{
return Err(anyhow!(
"Hands commit receipt {} belongs to intent {}/review {}, not {}/{}",
commit_receipt.receipt_id,
commit_receipt.intent_id,
commit_receipt.review_id,
intent.intent_id,
review.review_id
));
}
let receipt_id = args
.gate
.receipt_id
.unwrap_or_else(|| generated_receipt_id("hands-pr"));
let receipt = hands_pr_receipt_for_review(
receipt_id,
&intent,
&review,
&commit_receipt,
args.pull_request_url,
args.pull_request_number,
args.pull_request_title,
args.bifrost_publication_receipt_id,
args.gate.summary,
now(),
);
put_hands_pr_receipt(store, &receipt)?;
Ok(json!({
"status": "ok",
"type": "epiphany.hands.pr_receipt",
"receiptId": receipt.receipt_id,
"intentId": receipt.intent_id,
"reviewId": receipt.review_id,
"commitReceiptId": receipt.commit_receipt_id,
"commitSha": receipt.commit_sha,
"branch": receipt.branch,
"pullRequestUrl": receipt.pull_request_url,
"pullRequestNumber": receipt.pull_request_number,
"bifrostPublicationReceiptId": receipt.bifrost_publication_receipt_id,
"changedPaths": receipt.changed_paths,
"store": store,
}))
}
fn record_pass(store: &PathBuf, args: RecordPassArgs) -> Result<serde_json::Value> {
let patch = record_patch(
store,
@ -660,7 +570,7 @@ fn take_value(tokens: &mut impl Iterator<Item = String>, name: &str) -> Result<S
}
fn usage() -> &'static str {
"usage: epiphany-hands-action [--store path] <record-patch|record-command|record-commit|record-pr|record-pass> (--gate-summary path | --intent-id id --review-id id) --summary text ..."
"usage: epiphany-hands-action [--store path] <record-patch|record-command|record-commit|record-pass> (--gate-summary path | --intent-id id --review-id id) --summary text ..."
}
#[cfg(test)]
@ -675,7 +585,6 @@ mod tests {
use epiphany_core::runtime_hands_command_receipt;
use epiphany_core::runtime_hands_commit_receipt;
use epiphany_core::runtime_hands_patch_receipt;
use epiphany_core::runtime_hands_pr_receipt;
use epiphany_core::runtime_latest_hands_receipt_chain_after;
#[test]
@ -815,96 +724,6 @@ mod tests {
Ok(())
}
#[test]
fn records_pr_receipt_against_commit_and_bifrost_publication() -> Result<()> {
let temp = tempfile::tempdir()?;
let store = temp.path().join("runtime-spine.msgpack");
seed_gate(&store, vec!["src".to_string()])?;
record_commit(
&store,
RecordCommitArgs {
gate: gate_args("hands-commit-test"),
commit_sha: "abc123".to_string(),
branch: "codex/test".to_string(),
changed_paths: vec!["src/lib.rs".to_string()],
validate_commit_sha: false,
},
)?;
let result = record_pr(
&store,
RecordPrArgs {
gate: gate_args("hands-pr-test"),
commit_receipt_id: "hands-commit-test".to_string(),
pull_request_url: "https://github.com/GameCult/EpiphanyAgent/pull/1".to_string(),
pull_request_number: "1".to_string(),
pull_request_title: "Route Bifrost publication proof".to_string(),
bifrost_publication_receipt_id: "bifrost-publication-receipt-test".to_string(),
},
)?;
assert_eq!(
result
.pointer("/bifrostPublicationReceiptId")
.and_then(serde_json::Value::as_str),
Some("bifrost-publication-receipt-test")
);
let receipt =
runtime_hands_pr_receipt(&store, "hands-pr-test")?.expect("stored Hands PR receipt");
assert_eq!(receipt.commit_receipt_id, "hands-commit-test");
assert_eq!(receipt.commit_sha, "abc123");
assert_eq!(
receipt.pull_request_url,
"https://github.com/GameCult/EpiphanyAgent/pull/1"
);
assert_eq!(
receipt.bifrost_publication_receipt_id,
"bifrost-publication-receipt-test"
);
Ok(())
}
#[test]
fn refuses_pr_receipt_when_review_does_not_allow_publication() -> Result<()> {
let temp = tempfile::tempdir()?;
let store = temp.path().join("runtime-spine.msgpack");
seed_gate_with_operations(
&store,
vec!["src".to_string()],
vec![
"patch".to_string(),
"command".to_string(),
"commit".to_string(),
],
)?;
record_commit(
&store,
RecordCommitArgs {
gate: gate_args("hands-commit-test"),
commit_sha: "abc123".to_string(),
branch: "codex/test".to_string(),
changed_paths: vec!["src/lib.rs".to_string()],
validate_commit_sha: false,
},
)?;
let result = record_pr(
&store,
RecordPrArgs {
gate: gate_args("hands-pr-test"),
commit_receipt_id: "hands-commit-test".to_string(),
pull_request_url: "https://github.com/GameCult/EpiphanyAgent/pull/1".to_string(),
pull_request_number: "1".to_string(),
pull_request_title: "Route Bifrost publication proof".to_string(),
bifrost_publication_receipt_id: "bifrost-publication-receipt-test".to_string(),
},
);
assert!(result.is_err());
assert!(runtime_hands_pr_receipt(&store, "hands-pr-test")?.is_none());
Ok(())
}
#[test]
fn refuses_patch_receipt_outside_requested_paths() -> Result<()> {
let temp = tempfile::tempdir()?;

View file

@ -400,6 +400,7 @@ pub fn hands_commit_receipt_for_review(
}
}
#[cfg(test)]
#[allow(clippy::too_many_arguments)]
pub fn hands_pr_receipt_for_review(
receipt_id: String,

View file

@ -805,6 +805,7 @@ pub use runtime_spine::put_hands_action_review;
pub use runtime_spine::put_hands_command_receipt;
pub use runtime_spine::put_hands_commit_receipt;
pub use runtime_spine::put_hands_patch_receipt;
#[cfg(test)]
pub use runtime_spine::put_hands_pr_receipt;
pub use runtime_spine::put_mind_gateway_review;
pub use runtime_spine::put_mind_state_commit_receipt;

View file

@ -1573,6 +1573,7 @@ pub fn runtime_hands_commit_receipt(
cache.get::<HandsCommitReceipt>(receipt_id)
}
#[cfg(test)]
pub fn put_hands_pr_receipt(store_path: impl AsRef<Path>, receipt: &HandsPrReceipt) -> Result<()> {
validate_non_empty(&receipt.receipt_id, "Hands PR receipt id")?;
validate_non_empty(&receipt.intent_id, "Hands PR intent")?;