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

The show command does not display comment status correctly #22

Closed
jishi9 opened this issue Dec 23, 2015 · 6 comments
Closed

The show command does not display comment status correctly #22

jishi9 opened this issue Dec 23, 2015 · 6 comments
Labels

Comments

@jishi9
Copy link
Contributor

jishi9 commented Dec 23, 2015

It seems that the show command always displays the status of a comment as fyi.

Steps to reproduce

git appraise comment -m 'fyi comment'
git appraise comment -lgtm -m 'lgtm comment'
git appraise comment -nmw -m 'nmw comment'

Then running git appraise show will show something like:

    comment: $SHA
      author: $AUTHOR
      time:   $TIMESTAMP
      status: fyi
      fyi comment

    comment: $SHA
      author: $AUTHOR
      time:   $TIMESTAMP
      status: fyi
      lgtm comment

    comment: $SHA
      author: $AUTHOR
      time:   $TIMESTAMP
      status: fyi
      nmw comment

On the other hand git appraise show -json displays the correct status (in the resolved property):

  "comments": [
    {
      "hash": "$SHA",
      "comment": {
        "timestamp": "$TIMESTAMP",
        "author": "$AUTHOR",
        "location": {
          "commit": "$SHA"
        },
        "description": "fyi comment"
      }
    },
    {
      "hash": "$SHA",
      "comment": {
        "timestamp": "$TIMESTAMP",
        "author": "$AUTHOR",
        "location": {
          "commit": "$SHA"
        },
        "description": "lgtm comment"
        "resolved": true
      }
    },
    {
      "hash": "$SHA",
      "comment": {
        "timestamp": "$TIMESTAMP",
        "author": "$AUTHOR",
        "location": {
          "commit": "$SHA"
        },
        "description": "nmw comment"
        "resolved": false
      }
    }
@barbastan
Copy link

Interesting! Omar (our Tech Lead) wrote that code. Maaaaybe he had a
reason. He'll be back on Jan 4 and will respond.

Thanks!
Barbara

On Wed, Dec 23, 2015 at 4:25 AM, jishi9 [email protected] wrote:

It seems that the show command always displays the status of a comment as
fyi.
Steps to reproduce

git appraise comment -m 'fyi comment'
git appraise comment -lgtm -m 'lgtm comment'
git appraise comment -nmw -m 'nmw comment'

Then running git appraise show will show something like:

comment: $SHA
  author: $AUTHOR
  time:   $TIMESTAMP
  status: fyi
  fyi comment

comment: $SHA
  author: $AUTHOR
  time:   $TIMESTAMP
  status: fyi
  lgtm comment

comment: $SHA
  author: $AUTHOR
  time:   $TIMESTAMP
  status: fyi
  nmw comment

On the other hand git appraise show -json displays the correct status (in
the resolved property):

"comments": [
{
"hash": "$SHA",
"comment": {
"timestamp": "$TIMESTAMP",
"author": "$AUTHOR",
"location": {
"commit": "$SHA"
},
"description": "fyi comment"
}
},
{
"hash": "$SHA",
"comment": {
"timestamp": "$TIMESTAMP",
"author": "$AUTHOR",
"location": {
"commit": "$SHA"
},
"description": "lgtm comment"
"resolved": true
}
},
{
"hash": "$SHA",
"comment": {
"timestamp": "$TIMESTAMP",
"author": "$AUTHOR",
"location": {
"commit": "$SHA"
},
"description": "nmw comment"
"resolved": false
}
}


Reply to this email directly or view it on GitHub
#22.

hazbo pushed a commit to hazbo/git-appraise that referenced this issue Dec 23, 2015
As pointed out in google#22, the status for every comment seems to be fyi.
This seems to fix that.
@hazbo
Copy link
Contributor

hazbo commented Dec 23, 2015

The pull request I've just made should fix this bug, @jishi9 does this look reasonable to you?

@hazbo
Copy link
Contributor

hazbo commented Dec 23, 2015

I've just ran through this process a couple of times since fixing this bug, and it also appears to change the status of the review as a whole.

The discussion we had in that last thread outlined that this wasn't the case. Since changing this code, it now is. At this stage I'm not sure whether or not that is intended. But yeah - just thought I'd mention that.

@barbastan
Copy link

I am eager to hear what Omar originally had in mind.

Thanks again.
Barbara

On Wednesday, December 23, 2015, Harry Lawrence [email protected]
wrote:

I've just ran through this process
#17 (comment)
a couple of times since fixing this bug, and it also appears to change the
status of the review as a whole.

The discussion we had in that last thread outlined that this wasn't the
case. Since changing that code, it now is. At this stage I'm not sure
whether or not that is intended. But yeah - just thought I'd mention that.


Reply to this email directly or view it on GitHub
#22 (comment).

@jishi9
Copy link
Contributor Author

jishi9 commented Dec 24, 2015

@hazbo

It also appears to change the status of the review as a whole. The discussion we had in that last thread outlined that this wasn't the case. Since changing this code, it now is.

I don't think that's the case, the status of review as a whole was already displayed fine. As far as I could tell the bug only pertained to how the status of individual commits are displayed (always fyi, as opposed to lgtm or needs work where appropriate). Your change does fix this problem.

Looking at review.go where the CommenThread.Resolved field is defined, I'm thinking that maybe the original implementation of show was correct in using thread.Resolved rather than comment.Resolve. The bug might be that the value of thread.Resolved is not updated beforehand using updateResolvedStatus. I have created pull request #24 to fix this.

With this change things started to make more sense. This is the model I have pieced out:

A review's overall status:

  • There are no comment-threads, or all comment-thread statuses are FYI => pending
  • There is at least one LGTM comment-thread, and no NMW comment-threads => accepted
  • There is at least one NMW comment-thread => rejected

A comment-thread's overall status (this is a recursive definition):

  • root comment is NMW
    • there exists a direct LGTM child && no direct NMW child exists => FYI
    • otherwise => NMW
  • root comment is LGTM
    • direct NMW child exists => NMW
    • otherwise => LGTM
  • root comment is FYI
    • direct NMW child exists => NMW
    • otherwise => FYI

N.B. A comment-thread may be a global, attached to a file, or attached to a line.

ojarjur added a commit that referenced this issue Jan 4, 2016
Fixed updateThreadsStatus to modify original thread instances, rather than modifying copies
This is a proposed fix to #22

`updateThreadsStatus` was not actually updating the CommentThread instances, but updating copies thereof.
@ojarjur
Copy link
Collaborator

ojarjur commented Jan 4, 2016

@jishi9 Yes, your interpretation is exactly what was intended (and your bug fix was a good one). I merged your PR, and it seems to have fixed the bug (from what I've seen) so I'm going to close this issue.

Please re-open it if you find anything seems off.

Also, thanks for digging into this and sending out the fix!

@ojarjur ojarjur closed this as completed Jan 4, 2016
@ojarjur ojarjur added the bug label Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants