Add support for custom license action handling.

Review Request #14470 — Created June 23, 2025 and updated

Information

Review Board
release-7.1.x

Reviewers

License Providers that register custom actions can now handle them in
requests from the client. This is done by registering the action name in
the License Provider's custom_actions set and then adding a
handle_<actionid>_action() method to handle the response.

BaseLicenseProvider.call_action() has been added to invoke these
actions. This does the work formerly done by the view, making it more
generally-useful outside of HTTP handling. This takes the action ID,
action request data, the license information to operate off of, and an
optional HTTP request (which may be needed by some actions).

The action data may be any arbitrary JSON-safe data. Previously, when
the view handled an action, it expected keys and values in the HTTP POST
data to be used as arguments, but now it requires an explicit
action_data JSON field, which can then be deserialized and passed to
action handlers.

The built-in actions (license-update-check, process-license-update,
and upload-license) now live on BaseLicenseProvider instead of the
view, giving call_action() access to them.

Unit tests pass.

Manually tested the license update flow and some custom actions.

Summary ID
Add support for custom license action handling.
License Providers that register custom actions can now handle them in requests from the client. This is done by registering the action name in the License Provider's `custom_actions` set and then adding a `handle_<actionid>_action()` method to handle the response. `BaseLicenseProvider.call_action()` has been added to invoke these actions. This does the work formerly done by the view, making it more generally-useful outside of HTTP handling. This takes the action ID, action request data, the license information to operate off of, and an optional HTTP request (which may be needed by some actions). The action data may be any arbitrary JSON-safe data. Previously, when the view handled an action, it expected keys and values in the HTTP POST data to be used as arguments, but now it requires an explicit `action_data` JSON field, which can then be deserialized and passed to action handlers. The built-in actions (`license-update-check`, `process-license-update`, and `upload-license`) now live on `BaseLicenseProvider` instead of the view, giving `call_action()` access to them.
95f572b5922db1463a1d3200e5a0363c56d673a9
Description From Last Updated

'typing.Mapping' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'typing.Protocol' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

I think the TypeAlias import can be in TYPE_CHECKING

daviddavid

Can you add a docstring to this method?

daviddavid

This is missing a bunch of args.

daviddavid

undefined name 'e' Column: 20 Error code: F821

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

flake8

chipx86
david
  1. 
      
  2. reviewboard/licensing/actions.py (Diff revision 2)
     
     
    Show all issues

    I think the TypeAlias import can be in TYPE_CHECKING

  3. Show all issues

    Can you add a docstring to this method?

  4. reviewboard/licensing/tests/providers.py (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues

    This is missing a bunch of args.

  5. 
      
chipx86
Review request changed
Change Summary:
  • Brought in all the changes just made to /r/14405/.
  • Added missing docs and fixed a wrong copy/pasted docstring in the test providers.
  • Moved the TypeAlias import into TYPE_CHECKING.
Commits:
Summary ID
Add support for custom license action handling.
License Providers that register custom actions can now handle them in requests from the client. This is done by registering the action name in the License Provider's `custom_actions` set and then adding a `handle_<actionid>_action()` method to handle the response. `BaseLicenseProvider.call_action()` has been added to invoke these actions. This does the work formerly done by the view, making it more generally-useful outside of HTTP handling. This takes the action ID, action request data, the license information to operate off of, and an optional HTTP request (which may be needed by some actions). The action data may be any arbitrary JSON-safe data. Previously, when the view handled an action, it expected keys and values in the HTTP POST data to be used as arguments, but now it requires an explicit `action_data` JSON field, which can then be deserialized and passed to action handlers. The built-in actions (`license-update-check`, `process-license-update`, and `upload-license`) now live on `BaseLicenseProvider` instead of the view, giving `call_action()` access to them.
4b30f67dd7a699d3848a37165703c9d7c2156bd8
Add support for custom license action handling.
License Providers that register custom actions can now handle them in requests from the client. This is done by registering the action name in the License Provider's `custom_actions` set and then adding a `handle_<actionid>_action()` method to handle the response. `BaseLicenseProvider.call_action()` has been added to invoke these actions. This does the work formerly done by the view, making it more generally-useful outside of HTTP handling. This takes the action ID, action request data, the license information to operate off of, and an optional HTTP request (which may be needed by some actions). The action data may be any arbitrary JSON-safe data. Previously, when the view handled an action, it expected keys and values in the HTTP POST data to be used as arguments, but now it requires an explicit `action_data` JSON field, which can then be deserialized and passed to action handlers. The built-in actions (`license-update-check`, `process-license-update`, and `upload-license`) now live on `BaseLicenseProvider` instead of the view, giving `call_action()` access to them.
2a121ad29d481b6d5d555aeab9dcb013bf23663b

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Added a line missing during git add -p.

Commits:
Summary ID
Add support for custom license action handling.
License Providers that register custom actions can now handle them in requests from the client. This is done by registering the action name in the License Provider's `custom_actions` set and then adding a `handle_<actionid>_action()` method to handle the response. `BaseLicenseProvider.call_action()` has been added to invoke these actions. This does the work formerly done by the view, making it more generally-useful outside of HTTP handling. This takes the action ID, action request data, the license information to operate off of, and an optional HTTP request (which may be needed by some actions). The action data may be any arbitrary JSON-safe data. Previously, when the view handled an action, it expected keys and values in the HTTP POST data to be used as arguments, but now it requires an explicit `action_data` JSON field, which can then be deserialized and passed to action handlers. The built-in actions (`license-update-check`, `process-license-update`, and `upload-license`) now live on `BaseLicenseProvider` instead of the view, giving `call_action()` access to them.
2a121ad29d481b6d5d555aeab9dcb013bf23663b
Add support for custom license action handling.
License Providers that register custom actions can now handle them in requests from the client. This is done by registering the action name in the License Provider's `custom_actions` set and then adding a `handle_<actionid>_action()` method to handle the response. `BaseLicenseProvider.call_action()` has been added to invoke these actions. This does the work formerly done by the view, making it more generally-useful outside of HTTP handling. This takes the action ID, action request data, the license information to operate off of, and an optional HTTP request (which may be needed by some actions). The action data may be any arbitrary JSON-safe data. Previously, when the view handled an action, it expected keys and values in the HTTP POST data to be used as arguments, but now it requires an explicit `action_data` JSON field, which can then be deserialized and passed to action handlers. The built-in actions (`license-update-check`, `process-license-update`, and `upload-license`) now live on `BaseLicenseProvider` instead of the view, giving `call_action()` access to them.
95f572b5922db1463a1d3200e5a0363c56d673a9

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
maubin
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2.