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: create config fix tool #14342

Merged
merged 32 commits into from
Jan 10, 2023
Merged

feat: create config fix tool #14342

merged 32 commits into from
Jan 10, 2023

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Dec 16, 2022

Description

Closes: #13661, #11051

  1. prepare tooling
  2. implement confix migrate (config fix #13661) (WIP)
  3. implement confix set/get (Create A Command for Interacting With Configurations #11051)

Still decided to go with the standalone way, so it is re-usable.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

tools/confix/go.mod Outdated Show resolved Hide resolved
tools/confix/confix.go Fixed Show fixed Hide fixed
tools/confix/cmd/condiff/main.go Fixed Show fixed Hide fixed
tools/confix/confix.go Fixed Show fixed Hide fixed
tools/confix/cmd/condiff/main.go Fixed Show fixed Hide fixed
@github-actions github-actions bot added the C:CLI label Jan 4, 2023
tools/confix/confix.go Fixed Show fixed Hide fixed
tools/confix/confix.go Fixed Show fixed Hide fixed
@julienrbrt
Copy link
Member Author

So I think we can ignore the dependency review for this one, as gin does not affect confix at all.
If we were to add a replace tag this would break the go install.

@julienrbrt julienrbrt marked this pull request as ready for review January 5, 2023 15:00
@julienrbrt julienrbrt requested a review from a team as a code owner January 5, 2023 15:00
tools/confix/confix.go Fixed Show fixed Hide fixed
tools/confix/confix.go Fixed Show fixed Hide fixed
tools/confix/cmd/diff.go Fixed Show resolved Hide resolved
tools/confix/cmd/diff.go Fixed Show fixed Hide fixed
type MigrationMap map[string]transform.Plan

var Migrations = MigrationMap{
"v0.45": nil,
Copy link
Member Author

@julienrbrt julienrbrt Jan 5, 2023

Choose a reason for hiding this comment

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

So, here I wonder what is best, as the tool works standalone as well.
I think there are a few options:

  1. store the config files directly in the tool
    • pro: can work standalone
    • con: need to add the file in the tool at each release, as well for minor release with configuration changes
  2. use the SDK version of the app and marshal to config, and have a diff
    • pro: we don't mind about the different versions, as we just diff and add what is missing
    • con: as we use the SDK version probably work with only one version, especially standalone
  3. write migrations per versions
    • pro: can work standalone, similar to genesis migrate
    • con: need to detect which version you are migrating from (or assuming you can only bump one by one version - like genesis migrate), need to be updated at every configuration change

We can as well combine these options.

Copy link
Member Author

@julienrbrt julienrbrt Jan 8, 2023

Choose a reason for hiding this comment

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

Step one is already implemented. Working on supporting 2 (as per #14342 (comment)).
3 duplicates 1 and is more manual.

Adding some docs in the release process as well for 1.

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

left some comments. some things are unclear to me

client/config/config_test.go Outdated Show resolved Hide resolved
tools/confix/cmd/diff.go Outdated Show resolved Hide resolved
tools/confix/cmd/diff.go Fixed Show resolved Hide resolved

func MigrateCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "migrate [target-version] [app-toml-path] (options)",
Copy link
Member

Choose a reason for hiding this comment

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

im not sure this needs version? if this is part of the rootcmd it would check if the version config of the binary matches the one on disk.

Copy link
Member Author

@julienrbrt julienrbrt Jan 6, 2023

Choose a reason for hiding this comment

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

I wanted to keep the same UX that for genesis migration. So you basically say to which version you want to migrate. This way it works standalone and as well in the rootcmd.

Copy link
Member

Choose a reason for hiding this comment

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

this would be when the user is using the tool standalone, otherwise it would look at the binary right?

@julienrbrt
Copy link
Member Author

I can do that in a follow-up PR, as it increases the size of this PR: #14342 (comment). This leaves the diff a bit more readable. Then we can tag only when the follow-up PR is merged. Wdyt @tac0turtle?

Fixing the last tests, but the sonarcloud key should still be added in the repo.

@sonarcloud
Copy link

sonarcloud bot commented Jan 9, 2023

[Cosmos SDK] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

utACK

@sonarcloud
Copy link

sonarcloud bot commented Jan 10, 2023

[Cosmos SDK - SimApp] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Jan 10, 2023

[Cosmos SDK - Confix] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarcloud
Copy link

sonarcloud bot commented Jan 10, 2023

[Cosmos SDK - Rosetta] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@julienrbrt
Copy link
Member Author

Adding auto-merge, the follow-up will add the diff command and #14342 (comment).

@julienrbrt julienrbrt enabled auto-merge (squash) January 10, 2023 10:26
@julienrbrt julienrbrt merged commit 9742029 into main Jan 10, 2023
@julienrbrt julienrbrt deleted the julien/config-fix branch January 10, 2023 10:28
0xmuralik pushed a commit to 0xmuralik/cosmos-sdk that referenced this pull request Jan 12, 2023
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config fix
5 participants