Skip to content

analysis(rust): resolve bounded std string and index operations from exact test inputs (#3215 P3) #3295

Closed

Description

@EffortlessSteven

Parent: #3215
Depends on: #3294
Follows limitation vocabulary: #3271

Problem

After a changed binding is connected to its predicate use, the #3215 reproducer still cannot become satisfiable unless RIPR can conservatively evaluate the short deterministic operation chain that produces the operand values.

The first required family is common parser/lexer string and index code driven by literal test inputs:

let start = delim.chars().next().map_or(0, |c| c.len_utf8());
let end = input.rfind(delim).map_or(0, |idx| idx);
if end == start { ... }

Today #3271 can name this as rust_value_propagation_unresolved, but exact inputs such as input = "abc", delim = "" do not produce exact values at the predicate. The analyzer therefore cannot distinguish existing proof from missing proof.

Required outcome

Add a bounded, typed, conservative value-transfer layer for exact literal inputs and a controlled set of deterministic Rust/std operations. The evaluator is an evidence producer, not a general interpreter.

V1 operation families

str::strip_prefix / strip_suffix
str::find / rfind
str::starts_with / ends_with / contains
str::len
chars().next() / next_back()
char::len_utf8
Option::map_or with literal default and a supported pure closure
checked_add / checked_sub on exact integer inputs
bounded string slicing from exact resolved indices when UTF-8 boundaries are established
literal-driven simple string match arms

Each operation result is one of:

exact(value, provenance)
not_applicable
unsupported(kind, earliest_edge)
ambiguous(reason)
invalid_boundary(reason)

Unknown must remain unknown. No operation may become exact from token resemblance, an oracle expectation, or a successful runtime test.

Evidence contract

For every exact value retain:

source test/input identity
input literal and type
operation family
receiver/arguments
closure/default where applicable
result value
source spans
bounded chain depth

The test oracle remains separate. Exact input evaluation may establish activation/infection evidence; the exact assertion establishes observation/discrimination only when it targets the same sink.

Fix plan

  1. Introduce one typed value-transfer interface shared by the supported operation families.
  2. Evaluate only pure, deterministic expressions whose inputs are exact and whose semantics are implemented explicitly.
  3. Bound chain length and collection/string size; disclose the limit rather than silently stopping.
  4. Preserve UTF-8 boundary semantics for slicing and len_utf8.
  5. Handle Option::map_or only when both the default and the mapped closure are supported; keep map_or_else, arbitrary closures, member lookalikes, and trait-overridden methods unsupported.
  6. Feed exact results into analysis(rust): propagate changed bindings into same-function predicate operands (#3215 P2) #3294's predicate operands and existing activation/missing-discriminator models.
  7. Keep sibling-field and wrong-sink strong assertions as negative controls.
  8. Add per-family removal experiments or a table-driven discriminator showing each family changes at least one expected result and cannot be replaced by a constant.

Required fixtures

  • the rfind/chars.next/len_utf8 empty-delimiter equality boundary;
  • positive and negative strip_prefix/strip_suffix paths;
  • find and rfind with present, absent, empty, and multi-byte needles;
  • starts_with/ends_with/contains true and false controls;
  • next/next_back on empty, ASCII, and multi-byte strings;
  • checked arithmetic success and overflow/underflow;
  • valid and invalid UTF-8 slicing boundaries;
  • literal string match arms plus wildcard and duplicate-text controls;
  • map_or_else, custom methods with the same names, dynamic inputs, mutable captures, and unsupported closures as fail-closed negatives.

Acceptance

  • The source ripr#1429 equality-boundary fixture resolves start, end, and end == start for exact supported inputs.
  • Positive and negative tests can establish distinct predicate outcomes without a fabricated value.
  • Every supported operation emits typed provenance and every unsupported edge names the earliest operation.
  • Multi-byte UTF-8 cases preserve character/byte semantics.
  • map_or_else, lookalike methods, dynamic receivers, unsupported closures, overflow, and invalid slicing remain limited.
  • A strong assertion on the wrong sink does not credit discrimination.
  • Existing exact tests can move a supported seam out of rust_value_propagation_unresolved; missing boundary inputs still produce a concrete missing discriminator.
  • CLI, JSON, LSP explanation, and gap-ledger evidence agree on exact versus limited value state.
  • Removal/discriminator experiments fail when any claimed family is neutered.

Verification

cargo test -p ripr --lib analysis::value -- --nocapture
cargo test -p ripr --lib analysis::activation -- --nocapture
cargo test -p ripr --lib analysis::classifier -- --nocapture
cargo xtask fixtures
cargo xtask goldens check
cargo xtask check-output-contracts
cargo xtask check-static-language
cargo xtask check-evidence-promotion-honesty
cargo xtask check-pr
git diff --check

Non-goals

Claim boundary

Completion resolves a bounded set of deterministic std string/index expressions from exact test inputs and feeds those values into the exact predicate relation. It does not prove arbitrary Rust value flow or helper-chain semantics.

Activity

  1. coderabbitai commented on Aug 16, 2026

    @coderabbitai
    🔗 Related PRs

    #3193 - test(fixtures): isolate unchanged proof identity [merged]
    #3203 - test(gate): reject vacuous non-promotion charters [merged]
    #3243 - analysis(classify): whitespace-stable wildcard-discard detection (#3233) [merged]
    #3271 - feat(analysis): name bounded Rust value propagation limits [merged]
    #3273 - fix(rust): classify cfg(test) helpers as evidence [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    status/needs-work
    on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/needs-work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions