Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a new RulesEngine project to handle feature‐flag evaluation, metric periods, and entitlement logic, along with extensive model definitions and unit tests.
- Introduces domain models (Trait, Subscription, Rule, Flag, Condition, CompanyMetric, Company) with JSON serialization attributes
- Implements Metrics utility for calculating next reset dates and a FlagCheckService for evaluating flags against rules
- Adds NUnit test suites covering RuleCheckService and FlagCheckService, and updates solution and ignore files
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Trait.cs | Adds Trait model with JSON mappings |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Subscription.cs | Adds Subscription model |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Rule.cs | Defines Rule model including lists of conditions & groups |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Flag.cs | Defines Flag model with rules and default value |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/ConditionGroup.cs | Introduces ConditionGroup container |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Condition.cs | Defines Condition model covering various condition types |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/CompanyMetric.cs | Adds CompanyMetric model with lookup helper |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Company.cs | Implements Company model with trait & metric management |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Metrics.cs | Implements date‐calculation helpers for metric periods |
| src/SchematicHQ.RulesEngine/src/RulesEngine/FlagCheck.cs | Implements FlagCheckService and result types for flag logic |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Consts.cs | Defines enums and extensions for rule/metric concepts |
| src/SchematicHQ.RulesEngine/src/RulesEngine/Class1.cs | Placeholder class added |
| src/SchematicHQ.RulesEngine/src/RulesEngine.Test/TestRuleCheck.cs | Unit tests for RuleCheckService |
| src/SchematicHQ.RulesEngine/src/RulesEngine.Test/TestFlagCheck.cs | Unit tests for FlagCheckService |
| src/SchematicHQ.RulesEngine/src/RulesEngine.Test/Helpers.cs | Test helper methods |
| src/SchematicHQ.RulesEngine/src/RulesEngine.Test/RulesEngine.Test.csproj | Adds test project configuration |
| src/SchematicHQ.Client.sln | Registers new projects and platform configurations |
| .fernignore | Updates ignore paths |
Comments suppressed due to low confidence (4)
src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Subscription.cs:1
- [nitpick] The Subscription model has been introduced but has no unit tests. Consider adding tests to verify its serialization behavior and any validation or business logic.
using System.Text.Json.Serialization;
src/SchematicHQ.RulesEngine/src/RulesEngine/Test/TestFlagCheck.cs:19
- The Errors class is defined in the SchematicHQ.RulesEngine namespace, but this test file doesn't import that namespace. Add 'using SchematicHQ.RulesEngine;' or fully qualify Errors.ErrorFlagNotFound so the reference compiles.
Assert.That(result.Error, Is.EqualTo(Errors.ErrorFlagNotFound));
.fernignore:17
- The path 'src/SchematicHQ.RunesEngine' is misspelled; it should be 'src/SchematicHQ.RulesEngine' to correctly ignore the RulesEngine folder.
src/SchematicHQ.RunesEngine
src/SchematicHQ.RulesEngine/src/RulesEngine/Class1.cs:3
- [nitpick] Class1.cs contains an empty placeholder class. Consider removing this file or replacing it with the intended implementation to avoid dead code.
public class Class1
src/SchematicHQ.RulesEngine/src/RulesEngine/Models/Condition.cs
Outdated
Show resolved
Hide resolved
d32d810 to
0cd95d4
Compare
d32125e to
5ca3527
Compare
|
@claude review this PR |
|
Claude finished @cbrady's task in 1m 55s —— View job PR Review CompletedThis PR introduces significant new functionality with a datastream client and rules engine. Here's my comprehensive review: Major Findings🚨 Critical Issues
|
02c2565 to
c0a18a9
Compare
|
@claude review this PR |
|
Claude finished @cbrady's task in 3m 28s —— View job PR Review Complete ✅I've conducted a comprehensive review of this substantial PR introducing datastream functionality and rules engine capabilities. Here's my detailed analysis: 🚨 Critical Issues1. Inappropriate Console.WriteLine Usage -
|
|
I think we may have missed this on the Go side as well, but we need to log flag checks from the client now that we're doing client-side evaluation. Similar to what's happening here for the browser JS client: https://github.com/SchematicHQ/schematic-js/blob/main/js/src/index.ts#L201 nit but I think we need to add some more files to .fernignore |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances and tests the datastream functionality and caching in the client library while updating project and CI configurations to support .NET 9.0 and new tooling. Key changes include:
- Adding and updating mock implementations and tests for WebSocket communication, concurrency, and caching.
- Upgrading project target frameworks and .NET GitHub Action versions.
- Introducing example applications for webhook and datastream test servers.
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/SchematicHQ.Client.Test/TestCache.cs | Adds a using directive for the cache namespace. |
| src/SchematicHQ.Client.Test/Datastream/Mocks/MockWebSocket.cs | Provides a full mock implementation of the WebSocket client with methods for setting up various response types. |
| src/SchematicHQ.Client.Test/Datastream/Mocks/MockSchematicLogger.cs | Introduces a logger mock for capturing log entries during tests. |
| src/SchematicHQ.Client.Test/Datastream/Mocks/DatastreamClientTestFactory.cs | Creates a test factory to assemble a datastream client along with its mocks. |
| src/SchematicHQ.Client.Test/Datastream/DatastreamConnectionTests.cs | Adds several tests verifying error handling, timeouts, and concurrent behaviors in datastream connections. |
| src/SchematicHQ.Client.Test/Datastream/DatastreamConcurrencyTests.cs | Implements concurrency tests ensuring that multiple requests reuse a single WebSocket request and handle warnings properly. |
| src/SchematicHQ.Client.Test/Datastream/DatastreamClientTests.cs | Provides extensive tests on flag handling, caching, and resource reuse via the datastream client. |
| src/SchematicHQ.Client.Test/Datastream/DatastreamCacheTests.cs | Tests the cache expiration logic to ensure resources are re-requested when the cache expires. |
| examples/webhook-test-server/.csproj, appsettings, Program.cs, etc. | Updates project configuration and example server files to align with the updated framework and tooling requirements. |
| .github/workflows/ci.yml | Upgrades CI configuration to use .NET 9.0 alongside .NET 8.0 and switches to setup-dotnet v3. |
| .fernignore | Adjusts file ignore patterns for Fern to include new project areas. |
| _client.Start(); | ||
|
|
||
| // Give time for async operations to complete | ||
| Task.Delay(100).Wait(); |
There was a problem hiding this comment.
Consider using 'await Task.Delay(100)' instead of blocking with .Wait() to align with asynchronous best practices and avoid potential deadlocks.
| Task.Delay(100).Wait(); | |
| await Task.Delay(100); |
| _client.Start(); | ||
|
|
||
| // Give time for async operations to complete | ||
| Task.Delay(100).Wait(); |
There was a problem hiding this comment.
Replace 'Task.Delay(100).Wait()' with 'await Task.Delay(100)' for consistency with asynchronous patterns in tests.
| Task.Delay(100).Wait(); | |
| await Task.Delay(100); |
a5d1902 to
e804045
Compare
|
I think this is looking pretty good. Most of my concerns at this point are on the server side. |
No description provided.