Rework some core licensing stubs and prepare for new license actions.

Review Request #14401 — Created April 21, 2025 and updated

Information

Review Board
release-7.1.x

Reviewers

License has been updated to provide consistent expiration-related
information, factoring in hard expiration dates, grace periods, and
"expires soon" logic.

LicenseStatus constants have been renamed to go with
licensed/unlicensed terms and expired-based terms.

There are new classes, errors, and stubs for license update checks and
for license actions (which will include things like manually uploading a
license).

License check updates will be driven in an upcoming change. The process
involves asking the License Provider for a license check payload,
sending that payload to an outside server, then passing the result back
to the License Provider for processing.

Type hints have been updated to utilize | instead of Union.

Upcoming changes will begin to flesh out more of this, and add UI around
license displays.

Unit tests pass.

Tested this along with in-progress changes, verifying all these new
capabilities being stubbed out in this change.

Summary ID
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
9c7405e1255632c833a2a031655137938a0dfc64
Description From Last Updated

'datetime.timedelta' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'django.utils.html.format_html' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'reviewboard.licensing.errors.LicenseActionError' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'reviewboard.licensing.license.LicenseStatus' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

redefinition of unused 'datetime' from line 9 Column: 5 Error code: F811

reviewbotreviewbot

'datetime.datetime' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

'djblets.util.typing.SerializableJSONDict' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

'djblets.util.typing.SerializableJSONList' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

Mind changing this to use | syntax?

daviddavid

Mind changing this to use | syntax?

daviddavid

Should we make this (and get_expires_soon_days_threshold) properties?

daviddavid

Can we add a TODO comment to switch to StrEnum when we're 3.11+?

daviddavid

This needs a docstring.

daviddavid

'djblets.util.typing.SerializableJSONValue' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

'reviewboard.licensing.license_checks.RRequestCheckLicenseResult' imported but unused Column: 5 Error code: F401

reviewbotreviewbot

redefinition of unused 'RequestCheckLicenseResult' from line 14 Column: 5 Error code: F811

reviewbotreviewbot

Typo: licene

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

flake8

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

    Mind changing this to use | syntax?

  3. reviewboard/licensing/license.py (Diff revision 2)
     
     
    Show all issues

    Mind changing this to use | syntax?

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

    Should we make this (and get_expires_soon_days_threshold) properties?

    1. They initially were. I ended up changing them to methods just to help distinguish fixed values in the dataclass from attributes with dynamic results. But I'm not married to it.

    2. Been thinking about this, and I think because this method in particular may change results every time you call it (time-based), I'd like to keep it a function so it doesn't have the same static feel as the other properties on this class. The threshold one, I could go either way.

    3. OK, sure.

  5. reviewboard/licensing/license_checks.py (Diff revision 2)
     
     
    Show all issues

    Can we add a TODO comment to switch to StrEnum when we're 3.11+?

  6. Show all issues

    This needs a docstring.

  7. 
      
chipx86
Review request changed
Change Summary:
  • Altered the license check requests to return a new payload and to centralize functions.
  • get_license_actions() no longer returns any default actions.
  • Switched more types to | union syntax.
  • Added a missing docstring and a TODO.
Commits:
Summary ID
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
f0298a734d28ce2998231606c8402486237a3e59
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
327bb61425fb92a0c9172c058dc0fe82d3059cf8

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Removed unused imports and fixed a typo in a typing import.

Commits:
Summary ID
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
327bb61425fb92a0c9172c058dc0fe82d3059cf8
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
8bc4dbbf8a71fc98e7ba0aa66266e9c6ecb5fd2f

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Removed an extra import my editor helpfully added...

Commits:
Summary ID
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
8bc4dbbf8a71fc98e7ba0aa66266e9c6ecb5fd2f
Rework some core licensing stubs and prepare for new license actions.
`License` has been updated to provide consistent expiration-related information, factoring in hard expiration dates, grace periods, and "expires soon" logic. `LicenseStatus` constants have been renamed to go with licensed/unlicensed terms and expired-based terms. There are new classes, errors, and stubs for license update checks and for license actions (which will include things like manually uploading a license). License check updates will be driven in an upcoming change. The process involves asking the License Provider for a license check payload, sending that payload to an outside server, then passing the result back to the License Provider for processing. Type hints have been updated to utilize `|` instead of `Union`. Upcoming changes will begin to flesh out more of this, and add UI around license displays.
9c7405e1255632c833a2a031655137938a0dfc64

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. Ship It!
  2. 
      
maubin
  1. 
      
  2. reviewboard/licensing/license_checks.py (Diff revision 5)
     
     
    Show all issues

    Typo: licene

  3.