fix(settings): degrade load_features to defaults on PermissionError#3856
Merged
alteixeira20 merged 2 commits intoJun 11, 2026
Merged
Conversation
load_settings() already catches PermissionError, but load_features() caught only FileNotFoundError/JSONDecodeError/ValueError. An existing-but-unreadable data/features.json (e.g. root-owned after a deploy) therefore raised instead of falling back to DEFAULT_FEATURES, taking down GET /api/auth/features and anything that reads feature flags. Add PermissionError to the except tuple to match load_settings(). Adds tests/test_load_features_permission_error.py.
alteixeira20
approved these changes
Jun 11, 2026
alteixeira20
left a comment
Collaborator
There was a problem hiding this comment.
LGFM. This is a narrow degraded-state fix: load_features() now matches the existing fallback behavior for missing/invalid feature config when features.json is unreadable due to PermissionError.
The regression test is focused, normal CI is green, and the PR does not broaden scope beyond the intended fallback.
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
load_features()caught onlyFileNotFoundError,json.JSONDecodeError, andValueError, while its siblingload_settings()also catchesPermissionError. So an existing-but-unreadabledata/features.json(e.g. root-owned after a deploy) raised instead of falling back toDEFAULT_FEATURES, taking downGET /api/auth/featuresand anything that reads feature flags. This addsPermissionErrorto the except tuple to matchload_settings().Target branch
dev, notmain.Linked Issue
Fixes #3852
Type of Change
Checklist
devHow to Test
The test monkeypatches
opento raise PermissionError for features.json and assertsload_features()returnsDEFAULT_FEATURES. Verified it raises against currentdev.Visual / UI changes
None, backend only.