Skip to content

Conversation

@wasabigeek
Copy link
Contributor

Prereq to #320.

@wasabigeek
Copy link
Contributor Author

wasabigeek commented Jun 3, 2020

@dblock, not entirely sure if I've approached the patching (dd6b484) the right way, appreciate feedback. It was a bit painful to patch chat.rb, wondering if there's a better way - this is what I did:

  • it seems the underlying generated code drifted since the last patch so all the existing patches failed, I had to regenerate it without applying the patch (commented out the patching code in the rake task)
  • committed the new generated code
  • manually copied the code from old patches into the generated code
  • ran the git diff command as mentioned in the README

Seems like there aren't that many method patches, so hopefully I won't need to repeat this many times when we add the deprecation message.

There's also a bunch of new methods / commands that got added in 80a3962, I wasn't sure if you wanted to add them, it's an easy revert anyway.

@wasabigeek wasabigeek marked this pull request as ready for review June 3, 2020 14:37
Copy link
Collaborator

@dblock dblock left a comment

Choose a reason for hiding this comment

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

Something's wrong with the generated patches and the + stuff.

Let's split up this PR into manageable things to review, maybe start by taking out the reconnected business?

The CONTRIBUTING doc could use a better getting started for the patches. Since you've just done it, maybe update it too?

end

def reconnected?
@reconnected ||= false
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems unrelated, but regardless you don't want to have a side-effect on calling a property method of assigning anything. So this could be !! @reconnected to coerce it into a boolean, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I might have left this by accident while looking at slack-ruby/slack-ruby-bot#244 >_<

attachments = JSON.dump(attachments) unless attachments.is_a?(String)
options = options.merge(attachments: attachments)
end
+ # attachments must be passed as an encoded JSON string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Those + signs look like a patch bug, this code won't run :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly missing something here, but isn't this the output of the diff? I was able to run the rake task fine, so I don't think it causes an issue with the patching. Example output from the older files also has the + signs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Bah, I don't know what I was thinking, this is a patch file. You're right.

So what happened here? Before we were removing the code that did JSON.dump and now we put it back? Seems like the new(er) version is correct.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh looks like multiple patches got merged into one. I get it, ignore me.

@wasabigeek
Copy link
Contributor Author

Let's split up this PR into manageable things to review, maybe start by taking out the reconnected business?

I've kept only the chat changes for now!

@dangerpr-bot
Copy link

dangerpr-bot commented Jun 4, 2020

1 Warning
⚠️ There’re library changes, but not tests. That’s OK as long as you’re refactoring existing code.

Generated by 🚫 Danger

##### Resolving Patch Errors
The auto-generated method files may drift overtime e.g. new arguments may be added or descriptions changed. Since previous patches were based on the older auto-generated files, git may be unable to apply them to the new files. Resolving them requires some good ol' splicing:
1. Comment out the patching code in `lib/tasks/web.rake`:
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO for later, we should add a rake task option that skips patching, so rake slack:api:update --no-patch or something like that.

@dblock dblock merged commit 9b20556 into slack-ruby:master Jun 4, 2020
@dblock
Copy link
Collaborator

dblock commented Jun 4, 2020

Merged, 👍

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