3484: `rbt patch -c` fails for patches to public github repos with an RBCommons team when the patch if from a non-team member

john.******@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
July 22, 2014
What version are you running?
=============================
client: 0.6.2
server: https://rbcommons.com as of today's date

What's the URL of the page containing the problem?
==================================================
https://rbcommons.com/s/twitter/r/698
https://rbcommons.com/s/twitter/api/users/gmalmquist/

What steps will reproduce the problem?
======================================
1. Create a review for a public github repo but as a user outside the RBCommons owning team (for this case gmalmquist is an RBCommons user _not_ in the twitter team).
2. rbt patch -c [the review]

What is the expected output? What do you see instead?
=====================================================
The patch should apply and be committed but it only applies and the commit fails, looks like so when failing:
$ rbt patch --debug -c 698
>>> RBTools 0.6.2
>>> Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2]
>>> Running on Linux-3.13.0-30-generic-x86_64-with-Ubuntu-14.04-trusty
>>> Home = /home/jsirois
>>> Current directory = /home/jsirois/dev/3rdparty/pantsbuild-pants
>>> Checking for a Subversion repository...
>>> Running: svn info --non-interactive
>>> Command exited with rc 1: ['svn', 'info', '--non-interactive']
svn: E155007: '/home/jsirois/dev/3rdparty/pantsbuild-pants' is not a working copy
---
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git config --get branch.master.merge
>>> Running: git config --get branch.master.remote
>>> Running: git config --get remote.origin.url
>>> repository info: Path: git@github.com:pantsbuild/pants.git, Base path: , Supports changesets: False
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/info/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/698/diffs/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/698/diffs/1/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/698/diffs/1/
>>> Running: git status --porcelain --untracked-files=no
Patch is being applied from request 698 with diff revision  1.
>>> Running: git apply --index /tmp/tmpdUG2_a
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/698/?force-text-type=plain
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/users/gmalmquist/
>>> Got API Error 100 (HTTP code 404): Object does not exist
>>> Error data: {u'stat': u'fail', u'err': {u'msg': u'Object does not exist', u'code': 100}}
Traceback (most recent call last):
  File "/home/jsirois/.pythons/venvs/rbt/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.6.2', 'console_scripts', 'rbt')()
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/commands/main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/commands/__init__.py", line 416, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/commands/patch.py", line 154, in main
    author = review_request.get_submitter()
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/resource.py", line 139, in <lambda>
    self._get_url(url, **kwargs)))
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/decorators.py", line 24, in request_method
    *args, **kwargs)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/transport/sync.py", line 61, in execute_request_method
    return self._execute_request(request)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/transport/sync.py", line 70, in _execute_request
    rsp = self.server.make_request(request)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/request.py", line 484, in make_request
    self.process_error(e.code, e.read())
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/request.py", line 457, in process_error
    rsp['err']['msg'])
rbtools.api.errors.APIError: Object does not exist (HTTP 404, API Error 100)



What operating system are you using? What browser?
==================================================
Browser does not apply, but this is for:
$ uname -a
Linux gill 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"

Anecdotally this also fails on OSXes


Please provide any additional information below.
================================================
I peeked at the code here and the team is baked into the client early on when its constructed so it may be tricky to disentagle that bit from the api requests here.  In the end - assuming RBCommons is willing to support non-team members contributing patches via RBCommons for public repos, the patch command would need to perhaps fall back from looking for the user in the team to trying the user account in general to find the data needed to form the commit.
david
#1 david
I think this is actually something that can/should be fixed on the server side, rather than in RBTools. Thanks for the report!
  • +PendingReview
  • +Component-API
  • +david
david
#2 david
Fixed in release-1.7.x (2753b4b). We'll get this deployed to RBCommons soon.
  • -PendingReview
    +Fixed
#3 john.******@gmai***** (Google Code) (Is this you? Claim this profile.)
This is great news - thank you.
#4 john.******@gmai***** (Google Code) (Is this you? Claim this profile.)
Afaict there has been a regression.

I see currently for https://rbcommons.com/s/twitter/r/1072/:
jsirois@gill ~/dev/3rdparty/twitter-commons (master) $ rbt patch --debug -c 1072
>>> RBTools 0.6.2
>>> Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2]
>>> Running on Linux-3.13.0-36-generic-x86_64-with-Ubuntu-14.04-trusty
>>> Home = /home/jsirois
>>> Current directory = /home/jsirois/dev/3rdparty/twitter-commons
>>> Checking for a Subversion repository...
>>> Running: svn info --non-interactive
>>> Command exited with rc 1: ['svn', 'info', '--non-interactive']
svn: E155007: '/home/jsirois/dev/3rdparty/twitter-commons' is not a working copy
---
>>> Checking for a Git repository...
>>> Running: git rev-parse --git-dir
>>> Running: git config core.bare
>>> Running: git rev-parse --show-toplevel
>>> Running: git symbolic-ref -q HEAD
>>> Running: git config --get branch.master.merge
>>> Running: git config --get branch.master.remote
>>> Running: git config --get remote.origin.url
>>> repository info: Path: git@github.com:twitter/commons.git, Base path: , Supports changesets: False
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/1072/diffs/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/1072/diffs/1/
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/1072/diffs/1/
>>> Running: git status --porcelain --untracked-files=no
Patch is being applied from request 1072 with diff revision  1.
>>> Running: git apply --index /tmp/tmpJEnO5t
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/review-requests/1072/?force-text-type=plain
>>> Making HTTP GET request to https://rbcommons.com/s/twitter/api/users/Yasumoto/
>>> Got API Error 100 (HTTP code 404): Object does not exist
>>> Error data: {u'stat': u'fail', u'err': {u'msg': u'Object does not exist', u'code': 100}}
Traceback (most recent call last):
  File "/home/jsirois/.pythons/venvs/rbt/bin/rbt", line 9, in <module>
    load_entry_point('RBTools==0.6.2', 'console_scripts', 'rbt')()
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/commands/main.py", line 134, in main
    command.run_from_argv([RB_MAIN, command_name] + args)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/commands/__init__.py", line 416, in run_from_argv
    exit_code = self.main(*args) or 0
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/commands/patch.py", line 154, in main
    author = review_request.get_submitter()
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/resource.py", line 139, in <lambda>
    self._get_url(url, **kwargs)))
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/decorators.py", line 24, in request_method
    *args, **kwargs)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/transport/sync.py", line 61, in execute_request_method
    return self._execute_request(request)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/transport/sync.py", line 70, in _execute_request
    rsp = self.server.make_request(request)
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/request.py", line 484, in make_request
    self.process_error(e.code, e.read())
  File "/home/jsirois/.pythons/venvs/rbt/local/lib/python2.7/site-packages/rbtools/api/request.py", line 457, in process_error
    rsp['err']['msg'])
rbtools.api.errors.APIError: Object does not exist (HTTP 404, API Error 100)
#5 john.******@gmai***** (Google Code) (Is this you? Claim this profile.)
Filed a new bug with the regression detail in case that works better for you folks: https://code.google.com/p/reviewboard/issues/detail?id=3582