Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make feature flags easier to use and fix database errors #140

Merged
merged 12 commits into from
Oct 31, 2024

Conversation

aholmes
Copy link
Member

@aholmes aholmes commented Oct 17, 2024

This PR:

  • Adds a feature_flag decorator
  • Fixes problems with the DBFeatureFlagRouter not functioning in Ligare.web application contexts

specifying the type of feature flag router as a separate module.
@aholmes aholmes force-pushed the aholmes-feature-flag-changes branch from 023d8c8 to ffd1829 Compare October 17, 2024 15:53
The `cast` for the FeatureFlagRouters is necessary for Injector to
correctly resolve and inject instances of the type. The actual type is
`Self | FeatureFlagRouter[...]`, but the usages of the injected type do
not rely on `Self`, which messes up how Injector resolves dependencies.
Ligare needs a way to understand the base SQLAlchemy classes involved in
querying a database. This is for a few reasons:

- schema translation for systems that don't support schemas
- supporting schemas in general
- not overwritting `ScopedSession` registration when multiple
  `ScopedSession` instances are registered with Injector
This protects the class against modifications from instantiations during
an application runtime. It also resolves static type errors from private
member usages.
@aholmes aholmes changed the title Feature flag changes Make feature flags easier to use and fix database errors Oct 24, 2024
@aholmes aholmes marked this pull request as ready for review October 24, 2024 23:05
@aholmes aholmes requested a review from a team as a code owner October 24, 2024 23:05
@aholmes aholmes added the enhancement New feature or request label Oct 24, 2024
Copy link

@dan-knight dan-knight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Code looks good. A lot of familiar patterns for db sessions from CAP. If you have a free moment, could you add a quick usage example with the improvements?

@aholmes
Copy link
Member Author

aholmes commented Oct 31, 2024

Cool! Code looks good. A lot of familiar patterns for db sessions from CAP. If you have a free moment, could you add a quick usage example with the improvements?

Yes, I will add some docstrings and some examples to the "cookbook" idea.

@aholmes aholmes merged commit 3137d93 into main Oct 31, 2024
12 checks passed
@dan-knight
Copy link

Yes, I will add some docstrings and some examples to the "cookbook" idea.

Cookbook is perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants