Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom "Satisfies" terms #330

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

apiraino
Copy link
Contributor

@apiraino apiraino commented Apr 9, 2024

cargo-bisect-rustc prints "Yes" or "No" on whether or not a build
satisfies the condition that it is looking for (default: Yes =
reproduces regression, No = does not reproduce the regression). However,
this terminology is either confusing or backwards depending on what is
being tested.

For example, one can use one of --regress options (f.e. --regress success) to find when a regression was fixed. In that sense, the "old"
is "regression found" and the "new" is "regression fixed", which is
backwards from the normal behavior.

Taking inspiration from git bisect, we are introducing custom terms for
Satisfies. This is implemented with 2 new cli options:

--term-old, will apply for Satisfy::Yes (condition requested is matched)
--term-new, will apply for Satisfy::No (condition requested is NOT matched)

This will allow the user to specify their own wording. Then, the
--regress option could set the defaults for those terms appropriate for
the regression type.

Fixes #316

@ehuss
Copy link
Collaborator

ehuss commented Apr 9, 2024

Nice! I'm not sure if there is more work to do since this is in a Draft state.

One initial comment I have is that it seems like maybe the terms are backwards. My expectation is that this would work pretty much the same as git bisect where the default assumption is that you are looking for when a regression starts (and that is also cargo-bisect-rustc's default). With git bisect, the term "good" is synonymous with "old" which means that it successfully compiles. The term "bad" is synonymous with "new" which means that it fails to compile.

This PR seems to treat "good" meaning it found the regression, which is the opposite of git's behavior.

One of the reasons I suggested in #316 to use the old/new terminology is so that it is less ambiguous with good/bad. Good/bad could mean "good, I found the regression" or "good, it successfully compiles", which are opposites. I think with old/new, there is no ambiguity since there is only one direction of time.

@apiraino apiraino force-pushed the custom-satisfy-terms branch 3 times, most recently from bd38135 to e66020b Compare April 10, 2024 16:36
@apiraino
Copy link
Contributor Author

apiraino commented Apr 10, 2024

... since there is only one direction of time

@ehuss Hmm you're right. When I look at it from that point of view it makes def. more sense, sorry for not applying cleanly your suggestion.

Now it should work as expected. Can you check it one more time when you have a sec? Thanks

The draft state was because this patch stlll needs some documentation (I will update the book) and the tests are giving me headaches (the trycmd crate is not updating the .h .out files - looking into it...)

@apiraino apiraino marked this pull request as ready for review April 10, 2024 16:54
@apiraino apiraino force-pushed the custom-satisfy-terms branch 2 times, most recently from 8dd0ac0 to ef37a65 Compare April 15, 2024 13:34
@apiraino
Copy link
Contributor Author

@ehuss ok now tests are passing.

Feel free to review when you have a sec. I especially want to be sure the documentation explains the logic correctly and clearly.

thanks

@apiraino
Copy link
Contributor Author

r? @ehuss

when you have a chance

tests/cmd/start-in-future.stderr Outdated Show resolved Hide resolved
Comment on lines 179 to 193
let msg_yes = if regress == &RegressOn::Error || regress == &RegressOn::Ice {
// YES: condition satisfied, reproduces the regression
term_old
} else {
// NO: condition not satisfied, does not reproduce the regression
term_new
};

let msg_no = if regress == &RegressOn::Error || regress == &RegressOn::Ice {
// YES: condition satisfied, compiles successfully, does not reproduce the regression
term_new
} else {
// NO: condition not satisfied, the regression still reproduces
term_old
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

These messages still seem to be backwards to me.

For example, if I run cargo-bisect-rustc --term-old=compiles --term-new=errors, it prints "errors" when it successfully compiles the old code and "compiles" when it fails to compile the new code.

Also, not a blocker, but I think it would be nice to customize the default old/new terms based on the RegressOn setting. For example:

RegressOn Old New
Error "Successfully compiles" "Compile error"
Success "Compile error" "Successfully compiles"
Ice "Did not ICE" "Found ICE"
NonIce "Found ICE" "Did not ICE"
NonError "Compile error (no ICE)" "Successfully compiles"

That way there is a clear indication of what cbr observed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ehuss I have restarted this patchset from scratch. Flipped the previous logic wrong and corrected/clarified the commit message. Are we there?

if the new commit looks good, I will update in a second commit documentation and tests

thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new default messages are very nice and will implement them in a second patch

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good, thanks!

Copy link
Contributor Author

@apiraino apiraino May 14, 2024

Choose a reason for hiding this comment

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

OK, so @ehuss now what's the next step? Merge? Or is there anything else to do in this PR?

EDIT: oh, I'll fix the tests

@apiraino apiraino force-pushed the custom-satisfy-terms branch 2 times, most recently from 1292a3b to 556a00b Compare May 3, 2024 15:23
@apiraino apiraino closed this May 3, 2024
@apiraino apiraino force-pushed the custom-satisfy-terms branch from 556a00b to 0859f47 Compare May 3, 2024 15:54
@apiraino apiraino reopened this May 3, 2024
cargo-bisect-rustc prints "Yes" or "No" on whether or not a build
satisfies the condition that it is looking for (default: Yes =
reproduces regression, No = does not reproduce the regression). However,
this terminology is either confusing or backwards depending on what is
being tested.

For example, one can use one of `--regress` options (f.e. `--regress
success`) to find when a regression was fixed. In that sense, the "old"
is "regression found" and the "new" is "regression fixed", which is
backwards from the normal behavior.

Taking inspiration from git bisect, we are introducing custom terms for
Satisfies. This is implemented with 2 new cli options:

--term-old, will apply for Satisfy::Yes (condition requested is matched)
--term-new, will apply for Satisfy::No (condition requested is NOT matched)

This will allow the user to specify their own wording. Then, the
--regress option could set the defaults for those terms appropriate for
the regression type.

Fixes rust-lang#316
@apiraino apiraino force-pushed the custom-satisfy-terms branch from dee4e39 to ba7eb63 Compare May 14, 2024 08:01
Copy link
Collaborator

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss merged commit e75f187 into rust-lang:master May 14, 2024
4 checks passed
@apiraino apiraino deleted the custom-satisfy-terms branch May 22, 2024 08:40
apiraino added a commit to apiraino/cargo-bisect-rustc that referenced this pull request May 22, 2024
The default values for --term-old and --term-new could use some
reasonable defaults, here the mapping:

| RegressOn | Old                       | New                     |
| --------------------------------------------------------------- |
| Error     | "Successfully compiles"   | "Compile error"         |
| Success   | "Compile error"           | "Successfully compiles" |
| Ice       | "Did not ICE"             | "Found ICE"             |
| NonIce    | "Found ICE"               | "Did not ICE"           |
| NonError  | "Compile error (no ICE)"  | "Successfully compiles" |

Suggested here:
rust-lang#330 (comment)
apiraino added a commit to apiraino/cargo-bisect-rustc that referenced this pull request May 22, 2024
The default values for --term-old and --term-new could use some
reasonable defaults, here the mapping:

| RegressOn | Old                       | New                     |
| --------------------------------------------------------------- |
| Error     | "Successfully compiles"   | "Compile error"         |
| Success   | "Compile error"           | "Successfully compiles" |
| Ice       | "Did not ICE"             | "Found ICE"             |
| NonIce    | "Found ICE"               | "Did not ICE"           |
| NonError  | "Compile error (no ICE)"  | "Successfully compiles" |

Suggested here:
rust-lang#330 (comment)
@apiraino apiraino mentioned this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add custom "Satisfies" terms
2 participants