fix(auth): reuse a process-wide wasmtime engine - #1303
Draft
anastasia-nesterenko wants to merge 1 commit into
Draft
fix(auth): reuse a process-wide wasmtime engine#1303anastasia-nesterenko wants to merge 1 commit into
anastasia-nesterenko wants to merge 1 commit into
Conversation
Create the wasmtime Engine lazily once per process and reuse it across OPAPolicy instances. This avoids repeatedly initializing JIT and trap-handling state as auth-enabled test clients come and go, which caused native xdist worker crashes without Python tracebacks. Remove the obsolete scoped-access-key worker pin while retaining coverage that revoked keys are reported as REVOKED and rejected by authentication and workspace endpoints. Signed-off-by: anastasia-nesterenko <anesterenko@nvidia.com>
anastasia-nesterenko
requested review from
SandyChapman,
ironcommit and
mckornfield
August 14, 2026 00:11
Contributor
|
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.
Summary
Auth-enabled test clients previously created a new wasmtime
Enginefor everyOPAPolicy, repeatedly initializing native JIT and trap-handling resources until an xdist worker could terminate without a Python traceback. This change creates one lazy, thread-safeEngineper process and reuses it while each policy instance retains its ownStoreand evaluation state.Changes
Engine.OPAPolicycontinues to create its ownStore, linker, module, and instance.xdist_grouppin so the test runs through normal integration-test scheduling.REVOKEDand that the revoked token fails authentication and workspace access.Type of Change
Quality Gates
Verification
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowTargeted validation:
uv run --frozen pytest -q services/core/auth/tests/integration/test_scoped_access_keys.py services/core/auth/tests/test_embedded_pdp.py services/core/auth/tests/test_embedded_pdp_stress.py -m "not slow"— 80 passed, 4 deselected.uv run --frozen ruff check services/core/auth/src/nmp/core/auth/app/embedded_pdp/engine.py services/core/auth/tests/integration/test_scoped_access_keys.py— passed.uv run --frozen ruff format --check services/core/auth/src/nmp/core/auth/app/embedded_pdp/engine.py services/core/auth/tests/integration/test_scoped_access_keys.py— passed.uv run --frozen ty check services/core/auth/src/nmp/core/auth/app/embedded_pdp/engine.py services/core/auth/tests/integration/test_scoped_access_keys.py— passed.uv run --frozen pre-commit run -a— relevant Ruff, formatting, type-checking, config, and repository checks passed; the full gate was blocked becausehelm-docsis not installed and the host uv version is 0.9.18 instead of the required 0.9.14.