From 010801b4de5749301711ba81bdec0633d2a59444 Mon Sep 17 00:00:00 2001 From: "Steven Zimmerman, CPA" Date: Sat, 17 Oct 2026 16:49:18 +0000 Subject: [PATCH 1/4] fix(proof): explain supported semantic intent alternatives --- src/proof/intent.rs | 168 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 153 insertions(+), 15 deletions(-) diff --git a/src/proof/intent.rs b/src/proof/intent.rs index f745be42e..1def3264f 100644 --- a/src/proof/intent.rs +++ b/src/proof/intent.rs @@ -13,6 +13,7 @@ use anyhow::Result; use crate::*; const DEFAULT_TARGET_PREFIX: &str = "cargo-test:"; +const UNSUPPORTED_KIND_REASON: &str = "unsupported proof kind; supported kinds: focused-test, focused-build, base-plus-tests. Choose one only if it answers the proof question; otherwise leave the proof unresolved."; #[derive(Clone, Debug)] struct ApprovedTarget { @@ -89,13 +90,13 @@ pub(crate) fn resolve_model_proof_intents( resolve_test_target(graph, diff, &intent.target) } ProofKind::FocusedBuild => resolve_build_target(graph, diff, &intent.target), - _ => Err("unsupported proof kind".to_owned()), + _ => Err(UNSUPPORTED_KIND_REASON.to_owned()), }; let target = match target_result { Ok(target) => target, Err(reason) => { - resolved.status = if reason == "unsupported proof kind" { + resolved.status = if reason == UNSUPPORTED_KIND_REASON { "unsupported_kind".to_owned() } else if reason.starts_with("ambiguous") { "ambiguous_target".to_owned() @@ -113,7 +114,7 @@ pub(crate) fn resolve_model_proof_intents( ProofKind::FocusedBuild => "focused-build", _ => { resolved.status = "unsupported_kind".to_owned(); - resolved.resolution_reason = "unsupported proof kind".to_owned(); + resolved.resolution_reason = UNSUPPORTED_KIND_REASON.to_owned(); resolved_intents.push(resolved); continue; } @@ -244,9 +245,11 @@ fn resolve_test_target( }); match candidates.len() { 1 => Ok(candidates.remove(0)), - 0 => Err(format!("no approved focused test target matches `{label}`")), + 0 => Err(format!( + "no approved focused test target matches `{label}`; choose a declared integration test using `cargo-test:::`" + )), count => Err(format!( - "ambiguous focused test target `{label}` matched {count} approved targets" + "ambiguous focused test target `{label}` matched {count} approved targets; choose one declared integration test using `cargo-test:::`" )), } } @@ -305,10 +308,10 @@ fn resolve_build_target( match candidates.len() { 1 => Ok(candidates.remove(0)), 0 => Err(format!( - "no approved focused build target matches `{label}`" + "no approved focused build target matches `{label}`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" )), count => Err(format!( - "ambiguous focused build target `{label}` matched {count} approved targets" + "ambiguous focused build target `{label}` matched {count} approved targets; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" )), } } @@ -555,7 +558,7 @@ mod tests { assert_eq!(result.intents[1].status, "unsupported_kind"); assert_eq!( result.intents[1].resolution_reason, - "unsupported proof kind" + "unsupported proof kind; supported kinds: focused-test, focused-build, base-plus-tests. Choose one only if it answers the proof question; otherwise leave the proof unresolved." ); assert_eq!(result.intents[2].status, "rejected_target"); assert_eq!(result.intents[3].status, "invalid_timeout"); @@ -701,7 +704,7 @@ mod tests { &diff(&[]), "no-such-target" ))?, - "no approved focused test target matches `no-such-target`" + "no approved focused test target matches `no-such-target`; choose a declared integration test using `cargo-test:::`" ); assert_eq!( expected_error(resolve_test_target( @@ -709,7 +712,7 @@ mod tests { &diff(&[]), "cargo-package:ub-review" ))?, - "ambiguous focused test target `cargo-package:ub-review` matched 2 approved targets" + "ambiguous focused test target `cargo-package:ub-review` matched 2 approved targets; choose one declared integration test using `cargo-test:::`" ); Ok(()) } @@ -773,7 +776,7 @@ mod tests { &diff(&[]), "no-such-package" ))?, - "no approved focused build target matches `no-such-package`" + "no approved focused build target matches `no-such-package`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" ); assert_eq!( expected_error(resolve_build_target( @@ -781,7 +784,7 @@ mod tests { &diff(&[]), "cargo-target:ub-review/no-such-target" ))?, - "no approved focused build target matches `cargo-target:ub-review/no-such-target`" + "no approved focused build target matches `cargo-target:ub-review/no-such-target`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" ); assert_eq!( expected_error(resolve_test_target( @@ -789,7 +792,7 @@ mod tests { &diff(&[]), "no-such-test-target" ))?, - "no approved focused test target matches `no-such-test-target`" + "no approved focused test target matches `no-such-test-target`; choose a declared integration test using `cargo-test:::`" ); assert!( expected_error(resolve_test_target( @@ -804,14 +807,14 @@ mod tests { .ok_or_else(|| anyhow::anyhow!("missing focused-test rejection"))?; assert_eq!( direct_test_error, - "no approved focused test target matches `no-such-test-target`" + "no approved focused test target matches `no-such-test-target`; choose a declared integration test using `cargo-test:::`" ); let direct_build_error = resolve_build_target(&workspace, &diff(&[]), "no-such-package") .err() .ok_or_else(|| anyhow::anyhow!("missing focused-build rejection"))?; assert_eq!( direct_build_error, - "no approved focused build target matches `no-such-package`" + "no approved focused build target matches `no-such-package`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" ); assert_eq!( request_key( @@ -930,4 +933,139 @@ mod tests { assert_eq!(defaulted_result.intents[0].status, "resolved"); Ok(()) } + + #[test] + fn recovery_guidance_preserves_literal_rejection_and_resolution_controls() -> Result<()> { + let root = Path::new(env!("CARGO_MANIFEST_DIR")); + for kind in [ + ProofKind::SanitizerWitness, + ProofKind::MutationWitness, + ProofKind::MiriWitness, + ProofKind::SourceRouteProbe, + ProofKind::ExternalCheck, + ] { + let mut request = intent(kind, "cli"); + request + .resolved_request_ids + .push("stale-request".to_owned()); + let result = resolve_model_proof_intents(root, &diff(&[]), &[request], &[], budget())?; + assert!(result.proof_requests.is_empty()); + assert_eq!(result.intents[0].status, "unsupported_kind"); + assert!(result.intents[0].resolved_request_ids.is_empty()); + assert_eq!( + result.intents[0].resolution_reason, + "unsupported proof kind; supported kinds: focused-test, focused-build, base-plus-tests. Choose one only if it answers the proof question; otherwise leave the proof unresolved." + ); + } + for (target, status) in [ + ("absent-package::absent-test", "unsupported_target"), + ("module::unit_test_function", "unsupported_target"), + ("cargo-package:ub-review", "ambiguous_target"), + ("--test", "rejected_target"), + ("../../tests/cli.rs", "rejected_target"), + ("cli;cargo", "rejected_target"), + ("$(cargo)", "rejected_target"), + ] { + let result = resolve_model_proof_intents( + root, + &diff(&[]), + &[intent(ProofKind::FocusedTest, target)], + &[], + budget(), + )?; + assert!(result.proof_requests.is_empty(), "{target}"); + assert_eq!(result.intents[0].status, status, "{target}"); + assert!( + result.intents[0].resolved_request_ids.is_empty(), + "{target}" + ); + if status != "rejected_target" { + assert!( + result.intents[0] + .resolution_reason + .contains("declared integration test using `cargo-test:::`") + ); + } + } + for timeout in [0, 301, 600] { + let mut request = intent(ProofKind::FocusedTest, "cargo-test:ub-review::cli"); + request.timeout_sec = Some(timeout); + let result = resolve_model_proof_intents(root, &diff(&[]), &[request], &[], budget())?; + assert!(result.proof_requests.is_empty()); + assert_eq!(result.intents[0].status, "invalid_timeout"); + assert!(result.intents[0].resolved_request_ids.is_empty()); + } + for (kind, target, command) in [ + ( + ProofKind::FocusedTest, + "cargo-test:ub-review::cli", + "cargo test --locked --package ub-review --test cli", + ), + ( + ProofKind::BasePlusTests, + "cargo-test:ub-review::cli", + "cargo test --locked --package ub-review --test cli", + ), + ( + ProofKind::FocusedBuild, + "cargo-package:ub-review", + "cargo check --locked --package ub-review", + ), + ( + ProofKind::FocusedBuild, + "workspace", + "cargo check --locked --workspace", + ), + ] { + let result = resolve_model_proof_intents( + root, + &diff(&[]), + &[intent(kind, target)], + &[], + budget(), + )?; + assert_eq!(result.intents[0].status, "resolved"); + assert_eq!(result.proof_requests.len(), 1); + assert_eq!(result.proof_requests[0].command, command); + assert_eq!( + result.intents[0].resolved_request_ids, + [result.proof_requests[0].id.clone()] + ); + assert!( + focused_cargo_test_command_spec(command).is_some() + || focused_build_command_spec(command).is_some() + ); + } + Ok(()) + } + + #[test] + fn build_rejections_explain_declared_package_recovery() -> Result<()> { + let mut workspace = graph(); + let guidance = "; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`"; + for target in ["absent-package", "cargo-target:ub-review/absent-target"] { + assert_eq!( + expected_error(resolve_build_target(&workspace, &diff(&[]), target))?, + format!("no approved focused build target matches `{target}`{guidance}") + ); + } + let mut nested = workspace.packages[0].clone(); + nested.name = "nested".to_owned(); + nested.directory = "nested".to_owned(); + workspace.packages.push(nested); + assert_eq!( + expected_error(resolve_build_target( + &workspace, + &diff(&["nested/src/lib.rs"]), + "nested/src/lib.rs" + ))?, + format!( + "ambiguous focused build target `nested/src/lib.rs` matched 2 approved targets{guidance}" + ) + ); + let selected = resolve_build_target(&workspace, &diff(&[]), "cargo-package:nested") + .map_err(anyhow::Error::msg)?; + assert_eq!(selected.command, "cargo check --locked --package nested"); + Ok(()) + } } From 155e27501db0693432c143d4110ef5d0cbcf981e Mon Sep 17 00:00:00 2001 From: "Steven Zimmerman, CPA" Date: Sat, 17 Oct 2026 16:52:17 +0000 Subject: [PATCH 2/4] fix(proof): suggest only broker-admitted package builds --- src/proof/intent.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/proof/intent.rs b/src/proof/intent.rs index 1def3264f..f049dbab6 100644 --- a/src/proof/intent.rs +++ b/src/proof/intent.rs @@ -308,10 +308,10 @@ fn resolve_build_target( match candidates.len() { 1 => Ok(candidates.remove(0)), 0 => Err(format!( - "no approved focused build target matches `{label}`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" + "no approved focused build target matches `{label}`; choose a declared package using `cargo-package:`" )), count => Err(format!( - "ambiguous focused build target `{label}` matched {count} approved targets; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" + "ambiguous focused build target `{label}` matched {count} approved targets; choose a declared package using `cargo-package:`" )), } } @@ -776,7 +776,7 @@ mod tests { &diff(&[]), "no-such-package" ))?, - "no approved focused build target matches `no-such-package`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" + "no approved focused build target matches `no-such-package`; choose a declared package using `cargo-package:`" ); assert_eq!( expected_error(resolve_build_target( @@ -784,7 +784,7 @@ mod tests { &diff(&[]), "cargo-target:ub-review/no-such-target" ))?, - "no approved focused build target matches `cargo-target:ub-review/no-such-target`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" + "no approved focused build target matches `cargo-target:ub-review/no-such-target`; choose a declared package using `cargo-package:`" ); assert_eq!( expected_error(resolve_test_target( @@ -814,7 +814,7 @@ mod tests { .ok_or_else(|| anyhow::anyhow!("missing focused-build rejection"))?; assert_eq!( direct_build_error, - "no approved focused build target matches `no-such-package`; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`" + "no approved focused build target matches `no-such-package`; choose a declared package using `cargo-package:`" ); assert_eq!( request_key( @@ -1042,7 +1042,7 @@ mod tests { #[test] fn build_rejections_explain_declared_package_recovery() -> Result<()> { let mut workspace = graph(); - let guidance = "; choose a declared package using `cargo-package:` or a declared target using `cargo-target:::`"; + let guidance = "; choose a declared package using `cargo-package:`"; for target in ["absent-package", "cargo-target:ub-review/absent-target"] { assert_eq!( expected_error(resolve_build_target(&workspace, &diff(&[]), target))?, From 55320c660baa4783de9db281da5f8bf67997a270 Mon Sep 17 00:00:00 2001 From: "Steven Zimmerman, CPA" <15812269+EffortlessSteven@users.noreply.github.com> Date: Sat, 17 Oct 2026 16:26:52 -0400 Subject: [PATCH 3/4] fix(proof): preserve intent admission and settle elapsed proof budgets Decline unsupported named builds before scheduling and retain actionable supported alternatives. Settle completed matching receipts from measured duration while preserving lease ceilings and conservative identity/error handling. Add native boundary, sequential-build and fallback artifact controls with compiled defect checks. Record 38 independently reviewed exact static-exposure dispositions under the existing dated ledger contract. Prepared-head: 8d82b59f7ba614d2b2dffd79075da2ba79358e7d Source-tree: bfdf5fd52071db305686a07c65d4c80136e45dc8 --- .ripr/suppressions.toml | 232 ++++++++++++++++++++++++ policy/allow.toml | 2 +- src/proof/broker.rs | 382 ++++++++++++++++++++++++++++++++++++++-- src/proof/budget.rs | 273 +++++++++++++++++++++++++++- src/proof/build.rs | 105 +++++++++-- src/proof/command.rs | 6 +- src/proof/intent.rs | 341 ++++++++++++++++++++++++++++++++++- src/proof/planner.rs | 88 ++++++++- src/proof/red_green.rs | 9 +- 9 files changed, 1392 insertions(+), 46 deletions(-) diff --git a/.ripr/suppressions.toml b/.ripr/suppressions.toml index d4d97ca34..b85f01360 100644 --- a/.ripr/suppressions.toml +++ b/.ripr/suppressions.toml @@ -34460,3 +34460,235 @@ kind = "exposure_gap" finding_id = "probe:src_proof_broker.rs:field_construction:b7c7aae0" owner = "ub-review/core" reason = "RIPR discriminate false-negative on #4271 round-4 the fresh parameter binding in merge_proof_portfolio_candidate_tasks (twin of the round-2b decisions-merge parameter probe 859c91d4): the extended follow_up_write_preserves_required_flag_on_shared_task_id drives both merge arms and asserts the merged candidate record's required flag and request_ids equal the merged decision record exactly, so the construction outcome is pinned; ripr's assertion linker misses parameter bindings. Re-verify after any edit to proof/broker.rs." + +# #1507 local c21b312 -> 4f6aea8 RIPR0.10.0 exact dispositions, reviewed 2026-10-17. +# Native gaps were closed before disposition; existing threshold and dating remain unchanged. +# These are new local raw rows, not attribution or waiver of the inaccessible historical hosted three. + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_broker.rs:error_path:6b6b74dc" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Same artifact-writer Result propagation existed before; the newly multiline call moves the closing ? to line109. The native matrix does not assert an IO error kind, but no new error variant/contract was introduced here. Existing initial broker call plus write_proof_portfolio_selection_artifact in both base/head; normal broker success path exercised. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:field_construction:8794185e" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Unchanged existing_leases parameter declaration; family field_construction does not itself identify an executable field mutation. remaining_focused_proof_budget_subtracts_granted_focused_leases asserts literal counts/time; callback reservation controls retained. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:field_construction:a128c54c" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Closing fixture command-vector syntax is not an independent product behavior. Native shape and aggregation tests consume the resulting commands. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:field_construction:bb79af31" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Generic charge callback parameter is a declaration, not a constructed runtime field. Its observable contract is reservation versus actual charge. Remaining-granted native literal tests and settled elapsed native tests; old full-ceiling charging mutant killed independently. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:field_construction:e403cb27" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. duration_ms is a test-helper input forwarded into fixture commands. Native literal duration assertions already observe forwarding. accounting_settles_actual_duration_with_conservative_rounding covers five distinct supplied durations per status. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:field_construction:ed0910cc" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. requested_by empty vector is accounting fixture metadata, outside production settlement semantics. Fixture feeds accounting tests; requested_by is not read by the budget functions. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:15d1ea10" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Supported head-only shape is exercised by focused-head unit fixtures, focused-build receipts, and failed/timed-out red-green heads. accounting_settles_actual_duration_with_conservative_rounding; actual native matrix/build records. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:2d844d11" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Passed red-green head requires ordered head+base sides. Direct two-command aggregate assertion would fail if this were collapsed to head-only. accounting_timeout_spends_allowance_and_aggregates_red_green_once expects Some(1) for two1ms commands. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:5d422bae" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Status dispatch is observed through literal native passed/failed/skipped tables, timeout floors and unknown running status. accounting_settles_actual_duration_with_conservative_rounding; accounting_timeout_spends_allowance...; bad running status full reservation. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:98b12975" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Valid passed/failed arm has exact native duration-table residuals; proc_macro/fixture stops explain missing source-text association. accounting_settles_actual_duration_with_conservative_rounding: status passed/failed and1/999/1000/1001/6001ms literal outcomes. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:a3001cdc" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Valid timed-out receipt charges at least allowance and preserves overrun. Exact native Some(6)/Some(7) assertions discriminate it. accounting_timeout_spends_allowance_and_aggregates_red_green_once; real3s timeout matrix; erased-floor mutant killed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:dff6b8e0" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Skipped/error arm is exercised for measured durations, legacy positive allowance with zero unknown timing, and unstarted zero-allowance base. Native skipped duration table; bad skipped0 fixture; direct red-green base skipped/timeout0/duration0 assertion. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:e2907a21" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. elapsed_budget_rejects_zero_allowance_and_unknown_receipt_kind directly requires unknown-kind None; compiled unknown-receipt-kind mutant returned Some(1) and failed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:e2907a21.2" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Unknown status fallback is reached by native running-status fixture with otherwise matching lease/receipt identity; exact full reservation is asserted. accounting_ambiguous_or_unbound_receipts_keep_reservation sets command.status running and expects594. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:match_arm:f3535353" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. New receipt-kind dispatch; direct native head and red-green receipt tests and actual build receipts exercise supported dispatch. accounting_timeout_spends_allowance_and_aggregates_red_green_once; native build/matrix records; independent41 cases. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:predicate:1b232065" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. RIPR reports no compound boundary, but native direct code explicitly sets base timeout_sec=0 and duration_ms=0 and asserts Some(1); legacy skipped0 retains reservation. accounting_timeout_spends_allowance_and_aggregates_red_green_once plus accounting_ambiguous_or_unbound_receipts_keep_reservation. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:predicate:6e3126be" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Same passed-head predicate; exact native ordered two-side accounting and one-side failed/timed-out native matrix distinguish the branch. Direct red-green aggregate assertion plus five-case actual native matrix. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:predicate:82770364" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. elapsed_budget_rejects_zero_allowance_and_unknown_receipt_kind directly requires passed/failed zero-allowance None; compiled zero-success-allowance mutant returned Some(1) and failed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:predicate:84679b3c" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. elapsed_budget_rejects_zero_allowance_and_unknown_receipt_kind directly requires timed_out zero-allowance None; compiled zero-timeout-allowance mutant returned Some(1) and failed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:return_value:041e08e9" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. New #[cfg(test)] accounting_receipt helper returns fixture data; not a production return path. Native duration/revision/shape tests consume the helper and assert residual budgets. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:return_value:257023b3" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Coordinate91 is the duplicate-CONSUMER cardinality guard. Native different_id=true duplicate case isolates it because lease IDs are distinct. Adjacent lease-ID uniqueness needs a distinct-consumer fixture, recorded separately. accounting_duplicate_reservations_and_overflow_never_create_credit: both same/different ID cases expect588. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:return_value:2d5a1782" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Same fixture metadata line misclassified additionally as return_value; it is not an independent production return. Same source/evidence as row22. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:return_value:4b1bc57d" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. New no-matching-receipt early return. Native bad-receipt table includes empty receipts and unrelated IDs and checks full594s remaining. accounting_ambiguous_or_unbound_receipts_keep_reservation; independent no-receipt/wrong-ID controls. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:return_value:99d2667a" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Opening brace marks the composite conservative fallback; it is not a standalone return expression. Native stale-head, kind, duplicate and revision cases observe its effect. accounting_ambiguous_or_unbound_receipts_keep_reservation; independent ignored-revision and duplicate mutants killed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_budget.rs:return_value:9f776106" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Compatible lease/receipt kind guard is new but wrong-kind fixture reaches the fallback and checks full reservation. accounting_ambiguous_or_unbound_receipts_keep_reservation changes receipt.kind to focused-build while lease is focused-test. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_build.rs:call_deletion:4d228ff2" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. elapsed_budget_admits_second_build_only_when_actual_time_fits executes two builds at200ms and one at3001ms under total6/cap4; compiled restored-ceiling and free-credit accumulator mutants fail exact execution counts. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_build.rs:call_deletion:84d6f48c" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. elapsed_budget_admits_second_build_only_when_actual_time_fits observes actual same-runner accumulation with two cap4 builds/total6; compiled full-ceiling and ignored-charge mutants fail 2-versus1 execution oracles. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_build.rs:call_deletion:90a08fae" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Expression belongs to base build.rs:157; current155 closes the loop. The old estimated_seconds ceiling charge was intentionally removed, not a surviving production call. Exact base/current source comparison; actual new spent accumulator at149-151; multi-build test will discriminate restored old behavior. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_build.rs:field_construction:f7b05a10" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Renamed helper parameter spent_seconds is declaration syntax; the meaningful effect is its use in admission arithmetic. focused_build_budget_allows_next checks spent+next against allocation; rows26/27 identify the needed actual caller test. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:error_path:2c950ab9" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Unsupported-kind String Err behavior is observed at public resolver status/reason/no-request boundary. There is also a second unsupported-kind guard, so changing only one may be equivalent. Five unsupported kinds with literal reason/status and cleared IDs/no requests; native diagnostic-loss control. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:error_path:5de7f27b" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Named-build rejection Err is observed through literal reason, terminal status, empty request IDs/requests/candidate/planner tasks. Eight native named kind/separator cases; automatic package fallback and guard-removal mutants killed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:error_path:c03040ee" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. New #[cfg(test)] named_target_fixture Cargo.toml write propagation; a test-fixture setup error is not a production proof-intent error path. The native fixture successfully enables actual metadata/resolver\u2192request\u2192planner controls. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:field_construction:e11cbfe7" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. New diagnostic constant declaration has visible literal behavior. no_changed_rust_line/field_construction indicates static owner/span failure, not absent runtime reach. terminalizes_ambiguous_unsupported_and_malicious_intents and recovery_guidance... compare full literal; compiled kind-guidance-loss control failed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:match_arm:cf5a1b91" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Absent integration-test target Err has direct exact-string native checks through expected_error; fixture/proc-macro dataflow is opaque to static text matching. semantic_target_grammar_and_target_selectors_are_exact; build_resolution_and_command_templates_are_exact; literal absent/symbol controls. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:match_arm:ddcab20f" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. New guarded single named-build candidate arm is exercised by four kinds and both separators, plus package positives. named_build_intents_are_declined_before_scheduling; named_target_supported_intents_keep_exact_requests; nine compiled semantic defects killed. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:match_arm:ed2e64d6" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Same unsupported match arm classified separately; public rejection contract has direct native literal controls. Same native and extracted unsupported-kind evidence as row32. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:predicate:6f9aaca1" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. The constant string is not an executable predicate; same no_changed_rust_line owner limitation. Same full-literal native diagnostic assertions and kind-guidance-loss control as row30. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." + +[[suppressions]] +kind = "exposure_gap" +finding_id = "probe:src_proof_intent.rs:return_value:b72a971f" +owner = "ub-review/core" +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Same rejection statement classified additionally as return_value; native request/task non-creation is its behavioral oracle. Same native/extracted evidence as row38. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." diff --git a/policy/allow.toml b/policy/allow.toml index 4a8e668a5..cdd6ac4be 100644 --- a/policy/allow.toml +++ b/policy/allow.toml @@ -99,7 +99,7 @@ glob = ".ripr/suppressions.toml" category = "configuration-and-policy" language = "toml" owner = "ub-review/core" -reason = "RIPR's durable suppression manifest; every entry carries owner and reason per the suppression-health contract, and suppressed findings stay visible as suppressed in the gate receipt. Content-addressed IDs follow code rather than source lines; the receipt's review_after/expires carries the dating obligation. Re-verify entries after semantic edits and RIPR upgrades. Reviewed 2026-08-08 (PR #848), which added 25 entries for cfg(test) and integration-test fixture probes plus const/static declarations that RIPR 0.10.0 scores as production seams (ripr-swarm#1055). Reviewed 2026-08-21 (PR #870), which added 7 entries for impact_plan::relative_to_repo probes that RIPR 0.10.0 scores weakly_exposed despite exact-value unit-test discrimination of every branch. Reviewed 2026-08-21 (PR #854), which added 287 entries for the base+tests hunk-classification diff: cfg(test) test-module and declaration/const seams scored as production code (ripr-swarm#1055) plus weakly_exposed/no_static_path probes whose behavior is pinned by exact-value assertions in each file's co-located suite but whose discriminate check cannot match output-level assertion text. Reviewed 2026-08-21 (PR #853), which added 29 entries for suggestion-gate/delivery probes whose co-located tests discriminate with exact oracles that RIPR 0.10.0 cannot statically link (fixture_opaque), plus const/array declarations and two cfg(test) fixture lines. Reviewed 2026-08-22 (PR #915), which added 54 entries for the typed comment-plan envelope diff (#913): no_static_path declaration seams (gap variants, envelope/entry fields, schema const, disposition variant) and weakly_exposed parse/join probes whose colocated comment_plan_* and repair-queue tests assert every branch with exact-value oracles that RIPR 0.10.0 cannot statically attribute. Reviewed 2026-08-27 (PR #1255), which added exact receipts for the trusted-base admission declarations, context-free routing, isolated Git plumbing, and cfg(test) fixture probes after focused unit/action/CLI tests pinned successful artifacts and fail-closed identity, object, path, execution, and context boundaries (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #953), which replaced stale A2.1 task-ledger IDs with exact A2.2 accounting/release IDs after fallible truth-table tests pinned timing, terminal, receipt, consumer, revision, replay, and malformed-event behavior (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #954), which added 182 exact A2.3 artifact/replay and control-character validation IDs after co-located Rust and mirrored Python tests pinned cross-language golden bytes plus corruption, ordering, revision, terminal-release, receipt-reference, consumer, snapshot-integrity, and C0/C1 rejection failures (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #961), which added 79 exact integration-test loader and fixture-copier receipts after six executable Rust tests pinned the exact corpus, three hosted contradiction shapes, and eleven negative mutation classes; RIPR 0.10.0 cannot attribute fallible anyhow::ensure! oracles inside integration tests (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #955), which carries 273 exact sensor TaskLedger lifecycle receipts after final source review: hosted gate run 33139645715 retained 146 current #955 receipts, removed 40 displaced content-addressed receipts, and added 127 exact subprocess-authority, RIPR detail, aggregate-timeout, and stale-receipt projection IDs. The named focused suites and full Rust, policy, and verifier proof pin lifecycle, timing, terminal, receipt, release, artifact, and reused-output behavior (ripr-swarm#1054/#1055)." +reason = "RIPR's durable suppression manifest; every entry carries owner and reason per the suppression-health contract, and suppressed findings stay visible as suppressed in the gate receipt. Content-addressed IDs follow code rather than source lines; the receipt's review_after/expires carries the dating obligation. Re-verify entries after semantic edits and RIPR upgrades. Reviewed 2026-08-08 (PR #848), which added 25 entries for cfg(test) and integration-test fixture probes plus const/static declarations that RIPR 0.10.0 scores as production seams (ripr-swarm#1055). Reviewed 2026-08-21 (PR #870), which added 7 entries for impact_plan::relative_to_repo probes that RIPR 0.10.0 scores weakly_exposed despite exact-value unit-test discrimination of every branch. Reviewed 2026-08-21 (PR #854), which added 287 entries for the base+tests hunk-classification diff: cfg(test) test-module and declaration/const seams scored as production code (ripr-swarm#1055) plus weakly_exposed/no_static_path probes whose behavior is pinned by exact-value assertions in each file's co-located suite but whose discriminate check cannot match output-level assertion text. Reviewed 2026-08-21 (PR #853), which added 29 entries for suggestion-gate/delivery probes whose co-located tests discriminate with exact oracles that RIPR 0.10.0 cannot statically link (fixture_opaque), plus const/array declarations and two cfg(test) fixture lines. Reviewed 2026-08-22 (PR #915), which added 54 entries for the typed comment-plan envelope diff (#913): no_static_path declaration seams (gap variants, envelope/entry fields, schema const, disposition variant) and weakly_exposed parse/join probes whose colocated comment_plan_* and repair-queue tests assert every branch with exact-value oracles that RIPR 0.10.0 cannot statically attribute. Reviewed 2026-08-27 (PR #1255), which added exact receipts for the trusted-base admission declarations, context-free routing, isolated Git plumbing, and cfg(test) fixture probes after focused unit/action/CLI tests pinned successful artifacts and fail-closed identity, object, path, execution, and context boundaries (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #953), which replaced stale A2.1 task-ledger IDs with exact A2.2 accounting/release IDs after fallible truth-table tests pinned timing, terminal, receipt, consumer, revision, replay, and malformed-event behavior (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #954), which added 182 exact A2.3 artifact/replay and control-character validation IDs after co-located Rust and mirrored Python tests pinned cross-language golden bytes plus corruption, ordering, revision, terminal-release, receipt-reference, consumer, snapshot-integrity, and C0/C1 rejection failures (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #961), which added 79 exact integration-test loader and fixture-copier receipts after six executable Rust tests pinned the exact corpus, three hosted contradiction shapes, and eleven negative mutation classes; RIPR 0.10.0 cannot attribute fallible anyhow::ensure! oracles inside integration tests (ripr-swarm#1054/#1055). Reviewed 2026-08-27 (issue #955), which carries 273 exact sensor TaskLedger lifecycle receipts after final source review: hosted gate run 33139645715 retained 146 current #955 receipts, removed 40 displaced content-addressed receipts, and added 127 exact subprocess-authority, RIPR detail, aggregate-timeout, and stale-receipt projection IDs. The named focused suites and full Rust, policy, and verifier proof pin lifecycle, timing, terminal, receipt, release, artifact, and reused-output behavior (ripr-swarm#1054/#1055). Reviewed 2026-10-17 (issue #1507 local c21b312 to 4f6aea8): 38 exact RIPR 0.10.0 dispositions after owner-aware raw-row review, four durable native tests and eight compiled production defect controls. Records distinguish declarations/test helpers/deleted statements/unchanged error propagation from observed behavioral seams. The prior hosted three remain inaccessible and unclassified; these dispositions bind only the new local source analysis. Existing review_after/expires and strict-zero threshold are unchanged." created = "2026-06-07" review_after = "2026-11-21" expires = "2026-12-22" diff --git a/src/proof/broker.rs b/src/proof/broker.rs index b6706a876..7b6f9ee87 100644 --- a/src/proof/broker.rs +++ b/src/proof/broker.rs @@ -83,16 +83,30 @@ pub(crate) fn run_initial_diff_proof_broker_v0( run_command_to_files_with_spawn_observer, prepare_base_plus_tests_worktree, )?; + let final_budget = settled_focused_proof_budget( + budget, + &result.resource_leases, + &result.proof_receipts, + &diff.head, + ); let final_selection = select_proof_portfolio(ProofPortfolioInput { test_tasks: &tasks, build_tasks: &[], proof_requests: &[], proof_receipts: &result.proof_receipts, head: &diff.head, - budget, + budget: final_budget, runtime: current_portfolio_runtime(profile, box_state, run_started)?, }); - write_proof_portfolio_selection_artifact(out, diff, budget, &tasks, &[], &[], final_selection)?; + write_proof_portfolio_selection_artifact( + out, + diff, + final_budget, + &tasks, + &[], + &[], + final_selection, + )?; Ok(result) } @@ -232,10 +246,12 @@ fn remaining_focused_proof_budget_after( total_budget: ProofBudget, existing_leases: &[ResourceLease], new_leases: &[ResourceLease], + receipts: &[ProofReceipt], + head: &str, ) -> ProofBudget { let mut all_leases = existing_leases.to_vec(); all_leases.extend(new_leases.iter().cloned()); - remaining_focused_proof_budget(total_budget, &all_leases) + settled_focused_proof_budget(total_budget, &all_leases, receipts, head) } #[derive(Clone, Copy)] @@ -783,7 +799,8 @@ where // string, so the security boundary is preserved byte-for-byte. let v2_requests: Vec = proof_requests.iter().map(proof_request_to_v2).collect(); let total_budget = proof_budget(profile)?; - let budget = remaining_focused_proof_budget(total_budget, existing_leases); + let budget = + settled_focused_proof_budget(total_budget, existing_leases, existing_receipts, &diff.head); // Diff-derived Cargo candidates are owned by the initial diff broker and // already carry receipts by the time a request phase runs; this phase // re-plans requested work only. @@ -817,12 +834,17 @@ where )?; let mut consumed_leases = existing_leases.to_vec(); consumed_leases.extend(result.resource_leases.clone()); - let remaining_budget = remaining_focused_proof_budget(total_budget, &consumed_leases); let existing_and_new_receipts = existing_receipts .iter() .chain(result.proof_receipts.iter()) .cloned() .collect::>(); + let remaining_budget = settled_focused_proof_budget( + total_budget, + &consumed_leases, + &existing_and_new_receipts, + &diff.head, + ); let replan = select_proof_portfolio(ProofPortfolioInput { test_tasks: &test_candidates, build_tasks: &build_candidates, @@ -846,16 +868,18 @@ where )?; result.proof_receipts.extend(build_result.proof_receipts); result.resource_leases.extend(build_result.resource_leases); - let final_budget = remaining_focused_proof_budget_after( - total_budget, - existing_leases, - &result.resource_leases, - ); let final_receipts = existing_receipts .iter() .chain(result.proof_receipts.iter()) .cloned() .collect::>(); + let final_budget = remaining_focused_proof_budget_after( + total_budget, + existing_leases, + &result.resource_leases, + &final_receipts, + &diff.head, + ); let final_selection = select_proof_portfolio(ProofPortfolioInput { test_tasks: &test_candidates, build_tasks: &build_candidates, @@ -895,7 +919,8 @@ pub(crate) fn run_follow_up_proof_broker_v0( task_ledger: Option<&ProofTaskLedger>, ) -> Result { let total_budget = proof_budget(profile)?; - let budget = remaining_focused_proof_budget(total_budget, existing_leases); + let budget = + settled_focused_proof_budget(total_budget, existing_leases, existing_receipts, &diff.head); // As in the request phase: diff-derived Cargo candidates belong to the // initial diff broker; follow-up re-plans requested work only. let mut test_candidates = focused_test_candidates_from_diff(diff, &[], None); @@ -928,12 +953,17 @@ pub(crate) fn run_follow_up_proof_broker_v0( )?; let mut consumed_leases = existing_leases.to_vec(); consumed_leases.extend(result.resource_leases.clone()); - let remaining_budget = remaining_focused_proof_budget(total_budget, &consumed_leases); let existing_and_new_receipts = existing_receipts .iter() .chain(result.proof_receipts.iter()) .cloned() .collect::>(); + let remaining_budget = settled_focused_proof_budget( + total_budget, + &consumed_leases, + &existing_and_new_receipts, + &diff.head, + ); let replan = select_proof_portfolio(ProofPortfolioInput { test_tasks: &test_candidates, build_tasks: &build_candidates, @@ -957,16 +987,18 @@ pub(crate) fn run_follow_up_proof_broker_v0( )?; result.proof_receipts.extend(build_result.proof_receipts); result.resource_leases.extend(build_result.resource_leases); - let final_budget = remaining_focused_proof_budget_after( - total_budget, - existing_leases, - &result.resource_leases, - ); let final_receipts = existing_receipts .iter() .chain(result.proof_receipts.iter()) .cloned() .collect::>(); + let final_budget = remaining_focused_proof_budget_after( + total_budget, + existing_leases, + &result.resource_leases, + &final_receipts, + &diff.head, + ); let final_selection = select_proof_portfolio(ProofPortfolioInput { test_tasks: &test_candidates, build_tasks: &build_candidates, @@ -1585,10 +1617,324 @@ mod tests { use anyhow::{Result, ensure}; use super::*; + use crate::task_ledger_artifact::build_task_ledger_artifacts; use crate::test_parse::command_display_with_env; use crate::tests::test_run_args; use crate::{CommandStatus, DiffContext, DiffFlags}; + #[test] + fn accounting_matrix_releases_early_commands_before_required_build() -> Result<()> { + let mut failures = Vec::new(); + for case in [ + "success", + "failure", + "timeout", + "setup_failure", + "cancellation", + ] { + let temp = tempfile::tempdir()?; + let out = temp.path().join("out"); + let mut diff = test_diff(); + diff.head = "155e27501db0693432c143d4110ef5d0cbcf981e".to_owned(); + let mut test = proof_request("accounting-test", true); + test.command = "cargo test --locked --test config_tests".to_owned(); + test.timeout_sec = 3; + let mut build = proof_request("accounting-build", true); + build.command = "cargo check --workspace --all-targets --locked".to_owned(); + build.cost = "focused-build".to_owned(); + build.timeout_sec = 4; + let requests = vec![test, build]; + let mut profile = Profile::default(); + profile.limits.tests = 1; + profile.limits.builds = 1; + profile.budgets.proof_max_focused_test_files = 3; + profile.budgets.proof_max_focused_tests = 3; + profile.budgets.proof_command_timeout_sec = 4; + profile.budgets.proof_total_timeout_sec = 6; + profile.budgets.hard_timeout_sec = 30; + let args = test_run_args(out.clone()); + let box_state = BoxState::detect()?; + let started = Instant::now(); + let revision = RevisionRef { + digest: "a".repeat(64), + semantics: "candidate_head".to_owned(), + reviewed_commit: diff.head.clone(), + }; + let recorder = TaskLedgerRecorder::new(&revision, &started)?; + let ledger = ProofTaskLedger::new(recorder.clone()); + let mut actual = Vec::new(); + let mut builds = 0; + let mut build_started_ns = None; + let result = run_request_proof_broker_v0_with_runners( + temp.path(), + &out, + &diff, + &profile, + &requests, + &[], + &[], + &args, + &box_state, + &started, + Some(&ledger), + |root, argv, env, timeout, stdout, stderr, observer| { + ensure!(argv.first().is_some_and(|arg| arg == "cargo")); + ensure!(timeout == 3); + let base = stdout.to_string_lossy().contains("base-plus-tests"); + let clock = Instant::now(); + // The real subprocess runner executes these deterministic fixtures; + // the injected seam does not change the broker command allowlist. + let fixture = match (case, base) { + ("timeout", _) => vec!["/bin/sleep".to_owned(), "10".to_owned()], + ("setup_failure", _) => { + std::thread::sleep(std::time::Duration::from_millis(20)); + vec![ + root.join("missing-accounting-program") + .display() + .to_string(), + ] + } + ("cancellation", _) => vec!["/bin/sleep".to_owned(), "0.05".to_owned()], + ("failure", _) | (_, true) => { + vec!["/bin/sh".to_owned(), "-c".to_owned(), "exit 7".to_owned()] + } + _ => vec!["/bin/sh".to_owned(), "-c".to_owned(), "exit 0".to_owned()], + }; + let status = run_command_to_files_with_spawn_observer( + root, &fixture, env, timeout, stdout, stderr, observer, + ); + actual.push(serde_json::json!({ + "argv": fixture, "timeout_sec": timeout, + "monotonic_duration_ns": clock.elapsed().as_nanos(), + })); + if case == "cancellation" { + status?; + return Err(anyhow::anyhow!( + "fixture cancellation after confirmed completion" + )); + } + status + }, + |_root, _out, _diff| { + let base = temp.path().join("base-plus-tests"); + fs::create_dir_all(&base)?; + Ok(base) + }, + |root, _argv, env, timeout, stdout, stderr, observer| { + ensure!(timeout == 4); + builds += 1; + build_started_ns = Some(started.elapsed().as_nanos()); + run_command_to_files_with_spawn_observer( + root, + &["/bin/sh".to_owned(), "-c".to_owned(), "exit 0".to_owned()], + env, + timeout, + stdout, + stderr, + observer, + ) + }, + )?; + let artifact: serde_json::Value = + serde_json::from_slice(&fs::read(out.join("review/proof_portfolio.json"))?)?; + write_proof_receipt_artifacts(&out, &result.proof_receipts, Some(&revision))?; + ledger.reconcile_published_receipts(&out)?; + let ledger_bytes = build_task_ledger_artifacts(&revision, &recorder.inputs()?)?; + let ledger_snapshot: serde_json::Value = + serde_json::from_slice(&ledger_bytes.snapshot_json)?; + let row = serde_json::json!({ + "case": case, "actual_commands": actual, "proof_receipts": result.proof_receipts, + "leases": result.resource_leases, "portfolio": artifact, + "ledger": ledger_snapshot, "required_build_executions": builds, + "required_build_started_ns": build_started_ns, "box_state": box_state, + "hard_deadline_sec": profile.budgets.hard_timeout_sec, + "total_budget_sec": profile.budgets.proof_total_timeout_sec, + "elapsed_ns": started.elapsed().as_nanos(), + }); + eprintln!("ACCOUNTING_MATRIX {row}"); + if builds != usize::from(case != "timeout") { + failures.push(format!("{case}: required build executions={builds}")); + } + if matches!(case, "cancellation" | "setup_failure") + && row["proof_receipts"][0]["commands"][0]["duration_ms"] == 0 + { + failures.push(format!("{case}: elapsed setup/cancellation was erased")); + } + let first_receipt = &result.proof_receipts[0]; + let measured_ms: u128 = first_receipt + .commands + .iter() + .map(|command| { + command.duration_ms.max(if command.timed_out { + u128::from(command.timeout_sec) * 1_000 + } else { + 1 + }) + }) + .sum(); + let first_charge = u64::try_from(measured_ms.div_ceil(1_000))?; + let expected_remaining = 6_u64 + .saturating_sub(first_charge) + .saturating_sub(builds as u64); + if artifact["budget_seconds"].as_u64() != Some(expected_remaining) { + failures.push(format!("{case}: settlement does not reconcile")); + } + ensure!(result.resource_leases[0].timeout_sec == 6); + if let Some(at) = build_started_ns { + ensure!(at < 30_000_000_000); + ensure!(result.resource_leases[1].timeout_sec == 4); + } + if matches!( + case, + "failure" | "setup_failure" | "cancellation" | "timeout" + ) { + ensure!( + first_receipt.result != "head_passed" + && first_receipt.result != "discriminating" + ); + } + ensure!( + artifact["runtime"]["deadline_remaining_seconds"] + .as_u64() + .is_some_and(|n| n > 0) + ); + } + ensure!(failures.is_empty(), "{}", failures.join("; ")); + Ok(()) + } + + #[test] + fn composed_semantic_intents_preserve_refusal_and_release_early_budget() -> Result<()> { + let temp = tempfile::tempdir()?; + fs::write( + temp.path().join("Cargo.toml"), + "[package]\nname=\"fixture\"\nversion=\"0.0.0\"\nedition=\"2024\"\n[workspace]\n[[bin]]\nname=\"app\"\npath=\"app.rs\"\n[[test]]\nname=\"probe\"\npath=\"probe.rs\"\n", + )?; + for name in ["app.rs", "probe.rs"] { + fs::write(temp.path().join(name), "fn main() {}\n")?; + } + let mut diff = test_diff(); + diff.changed_files.clear(); + let semantic = |kind, target: &str, timeout| ProofIntent { + id: target.to_owned(), + claim_id: "composition".to_owned(), + question: "Does the declared proof answer the claim?".to_owned(), + expected_answer_shape: "terminal receipt".to_owned(), + proof_kind: kind, + target: target.to_owned(), + estimated_value: "high".to_owned(), + requested_by: vec!["tests-oracle".to_owned()], + status: "requested".to_owned(), + timeout_sec: Some(timeout), + resolved_request_ids: vec!["stale".to_owned()], + resolution_reason: String::new(), + }; + let mut profile = Profile::default(); + profile.limits.tests = 1; + profile.limits.builds = 1; + profile.budgets.proof_max_focused_test_files = 3; + profile.budgets.proof_max_focused_tests = 3; + profile.budgets.proof_command_timeout_sec = 4; + profile.budgets.proof_total_timeout_sec = 6; + profile.budgets.hard_timeout_sec = 30; + let resolved = resolve_model_proof_intents( + temp.path(), + &diff, + &[ + semantic(ProofKind::FocusedBuild, "cargo-target:fixture::app", 4), + semantic(ProofKind::FocusedTest, "cargo-test:fixture::probe", 3), + semantic(ProofKind::FocusedBuild, "cargo-package:fixture", 4), + ], + &[], + proof_budget(&profile)?, + )?; + ensure!(resolved.intents[0].status == "unsupported_target"); + ensure!(resolved.intents[0].resolved_request_ids.is_empty()); + ensure!(resolved.proof_requests.len() == 2); + let out = temp.path().join("out"); + let args = test_run_args(out.clone()); + let mut executed = Vec::new(); + let mut builds = 0; + let result = run_request_proof_broker_v0_with_runners( + temp.path(), + &out, + &diff, + &profile, + &resolved.proof_requests, + &[], + &[], + &args, + &BoxState::detect()?, + &Instant::now(), + None, + |_root, argv, _env, timeout, stdout, stderr, _observer| { + ensure!(argv.join(" ") == "cargo test --locked --package fixture --test probe"); + ensure!(timeout == 3); + let base = stdout.to_string_lossy().contains("base-plus-tests"); + executed.push(if base { "base-plus-tests" } else { "head" }); + fs::write(stdout, b"controlled semantic test")?; + fs::write(stderr, b"")?; + Ok(CommandStatus { + success: !base, + exit_code: Some(if base { 7 } else { 0 }), + timed_out: false, + duration_ms: 200, + reason: "fixture".to_owned(), + }) + }, + |_root, _out, _diff| { + let base = temp.path().join("base-plus-tests"); + fs::create_dir_all(&base)?; + Ok(base) + }, + |_root, argv, _env, timeout, stdout, stderr, _observer| { + ensure!(argv.join(" ") == "cargo check --locked --package fixture"); + ensure!(timeout == 4); + builds += 1; + fs::write(stdout, b"controlled semantic build")?; + fs::write(stderr, b"")?; + Ok(CommandStatus { + success: true, + exit_code: Some(0), + timed_out: false, + duration_ms: 200, + reason: "fixture".to_owned(), + }) + }, + )?; + ensure!(executed == ["head", "base-plus-tests"]); + ensure!( + builds == 1, + "early completion must admit the approved package build" + ); + ensure!(result.proof_receipts.len() == 2); + ensure!(result.resource_leases.len() == 2); + ensure!(result.resource_leases[0].timeout_sec == 6); + ensure!(result.resource_leases[1].timeout_sec == 4); + ensure!(result.proof_receipts[0].result == "discriminating"); + ensure!(result.proof_receipts[1].result == "head_passed"); + for request in &resolved.proof_requests { + ensure!( + result + .proof_receipts + .iter() + .any(|receipt| receipt.request_ids.contains(&request.id)) + ); + } + let portfolio: serde_json::Value = + serde_json::from_slice(&fs::read(out.join("review/proof_portfolio.json"))?)?; + ensure!(portfolio["budget_seconds"] == 4); + eprintln!( + "COMPOSED_INTENT_ACCOUNTING {}", + serde_json::json!({ + "intents": resolved.intents, "requests": resolved.proof_requests, + "receipts": result.proof_receipts, "leases": result.resource_leases, + "portfolio": portfolio, + }) + ); + Ok(()) + } + fn test_diff() -> DiffContext { DiffContext { base: "HEAD~1".to_owned(), @@ -1716,6 +2062,8 @@ mod tests { proof_budget_for_test(2, 120), std::slice::from_ref(&existing), std::slice::from_ref(&new), + &[], + "head", ); assert_eq!(remaining.max_focused_tests, 0); diff --git a/src/proof/budget.rs b/src/proof/budget.rs index a6b399a5f..0f9ea92de 100644 --- a/src/proof/budget.rs +++ b/src/proof/budget.rs @@ -58,8 +58,98 @@ pub(crate) fn proof_lease_budget(profile: &Profile) -> Result } pub(crate) fn remaining_focused_proof_budget( + budget: ProofBudget, + existing_leases: &[ResourceLease], +) -> ProofBudget { + focused_proof_budget_with_charges(budget, existing_leases, |lease| lease.timeout_sec) +} + +/// A ceiling remains reserved until one unambiguous, matching receipt settles +/// it. Keep the original lease intact: its timeout is still the admission cap. +pub(crate) fn settled_focused_proof_budget( + budget: ProofBudget, + leases: &[ResourceLease], + receipts: &[ProofReceipt], + head: &str, +) -> ProofBudget { + if receipts.is_empty() { + return remaining_focused_proof_budget(budget, leases); + } + focused_proof_budget_with_charges(budget, leases, |lease| { + let mut matching = receipts + .iter() + .filter(|receipt| receipt.id == lease.consumer); + let Some(receipt) = matching.next() else { + return lease.timeout_sec; + }; + if matching.next().is_some() + || leases.iter().filter(|other| other.id == lease.id).count() != 1 + || leases + .iter() + .filter(|other| other.consumer == lease.consumer && other.status == "granted") + .count() + != 1 + || !receipt.head.eq_ignore_ascii_case(head) + || receipt.revision != lease.revision + || !matches!( + (lease.kind.as_str(), receipt.kind.as_str()), + ("focused-test", "focused-head" | "focused-red-green") + | ("focused-build", "focused-build") + ) + { + return lease.timeout_sec; + } + focused_proof_receipt_spent_seconds(receipt).unwrap_or(lease.timeout_sec) + }) +} + +/// Budget units are whole seconds; round the aggregate actual duration up. +/// A real timeout spends at least its allowance, including when its receipt +/// clock rounds down. Unknown/legacy error timing cannot create free credit. +pub(crate) fn focused_proof_receipt_spent_seconds(receipt: &ProofReceipt) -> Option { + if receipt.commands.is_empty() { + return None; + } + let expected_sides = match receipt.kind.as_str() { + "focused-red-green" if receipt.commands[0].status == "passed" => { + &["head", "base-plus-tests"][..] + } + "focused-red-green" | "focused-head" | "focused-build" => &["head"][..], + _ => return None, + }; + if !receipt + .commands + .iter() + .map(|command| command.side.as_str()) + .eq(expected_sides.iter().copied()) + { + return None; + } + let mut duration_ms = 0_u128; + for command in &receipt.commands { + let spent_ms = match command.status.as_str() { + "passed" | "failed" if !command.timed_out && command.timeout_sec > 0 => { + command.duration_ms.max(1) + } + "timed_out" if command.timed_out && command.timeout_sec > 0 => command + .duration_ms + .max(u128::from(command.timeout_sec) * 1_000), + "skipped" + if !command.timed_out && (command.timeout_sec == 0 || command.duration_ms > 0) => + { + command.duration_ms + } + _ => return None, + }; + duration_ms = duration_ms.saturating_add(spent_ms); + } + Some(u64::try_from(duration_ms.div_ceil(1_000)).unwrap_or(u64::MAX)) +} + +fn focused_proof_budget_with_charges( mut budget: ProofBudget, existing_leases: &[ResourceLease], + charge: impl Fn(&ResourceLease) -> u64, ) -> ProofBudget { let focused_leases = existing_leases .iter() @@ -82,8 +172,7 @@ pub(crate) fn remaining_focused_proof_budget( let granted_seconds = focused_leases .iter() .filter(|lease| lease.status == "granted") - .map(|lease| lease.timeout_sec) - .sum::(); + .fold(0_u64, |total, lease| total.saturating_add(charge(lease))); budget.max_focused_tests = budget.max_focused_tests.saturating_sub(granted); budget.max_focused_test_files = budget.max_focused_test_files.saturating_sub(granted); budget.max_total_seconds = budget.max_total_seconds.saturating_sub(granted_seconds); @@ -131,6 +220,186 @@ mod tests { } } + fn accounting_receipt(status: &str, duration_ms: u128) -> ProofReceipt { + ProofReceipt { + revision: None, + schema: PROOF_RECEIPT_SCHEMA.to_owned(), + id: "proof-test".to_owned(), + kind: "focused-head".to_owned(), + base: "base".to_owned(), + head: "head".to_owned(), + test_patch_mode: "head-only".to_owned(), + requested_by: Vec::new(), + request_ids: Vec::new(), + commands: vec![ProofCommandReceipt { + side: "head".to_owned(), + command: "fixture".to_owned(), + env: Default::default(), + status: status.to_owned(), + exit_code: Some(if status == "passed" { 0 } else { 7 }), + timed_out: status == "timed_out", + timeout_sec: 6, + duration_ms, + stdout: String::new(), + stderr: String::new(), + reason: "fixture".to_owned(), + }], + result: "fixture".to_owned(), + reason: "fixture".to_owned(), + } + } + + #[test] + fn elapsed_budget_reserves_duplicate_lease_ids_for_distinct_consumers() { + let first = test_lease("focused-test", "granted", 6); + let mut second = first.clone(); + second.consumer = "second-proof".to_owned(); + let first_receipt = accounting_receipt("passed", 200); + let mut second_receipt = first_receipt.clone(); + second_receipt.id = "second-proof".to_owned(); + let mut budget = test_budget(); + budget.max_total_seconds = 20; + let remaining = settled_focused_proof_budget( + budget, + &[first, second], + &[first_receipt, second_receipt], + "head", + ); + assert_eq!(remaining.max_total_seconds, 8); + assert_eq!(remaining.max_focused_tests, 2); + } + + #[test] + fn elapsed_budget_rejects_zero_allowance_and_unknown_receipt_kind() { + for status in ["passed", "failed", "timed_out"] { + let mut receipt = accounting_receipt(status, 200); + receipt.commands[0].timeout_sec = 0; + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), None); + } + let mut receipt = accounting_receipt("passed", 200); + receipt.kind = "unknown".to_owned(); + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), None); + + let mut receipt = accounting_receipt("skipped", 0); + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), None); + receipt.commands[0].timeout_sec = 0; + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), Some(0)); + receipt.commands[0].timed_out = true; + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), None); + } + + #[test] + fn accounting_settles_actual_duration_with_conservative_rounding() { + for status in ["passed", "failed", "skipped"] { + for (ms, spent) in [(1, 1), (999, 1), (1_000, 1), (1_001, 2), (6_001, 7)] { + let lease = test_lease("focused-test", "granted", 6); + let receipt = accounting_receipt(status, ms); + let budget = + settled_focused_proof_budget(test_budget(), &[lease], &[receipt], "head"); + assert_eq!(budget.max_total_seconds, 600 - spent); + assert_eq!(budget.max_focused_tests, 3); + assert_eq!(budget.max_focused_test_files, 2); + assert_eq!(budget.per_command_timeout_sec, 300); + } + } + } + + #[test] + fn accounting_timeout_spends_allowance_and_aggregates_red_green_once() { + let mut receipt = accounting_receipt("timed_out", 1); + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), Some(6)); + receipt.commands[0].duration_ms = 6_001; + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), Some(7)); + receipt = accounting_receipt("passed", 1); + receipt.kind = "focused-red-green".to_owned(); + let mut base = receipt.commands[0].clone(); + base.side = "base-plus-tests".to_owned(); + receipt.commands.push(base); + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), Some(1)); + receipt.commands[1].status = "skipped".to_owned(); + receipt.commands[1].timeout_sec = 0; + receipt.commands[1].duration_ms = 0; + assert_eq!(focused_proof_receipt_spent_seconds(&receipt), Some(1)); + } + + #[test] + fn accounting_ambiguous_or_unbound_receipts_keep_reservation() { + let lease = test_lease("focused-test", "granted", 6); + let valid = accounting_receipt("passed", 1); + let mut bad = Vec::new(); + let mut receipt = valid.clone(); + receipt.head = "stale".to_owned(); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.kind = "focused-build".to_owned(); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.kind = "focused-red-green".to_owned(); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.id = "unrelated".to_owned(); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.commands.push(receipt.commands[0].clone()); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.commands[0].side = "unknown".to_owned(); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.commands[0].status = "running".to_owned(); + bad.push(vec![receipt]); + let mut receipt = valid.clone(); + receipt.revision = Some(RevisionRef { + digest: "a".repeat(64), + semantics: "candidate_head".to_owned(), + reviewed_commit: "b".repeat(40), + }); + bad.push(vec![receipt]); + bad.push(vec![accounting_receipt("skipped", 0)]); + bad.push(vec![valid.clone(), valid]); + bad.push(Vec::new()); + for receipts in bad { + let budget = settled_focused_proof_budget( + test_budget(), + std::slice::from_ref(&lease), + &receipts, + "head", + ); + assert_eq!(budget.max_total_seconds, 594); + } + } + + #[test] + fn accounting_duplicate_reservations_and_overflow_never_create_credit() { + let lease = test_lease("focused-test", "granted", 6); + let receipt = accounting_receipt("passed", 1); + for different_id in [false, true] { + let mut duplicate = lease.clone(); + if different_id { + duplicate.id.push_str("-second"); + } + let budget = settled_focused_proof_budget( + test_budget(), + &[lease.clone(), duplicate], + std::slice::from_ref(&receipt), + "head", + ); + assert_eq!(budget.max_total_seconds, 588); + } + let budget = remaining_focused_proof_budget( + test_budget(), + &[ + test_lease("focused-test", "granted", u64::MAX), + test_lease("focused-build", "granted", u64::MAX), + ], + ); + assert_eq!(budget.max_total_seconds, 0); + assert_eq!( + focused_proof_receipt_spent_seconds(&accounting_receipt("passed", u128::MAX)), + Some(u64::MAX) + ); + } + #[test] fn proof_budget_comes_from_runtime_profile_budgets() -> Result<()> { let profiles = builtin_profiles(); diff --git a/src/proof/build.rs b/src/proof/build.rs index b5986806a..8014166f6 100644 --- a/src/proof/build.rs +++ b/src/proof/build.rs @@ -38,7 +38,7 @@ where let mut receipts = Vec::new(); let mut leases = Vec::new(); let mut executed_tasks = 0_usize; - let mut estimated_seconds = 0_u64; + let mut spent_seconds = 0_u64; let lease_budget = proof_lease_budget(profile)?; for task in tasks { let task_timeout_sec = focused_build_task_command_timeout(&task, budget); @@ -92,7 +92,7 @@ where } if !focused_build_budget_allows_next( executed_tasks, - estimated_seconds, + spent_seconds, task_timeout_sec, budget, ) { @@ -145,16 +145,13 @@ where _ => "skipped_profile", }; let reason = format!("HEAD build proof {}: {}", head.status, head.reason); - receipts.push(focused_build_receipt( - diff, - &task, - vec![head], - result.to_owned(), - reason, - )); + let receipt = focused_build_receipt(diff, &task, vec![head], result.to_owned(), reason); + spent_seconds = spent_seconds.saturating_add( + focused_proof_receipt_spent_seconds(&receipt).unwrap_or(lease.timeout_sec), + ); + receipts.push(receipt); leases.push(lease); executed_tasks += 1; - estimated_seconds = estimated_seconds.saturating_add(task_timeout_sec); } Ok(ProofBrokerResult { proof_receipts: receipts, @@ -164,12 +161,12 @@ where fn focused_build_budget_allows_next( current_tasks: usize, - estimated_seconds: u64, + spent_seconds: u64, next_timeout_sec: u64, budget: ProofBudget, ) -> bool { current_tasks < budget.max_focused_tests - && estimated_seconds.saturating_add(next_timeout_sec) <= budget.max_total_seconds + && spent_seconds.saturating_add(next_timeout_sec) <= budget.max_total_seconds } #[cfg(test)] @@ -184,6 +181,90 @@ mod tests { use crate::tests::{test_diff, test_run_args}; use crate::*; + #[test] + fn elapsed_budget_admits_second_build_only_when_actual_time_fits() -> Result<()> { + for (first_duration_ms, expected_executions, second_result) in + [(200, 2, "head_passed"), (3_001, 1, "skipped_budget")] + { + let temp = tempfile::tempdir()?; + let out = temp.path().join("out"); + let requests = [ + "cargo check --workspace --all-targets --locked", + "cargo check --locked --package fixture", + ] + .into_iter() + .enumerate() + .map(|(i, command)| ProofRequest { + schema: "ub-review.proof_request.v1".to_owned(), + id: format!("elapsed-build-{i}"), + lane: "tests-oracle".to_owned(), + requested_by: vec!["tests-oracle".to_owned()], + command: command.to_owned(), + reason: "Bound sequential builds by actual elapsed time.".to_owned(), + cost: "focused-build".to_owned(), + timeout_sec: 4, + required: true, + status: "requested".to_owned(), + }) + .collect::>(); + let tasks = focused_build_candidates_from_requests(&requests); + assert_eq!(tasks.len(), 2); + let expected_commands = tasks + .iter() + .map(|task| task.command.clone()) + .collect::>(); + let profile = Profile { + limits: Limits { + builds: 2, + ..Limits::default() + }, + ..Profile::default() + }; + let mut commands = Vec::new(); + let result = super::run_focused_build_proof_tasks_with_runner( + temp.path(), + &out, + &test_diff(), + &profile, + &test_run_args(out.clone()), + ProofBudget { + max_focused_test_files: 2, + max_focused_tests: 2, + per_command_timeout_sec: 4, + max_total_seconds: 6, + }, + tasks, + None, + ProofExecutionPhase::ModelRequest, + |_root, argv, env, timeout, stdout, stderr, _observe_process| { + commands.push(command_display_with_env(env, argv)); + assert_eq!(timeout, 4); + fs::write(stdout, b"build fixture\n")?; + fs::write(stderr, b"")?; + Ok(CommandStatus { + exit_code: Some(0), + timed_out: false, + success: true, + reason: "deterministic elapsed-time fixture".to_owned(), + duration_ms: if commands.len() == 1 { + first_duration_ms + } else { + 200 + }, + }) + }, + )?; + assert_eq!(commands.len(), expected_executions); + assert_eq!(commands, expected_commands[..expected_executions]); + assert_eq!(result.proof_receipts.len(), 2); + assert_eq!(result.proof_receipts[0].result, "head_passed"); + assert_eq!(result.proof_receipts[1].result, second_result); + assert_eq!(result.resource_leases[0].timeout_sec, 4); + assert_eq!(result.resource_leases[1].timeout_sec, 4); + } + Ok(()) + } + #[test] fn proof_broker_v0_executes_allowlisted_focused_build_request() -> Result<()> { let temp = tempfile::tempdir()?; diff --git a/src/proof/command.rs b/src/proof/command.rs index 36904231a..5e75f4436 100644 --- a/src/proof/command.rs +++ b/src/proof/command.rs @@ -161,6 +161,7 @@ where completion_unconfirmed = true; } }; + let command_started = std::time::Instant::now(); let status = runner( command_root, &spec.argv, @@ -170,6 +171,9 @@ where &paths.stderr_path, &mut observe_process, ); + // Zero on an old error receipt means timing was unavailable. Preserve a + // measured submillisecond failure as one millisecond instead of losing it. + let command_elapsed_ms = command_started.elapsed().as_millis().max(1); if completion_unconfirmed { let error = match status { Err(error) => error, @@ -302,7 +306,7 @@ where format!("focused proof command unavailable: {error:#}"), None, false, - 0, + command_elapsed_ms, ), }; Ok(ProofCommandReceipt { diff --git a/src/proof/intent.rs b/src/proof/intent.rs index f049dbab6..d2e1518a2 100644 --- a/src/proof/intent.rs +++ b/src/proof/intent.rs @@ -306,7 +306,18 @@ fn resolve_build_target( .cmp(&(right.package.as_str(), right.target_name())) }); match candidates.len() { - 1 => Ok(candidates.remove(0)), + 1 => { + let candidate = candidates.remove(0); + if let Some(target) = &candidate.target + && matches!(target.kind.as_str(), "bin" | "test" | "example" | "bench") + { + return Err(format!( + "named focused build target `{label}` of kind `{}` is unsupported by the proof broker; choose `cargo-package:{}` only if package-level checking answers the proof question; otherwise leave the proof unresolved", + target.kind, candidate.package + )); + } + Ok(candidate) + } 0 => Err(format!( "no approved focused build target matches `{label}`; choose a declared package using `cargo-package:`" )), @@ -733,14 +744,14 @@ mod tests { ); assert!(package_target.target.is_none()); - let bin_target = - resolve_build_target(&workspace, &diff(&[]), "cargo-target:ub-review/ub-review") - .map_err(anyhow::Error::msg)?; assert_eq!( - bin_target.command, - "cargo check --locked --package ub-review --bin ub-review" + expected_error(resolve_build_target( + &workspace, + &diff(&[]), + "cargo-target:ub-review/ub-review" + ))?, + "named focused build target `cargo-target:ub-review/ub-review` of kind `bin` is unsupported by the proof broker; choose `cargo-package:ub-review` only if package-level checking answers the proof question; otherwise leave the proof unresolved" ); - assert_eq!(bin_target.target_name(), "ub-review"); let package = &workspace.packages[0]; let lib = CargoTargetInfo { @@ -1068,4 +1079,320 @@ mod tests { assert_eq!(selected.command, "cargo check --locked --package nested"); Ok(()) } + + fn named_target_fixture() -> Result { + let temp = tempfile::tempdir()?; + std::fs::write( + temp.path().join("Cargo.toml"), + r#"[package] +name = "proof-fixture" +version = "0.0.0" +edition = "2024" +[workspace] +[[bin]] +name = "app" +path = "app.rs" +[[test]] +name = "integration" +path = "integration.rs" +[[example]] +name = "demo" +path = "demo.rs" +test = true +[[bench]] +name = "speed" +path = "speed.rs" +"#, + )?; + for path in ["app.rs", "integration.rs", "demo.rs", "speed.rs"] { + std::fs::write(temp.path().join(path), "fn main() {}\n")?; + } + Ok(temp) + } + + #[test] + fn named_build_intents_are_declined_before_scheduling() -> Result<()> { + let temp = named_target_fixture()?; + for (kind, target, command) in [ + ( + "bin", + "app", + "cargo check --locked --package proof-fixture --bin app", + ), + ( + "test", + "integration", + "cargo check --locked --package proof-fixture --test integration", + ), + ( + "example", + "demo", + "cargo check --locked --package proof-fixture --example demo", + ), + ( + "bench", + "speed", + "cargo check --locked --package proof-fixture --bench speed", + ), + ] { + for separator in ["::", "/"] { + let label = format!("cargo-target:proof-fixture{separator}{target}"); + let mut input = intent(ProofKind::FocusedBuild, &label); + input.resolved_request_ids.push("stale-request".to_owned()); + let result = + resolve_model_proof_intents(temp.path(), &diff(&[]), &[input], &[], budget())?; + assert_eq!(result.intents[0].status, "unsupported_target", "{label}"); + assert_eq!( + result.intents[0].resolution_reason, + format!( + "named focused build target `{label}` of kind `{kind}` is unsupported by the proof broker; choose `cargo-package:proof-fixture` only if package-level checking answers the proof question; otherwise leave the proof unresolved" + ) + ); + assert!(result.intents[0].resolved_request_ids.is_empty()); + assert!(result.proof_requests.is_empty()); + assert!(focused_build_candidates_from_requests(&result.proof_requests).is_empty()); + assert!(focused_test_candidates_from_requests(&result.proof_requests).is_empty()); + let tasks = build_proof_planner_output( + &diff(&[]), + &Profile::default(), + &result.proof_requests, + )? + .proof_tasks; + assert!(tasks.is_empty()); + assert!(focused_build_command_spec(command).is_none()); + let broker_status = proof_request_status(command, "focused-build"); + assert_eq!(broker_status, "unsupported"); + println!( + "named_target_receipt {}", + serde_json::json!({ + "intent": result.intents[0], "generated_requests": result.proof_requests, + "declined_command": command, "broker_status": broker_status, "planner_tasks": tasks, + }) + ); + } + } + Ok(()) + } + + #[test] + fn named_target_supported_intents_keep_exact_requests() -> Result<()> { + let temp = named_target_fixture()?; + for (kind, label, cost, command) in [ + ( + ProofKind::FocusedTest, + "cargo-test:proof-fixture::integration", + "focused-test", + "cargo test --locked --package proof-fixture --test integration", + ), + ( + ProofKind::BasePlusTests, + "cargo-test:proof-fixture::integration", + "focused-test", + "cargo test --locked --package proof-fixture --test integration", + ), + ( + ProofKind::FocusedBuild, + "cargo-package:proof-fixture", + "focused-build", + "cargo check --locked --package proof-fixture", + ), + ( + ProofKind::FocusedBuild, + "workspace", + "focused-build", + "cargo check --locked --workspace", + ), + ] { + let result = resolve_model_proof_intents( + temp.path(), + &diff(&[]), + &[intent(kind, label)], + &[], + budget(), + )?; + assert_eq!(result.intents[0].status, "resolved"); + assert_eq!(result.proof_requests.len(), 1); + let request = &result.proof_requests[0]; + assert_eq!(request.command, command); + assert_eq!(request.cost, cost); + assert_eq!(request.timeout_sec, 300); + assert!(request.required); + assert_eq!( + result.intents[0].resolved_request_ids, + std::slice::from_ref(&request.id) + ); + let test_tasks = focused_test_candidates_from_requests(&result.proof_requests); + let build_tasks = focused_build_candidates_from_requests(&result.proof_requests); + assert_eq!( + (test_tasks.len(), build_tasks.len()), + if cost == "focused-test" { + (1, 0) + } else { + (0, 1) + } + ); + let spec = if cost == "focused-test" { + focused_cargo_test_command_spec(command) + } else { + focused_build_command_spec(command) + }; + assert_eq!( + spec.map(|spec| spec.argv.join(" ")).as_deref(), + Some(command) + ); + let broker_status = proof_request_status(command, cost); + assert_eq!(broker_status, "requested"); + let tasks = build_proof_planner_output( + &diff(&[]), + &Profile::default(), + &result.proof_requests, + )? + .proof_tasks; + assert_eq!(tasks.len(), 1); + assert_eq!(tasks[0].request_ids, std::slice::from_ref(&request.id)); + println!( + "named_target_receipt {}", + serde_json::json!({ + "intent": result.intents[0], "generated_requests": result.proof_requests, + "test_tasks": test_tasks.len(), "build_tasks": build_tasks.len(), "broker_status": broker_status, "planner_tasks": tasks, + }) + ); + } + Ok(()) + } + + #[test] + fn named_target_literal_admission_and_malicious_controls() -> Result<()> { + for (command, test, build) in [ + ( + "cargo test --locked --package proof-fixture --test integration", + true, + false, + ), + ( + "cargo test --locked --package proof-fixture --bin app named_probe", + true, + false, + ), + ( + "cargo test --locked --package proof-fixture --example demo named_probe", + true, + false, + ), + ( + "cargo test --locked --package proof-fixture --bin app", + false, + false, + ), + ( + "cargo test --locked --package proof-fixture --example demo", + false, + false, + ), + ( + "cargo test --locked --package proof-fixture --bench speed named_probe", + false, + false, + ), + ( + "cargo check --locked --package proof-fixture --bins", + false, + true, + ), + ( + "cargo check --locked --package proof-fixture --tests", + false, + true, + ), + ( + "cargo check --locked --package proof-fixture --examples", + false, + true, + ), + ( + "cargo check --locked --package proof-fixture --benches", + false, + true, + ), + ( + "cargo check --locked --package proof-fixture --bin app", + false, + false, + ), + ( + "cargo check --locked --package proof-fixture --test integration", + false, + false, + ), + ( + "cargo check --locked --package proof-fixture --example demo", + false, + false, + ), + ( + "cargo check --locked --package proof-fixture --bench speed", + false, + false, + ), + ( + "cargo check --locked --package proof-fixture --bins extra", + false, + false, + ), + ( + "cargo test --locked --package proof-fixture --test integration -- --format json", + false, + false, + ), + ( + "cargo test --locked --package proof-fixture --test integration && cargo build", + false, + false, + ), + ] { + assert_eq!( + focused_cargo_test_command_spec(command).is_some(), + test, + "{command}" + ); + assert_eq!( + focused_build_command_spec(command).is_some(), + build, + "{command}" + ); + assert_eq!( + proof_request_allowed_v0(command, "focused-test"), + test, + "{command}" + ); + assert_eq!( + proof_request_allowed_v0(command, "focused-build"), + build, + "{command}" + ); + println!( + "named_target_admission_receipt {}", + serde_json::json!({"command": command, "focused_test": proof_request_status(command, "focused-test"), "focused_build": proof_request_status(command, "focused-build")}) + ); + } + let temp = named_target_fixture()?; + for label in [ + "cargo-target:proof-fixture::app --release", + "cargo-target:proof-fixture::app;cargo", + "cargo-target:proof-fixture::../app", + "cargo-target:proof-fixture::$(cargo)", + ] { + let result = resolve_model_proof_intents( + temp.path(), + &diff(&[]), + &[intent(ProofKind::FocusedBuild, label)], + &[], + budget(), + )?; + assert_eq!(result.intents[0].status, "rejected_target", "{label}"); + assert!(result.proof_requests.is_empty()); + assert!(result.intents[0].resolved_request_ids.is_empty()); + } + Ok(()) + } } diff --git a/src/proof/planner.rs b/src/proof/planner.rs index fa5e6bf04..a869e18ca 100644 --- a/src/proof/planner.rs +++ b/src/proof/planner.rs @@ -424,7 +424,8 @@ pub(crate) fn write_proof_request_artifacts( let portfolio_path = review_dir.join("proof_portfolio.json"); if !portfolio_path.exists() { let total_budget = proof_budget(profile)?; - let remaining_budget = remaining_focused_proof_budget(total_budget, resource_leases); + let remaining_budget = + settled_focused_proof_budget(total_budget, resource_leases, proof_receipts, &diff.head); let test_candidates = focused_test_candidates_from_diff(diff, proof_requests, None); let build_candidates = focused_build_candidates_from_requests(proof_requests); let portfolio = select_proof_portfolio(ProofPortfolioInput { @@ -452,7 +453,7 @@ pub(crate) fn write_proof_request_artifacts( schema: PROOF_PORTFOLIO_SCHEMA, phase: "final", head: diff.head.clone(), - budget_seconds: total_budget.max_total_seconds, + budget_seconds: remaining_budget.max_total_seconds, remaining_seconds: portfolio.remaining_seconds, candidate_count: test_candidates.len() + build_candidates.len(), candidate_tasks: portfolio_candidate_tasks( @@ -895,6 +896,89 @@ mod tests { Ok(()) } + #[test] + fn elapsed_budget_fallback_portfolio_preserves_settled_capacity() -> Result<()> { + let temp = tempfile::tempdir()?; + let mut diff = test_diff(); + diff.changed_files.clear(); + diff.patch.clear(); + let profile = Profile { + limits: Limits { + builds: 1, + tests: 1, + ..Limits::default() + }, + budgets: Budgets { + proof_max_focused_tests: 2, + proof_max_focused_test_files: 2, + proof_command_timeout_sec: 4, + proof_total_timeout_sec: 6, + hard_timeout_sec: 30, + proof_cpu: 1, + proof_memory_mb: 32, + proof_disk_mb: 32, + proof_scratch: true, + ..Budgets::default() + }, + ..Profile::default() + }; + let requests = vec![ProofRequest { + schema: "ub-review.proof_request.v1".to_owned(), + id: "elapsed-fallback-build".to_owned(), + lane: "tests-oracle".to_owned(), + requested_by: vec!["tests-oracle".to_owned()], + command: "cargo check --workspace --all-targets --locked".to_owned(), + reason: "Preserve settled capacity in a fresh fallback portfolio.".to_owned(), + cost: "focused-build".to_owned(), + timeout_sec: 4, + required: true, + status: "requested".to_owned(), + }]; + let tasks = focused_build_candidates_from_requests(&requests); + assert_eq!(tasks.len(), 1); + let lease = focused_build_resource_lease( + &tasks[0], + proof_budget(&profile)?, + proof_lease_budget(&profile)?, + "granted", + "fixture admission", + ); + let receipt = focused_build_receipt( + &diff, + &tasks[0], + vec![ProofCommandReceipt { + side: "head".to_owned(), + command: tasks[0].command.clone(), + env: Default::default(), + status: "passed".to_owned(), + exit_code: Some(0), + timed_out: false, + timeout_sec: 4, + duration_ms: 200, + stdout: String::new(), + stderr: String::new(), + reason: "deterministic elapsed-time fixture".to_owned(), + }], + "head_passed".to_owned(), + "completed fixture".to_owned(), + ); + write_proof_request_artifacts( + temp.path(), + &diff, + &profile, + &requests, + &[receipt], + std::slice::from_ref(&lease), + )?; + let portfolio: serde_json::Value = + serde_json::from_slice(&fs::read(temp.path().join("review/proof_portfolio.json"))?)?; + assert_eq!(portfolio["budget_seconds"], 5); + assert_eq!(portfolio["remaining_seconds"], 5); + assert_eq!(portfolio["selected_task_ids"], serde_json::json!([])); + assert_eq!(lease.timeout_sec, 4); + Ok(()) + } + #[test] fn proof_request_artifacts_group_duplicate_commands_once() -> Result<()> { let proof_requests = vec![ diff --git a/src/proof/red_green.rs b/src/proof/red_green.rs index 5c34166bf..65a622317 100644 --- a/src/proof/red_green.rs +++ b/src/proof/red_green.rs @@ -42,7 +42,7 @@ where let mut leases = Vec::new(); let mut executed_tasks = 0_usize; let mut executed_files = BTreeSet::new(); - let mut estimated_seconds = 0_u64; + let mut spent_seconds = 0_u64; let lease_budget = proof_lease_budget(profile)?; for task in tasks { let task_timeout_sec = focused_test_task_command_timeout(&task, budget); @@ -108,7 +108,7 @@ where executed_tasks, &executed_files, &task.file, - estimated_seconds, + spent_seconds, task_timeout_sec, task.mode.command_count(), budget, @@ -186,11 +186,12 @@ where &mut prepare_base_plus_tests, )?, }; + spent_seconds = spent_seconds.saturating_add( + focused_proof_receipt_spent_seconds(&receipt).unwrap_or(lease.timeout_sec), + ); leases.push(lease); receipts.push(receipt); executed_tasks += 1; - estimated_seconds = estimated_seconds - .saturating_add(task_timeout_sec.saturating_mul(task.mode.command_count())); } Ok(ProofBrokerResult { proof_receipts: receipts, From c1b761405e74a7512e66268913465458184af5c2 Mon Sep 17 00:00:00 2001 From: "Steven Zimmerman, CPA" <15812269+EffortlessSteven@users.noreply.github.com> Date: Sat, 17 Oct 2026 16:46:15 -0400 Subject: [PATCH 4/4] fix(proof): refuse every named build intent before scheduling Reject library, custom-build and non-enumerated named Cargo targets before requests or tasks; preserve explicit package recovery, command templates and admission permissions. Add literal native refusal controls and update two disposition reasons to cite completed budget tests. Prepared-head: b951c0b906cfe4b953107e99be656d743beaec3f Source-tree: 5b7cc3ba96385142bdb84efc4a9c9d55d46590c4 --- .ripr/suppressions.toml | 4 +-- src/proof/intent.rs | 75 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/.ripr/suppressions.toml b/.ripr/suppressions.toml index b85f01360..089e31194 100644 --- a/.ripr/suppressions.toml +++ b/.ripr/suppressions.toml @@ -34631,13 +34631,13 @@ reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. kind = "exposure_gap" finding_id = "probe:src_proof_build.rs:call_deletion:90a08fae" owner = "ub-review/core" -reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Expression belongs to base build.rs:157; current155 closes the loop. The old estimated_seconds ceiling charge was intentionally removed, not a surviving production call. Exact base/current source comparison; actual new spent accumulator at149-151; multi-build test will discriminate restored old behavior. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Expression belongs to base build.rs:157; current155 closes the loop. The old estimated_seconds ceiling charge was intentionally removed, not a surviving production call. Exact base/current source comparison; elapsed_budget_admits_second_build_only_when_actual_time_fits runs the actual broker loop and rejects both compiled restored-ceiling and free-credit mutants with literal two-versus-one execution counts. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." [[suppressions]] kind = "exposure_gap" finding_id = "probe:src_proof_build.rs:field_construction:f7b05a10" owner = "ub-review/core" -reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Renamed helper parameter spent_seconds is declaration syntax; the meaningful effect is its use in admission arithmetic. focused_build_budget_allows_next checks spent+next against allocation; rows26/27 identify the needed actual caller test. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." +reason = "Issue #1507; pinned RIPR0.10.0 local c21b312->4f6aea8 exact raw probe. Renamed helper parameter spent_seconds is declaration syntax; the meaningful effect is its use in admission arithmetic. focused_build_budget_allows_next checks spent+next against allocation; elapsed_budget_admits_second_build_only_when_actual_time_fits exercises the actual caller with total6/cap4 and first-duration200ms versus3001ms, with compiled overcharge/free-credit controls rejected. Static limitation documented by ripr-swarm#1054/#1055; no runtime proof credit is supplied by this disposition. Re-verify after semantic edits or tool upgrades; dated review/expiry follows policy/allow.toml#non-rust-ripr-suppressions." [[suppressions]] kind = "exposure_gap" diff --git a/src/proof/intent.rs b/src/proof/intent.rs index d2e1518a2..a80c89b03 100644 --- a/src/proof/intent.rs +++ b/src/proof/intent.rs @@ -308,9 +308,7 @@ fn resolve_build_target( match candidates.len() { 1 => { let candidate = candidates.remove(0); - if let Some(target) = &candidate.target - && matches!(target.kind.as_str(), "bin" | "test" | "example" | "bench") - { + if let Some(target) = &candidate.target { return Err(format!( "named focused build target `{label}` of kind `{}` is unsupported by the proof broker; choose `cargo-package:{}` only if package-level checking answers the proof question; otherwise leave the proof unresolved", target.kind, candidate.package @@ -1088,7 +1086,11 @@ mod tests { name = "proof-fixture" version = "0.0.0" edition = "2024" +build = "build.rs" [workspace] +[lib] +name = "library" +path = "library.rs" [[bin]] name = "app" path = "app.rs" @@ -1104,7 +1106,14 @@ name = "speed" path = "speed.rs" "#, )?; - for path in ["app.rs", "integration.rs", "demo.rs", "speed.rs"] { + for path in [ + "library.rs", + "build.rs", + "app.rs", + "integration.rs", + "demo.rs", + "speed.rs", + ] { std::fs::write(temp.path().join(path), "fn main() {}\n")?; } Ok(temp) @@ -1174,6 +1183,64 @@ path = "speed.rs" Ok(()) } + #[test] + fn remaining_named_build_kinds_are_declined_before_scheduling() -> Result<()> { + let temp = named_target_fixture()?; + for (kind, target) in [("lib", "library"), ("custom-build", "build-script-build")] { + for separator in ["::", "/"] { + let label = format!("cargo-target:proof-fixture{separator}{target}"); + let mut input = intent(ProofKind::FocusedBuild, &label); + input.resolved_request_ids.push("stale-request".to_owned()); + let result = + resolve_model_proof_intents(temp.path(), &diff(&[]), &[input], &[], budget())?; + assert_eq!(result.intents[0].status, "unsupported_target", "{label}"); + assert_eq!( + result.intents[0].resolution_reason, + format!( + "named focused build target `{label}` of kind `{kind}` is unsupported by the proof broker; choose `cargo-package:proof-fixture` only if package-level checking answers the proof question; otherwise leave the proof unresolved" + ) + ); + assert!(result.intents[0].resolved_request_ids.is_empty()); + assert!(result.proof_requests.is_empty()); + assert!(focused_build_candidates_from_requests(&result.proof_requests).is_empty()); + assert!(focused_test_candidates_from_requests(&result.proof_requests).is_empty()); + assert!( + build_proof_planner_output( + &diff(&[]), + &Profile::default(), + &result.proof_requests, + )? + .proof_tasks + .is_empty() + ); + } + } + assert!( + focused_build_command_spec( + "cargo check --locked --package proof-fixture --lib library" + ) + .is_none() + ); + assert!( + focused_build_command_spec("cargo check --locked --package proof-fixture").is_some() + ); + let Some(mut graph) = parse_cargo_workspace(temp.path()) else { + anyhow::bail!("named-target fixture metadata is unavailable"); + }; + graph.packages[0].targets[0].kind = "future-target-kind".to_owned(); + let target_name = &graph.packages[0].targets[0].name; + for separator in ["::", "/"] { + let label = format!("cargo-target:proof-fixture{separator}{target_name}"); + assert_eq!( + resolve_build_target(&graph, &diff(&[]), &label).err(), + Some(format!( + "named focused build target `{label}` of kind `future-target-kind` is unsupported by the proof broker; choose `cargo-package:proof-fixture` only if package-level checking answers the proof question; otherwise leave the proof unresolved" + )) + ); + } + Ok(()) + } + #[test] fn named_target_supported_intents_keep_exact_requests() -> Result<()> { let temp = named_target_fixture()?;