Skip to content

Remove internal method from IPostHogClient interface #61

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

Merged
merged 5 commits into from
Mar 5, 2025

Conversation

haacked
Copy link
Collaborator

@haacked haacked commented Mar 5, 2025

This method was there to support .NET Feature Management. For now, I'll just cast to PostHogClient and use reflection if the IPostHogClient isn't a PostHogClient. It's ugly, but it'll do for now.

I do see the benefit of a method to enumerate flag definitions on IPostHogClient, I just need to think it over a bit. Any method we add, we have to support. Do we do an IAsyncEnumerabel or a Task<IReadOnlyList> or something else?

Fixes #60

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR removes the internal GetLocalEvaluatorAsync method from IPostHogClient interface and implements a temporary reflection-based workaround to maintain .NET Feature Management functionality.

  • Moved GetLocalEvaluatorAsync from interface to internal method in src/PostHog/PostHogClient.cs
  • Added new src/PostHog.AspNetCore/FeatureManagement/FeatureManagementExtensions.cs with reflection-based workaround
  • Introduces potential performance overhead due to reflection usage in extension method
  • Author acknowledges need to carefully design proper API for flag definition enumeration (IAsyncEnumerable vs IReadOnlyList)
  • Change simplifies unit testing for dependent projects by removing internal interface method

4 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

haacked and others added 2 commits March 5, 2025 15:32
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@haacked haacked merged commit 3f27213 into main Mar 5, 2025
4 checks passed
@haacked haacked deleted the haacked/60-remove-internal-interface-method branch March 5, 2025 23:40
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.

1 participant