Skip to content

Conversation

MozirDmitriy
Copy link
Contributor

Motivation

The selection criterion is inverted:

  • Comment: “selected” if the proportion of new finds is above the threshold.
  • Code: is_favored is set when the proportion is below the threshold (< FAVORABILITY_THRESHOLD).
  • This reverses the meaning and distorts metrics.favored_items.

Solution

  • Fix incorrect favored comparison from < to > so only productive corpus entries (ratio > threshold) are marked as favored.
  • Add unit tests to assert favored transitions (> threshold true, < threshold false, == threshold false with strict >) and eviction behavior (favored protected, non‑favored evicted).
  • This prevents productive seeds from being evicted and aligns code with documented intent.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! oh, I think you're on to something here, indeed if for example 40 new finds produced from 100 mutations that would be 0.4 while if only let's say 20 new finds from 100 mutations that will make 0.2 so indeed favored should be determined by greater than 0.3
Will make some tests with this fix, meanwhile mind to fix the failing favored_sets_false_and_metrics_decrement_when_ratio_lt_threshold test you added?
CC @0xalpharush

@0xalpharush
Copy link
Contributor

This seems right. The refactoring I made here should have inverted it like is done in this PR. Thanks @MozirDmitriy
https://github.com/foundry-rs/foundry/pull/10988/files#diff-6672478b3ff4d87907eb18ba56f9037395efbe25bb567b668d9b82a580d0b0c5L298-L299

@grandizzy grandizzy self-requested a review October 1, 2025 12:39
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you!

@grandizzy grandizzy enabled auto-merge (squash) October 1, 2025 12:39
@grandizzy grandizzy merged commit 6e91f79 into foundry-rs:master Oct 1, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants