Skip to content

Conversation

@lloyd-brown
Copy link
Collaborator

@lloyd-brown lloyd-brown commented Oct 30, 2025

Before this PR while we are lazy initializing the PermissionService if we fail after having set the global enforcer instance then our enforcer is still none but we change the enforcer instance that we use on every subsequent call. That leads to future calls trying to use a None object to load policies which breaks requests.

This PR moves our change of the global enforcer instance until after we've successfully created an enforcer so that a DB failure will not break the permission service. I added a unit test to catch this in the future.

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

@lloyd-brown lloyd-brown marked this pull request as ready for review October 30, 2025 22:38
@lloyd-brown
Copy link
Collaborator Author

/smoke-test

@lloyd-brown lloyd-brown merged commit 648ea9a into master Oct 30, 2025
20 of 21 checks passed
@lloyd-brown lloyd-brown deleted the lloyd/fix-db-failure-enforcer branch October 30, 2025 23:56
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