Allow the open browser and web login options to be used on all commands.
Review Request #14573 — Created Sept. 8, 2025 and updated
We received a bug report that the web login option was not working for
therbt postcommand. Upon investigation, it was found that web login only
actually worked correctly forrbt login. It also worked for commands that
callget_authenticated_sessionbefore doing any requests that require
authentication (such asrbt status), but this only worked when the
WEB_LOGINoption was set in.reviewboardrc, not when the option was
passed through the command line.This change is the beginning in a series of ones that allow web login to be
used for authentication when using any rbt command. This change only
generalizes command options, it doesn't actually implement web login on the
commands (that happens in /r/14575 and /r/14576).We make the web login option a general server option, instead of only
applying to the login command. The command's long form has been renamed to
--web-logininstead of just--web, but we keep the existing-w/--web
option on the login command for compatibility and since-wis a
convenient short-form of the option.Similarly, we make the open browser option a general one, instead of only
applying to the login and post commands. In the future, any commands that
navigate to a URL can make use of this option to open URLs automatically in a
browser. It has also been renamed to--open-browser, but keeping the old
-o/--openversion like we did for the--weboption.We also deprecate the
--enable-loggingoption forrbt login, instead we'll
just use the--debugoption to enable server logs.These options now get set on
RBClientas theweb_login_optionsdict. It
makes sense to centralize these settings onto the client, so that callers can
easily set things in one place instead of having to plumb values through
various functions to reach the web login server. This will make more sense
in the context of the upcoming changes.
- Used in upcoming changes.
- Ran unit tests.
- Tested using all versions of the web login, open browser, and
debug/logging options and their.reviewboardrcconfig values
onrbt login,rbt postandrbt status.
| Summary | ID |
|---|---|
| ff33cd7379280856195f9b01d5ac63d27ad43313 |
| Description | From | Last Updated |
|---|---|---|
|
I don't like the idea of storing the options as an attribute on RBClient when the client isn't actually using … |
|
|
|
I think -o is still very important here, and we should keep it for the long term. rbt post -o … |
|
|
|
Perhaps we should use a dataclass here instead of a dict? |
|
|
|
This should be RBClientWebLoginOptions | None |
|
|
|
This should use (RBClientWebLoginOptions | None) = None |
|
|
|
Type here is incorrect. |
|
|
|
This should be able to go in the if TYPE_CHECKING block. |
|
|
|
I have an idea here. Right now, this will make it so help output will show two separate lines each … |
|
|
|
Can we add something that triggers a deprecation warning if this option is used? |
|
|
|
Can you add docs for the return value and CommandError raise? |
|
|
|
This should be able to go in the if TYPE_CHECKING block. |
|
|
|
This is no longer true. |
|
|
|
We could do the same thing here modifying self._global_options instead of duplicating the option. |
|
|
|
These should use | None syntax |
|
|
|
This should fit on one line. |
|
|
|
Let's go with 5.4 for this release, since we're introducing new abilities. This will apply to other version references. |
|
|
|
Blank line between the class docstring and attributes. |
|
|
|
Can we alphabetize these? |
|
|
|
Both of these need their own Version Changed. |
|
|
|
I think this will end up polluting the shared options. We'd have to make a copy. Also, do we want … |
|
|
|
Same note here as with the other location. |
|
|
|
line too long (80 > 79 characters) Column: 80 Error code: E501 |
|
|
|
Each one of these needs its own Version Changed. |
|
|
|
I think this probably should be a Sequence, unless we're allowing manipulation of it. This may become a larger change … |
|
|
|
Same note here with Sequence, if going this route for this change. |
|
-
-
I don't like the idea of storing the options as an attribute on
RBClientwhen the client isn't actually using it at all. I also can't see where web-based auth is implemented for commands other thanrbt login.Architecturally, how does this sound:
- Update
auth_callbackto return a dict instead of atuple[str, str]. This dict can include either username/password or an API token (actually, probably either dict or tuple and trigger a DeprecationWarning if the caller receives a tuple back). - Update
ReviewBoardHTTPPasswordMgrto also plumb that through. - Update
ReviewBoardServer.retry_http_basic_authto handle an API token result. - Add the web-login implementation to
BaseCommand.credentials_prompt. This has access toself.optionsdirectly.
- Update
-
I think
-ois still very important here, and we should keep it for the long term.rbt post -ois a lot easier to type thanrbt post --open-browser
- Description:
-
We received a bug report that the web login option was not working for
the rbt postcommand. Upon investigation, it was found that web login onlyactually worked correctly for rbt login. It also worked for commands thatcall get_authenticated_sessionbefore doing any requests that requireauthentication (such as rbt status), but this only worked when theWEB_LOGINoption was set in.reviewboardrc, not when the option waspassed through the command line. ~ This change is the beginning in a series of ones that fix web login, allowing
~ it to be used for authentication when using any rbt command. We make the ~ web login option a general server option, instead of only applying to ~ the login command. The command's long form has been renamed to --web-login~ instead of just --web, but we keep and deprecate the existing-w/--web~ option on the login command for compatibility. When we remove this option ~ in the future, users will no longer be able to pass -wbut--webwill~ still work since our arg parser allows for the abbreviation of long ~ arguments. ~ This change is the beginning in a series of ones that allow web login to be
~ used for authentication when using any rbt command. This change only ~ generalizes command options, it doesn't actually implement web login on the ~ commands (that happens in /r/14575 and /r/14576). ~ ~ We make the web login option a general server option, instead of only
~ applying to the login command. The command's long form has been renamed to ~ --web-logininstead of just--web, but we keep the existing-w/--web~ option on the login command for compatibility and since -wis a+ convenient short-form of the option. Similarly, we make the open browser option a general one, instead of only
applying to the login and post commands. In the future, any commands that navigate to a URL can make use of this option to open URLs automatically in a browser. It has also been renamed to --open-browser, but keeping the old-o/--openversion like we did for the--weboption.We also deprecate the
--enable-loggingoption forrbt login, instead we'lljust use the --debugoption to enable server logs.These options now get set on
RBClientas theweb_login_optionsdict. Itmakes sense to centralize these settings onto the client, so that callers can easily set things in one place instead of having to plumb values through various functions to reach the web login server. This will make more sense in the context of the upcoming changes. - Commits:
-
Summary ID a8e6d286ea4315f0c8cfcf14b4d58e67a7719407 5679ce5963d83f0a29c80bdd74e6fe1ae381ed24
Checks run (2 succeeded)
- Change Summary:
-
Actually remove the deprecation on the
-oand-woptions, which I forgot to do in the last review request update. - Commits:
-
Summary ID 5679ce5963d83f0a29c80bdd74e6fe1ae381ed24 a5b73b72c08d333df3a5f15712953843a59fba27
Checks run (2 succeeded)
-
-
-
-
-
-
I have an idea here. Right now, this will make it so help output will show two separate lines each of these.
How about, instead of duplicating the options, we do:
def create_parser( self, config: RBToolsConfig, argv: (list[str] | None) = None, ) -> argparse.ArgumentParser: for option in self._global_options: if option.opts[0] == '--open-browser': option.opts = ['-o', '--open', '--open-browser'] elif option.opts[0] == '--web-login': option.opts = ['-w', '--web', '--web-login'] return super.create_parser(config, argv)That'll simplify the
RBClientWebLoginOptionscreation too. -
-
-
-
-
-
- Change Summary:
-
- Use a dataclass instead of TypedDict for the RBClientWebLoginOptions definition.
- Typing fixes.
- Combine some args in
create_parser()instead of duplicating them in the option lists.
- Commits:
-
Summary ID a5b73b72c08d333df3a5f15712953843a59fba27 5853519760195f5d3e225d9a233a75705961665a
Checks run (2 succeeded)
- Commits:
-
Summary ID 5853519760195f5d3e225d9a233a75705961665a 6d3e0136fbfd254a7af117e4cf3b0aa689d732a0
Checks run (2 succeeded)
- Change Summary:
-
- Changed to target version 5.4.
- Doesn't modify shared option lists on the base command class.
- Commits:
-
Summary ID 6d3e0136fbfd254a7af117e4cf3b0aa689d732a0 ff33cd7379280856195f9b01d5ac63d27ad43313