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

feat: add featureFlags param #26

Merged
merged 1 commit into from
Nov 26, 2024
Merged

feat: add featureFlags param #26

merged 1 commit into from
Nov 26, 2024

Conversation

ascandone
Copy link
Contributor

@ascandone ascandone commented Nov 26, 2024

this is noop PR, but it involves changing the publicly exposed function, which we'll want to design in a way that will be backwards compatible in the future

@ascandone ascandone force-pushed the feat/add-feature-flags branch from 34fecc0 to a894df1 Compare November 26, 2024 11:29
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 63.24%. Comparing base (fd2a1e0) to head (778896f).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/cmd/run.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
+ Coverage   63.21%   63.24%   +0.02%     
==========================================
  Files          28       28              
  Lines        6206     6211       +5     
==========================================
+ Hits         3923     3928       +5     
  Misses       2115     2115              
  Partials      168      168              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

return p.RunWithFeatureFlags(ctx, vars, store, nil)
}

func (p ParseResult) RunWithFeatureFlags(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we add a new publicly exposed function which has a featureFlags map[string]struct{} param
We have a map with untyped keys instead of a struct so that removing feature flags is not a breaking change

@ascandone ascandone force-pushed the feat/add-feature-flags branch from a894df1 to 778896f Compare November 26, 2024 11:35
@@ -175,6 +175,7 @@ func RunProgram(
program parser.Program,
vars map[string]string,
store Store,
featureFlags map[string]struct{},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we pass the feature flags here directly (without further design patterns e.g. dependency injection). When a fflag will be available, we will parse it as a boolean field in the programState struct

this way

  1. we can still control presence/absence of fflags in tests
  2. the runtime will have access to passed feature flags in each moment

@ascandone ascandone requested a review from gfyrag November 26, 2024 11:39
@ascandone ascandone merged commit f6d4e75 into main Nov 26, 2024
4 of 5 checks passed
@ascandone ascandone deleted the feat/add-feature-flags branch November 26, 2024 12:42
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.

2 participants