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

feat: support fetching and showing fuels_version in fuelup show #410

Merged
merged 6 commits into from
Mar 9, 2023

Conversation

eightfilms
Copy link
Contributor

@eightfilms eightfilms commented Mar 3, 2023

closes #289

This doesn't really address the issue directly because it shows the compatible fuels version on a component level rather than the toolchain level, which I think is probably better.

I was contemplating between dealing with this on the toolchain-level or on the component-level, and it came down to where we wanted the logic for getting the fuels version to live.

The problem

Ultimately, trying to get the fuels version means we have to unavoidably fetch it from the Cargo.toml directly, whether we solve it on the toolchain-level or component-level.

On the toolchain-level, we could publish the info in our channels, but that means that on a component-level we do not know what fuels version is compatible.

On the component-level, we could fetch the info directly on the first installation, but that means in some areas of fuelup we have to hardcode the logic to fetch the info directly, which may be ugly (see). However this method is a lot more flexible and we can leverage the store by storing a fuels_version textfile that is cached in the component directory, rather than store it in the toolchain directory.

Solution

Ultimately I decided to go with shipping this feature using the latter method.

My justification:

  • In both circumstances we have to maintain some ugly logic that hard codes the URI of the Cargo.toml file to fetch and read the fuels version, so either way we would have to maintain such code. If we had chosen to ship this feature on the toolchain-level, we would have this logic in the build-channel script anyway. I'd say the upside of shipping this on the backend side means that we don't need new fuelup releases in the case that the URI changes, and that could be a strong case for NOT taking this approach.

  • The latter method also allows us to show the tested fuels version per component instead of per toolchain, which I think is better DevEx for users.

At this point of my thought process I'm not sure if there's any cataclysmic downside to doing it as such instead of the original proposed method. I'm still open minded as to the best approach, so let me know if there's some flaw in my thinking here!

@eightfilms eightfilms marked this pull request as ready for review March 3, 2023 09:20
@eightfilms
Copy link
Contributor Author

This should be tested, but currently the tests are not aware of the store yet - created #411 to track this and prioritizing that, since that will require changes to the test env setup that doesn't concern this PR as a whole.

@eightfilms eightfilms requested a review from a team March 6, 2023 06:56
@eureka-cpu
Copy link
Contributor

Seems reasonable

sdankel
sdankel previously approved these changes Mar 7, 2023
Copy link
Member

@sdankel sdankel left a comment

Choose a reason for hiding this comment

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

Couple nits, otherwise LGTM!

src/download.rs Show resolved Hide resolved
src/download.rs Show resolved Hide resolved
src/store.rs Outdated Show resolved Hide resolved
src/store.rs Outdated Show resolved Hide resolved
@@ -89,6 +90,7 @@ latest-{target} (default)
"#
);
assert!(stdout.contains(expected_stdout));
assert!(!stdout.contains("fuels versions"));
Copy link
Member

Choose a reason for hiding this comment

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

The heading "fuels versions" is a little confusing to me because I think of fuels as the SDK, not forc. Perhaps a better heading would be "Fuel component versions" ?

Copy link
Member

Choose a reason for hiding this comment

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

Or even just "Component versions" or "Package versions" since the use is running fuelup, so the versions much be pertaining to fuel.

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 heading "fuels versions" is a little confusing to me because I think of fuels as the SDK

Yeah actually, that is the point! I think there was a past version of forc that deviated from fuels which resulted in incompatibility between certain SDK methods and forc itself. So the feature introduced in this PR is meant to serve as a sort of 'guide' as to what fuels version the component was tested/built against.

I agree though it might need better naming or more explanation behind what 'fuels versions' mean 🤔

@eightfilms
Copy link
Contributor Author

I merged the other PR that introduces testing to this PR - apologies but i'm going to have to re-request reviews soon

src/download.rs Show resolved Hide resolved
@eightfilms eightfilms merged commit fb2c511 into master Mar 9, 2023
@eightfilms eightfilms deleted the bing/show-fuels-version branch March 9, 2023 05:42
@eightfilms eightfilms mentioned this pull request Apr 6, 2023
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.

Provide a way to view SDK version compatibility for official toolchains
4 participants