feat: implement shared ExecutionContext for concurrent sieve checks - #189
Merged
mlieberman85 merged 1 commit intoApr 15, 2026
Merged
Conversation
This adds the ExecutionContext class with thread-safe resource locking via get_or_run_tool(), solving the performance issue with executing heavy toolings like OpenSSF Scorecard multiple times. Extends Context models across models, handler_registry, and the sieve orchestrator to map context down. Adds verification tests and handlers logic to HANDLER_AUTHORING.md. Signed-off-by: jaydeep869 <jaydeeppokhariya2106@gmail.com>
Contributor
|
LGTM — merging. The double-checked locking design is clean, and the 10-thread concurrency test validates the single-execution guarantee correctly. Three follow-up issues created:
Thanks for turning the long-standing scaffold in |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fully implements the shared
ExecutionContextsystem (previously outlined in comments withindarnit/core/models.py). This allows large, heavy API toolings (like OpenSSF Scorecard) to cache and share outputs safely across multiple Control evaluations rather than being run redundantly.Includes thread safe locking mechanisms
get_or_run_tool()to anticipate concurrent sieve handler executions. The createdexecution_contextis seamlessly propagated throughCheckContextand injected natively downstream onto custom Python Handler'sHandlerContextmodels.Motivation and Context
Currently, each control runs tools independently, bottlenecking performance. With heavy tools like OpenSSF scorecard running per rule, wait times escalate rapidly. Shared execution contexts securely cache outputs for multi control usage and prevent duplicate networking trips simultaneously.
How Has This Been Tested?
tests/darnit/core/test_models.pyverifying cache hits, cache misses, and ThreadPool concurrent access validations limiting tool execution to precisely 1 trigger safely.tests/darnit/sieve/test_orchestrator.pyviaTestExecutionContextPropagationtests./docs/HANDLER_AUTHORING.mddemonstrating custom Python handler integrations.pytestsuite ensuring all core framework / sieve orchestrator paths passed smoothly without regressions.Types of changes
Checklist:
ruff check&ruff format).docs/HANDLER_AUTHORING.md).