Use SCMTool IDs to look up repositories when possible.

Review Request #13973 — Created June 11, 2024 and submitted

Information

RBTools
release-5.x

Reviewers

Many versions of Review Board currently have a bug where sending an
unknown value in the tool= parameter to the repository list API would
cause a crash. We'll be shipping a fix for that, but unfortunately there
are a variety of released versions where the Git and ClearCase clients
can trigger this crash on servers that do not have Power Pack installed.

This change fixes the RBTools side to not include the Power Pack SCMTool
names, which will avoid the problem for existing servers. For new
servers, we'll be shipping a server-side fix that fixes the crash, adds
the SCMTool IDs to the capabilities, and allows us to pass SCMTool IDs
rather than names to the repository list API. If we see the IDs in the
capability blob, we can assume that we can pass the IDs, including
potentially unknown IDs.

This also fixes a problem where we were sometimes accessing the
repository list API twice with exactly the same parameters.

  • Ran unit tests.
  • Verified that the repository list API was accessed using SCMTool names
    that did not include potentially missing ones when running against an
    older server.
  • Verified that the repository list API was accessed with SCMTool IDs
    when running against a server with the new API fixes.
Summary ID
Use SCMTool IDs to look up repositories when possible.
Many versions of Review Board currently have a bug where sending an unknown value in the tool= parameter to the repository list API would cause a crash. We'll be shipping a fix for that, but unfortunately there are a variety of released versions where the Git and Clearcase clients can trigger this crash on servers that do not have Power Pack installed. This change fixes the RBTools side to not include the Power Pack SCMTool names, which will avoid the problem for existing servers. For new servers, we'll be shipping a server-side fix that fixes the crash, adds the SCMTool IDs to the capabilities, and allows us to pass SCMTool IDs rather than names to the repository list API. If we see the IDs in the capability blob, we can assume that we can pass the IDs, including potentially unknown IDs. This also fixes a problem where we were sometimes accessing the repository list API twice with exactly the same parameters. Testing Done: - Ran unit tests. - Verified that the repository list API was accessed using SCMTool names that did not include potentially missing ones when running against an older server. - Verified that the repository list API was accessed with SCMTool IDs when running against a server with the new API fixes.
69154c85a7d367a8c6389242b658387b79814d26
Description From Last Updated

Small typo in the description: "Clearcase" -> "ClearCase".

chipx86chipx86

'rbtools.api.capabilities.Capabilities' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

'rbtools.api.capabilities.Capabilities' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

line too long (80 > 79 characters) Column: 80 Error code: E501

reviewbotreviewbot

:py:attr for server_tool_names.

chipx86chipx86

Can we take the opportunity to make this a list of strings? I know we're just passing this to the …

chipx86chipx86

These should be in the same import group. Also, Optional before TYPE_CHECKING.

chipx86chipx86

Missing a return type.

chipx86chipx86

Let's avoid _, since we're using this for gettext in places. Could just do [0] at the end.

chipx86chipx86

whitespace before ',' Column: 55 Error code: E203

reviewbotreviewbot

I don't know where we landed on this, but if we're postponing any changes to this format, let's update this …

chipx86chipx86

Here and the other, TYPE_CHECKING sorts before Tuple.

chipx86chipx86

This should be two separate strings.

chipx86chipx86
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. Show all issues

    Small typo in the description: "Clearcase" -> "ClearCase".

  3. rbtools/clients/base/scmclient.py (Diff revision 2)
     
     
    Show all issues

    :py:attr for server_tool_names.

  4. rbtools/clients/base/scmclient.py (Diff revision 2)
     
     
    Show all issues

    Can we take the opportunity to make this a list of strings?

    I know we're just passing this to the API, and saving a split/join, but that's pretty inexpensive, and feels like an implementation detail. It'd be nice to have a formal structured definition of what a list of IDs is, so this is more useful going forward outside this one use case.

  5. rbtools/commands/setup_repo.py (Diff revision 2)
     
     
     
     
    Show all issues

    These should be in the same import group.

    Also, Optional before TYPE_CHECKING.

    1. One thing I've recently come across is that the standard sort order is supposed to be "CONSTANT_VARIABLE, CamelCaseClass, variable_or_function"

    2. Standard, or tool-defined preference?

      I can understand the preference for that, but we haven't been doing that, and it requiress more micromanaging. I'd much prefer to be able to continue feeding imports into |sort and have it do the right thing, rather than having to move things around myself.

  6. rbtools/commands/setup_repo.py (Diff revision 2)
     
     
    Show all issues

    Missing a return type.

  7. rbtools/utils/repository.py (Diff revision 2)
     
     
    Show all issues

    Let's avoid _, since we're using this for gettext in places.

    Could just do [0] at the end.

  8. 
      
david
Review request changed
Description:
   

Many versions of Review Board currently have a bug where sending an

    unknown value in the tool= parameter to the repository list API would
    cause a crash. We'll be shipping a fix for that, but unfortunately there
~   are a variety of released versions where the Git and Clearcase clients
  ~ are a variety of released versions where the Git and ClearCase clients
    can trigger this crash on servers that do not have Power Pack installed.

   
   

This change fixes the RBTools side to not include the Power Pack SCMTool

    names, which will avoid the problem for existing servers. For new
    servers, we'll be shipping a server-side fix that fixes the crash, adds
    the SCMTool IDs to the capabilities, and allows us to pass SCMTool IDs
    rather than names to the repository list API. If we see the IDs in the
    capability blob, we can assume that we can pass the IDs, including
    potentially unknown IDs.

   
   

This also fixes a problem where we were sometimes accessing the

    repository list API twice with exactly the same parameters.

Commits:
Summary ID
Use SCMTool IDs to look up repositories when possible.
Many versions of Review Board currently have a bug where sending an unknown value in the tool= parameter to the repository list API would cause a crash. We'll be shipping a fix for that, but unfortunately there are a variety of released versions where the Git and Clearcase clients can trigger this crash on servers that do not have Power Pack installed. This change fixes the RBTools side to not include the Power Pack SCMTool names, which will avoid the problem for existing servers. For new servers, we'll be shipping a server-side fix that fixes the crash, adds the SCMTool IDs to the capabilities, and allows us to pass SCMTool IDs rather than names to the repository list API. If we see the IDs in the capability blob, we can assume that we can pass the IDs, including potentially unknown IDs. This also fixes a problem where we were sometimes accessing the repository list API twice with exactly the same parameters. Testing Done: - Ran unit tests. - Verified that the repository list API was accessed using SCMTool names that did not include potentially missing ones when running against an older server. - Verified that the repository list API was accessed with SCMTool IDs when running against a server with the new API fixes.
26ee167ed435deb651643aff6d7d9465d2c2c7b9
Use SCMTool IDs to look up repositories when possible.
Many versions of Review Board currently have a bug where sending an unknown value in the tool= parameter to the repository list API would cause a crash. We'll be shipping a fix for that, but unfortunately there are a variety of released versions where the Git and Clearcase clients can trigger this crash on servers that do not have Power Pack installed. This change fixes the RBTools side to not include the Power Pack SCMTool names, which will avoid the problem for existing servers. For new servers, we'll be shipping a server-side fix that fixes the crash, adds the SCMTool IDs to the capabilities, and allows us to pass SCMTool IDs rather than names to the repository list API. If we see the IDs in the capability blob, we can assume that we can pass the IDs, including potentially unknown IDs. This also fixes a problem where we were sometimes accessing the repository list API twice with exactly the same parameters. Testing Done: - Ran unit tests. - Verified that the repository list API was accessed using SCMTool names that did not include potentially missing ones when running against an older server. - Verified that the repository list API was accessed with SCMTool IDs when running against a server with the new API fixes.
9d34d25edd1b0f198fea3d0f52e09e63bb400e3d

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. rbtools/clients/clearcase.py (Diff revision 4)
     
     
    Show all issues

    I don't know where we landed on this, but if we're postponing any changes to this format, let's update this and the other imports in the change to be consistent with what we're doing today.

  3. rbtools/clients/clearcase.py (Diff revision 4)
     
     
    Show all issues

    This should be two separate strings.

  4. 
      
david
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. rbtools/clients/clearcase.py (Diff revisions 4 - 5)
     
     
    Show all issues

    Here and the other, TYPE_CHECKING sorts before Tuple.

  3. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (36efa07)