Skip to content

Python 3.13 refactor: Python/common tweaks for DBC consoldation refactor#4440

Merged
loneil merged 3 commits into
bcgov:mainfrom
loneil:dbcRefactorPythonCommon
May 29, 2026
Merged

Python 3.13 refactor: Python/common tweaks for DBC consoldation refactor#4440
loneil merged 3 commits into
bcgov:mainfrom
loneil:dbcRefactorPythonCommon

Conversation

@loneil
Copy link
Copy Markdown
Collaborator

@loneil loneil commented May 28, 2026

Issue #: /bcgov/entity###

Description of changes:
Doing this in multiple PRs. First adjust python/common DBC modules to centralize more code legal-api uses so we can remove from legal-api.

Move some things from the DBC queue service to this module as well (digital_credentials_lifecycle.py)

Python/common does not deal with flags. LD flags are loaded in legal-api as usual and business needs of them (enabled, entity types, etc) are just passed when needed.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).

Copilot AI review requested due to automatic review settings May 28, 2026 06:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the shared digital credentials package to centralize DBC access, helper, and lifecycle logic for use by legal-api and queue services as part of the Python 3.13 consolidation work.

Changes:

  • Updates DBC access checks to require caller-provided enabled business types.
  • Adds shared credential lifecycle helpers for issuing, revoking, replacing, and listing credentials.
  • Modernizes typing/imports and adjusts related unit tests.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/__init__.py Re-exports shared DBC services/helpers and initializes the singleton.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/decorators.py Removes DBC access decorator and updates token datetime handling.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/digital_credentials.py Modernizes optional type hints and string formatting.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/digital_credentials_auth.py Requires explicit allowed business types for access checks.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/digital_credentials_helpers.py Updates typing and legislation-timezone date formatting.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/digital_credentials_lifecycle.py Adds shared credential lifecycle DB/Traction helper functions.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/digital_credentials_rules.py Updates access rules to consume caller-provided allowed business types.
python/common/business-registry-digital-credentials/src/business_registry_digital_credentials/digital_credentials_utils.py Changes business type filtering to intersect caller-provided enabled types.
python/common/business-registry-digital-credentials/pyproject.toml Bumps package version, Python minimum, and adds common package dependency.
Test files Updates unit tests for the new access/type-filtering signatures and removes deleted decorator tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.

@loneil loneil requested a review from kialj876 May 28, 2026 07:09
Copy link
Copy Markdown
Collaborator

@kialj876 kialj876 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! This looks good to me - can you add the CI action for it so that it runs the linting / tests? If there isn't time no worries, but can you add a ticket for us under here: bcgov/entity#33533

Also I think you can probably merge this into main since its the common code right? I've been merging my changes to common stuff into main to reduce the final feature merge diff

loneil added 3 commits May 28, 2026 23:23
Signed-off-by: Lucas <lucasoneil@gmail.com>
Signed-off-by: Lucas <lucasoneil@gmail.com>
Signed-off-by: Lucas <lucasoneil@gmail.com>
@loneil loneil force-pushed the dbcRefactorPythonCommon branch from ece07de to 088dc5c Compare May 29, 2026 06:23
@loneil loneil changed the base branch from feature-legal-api-python3.13 to main May 29, 2026 06:23
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@loneil
Copy link
Copy Markdown
Collaborator Author

loneil commented May 29, 2026

@kialj876 Yes! Thanks! I **should ** target this to main. Was going to do all to the feature branch but it's simpler that way. It's only changing the python/common/dbc part so I can merge this, reimport and refactor the queue service also in main. Then refactor the legal-api part in the feature branch.

Rebased and adjusted to go to main

@loneil loneil merged commit b23c6da into bcgov:main May 29, 2026
2 of 3 checks passed
@loneil loneil deleted the dbcRefactorPythonCommon branch May 29, 2026 06:26
@loneil
Copy link
Copy Markdown
Collaborator Author

loneil commented May 29, 2026

CI added: #4447

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants