Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .ripr/traceability.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21116,8 +21116,8 @@ tests = [
"crates/ripr/tests/out_parameter_oracle.rs::a_constant_conditional_sign_row_does_not_come_from_the_out_parameter_route",
"crates/ripr/tests/out_parameter_oracle.rs::a_fmt_write_owner_and_a_non_empty_initial_local_behave_as_specified",
"crates/ripr/tests/out_parameter_oracle.rs::a_same_named_method_on_another_or_unresolved_receiver_is_not_credited",
"crates/ripr/tests/collection_out_parameter_repair.rs::count_read_of_the_passed_vector_is_followed_in_both_commands",
"crates/ripr/tests/collection_out_parameter_repair.rs::emptiness_read_of_the_passed_vector_is_followed_in_both_commands",
"crates/ripr/tests/collection_out_parameter_repair.rs::count_read_of_the_passed_vector_starts_in_both_commands",
"crates/ripr/tests/collection_out_parameter_repair.rs::emptiness_read_keeps_the_contents_check_reason",
"crates/ripr/tests/collection_out_parameter_repair.rs::reading_a_different_binding_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::reading_the_pushed_item_is_not_this_rules_to_grade",
"crates/ripr/tests/collection_out_parameter_repair.rs::reborrowed_vector_is_not_followed",
Expand All @@ -21128,14 +21128,23 @@ tests = [
"crates/ripr/tests/collection_out_parameter_repair.rs::second_push_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::ignored_test_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::should_panic_test_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::string_count_read_is_followed_in_both_commands",
"crates/ripr/tests/collection_out_parameter_repair.rs::string_count_read_starts_in_both_commands",
"crates/ripr/tests/collection_out_parameter_repair.rs::push_argument_that_may_return_first_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::exactly_checked_vector_is_already_noticed_not_a_contents_gap",
"crates/ripr/tests/collection_out_parameter_repair.rs::async_owner_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::final_contents_check_without_semicolon_is_not_this_rules_to_grade",
"crates/ripr/tests/collection_out_parameter_repair.rs::count_read_that_does_not_pin_the_push_keeps_the_contents_check_reason",
"crates/ripr/tests/collection_out_parameter_repair.rs::inner_attribute_in_the_test_body_is_not_followed",
"crates/ripr/tests/collection_out_parameter_repair.rs::stub_writes_an_exact_contents_check_of_the_pushed_buffer",
"crates/ripr/tests/collection_out_parameter_repair.rs::stub_for_a_push_into_a_local_vector_still_needs_an_observer",
"crates/ripr/tests/collection_out_parameter_repair.rs::stub_for_a_conditional_push_into_the_buffer_still_needs_an_observer",
"crates/ripr/tests/collection_out_parameter_repair.rs::stub_for_a_local_that_shadows_the_buffer_still_needs_an_observer",
"crates/ripr/tests/collection_out_parameter_repair.rs::inline_count_read_with_no_editable_test_starts_in_neither_command",
"crates/ripr/src/analysis/repair_route.rs::tests::contents_check_is_proposed_only_for_a_marked_side_effect_push",
"crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs::tests::count_reads_of_a_fresh_vector_or_string_are_followed",
"crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs::tests::reads_calls_and_statements_that_break_the_straight_line_are_refused",
"crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs::tests::gated_tests_shadowed_buffers_and_skippable_pushes_are_refused",
"crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs::tests::only_an_exact_nonzero_count_pins_the_push",
]
fixtures = [
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
"fixtures/out_parameter_unrelated_write_no_promote",
Expand All @@ -21146,6 +21155,10 @@ code = [
"crates/ripr/src/analysis/classify/out_parameter.rs",
"crates/ripr/src/analysis/classify/propagation_witness/collection_out_parameter.rs",
"crates/ripr/src/analysis/repair_route.rs",
"crates/ripr/src/analysis/test_stub.rs",
"crates/ripr/src/analysis/test_grip_evidence.rs",
"crates/ripr/src/analysis/classifier/evidence.rs",
"crates/ripr/src/app/task_first.rs",
]
outputs = [
"docs/specs/RIPR-SPEC-0351-out-parameter-oracle-credit.md",
Expand Down
9 changes: 9 additions & 0 deletions changelog.d/11402-collection-contents-check-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- section: Fixed -->
- When a test passes its own empty vector or string as `&mut` to a function
that pushes into it, and checks an exact count that only a pushed item can
make true (`assert_eq!(b.len(), 1)`), `ripr check`
now reads a deleted push as noticed. Both `ripr check` and `ripr repair` then
start a repair on the changed pushed value. `ripr agent stub` writes that
test as an exact check of the full contents, not a mock (#11402).
- `ripr check` no longer offers a repair start that `ripr repair` would
refuse because there is no test file it may edit (#11402).
6 changes: 3 additions & 3 deletions changelog.d/11402-collection-out-parameter-propagation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
- When a test passes its own empty vector or string as `&mut` to a function
that pushes into it, and checks only how many items it holds, `ripr check`
and `ripr repair` no longer say the changed value cannot be followed. Both
now give the same reason for not starting a repair: the test needs an exact
check of the full contents it reads back, which ripr cannot write yet
(#11402).
give the same reason when they do not start a repair: the test needs an
exact count that would fail if nothing were pushed, and until then the full
contents can be checked by hand (#11402).
36 changes: 24 additions & 12 deletions crates/ripr/src/analysis/classifier/evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ use crate::analysis::classify::{
ProbeContext, PropagationWitnessV1, ReturnOracleAdmission, TransitiveReachIndex,
WrapperEntryPairing, activation_and_boundary_input, assertion_compares_hand_built_field,
assertion_observes_collection_argument, assertion_observes_scope_end, assertion_out_parameter,
body_contains_owner_call, call_parameter_names, callee_is_unique, chain_entry_pin_admits,
chain_forwards_to_observed_hops, chain_passes_effect_target_to_observed_hops, classify,
confidence_score, constructor_starts_empty, contains_as_whole_word, current_path_witness_with,
direct_call_name, direct_collection_mutation_receiver, error_path_arm_probe,
expected_operand_value, fallible_check_receipt, fallible_literal_witness,
function_returns_value, getter_plainly_reads, getter_plainly_reads_key,
has_same_test_boundary_oracle_pairing, helper_only_reach, helper_pins_owner_call,
infection_evidence_for_owner, is_drop_destructor, local_flow_sinks, method_cannot_store,
observes_returned_element_field, operand_only_pin, oracle_crediting_relations,
outer_imported_names, owner_touches_field_only_at, package_prefix, parameter_rebound,
propagation_evidence_with_witness, pushed_collection_compared_whole, pushed_literal_path,
reach_evidence, returned_array_construction_plain, reveal_outcome,
assertion_pins_pushed_collection_count, body_contains_owner_call, call_parameter_names,
callee_is_unique, chain_entry_pin_admits, chain_forwards_to_observed_hops,
chain_passes_effect_target_to_observed_hops, classify, confidence_score,
constructor_starts_empty, contains_as_whole_word, current_path_witness_with, direct_call_name,
direct_collection_mutation_receiver, error_path_arm_probe, expected_operand_value,
fallible_check_receipt, fallible_literal_witness, function_returns_value, getter_plainly_reads,
getter_plainly_reads_key, has_same_test_boundary_oracle_pairing, helper_only_reach,
helper_pins_owner_call, infection_evidence_for_owner, is_drop_destructor, local_flow_sinks,
method_cannot_store, observes_returned_element_field, operand_only_pin,
oracle_crediting_relations, outer_imported_names, owner_touches_field_only_at, package_prefix,
parameter_rebound, propagation_evidence_with_witness, pushed_collection_compared_whole,
pushed_literal_path, reach_evidence, returned_array_construction_plain, reveal_outcome,
same_test_pairing_missing_summary, setter_plainly_writes, signature_parameters,
unconditional_owner_insert_field, unexercised_mask_bits, wrapper_return_boundary_pinned,
};
Expand Down Expand Up @@ -1214,6 +1214,18 @@ impl ClassifiedProbeEvidence {
assertion,
pin_syntax,
)
// #11402: a count read that pins the single push
// into the passed local notices the deleted push,
// by the rule the call-presence seam reads too.
|| (matches!(context.probe.family, ProbeFamily::CallDeletion)
&& assertion_pins_pushed_collection_count(
receiver,
owner,
context.index,
test,
assertion,
pin_syntax,
))
})
},
pushed_literal_observed: &|test, assertion| {
Expand Down
12 changes: 8 additions & 4 deletions crates/ripr/src/analysis/classify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ pub(in crate::analysis) use infection::{
pub(in crate::analysis) use literal_length_boundary::refine_literal_length_boundary;
pub(in crate::analysis) use mask_pin::unexercised_mask_bits;
pub(in crate::analysis) use operand_pin::{operand_only_pin, outer_imported_names};
pub(in crate::analysis) use out_parameter::{assertion_out_parameter, expression_writes_parameter};
pub(in crate::analysis) use out_parameter::{
assertion_out_parameter, expression_writes_parameter, file_shadows_buffer_types,
};
pub(in crate::analysis) use owner_pin::{
AssertionRefusal, OwnerPinSyntax, OwnerReturnPin, WithheldMacroBindings, direct_call_name,
equality_condition_operands, expected_operand_value, function_declaration_is_async,
Expand All @@ -153,9 +155,11 @@ pub(in crate::analysis) use pinned_shape::{
pub(in crate::analysis) use propagation_witness::{
PropagationWitnessV1, assertion_compares_hand_built_field,
assertion_observes_collection_argument, assertion_observes_direct_collection_for_probe,
assigned_field_path, concat_literal_tail, concat_tail_witness, current_path_witness_with,
direct_collection_mutation_receiver, field_assignment_target, owner_may_exit_before_line,
retain_returned_ledger, returned_ledger_witness, test_counts_pushed_collection_argument,
assertion_pins_pushed_collection_count, assigned_field_path, concat_literal_tail,
concat_tail_witness, current_path_witness_with, direct_collection_mutation_receiver,
field_assignment_target, owner_may_exit_before_line, retain_returned_ledger,
returned_ledger_witness, sole_pushed_buffer_at, test_count_pins_pushed_collection,
test_counts_pushed_collection_argument,
};
pub(in crate::analysis) use propagation_witness::{
constant_tail_witness, fallible_literal_witness, format_tail_witness, result_map_witness,
Expand Down
5 changes: 4 additions & 1 deletion crates/ripr/src/analysis/classify/propagation_witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use sha2::{Digest, Sha256};
mod collection_argument;
pub(in crate::analysis) use collection_argument::assertion_observes_collection_argument;
mod collection_out_parameter;
pub(in crate::analysis) use collection_out_parameter::test_counts_pushed_collection_argument;
pub(in crate::analysis) use collection_out_parameter::{
assertion_pins_pushed_collection_count, sole_pushed_buffer_at,
test_count_pins_pushed_collection, test_counts_pushed_collection_argument,
};

const SCHEMA_VERSION: u16 = 1;

Expand Down
Loading
Loading