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: update server_version #233

Merged
merged 1 commit into from
Mar 16, 2023
Merged

fix: update server_version #233

merged 1 commit into from
Mar 16, 2023

Conversation

obycode
Copy link
Member

@obycode obycode commented Mar 9, 2023

The /v2/info endpoint is updated to report "subnet-node" instead of
"stacks-node".

@obycode obycode requested a review from jbencin March 9, 2023 02:33
@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2023

Codecov Report

Merging #233 (347fc31) into master (409b9be) will decrease coverage by 1.21%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #233      +/-   ##
==========================================
- Coverage   93.47%   92.26%   -1.21%     
==========================================
  Files           6        6              
  Lines         337      336       -1     
==========================================
- Hits          315      310       -5     
- Misses         22       26       +4     

see 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@obycode obycode force-pushed the fix/server_version branch 2 times, most recently from 99916e6 to 612e470 Compare March 15, 2023 02:19
@jbencin
Copy link
Member

jbencin commented Mar 15, 2023

I have a few comments/questions, some of which are not directly related to the changes in this PR:

  • The environment variable STACKS_NODE_VERSION still shows up in Dockerfiles in this repo. I don't think it's ever used, but these occurrences should probably be removed
  • Why do we repeat the logic to generate the version string in both main.rs and rpc.rs? Can't we just call the one in main.rs from rpc.rs?
  • Looking at this function:
    fn version() -> String {
      stacks::version_string(
        "subnet-node",
        option_env!("SUBNET_NODE_VERSION")
          .or(option_env!("CARGO_PKG_VERSION"))
          .unwrap_or("0.0.0.0"),
      )
    }
    I don't understand why we would ever want to return CARGO_PKG_VERSION (which is still 0.0.1 and not useful). If we don't know SUBNET_NODE_VERSION, shouldn't we give a response indicating that rather than something misleading?

@obycode
Copy link
Member Author

obycode commented Mar 15, 2023

  • The environment variable STACKS_NODE_VERSION still shows up in Dockerfiles in this repo. I don't think it's ever used, but these occurrences should probably be removed

Good catch. I think these ARGs should be renamed to SUBNET_NODE_VERSION as well.

  • Why do we repeat the logic to generate the version string in both main.rs and rpc.rs? Can't we just call the one in main.rs from rpc.rs?

Since main.rs is in test/stacks-node, I don't think we want to create a reference in that direction, but it could make sense to move a shared function somewhere and use it from both places.

I don't understand why we would ever want to return CARGO_PKG_VERSION (which is still 0.0.1 and not useful). If we don't know SUBNET_NODE_VERSION, shouldn't we give a response indicating that rather than something misleading?

I think this is reasonable. We may even want to make CARGO_PKG_VERSION the default once we've setup a proper release process for this repo (that's what Clarinet does for example). That version number in the Cargo.toml should eventually be incremented by our release process.

@obycode
Copy link
Member Author

obycode commented Mar 15, 2023

I'm going to leave those two calls to version_string as-is for the time being.

The `/v2/info` endpoint is updated to report "subnet-node" instead of
"stacks-node".
@obycode obycode force-pushed the fix/server_version branch from 612e470 to 347fc31 Compare March 15, 2023 15:24
Copy link
Member

@jbencin jbencin left a comment

Choose a reason for hiding this comment

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

Looks good, we can address those other things I mentioned in the future

@obycode obycode merged commit ca1d9c0 into master Mar 16, 2023
@obycode obycode deleted the fix/server_version branch March 16, 2023 11:16
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.

3 participants