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

Fix: --strategies on CLI do not seem to override disabled-strategies in the manifest #1857

Merged
merged 21 commits into from
Aug 3, 2024

Conversation

NobodyXu
Copy link
Member

@NobodyXu NobodyXu commented Aug 3, 2024

Fixed #1851

Forward `args.disabled_strategies`

Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
crates/bin/src/entry.rs Outdated Show resolved Hide resolved
Signed-off-by: Jiahao XU <[email protected]>
crates/bin/src/entry.rs Outdated Show resolved Hide resolved
Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu NobodyXu enabled auto-merge August 3, 2024 01:35
@NobodyXu NobodyXu added this pull request to the merge queue Aug 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 3, 2024
Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu NobodyXu enabled auto-merge August 3, 2024 01:59
@NobodyXu NobodyXu added this pull request to the merge queue Aug 3, 2024
@NobodyXu NobodyXu removed this pull request from the merge queue due to a manual request Aug 3, 2024
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
e2e-tests/strategies.sh Outdated Show resolved Hide resolved
@NobodyXu NobodyXu enabled auto-merge August 3, 2024 03:57
@NobodyXu NobodyXu added this pull request to the merge queue Aug 3, 2024
@NobodyXu NobodyXu removed this pull request from the merge queue due to a manual request Aug 3, 2024
@NobodyXu NobodyXu enabled auto-merge August 3, 2024 04:04
@NobodyXu NobodyXu disabled auto-merge August 3, 2024 04:07
e2e-tests/strategies.sh Outdated Show resolved Hide resolved
Make sure both --strategies and --disable-strategies is tested

Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu
Copy link
Member Author

NobodyXu commented Aug 3, 2024

cc @ilyagr does this look good to you?

@NobodyXu NobodyXu requested a review from passcod August 3, 2024 04:10
e2e-tests/strategies.sh Outdated Show resolved Hide resolved
Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu NobodyXu added this pull request to the merge queue Aug 3, 2024
Merged via the queue into main with commit ee94b8b Aug 3, 2024
23 checks passed
@NobodyXu NobodyXu deleted the fix/1851 branch August 3, 2024 05:43
## Test --strategies overriding `disabled-strategies=["compile"]` in Cargo.toml
"./$1" binstall --no-confirm --manifest-path "manifests/strategies-test-override-Cargo.toml" --strategies compile [email protected]

## Test --disable-strategies overriding `disabled-strategies=["compile"]` in Cargo.toml
Copy link

Choose a reason for hiding this comment

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

I only glanced at this so far, but my first instinct would be to expect the CLI --disable-strategies to only ever decrease the set of allowed strategies. So, I would make it so the situation of this test disallow all strategies.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the current implementation might makes sense?

After all cli options can overrides anything from the maintainer, previously we have pkg-url, pkg-bin and pkg-fmt which overrides the maintainers' configurations.

Copy link

Choose a reason for hiding this comment

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

I think disabled-strategies should be treated more like specifying both on the same command-line.

Here's a scenario: let's say the maintainer disabled quick-install, but the user doesn't know about it. Let's say Github downloads are temporarily down for whatever reason. The user runs cargo binstall package, it uses compile, and they don't like it. So, one natural thing to try would be to interrupt that and try cargo binstall --disable-strategies compile.

I think that it wouldn't be great if this installed the package from quickinstall without the user realizing that he's getting a different thing than the GitHub download they usually gets. I think the "good" outcome here would be if binstall told the user that it can't download the package from GitHub, and thus can't install anything. (It could also tell the user that quick-install was disabled by maintainer, and to use --strategies quick-install if the user wants to override that).

I don't think this scenario would be very common, but it's enough to form my opinion of what behavior is a bit better. Either way, we should make sure that what happens is documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, maybe we should add a new option for this...

Copy link
Member Author

Choose a reason for hiding this comment

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

cc @passcod I don't have much idea on how we could fix/improve this, do you have any idea/suggestion for this?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good enough to do this:

[merge disable strategies so that] binstall tells the user that it can't download the package from GitHub, and thus can't install anything.

and make sure that a positive (eg. enable quickinstall) overrides a negative (eg disable quickinstall) regardless of source (cli or maintainer).

I don't think it's worth having a message for the user until we get feedback to that effect, given this should be pretty rare.

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.

--strategies on CLI do not seem to override disabled-strategies in the manifest
3 participants