Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
49341dd
test: reject unqualified complete-execution producer generations
EffortlessSteven Oct 9, 2026
1faf163
feat: add an inactive owned complete-execution resource experiment
EffortlessSteven Oct 9, 2026
5874ca7
fix: bind experimental completion to bounded exact artifacts
EffortlessSteven Oct 9, 2026
d71ebe7
fix: reject subject-only experimental producer markers
EffortlessSteven Oct 9, 2026
41d8d85
fix: preflight experimental files and require the pinned worker
EffortlessSteven Oct 9, 2026
9a4d10c
style: apply the pinned complete-execution formatter diagnostics
EffortlessSteven Oct 9, 2026
c02f105
test(pr-evidence): retain exact failure evidence in experiment controls
EffortlessSteven Oct 9, 2026
e866eb2
style: format experimental saved-check refusal oracles
EffortlessSteven Oct 9, 2026
ccc192d
fix: preserve experimental resource parse refusal cause
EffortlessSteven Oct 9, 2026
247e7e9
fix: preserve inherited resource ceiling parse refusal cause
EffortlessSteven Oct 9, 2026
2ee7a93
style: apply inherited ceiling diagnostic formatter output
EffortlessSteven Oct 9, 2026
addde62
test: expose experimental evidence consumer admission gaps
EffortlessSteven Oct 9, 2026
a61cc4b
fix: keep inactive experiment artifacts inadmissible across consumers
EffortlessSteven Oct 9, 2026
e65e188
test: verify ordinary mutation routing survives experimental refusal
EffortlessSteven Oct 9, 2026
8359405
fix: preserve build context and exhaust experimental cleanup attempts
EffortlessSteven Oct 9, 2026
416b544
fix: use shared authority for experimental review fallback
EffortlessSteven Oct 9, 2026
9247173
fix: refuse malformed Cargo artifact metadata before selection
EffortlessSteven Oct 9, 2026
e82d6f0
Merge accepted lifecycle prerequisite into inactive producer source
EffortlessSteven Oct 9, 2026
0158009
style: apply complete required formatter output for inactive executio…
EffortlessSteven Oct 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 75 additions & 5 deletions crates/ripr/src/app/pr_evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
//! resulting [`crate::CheckOutput`] as JSON via [`crate::app::render_check_json_unbounded`].
//! This avoids recompilation and keeps the analysis in-process.

mod complete_execution;

use crate::app::{CheckInput, Mode, OutputFormat, check_workspace_with_config};
use crate::cli::unknown_argument;
use crate::config::{
Expand Down Expand Up @@ -78,6 +80,12 @@ impl Default for PrEvidenceOptions {
/// When the check fails, an `error` packet is still written so downstream
/// consumers see a contract-valid, actionable artifact rather than a gap.
pub(crate) fn run_pr_evidence(args: &[String]) -> Result<(), String> {
if args
.first()
.is_some_and(|arg| arg == complete_execution::WORKER_FLAG)
{
return complete_execution::run_worker(&args[1..]);
}
if args.iter().any(|arg| arg == "--help" || arg == "-h") {
print_help();
return Ok(());
Expand Down Expand Up @@ -178,6 +186,15 @@ fn write_pr_evidence_with_runner(
repo: &Path,
options: &PrEvidenceOptions,
run_check: impl FnOnce(&Path, &PrEvidenceOptions) -> Result<String, String>,
) -> Result<(), String> {
write_pr_evidence_with_generation(repo, options, run_check, None)
}

fn write_pr_evidence_with_generation(
repo: &Path,
options: &PrEvidenceOptions,
run_check: impl FnOnce(&Path, &PrEvidenceOptions) -> Result<String, String>,
generation: Option<&Value>,
) -> Result<(), String> {
remove_stale_check_artifact(repo)?;
verify_revision(repo, &options.base)?;
Expand All @@ -186,7 +203,13 @@ fn write_pr_evidence_with_runner(
write_diff(repo, options)?;
match run_check(repo, options) {
Ok(check_json) => {
match write_pr_evidence_packet(repo, options, &changed_files, &check_json) {
match write_pr_evidence_packet_with_generation(
repo,
options,
&changed_files,
&check_json,
generation,
) {
Ok(()) => Ok(()),
Err(err) => write_pr_evidence_error_packet(
repo,
Expand Down Expand Up @@ -215,18 +238,32 @@ fn write_pr_evidence_from_check_json(
write_pr_evidence_packet(repo, options, &changed_files, check_json)
}

#[cfg(test)]
fn write_pr_evidence_packet(
repo: &Path,
options: &PrEvidenceOptions,
changed_files: &[String],
check_json: &str,
) -> Result<(), String> {
write_pr_evidence_packet_with_generation(repo, options, changed_files, check_json, None)
}

fn write_pr_evidence_packet_with_generation(
repo: &Path,
options: &PrEvidenceOptions,
changed_files: &[String],
check_json: &str,
generation: Option<&Value>,
) -> Result<(), String> {
let check_value: Value = serde_json::from_str(check_json)
.map_err(|err| format!("ripr check output was not valid JSON: {err}"))?;
if !check_value.is_object() {
return Err("ripr check output must be a JSON object".to_string());
}
let packet = pr_evidence_packet(options, changed_files, &check_value);
let mut packet = pr_evidence_packet(options, changed_files, &check_value);
if let Some(generation) = generation {
packet[complete_execution::GENERATION_FIELD] = generation.clone();
Comment thread
EffortlessSteven marked this conversation as resolved.
Resolved
Comment thread
EffortlessSteven marked this conversation as resolved.
Resolved
}
Comment thread
EffortlessSteven marked this conversation as resolved.
Resolved
let json_text = serde_json::to_string_pretty(&packet)
.map_err(|err| format!("serialize PR evidence packet: {err}"))?;
let markdown = render_pr_evidence_markdown(&packet);
Expand Down Expand Up @@ -266,7 +303,11 @@ fn write_pr_evidence_packet(
"canonical_finding_index_entry_count": findings.len(),
"canonical_finding_index_byte_count": index_byte_count,
});
let review_input = producer_review_input(&check_value, repo, options, &subject)?;
let mut review_input = producer_review_input(&check_value, repo, options, &subject)?;
if let Some(generation) = generation {
subject[complete_execution::GENERATION_FIELD] = generation.clone();
review_input[complete_execution::GENERATION_FIELD] = generation.clone();
}
Comment thread
EffortlessSteven marked this conversation as resolved.
Resolved
let review_input_text = format!(
"{}\n",
serde_json::to_string_pretty(&review_input)
Expand Down Expand Up @@ -392,7 +433,12 @@ fn producer_review_input(
fn remove_stale_check_artifact(repo: &Path) -> Result<(), String> {
// The subject is admission authority. Remove it before touching subordinate
// artifacts or attempting setup/analysis; only missing files are harmless.
for relative in [PR_CHECK_SUBJECT_JSON, PR_CHECK_JSON, PR_REVIEW_INPUT_JSON] {
for relative in [
PR_CHECK_SUBJECT_JSON,
PR_CHECK_JSON,
PR_REVIEW_INPUT_JSON,
complete_execution::RECEIPT,
] {
match fs::remove_file(repo.join(relative)) {
Ok(()) => {}
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
Expand Down Expand Up @@ -440,11 +486,17 @@ fn write_pr_evidence_error_packet(
}))
}

/// Return the fail-closed error for a producer error packet, if present.
/// Return the fail-closed error for failed or experimental producer evidence.
///
/// This is the single status-level actionability authority shared by the
/// public `ripr pr-evidence` command and the xtask compatibility wrapper.
pub fn reject_pr_evidence_error_packet(packet: &Value) -> Option<String> {
if packet.get(complete_execution::GENERATION_FIELD).is_some() {
return Some(
"experimental complete-execution evidence is not qualified for production admission"
.to_string(),
);
}
(packet.get("status").and_then(Value::as_str) == Some("error")).then(|| {
format!(
"PR evidence producer failed; review-comments must not run: {}",
Expand Down Expand Up @@ -504,6 +556,9 @@ fn validate_producer_artifacts(repo: &Path, options: &PrEvidenceOptions) -> Resu
.map_err(|error| format!("missing or unreadable {PR_REVIEW_INPUT_JSON}: {error}"))?;
let subject: Value = serde_json::from_slice(&subject_bytes)
.map_err(|error| format!("{PR_CHECK_SUBJECT_JSON} is not valid JSON: {error}"))?;
if let Some(error) = reject_pr_evidence_error_packet(&subject) {
return Err(error);
}
let review_input: ReviewInputV1 = serde_json::from_slice(&review_input_bytes)
.map_err(|error| format!("{PR_REVIEW_INPUT_JSON} is not valid ReviewInputV1: {error}"))?;
if subject.get("schema_version").and_then(Value::as_str) != Some("ripr.pr_check_subject.v1") {
Expand Down Expand Up @@ -2846,4 +2901,19 @@ mod tests {
fs::create_dir_all(&path).map_err(|err| format!("create {}: {err}", path.display()))?;
Ok(path)
}

#[test]
fn experimental_complete_generation_cannot_be_laundered_through_status_ok() {
Comment thread
EffortlessSteven marked this conversation as resolved.
Resolved
for generation in [
Value::Null,
json!({"coverage":"complete","production_admission":true}),
] {
let mut packet = json!({"status":"ok","analysis_complete":true});
packet["experimental_complete_execution"] = generation;
assert!(
reject_pr_evidence_error_packet(&packet).is_some(),
"experimental generation is not qualified for production admission"
);
}
}
}
Loading
Loading