Skip to content

Conversation

@moonbox3
Copy link
Collaborator

Motivation and Context

The Dapr Runtime uses string-based class names to load step classes dynamically. This PR adds validation to ensure that only valid KernelProcessStep subclasses can be loaded and instantiated, improving type safety and providing better error messages when misconfigured.

The new allowed_module_prefixes parameter gives users control over which modules are permitted for step class loading, which can be useful in environments where stricter control is desired.

Description

  • Add issubclass(cls, KernelProcessStep) validation when loading step classes from qualified names
  • Add optional allowed_module_prefixes parameter for restricting which modules can be loaded
  • Centralize class loading logic in get_step_class_from_qualified_name() utility function
  • Remove duplicate _get_class_from_string methods from DaprStepInfo and StepActor

Contribution Checklist

@moonbox3 moonbox3 self-assigned this Jan 30, 2026
@moonbox3 moonbox3 requested a review from a team as a code owner January 30, 2026 21:29
@moonbox3 moonbox3 added the python Pull requests for the Python Semantic Kernel label Jan 30, 2026
@moonbox3
Copy link
Collaborator Author

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
processes
   step_utils.py510100% 
processes/dapr_runtime
   dapr_process_info.py32487%32, 37, 47, 54
   dapr_step_info.py26196%47
processes/dapr_runtime/actors
   step_actor.py2656176%104, 107, 111–112, 124–126, 170–173, 191, 195, 199, 225, 233–234, 250–252, 255–260, 263–265, 272–273, 287, 291–293, 296–297, 314, 331–332, 337, 368–370, 390, 430, 442–450, 453, 456–460
TOTAL28147482182% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3833 23 💤 0 ❌ 0 🔥 1m 48s ⏱️

@moonbox3 moonbox3 added this pull request to the merge queue Jan 30, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 30, 2026
@moonbox3 moonbox3 merged commit b6f95e2 into microsoft:main Feb 2, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants