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

Make snapshot: a synonym for resolver #4341

Merged
merged 8 commits into from
Oct 9, 2018

Conversation

aleksejkozin
Copy link
Contributor

@aleksejkozin aleksejkozin commented Oct 5, 2018

  • Any changes that could be relevant to users have been recorded in the ChangeLog.md
  • The documentation has been updated, if necessary.

Fixing #4256

@aleksejkozin
Copy link
Contributor Author

At this point I've added unit test

@aleksejkozin
Copy link
Contributor Author

@snoyberg can you review my current code?

Copy link
Contributor

@mihaimaruseac mihaimaruseac 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. Add a line to documentation and then it's ready to merge.
thanks

@snoyberg
Copy link
Contributor

snoyberg commented Oct 6, 2018

Agreed with @mihaimaruseac, thanks!

@aleksejkozin
Copy link
Contributor Author

@snoyberg as you mentioned in #4256

Implementation: in both snapshots and stack.yaml files

I'm not quite sure what the snapshots file is and how to use it. Could you please point me on a piece of documentation or code?

Also, there are multiple mentions of "resolver" in the source that I've missed before:

Config.hs

, ["resolver" .= resolver]

I'm not sure that if I rename it to "snapshot" everything will work fine. I can delete it without any test fail
What should I do?

Other files

ConfigCmd.hs
Freeze.hs
Init.hs
Options/ResolverParser.hs
Curator/Unpack.hs
Pantry/Types.hs

What should I do with them?

@snoyberg
Copy link
Contributor

snoyberg commented Oct 8, 2018

For snapshots files, this is what's known as "custom snapshots" and lives in the pantry part of the codebase. See:

https://github.com/commercialhaskell/stack/blob/master/doc/pantry.md

I believe that, for now, we should continue to use resolver when generating these files to keep better backwards compatibility. Therefore

  • ConfigCmd: leave as-is
  • Freeze: leave as-is
  • Init: leave as-is
  • ResolverParser: support --snapshot as well
  • Unpack.hs: don't worry about the entire subs/curator subdir for now
  • Pantry/Types: modify the FromJSON instance, but not the ToJSON instance

Does that make sense?

@aleksejkozin
Copy link
Contributor Author

Does that make sense?

Partially, I still have a lot of questions 😃

  1. I'm not sure what you meant by "ResolverParser: support --snapshot as well"
    Should I add the --snapshot support? If so, I don't know how to add a synonym to abstractResolverOptsParser, I think I should fix GlobalOptsMonoid but I don't know how
  2. I don't know what to write about the FromJSON SnapshotLayer fix into ChangeLog.md
  3. I'm not sure what to write into yaml_configuration.md
  4. "resolver" mentions are scattered across all the documentation in different examples. Should I fix all if i? Make a search for resolver: in all .md files and replace mentions

@snoyberg
Copy link
Contributor

snoyberg commented Oct 9, 2018

  1. Let's punt on this for now, we can figure it out later. It's definitely not needed immediately. For the record: I think you can use the alternative instance for the CLI parser to add support for "resolver" and "snapshot".
  2. No changelog entries necessary in pantry, it's never been released. The changelog in Stack itself should be sufficient.
  3. I can update the docs for you if you'd like, but it would be something like "Starting with Stack 2.0, snapshot is accepted as a synonym for resolver. Only one of these fields is permitted, not both."
  4. Not yet, I'd say after some period of time of snapshot being supported we would take a pass at updating the docs.

@aleksejkozin
Copy link
Contributor Author

Both Travis and AppVeyor builds has failed due to timeout, I don't know how to fix the issue

@snoyberg
Copy link
Contributor

snoyberg commented Oct 9, 2018

Looks like it passed this time. Even the Travis job that "failed" actually succeeded, it just didn't complete the cache upload. So I believe this is ready for final review. @mihaimaruseac did you want to do that, or would you like me to?

@mihaimaruseac
Copy link
Contributor

Thanks

@mihaimaruseac mihaimaruseac merged commit a7d3fb7 into commercialhaskell:master Oct 9, 2018
@aleksejkozin
Copy link
Contributor Author

@mihaimaruseac thx for the reviews

This was my first code contribution to an open source project ever, I'm proud of myself 😄

I would be able to write better code for Stack if you guys would point on some of my weak points so I could work on them.
If you have some free time could you please answer:

  • What one thing in the code I could write better?
  • Were there any issues in our communication?

Thx!

@snoyberg
Copy link
Contributor

I've never actually received that question on open source work before, I really appreciate your interest.

I'll give you a big communication strength: you pointed out when you were delayed, and then quite clearly pointed out problems you were having. It made it very easy to assist you.

I'm honestly very impressed with the code, and the fact that you included tests: many contributors don't do that. The only thing I'd recommend looking into is applicative parsers for CLI flags, so that you could more easily add --snapshot support on the command line on the future if desired.

I'd be very happy if you're interested in working on more issues. If you want any recommendations of good ones to onboard with, let me know.

@mihaimaruseac
Copy link
Contributor

I second @snoyberg, this is the first time I see this, congrats.

From my point of view, all went perfect in handling this

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