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(github-release): release name is packageName #757

Conversation

joeldodge79
Copy link
Collaborator

@joeldodge79 joeldodge79 commented Feb 10, 2021

Forming the contents of a release was factored out of GitHubRelease in
#720
The argument provide for the release name was accidentally swapped to be
the packagePrefix (e.g. sans @scope/ for node packages).

@joeldodge79 joeldodge79 requested a review from a team as a code owner February 10, 2021 01:53
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Feb 10, 2021
@codecov
Copy link

codecov bot commented Feb 10, 2021

Codecov Report

Merging #757 (2837716) into master (b277b89) will increase coverage by 0.20%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #757      +/-   ##
==========================================
+ Coverage   90.02%   90.22%   +0.20%     
==========================================
  Files          57       57              
  Lines        7490     7470      -20     
  Branches      674      715      +41     
==========================================
- Hits         6743     6740       -3     
+ Misses        746      729      -17     
  Partials        1        1              
Impacted Files Coverage Δ
src/github-release.ts 100.00% <100.00%> (ø)
src/github.ts 83.76% <100.00%> (+0.01%) ⬆️
src/release-pr.ts 91.42% <100.00%> (ø)
src/bin/release-please.ts 88.38% <0.00%> (+6.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b277b89...2983cf4. Read the comment docs.

Copy link
Collaborator Author

@joeldodge79 joeldodge79 left a comment

Choose a reason for hiding this comment

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

some explanatory comments inline

exports['GitHubRelease createRelease attempts to guess package name for release 1'] = {
"tag_name": "v1.0.3",
"body": "\n* entry",
"name": "@google-cloud/foo v1.0.3",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can see from the old (and stale as of #720) snapshot that the request payload to /repos/releases used to include the full package name

Comment on lines -54 to -56
"tag_name": "@google-cloud/foo-v1.0.3",
"body": "\n* entry",
"name": "@google-cloud/foo @google-cloud/foo-v1.0.3",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this one confuses me a bit. I would have expected it to be

"name": "@google-cloud/foo foo-v1.0.3"

I'm guessing it's because that prior to #720 either the way the test was setup or the actual source code was not correctly removing the @scope/ from the tag_name. Not a big deal, just pointing out that we have evidence of behavior that suggests we were not stripping out @scope/ from tag_name prior to #720 ...

Comment on lines +292 to +298
.withArgs(
'@google-cloud/foo',
'foo-v1.0.3',
'abc123',
'\n* entry',
false
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A few times now this withArgs has caused me to scratch my head for a minute when the code path stops sending the exact args. The result is undefined. Reading the docs you'd think that not matching the args would fall through to the original implementation but that's not the case. I know this is a "stub" as opposed to a "mock" so it shouldn't really be in the business of verifying that it's used properly. However, the mis-matched withArgs behavior results in confusing failures: "undefined has no property html_url" so... what to folks think about adding a rejects or throwsArg(0) to any stub that we use withArgs on in order to make diagnosing test failures easier?

It's done once here on L288 above. I suggest we try to always add it (except in cases where we need the stub to reject calls mimicking a 403 or 404 from the GH api) Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, it'd be nice if it threw on an unexpected input which we do similar to the get file stubs. We can grab the stub and have the fallthrough case reject, but it's more verbose to write in the test.

@joeldodge79
Copy link
Collaborator Author

cc @chingor13

@joeldodge79 joeldodge79 force-pushed the github-release-name-vs-tag-name-bugfix branch from 610af0b to 2837716 Compare February 11, 2021 00:48
Forming the contents of a release was factored out of GitHubRelease in
googleapis#720
The argument provide for the release name was accidentally swapped to be
the packagePrefix (e.g. sans @scope for node packages).
@joeldodge79 joeldodge79 force-pushed the github-release-name-vs-tag-name-bugfix branch from 62ad6b0 to 2983cf4 Compare February 11, 2021 18:30
@bcoe bcoe added the automerge Merge the pull request once unit tests and other checks pass. label Feb 11, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit 869f1a1 into googleapis:master Feb 11, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants