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

x/build/maintner: useless github mutations #35985

Closed
bradfitz opened this issue Dec 5, 2019 · 3 comments
Closed

x/build/maintner: useless github mutations #35985

bradfitz opened this issue Dec 5, 2019 · 3 comments
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

bradfitz commented Dec 5, 2019

In https://go-review.googlesource.com/c/build/+/209962 I added a maintwatch command to let me tail the maintner mutation log.

I've seen these mutations fly by a few times now:

github_issue: <
  owner: "golang"
  repo: "sys"
  number: 40
  pull_request: true
>
github_issue: <
  owner: "golang"
  repo: "sys"
  number: 34
  pull_request: true
>
github_issue: <
  owner: "golang"
  repo: "tools"
  number: 152
  pull_request: true
>
github_issue: <
  owner: "golang"
  repo: "tools"
  number: 117
  pull_request: true
>
github_issue: <
  owner: "golang"
  repo: "lint"
  number: 458
  pull_request: true
>
github_issue: <
  owner: "golang"
  repo: "lint"
  number: 405
  pull_request: true
>

Looks like this started with golang/build@93b7f03 (https://go-review.googlesource.com/69590).

/cc @andybons

@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 5, 2019
@gopherbot gopherbot added this to the Unreleased milestone Dec 5, 2019
@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Dec 5, 2019
@bradfitz
Copy link
Contributor Author

bradfitz commented Dec 5, 2019

Actually, the pull_request bit seems likely unrelated, despite those all having it.

These mutations are emitted if any of the issueDiffMethods funcs returns true. The ones I'm suspicious of are:

func (d githubIssueDiffer) diffBody(m *maintpb.GithubIssueMutation) bool {
        if d.a != nil && d.a.Body == d.b.GetBody() {                                                                                                                                                                   return false
        } 
        m.Body = d.b.GetBody()
        return true 
} 
 
func (d githubIssueDiffer) diffTitle(m *maintpb.GithubIssueMutation) bool {
        if d.a != nil && d.a.Title == d.b.GetTitle() {
                return false
        }
        m.Title = d.b.GetTitle()
        return true
}       

Because GetBody or GetTitle can return the empty string and return true and then generate what we see above.

The other methods all look like they can only return true if something got modified.

@bradfitz
Copy link
Contributor Author

bradfitz commented Dec 5, 2019

Confirmed. It's from diffBody.

It happens most often on PRs because we often fix people's PR's for them, removing redundant bodies from their commit messages.

The diffBody func can't express the transition from an issue having a body to not having a body.

For bools we have the BoolChange proto type:

// BoolChange represents a change to a boolean value.                                                                                                                                                                                    message BoolChange { 
  bool val = 1;                                                                                                                                                                                                                          }  

We should do the same for strings.

@gopherbot
Copy link

Change https://golang.org/cl/209967 mentions this issue: maintner: don't generate no-op github issue mutations on empty bodies

@golang golang locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants