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

Config v6 #75

Merged
merged 50 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b1041b9
Update config JSON model to v6
adams85 Jun 24, 2023
4d9e1af
Refactor evaluator and evaluation logging to prepare it for the new f…
adams85 Jun 29, 2023
8a5367c
Implement segment condition evaluation
adams85 Jun 29, 2023
008fec7
Implement prerequisite flag condition evaluation
adams85 Jun 29, 2023
a591ba8
Implement new comparison operators
adams85 Jun 30, 2023
9d44952
Implement SDK key format validation + fix broken tests
adams85 Jun 30, 2023
3bbf636
Add matrix tests
adams85 Jun 30, 2023
754e3bc
Add more tests (sdk key format, circular dependency detection)
adams85 Jul 3, 2023
2895001
Finalize evaluation error handling + implement ToString() in model cl…
adams85 Jul 27, 2023
065ff10
Evaluation log test data
adams85 Jul 31, 2023
d794cc2
Add tests for evaluation logging
adams85 Jul 31, 2023
cd4b022
Add benchmarks for flag evaluation
adams85 Jul 1, 2023
a9063d0
Requested changes
adams85 Sep 1, 2023
c89b279
Add evaluation log tests for invalid values
adams85 Sep 1, 2023
5a7a6ac
Fixes for previous commit
adams85 Sep 1, 2023
4ac5094
Improve comparator display texts
adams85 Sep 1, 2023
73be9cf
Add more evaluation log tests
adams85 Sep 1, 2023
81777f4
Minor improvements
adams85 Sep 1, 2023
2648fc7
ARRAY (NOT) CONTAINS -> ARRAY (NOT) CONTAINS ANY OF
adams85 Sep 6, 2023
f530ff0
Refactor matrix and model tests to load configs directly from CDN ins…
adams85 Sep 6, 2023
121290c
Update matrix tests from Python SDK
adams85 Sep 7, 2023
4171dbb
Improve model and evaluation of conditions
adams85 Sep 7, 2023
2848429
Rename Comparator/ComparisonCondition to UserComparator/UserCondition…
adams85 Sep 7, 2023
67b8c11
Add tests for advanced flag override use cases
adams85 Sep 7, 2023
6d387f4
Remove operator name from warning 3004
adams85 Sep 8, 2023
432719b
Add helper methods for converting numeric/datetime/string array value…
adams85 Sep 15, 2023
4ed6d34
Run matrix tests on migrated configs + update SDK keys in new tests
adams85 Oct 4, 2023
f043974
XML documentation review
adams85 Oct 5, 2023
fc231c4
Fix sonar issues
adams85 Oct 5, 2023
c4aef60
Add more evaluation log tests
adams85 Oct 6, 2023
9b5925a
Fix list truncation format
adams85 Oct 18, 2023
22e6b69
Add more matrix tests for ANY OF comparators
adams85 Oct 18, 2023
30cecc0
Add clear text comparators
adams85 Oct 20, 2023
14f84f8
Clean up setting type mismatch handling & logging logic + eliminate d…
adams85 Oct 24, 2023
7306e00
Adjust model and tests to config v6 schema changes
adams85 Oct 25, 2023
9d708fc
Adjust evaluation logic to config v6 schema changes (length prefixed …
adams85 Oct 26, 2023
553b7e4
Add matrix tests for clear text comparators and non-ASCII comparison …
adams85 Oct 26, 2023
0862919
Requested changes
adams85 Oct 27, 2023
834bc4d
Fix failure case in segment evaluation + add more tests for segment e…
adams85 Oct 27, 2023
1fb9f2d
Fix typos & minor improvements
adams85 Oct 25, 2023
24ac423
Prevent user attributes dictionary from being created multiple times …
adams85 Nov 7, 2023
9414874
Adds test for utils + minor improvements
adams85 Nov 7, 2023
c2c2dee
Remove unnecessary ItemGroup from ConfigCat.Client.Tests.csproj
adams85 Nov 10, 2023
b551d23
Seal IndentedTextBuilder
adams85 Nov 13, 2023
ce15a57
Add tests for EvaluationDetails.MatchedTargetingRule/MatchedPercentag…
adams85 Nov 13, 2023
c148867
Improve error handling consistency in prerequisite flag evaluation
adams85 Nov 15, 2023
4066377
Don't force users to pass user object attributes as strings
adams85 Nov 15, 2023
d836236
Allow passing NaN values to number/datetime comparisons
adams85 Nov 20, 2023
846b310
Merge branch 'master' into config-v6
adams85 Nov 20, 2023
dcfe26e
Fix merged test
adams85 Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ indent_size = 2
charset = utf-8
indent_size = 2

# Json files
[*.json]
charset = utf-8
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ __pycache__/
*.xsd.cs

# Custom
BenchmarkDotNet.Artifacts*/
coverage.xml
.DS_Store
.vscode
Expand Down
60 changes: 60 additions & 0 deletions benchmarks/ConfigCat.Client.Benchmarks.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigCat.Client.Benchmarks", "ConfigCat.Client.Benchmarks\ConfigCat.Client.Benchmarks.csproj", "{B7381881-0709-4F72-AE6C-3778979CD8C1}"
ProjectSection(ProjectDependencies) = postProject
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC} = {B51439A6-F230-46E5-9BC3-7E4E9FA841FC}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigCatClient", "..\src\ConfigCatClient\ConfigCatClient.csproj", "{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OldVersionLib", "OldVersionLib\OldVersionLib.csproj", "{53015044-8ED1-4F77-BB02-357313F7952A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewVersionLib", "NewVersionLib\NewVersionLib.csproj", "{30B22E19-6701-4C36-B1F4-72AE24E93CEA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProjectReferences", "ProjectReferences", "{3B9B9CF8-8D20-423D-A327-60D2D2C77976}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Benchmark|Any CPU = Benchmark|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B7381881-0709-4F72-AE6C-3778979CD8C1}.Benchmark|Any CPU.ActiveCfg = Release|Any CPU
{B7381881-0709-4F72-AE6C-3778979CD8C1}.Benchmark|Any CPU.Build.0 = Release|Any CPU
{B7381881-0709-4F72-AE6C-3778979CD8C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7381881-0709-4F72-AE6C-3778979CD8C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7381881-0709-4F72-AE6C-3778979CD8C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7381881-0709-4F72-AE6C-3778979CD8C1}.Release|Any CPU.Build.0 = Release|Any CPU
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}.Benchmark|Any CPU.ActiveCfg = Benchmark|Any CPU
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}.Benchmark|Any CPU.Build.0 = Benchmark|Any CPU
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC}.Release|Any CPU.Build.0 = Release|Any CPU
{53015044-8ED1-4F77-BB02-357313F7952A}.Benchmark|Any CPU.ActiveCfg = Release|Any CPU
{53015044-8ED1-4F77-BB02-357313F7952A}.Benchmark|Any CPU.Build.0 = Release|Any CPU
{53015044-8ED1-4F77-BB02-357313F7952A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53015044-8ED1-4F77-BB02-357313F7952A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53015044-8ED1-4F77-BB02-357313F7952A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53015044-8ED1-4F77-BB02-357313F7952A}.Release|Any CPU.Build.0 = Release|Any CPU
{30B22E19-6701-4C36-B1F4-72AE24E93CEA}.Benchmark|Any CPU.ActiveCfg = Release|Any CPU
{30B22E19-6701-4C36-B1F4-72AE24E93CEA}.Benchmark|Any CPU.Build.0 = Release|Any CPU
{30B22E19-6701-4C36-B1F4-72AE24E93CEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30B22E19-6701-4C36-B1F4-72AE24E93CEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30B22E19-6701-4C36-B1F4-72AE24E93CEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30B22E19-6701-4C36-B1F4-72AE24E93CEA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B51439A6-F230-46E5-9BC3-7E4E9FA841FC} = {3B9B9CF8-8D20-423D-A327-60D2D2C77976}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {71FC06CD-80AD-4090-863E-1965313C9027}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net6.0</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\ConfigCatClient.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="ConfigCat.Client" Version="8.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\ConfigCatClient\ConfigCatClient.csproj">
<AdditionalProperties>Configuration=Benchmark</AdditionalProperties>
<Aliases>from_project</Aliases>
</ProjectReference>
<ProjectReference Include="..\NewVersionLib\NewVersionLib.csproj" />
<ProjectReference Include="..\OldVersionLib\OldVersionLib.csproj" />
</ItemGroup>

<Target Name="ChangeAliasOfReferencedNuget" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
<ItemGroup>
<ReferencePath Condition="'%(FileName)' == 'ConfigCat.Client'">
<Aliases>from_nuget</Aliases>
</ReferencePath>
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
extern alias from_nuget;
extern alias from_project;

using System;
using BenchmarkDotNet.Attributes;

namespace ConfigCat.Client.Benchmarks;

[MemoryDiagnoser]
public class FlagEvaluationBenchmark
{
private object evaluationServicesOld = null!;
private from_nuget::ConfigCat.Client.User userOld = null!;

private object evaluationServicesNew = null!;
private from_project::ConfigCat.Client.User userNew = null!;

[GlobalSetup]
public void Setup()
{
Environment.CurrentDirectory = AppContext.BaseDirectory;

this.evaluationServicesOld = Old.BenchmarkHelper.CreateEvaluationServices(LogInfo);
this.userOld = new("Cat") { Email = "[email protected]", Custom = { ["Version"] = "1.1.1", ["Number"] = "1" } };

this.evaluationServicesNew = New.BenchmarkHelper.CreateEvaluationServices(LogInfo);
this.userNew = new("Cat") { Email = "[email protected]", Custom = { ["Version"] = "1.1.1", ["Number"] = "1" } };
}

[Params(false, true)]
public bool LogInfo { get; set; }

[Benchmark]
public object Basic_ConfigV5()
{
return Old.BenchmarkHelper.Evaluate(this.evaluationServicesOld, "basicFlag", false);
}

[Benchmark]
public object Basic_ConfigV6()
{
return New.BenchmarkHelper.Evaluate(this.evaluationServicesNew, "basicFlag", false);
}

[Benchmark]
public object Complex_ConfigV5()
{
return Old.BenchmarkHelper.Evaluate(this.evaluationServicesOld, "complexFlag", "", this.userOld);
}

[Benchmark]
public object Complex_ConfigV6()
{
return New.BenchmarkHelper.Evaluate(this.evaluationServicesNew, "complexFlag", "", this.userNew);
}

[Benchmark]
public object All_ConfigV5()
{
return Old.BenchmarkHelper.EvaluateAll(this.evaluationServicesOld, this.userOld);
}

[Benchmark]
public object All_ConfigV6()
{
return New.BenchmarkHelper.EvaluateAll(this.evaluationServicesNew, this.userNew);
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
extern alias from_nuget;
extern alias from_nuget;
extern alias from_project;
using BenchmarkDotNet.Attributes;
using System;

namespace ConfigCatClient.Benchmarks;
namespace ConfigCat.Client.Benchmarks;

[MemoryDiagnoser]
public class JsonDeserializationBenchmark
{
private readonly from_project::ConfigCat.Client.IConfigCatClient newClient = from_project::ConfigCat.Client.ConfigCatClientBuilder
.Initialize("rv3YCMKenkaM7xkOCVQfeg/-I_w49WSQUWdZypPPM4Yyg")
.WithManualPoll()
.WithBaseUrl(new Uri("https://test-cdn-global.configcat.com"))
.Create();
private readonly from_project::ConfigCat.Client.IConfigCatClient newClient = from_project::ConfigCat.Client.ConfigCatClient.Get("rv3YCMKenkaM7xkOCVQfeg/-I_w49WSQUWdZypPPM4Yyg", o =>
{
o.PollingMode = from_project::ConfigCat.Client.PollingModes.ManualPoll;
o.BaseUrl = new Uri("https://test-cdn-global.configcat.com");
});

private readonly from_nuget::ConfigCat.Client.IConfigCatClient oldClient = from_nuget::ConfigCat.Client.ConfigCatClientBuilder
.Initialize("rv3YCMKenkaM7xkOCVQfeg/-I_w49WSQUWdZypPPM4Yyg")
.WithManualPoll()
.WithBaseUrl(new Uri("https://test-cdn-global.configcat.com"))
.Create();
private readonly from_nuget::ConfigCat.Client.IConfigCatClient oldClient = from_nuget::ConfigCat.Client.ConfigCatClient.Get("rv3YCMKenkaM7xkOCVQfeg/-I_w49WSQUWdZypPPM4Yyg", o =>
{
o.PollingMode = from_nuget::ConfigCat.Client.PollingModes.ManualPoll;
o.BaseUrl = new Uri("https://test-cdn-global.configcat.com");
});

private readonly from_project::ConfigCat.Client.User newUser = new("[email protected]");
private readonly from_nuget::ConfigCat.Client.User oldUser = new("[email protected]");
Expand Down
45 changes: 45 additions & 0 deletions benchmarks/ConfigCat.Client.Benchmarks/MatrixTestBenchmark.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using BenchmarkDotNet.Attributes;

namespace ConfigCat.Client.Benchmarks;

[MemoryDiagnoser]
public class MatrixTestBenchmark
{
private Old.MatrixTestRunnerBase<Old.BenchmarkHelper.BasicMatrixTestsDescriptor> testRunnerOld = null!;
private object evaluationServicesOld = null!;

private New.MatrixTestRunnerBase<New.BenchmarkHelper.BasicMatrixTestsDescriptor> testRunnerNew = null!;
private object evaluationServicesNew = null!;

private object?[][] tests = null!;

[GlobalSetup]
public void Setup()
{
Environment.CurrentDirectory = AppContext.BaseDirectory;

this.testRunnerOld = new();
this.evaluationServicesOld = Old.BenchmarkHelper.CreateEvaluationServices(LogInfo);

this.testRunnerNew = new();
this.evaluationServicesNew = New.BenchmarkHelper.CreateEvaluationServices(LogInfo);

this.tests = New.BenchmarkHelper.GetMatrixTests<New.BenchmarkHelper.BasicMatrixTestsDescriptor>();
}

[Params(false, true)]
public bool LogInfo { get; set; }

[Benchmark]
public int MatrixTests_ConfigV5()
{
return Old.BenchmarkHelper.RunAllMatrixTests(this.testRunnerOld, this.evaluationServicesOld, this.tests);
}

[Benchmark]
public int MatrixTests_ConfigV6()
{
return New.BenchmarkHelper.RunAllMatrixTests(this.testRunnerNew, this.evaluationServicesNew, this.tests);
}
}
11 changes: 11 additions & 0 deletions benchmarks/ConfigCat.Client.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using BenchmarkDotNet.Running;

namespace ConfigCatClient.Benchmarks;

internal class Program
{
private static void Main(string[] args)
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
}
35 changes: 0 additions & 35 deletions benchmarks/ConfigCatClient.Benchmarks.csproj

This file was deleted.

39 changes: 0 additions & 39 deletions benchmarks/ConfigCatClient.Benchmarks.sln

This file was deleted.

Loading
Loading