Repository navigation
fix: treat missing user attributes as non-matching - #37
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds explicit user-property lookup support, guards condition matching against invalid or missing properties, centralizes built-in attribute names, updates serialization, and adds regression tests for empty and built-in attributes. ChangesUser attribute matching
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Missing user attributes now do not satisfy attribute conditions, while present empty values continue to be evaluated normally. Existing ValueOf fallback behavior and event field names are preserved, with coverage for the changed matching cases. Sequence Diagram(s)sequenceDiagram
participant Evaluator.IsMatchCondition
participant FbUser.TryGetValue
participant Operator evaluation
Evaluator.IsMatchCondition->>FbUser.TryGetValue: request condition property
FbUser.TryGetValue-->>Evaluator.IsMatchCondition: found flag and value
Evaluator.IsMatchCondition->>Operator evaluation: evaluate operator when property exists
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The changes consistently implement the spec’s “missing attribute is non-matching” rule and are backed by targeted tests for the new edge cases.
Pull request overview
This PR aligns user-attribute lookup and condition evaluation with the User Context Spec by distinguishing between missing attributes and present-but-empty attributes, and ensuring missing attributes never satisfy conditions (including negative operators).
Changes:
- Updated
FbUserattribute lookup to preserve attribute presence (missing →null/not found; present empty →""). - Updated condition matching to return
falsewhen the condition property is empty/whitespace or the user attribute is missing. - Added/extended unit tests to cover missing attributes, empty values, invalid properties, and built-in attribute precedence.
File summaries
| File | Description |
|---|---|
| tests/FeatBit.ServerSdk.Tests/Model/FbUserTests.cs | Adds coverage for FbUser.ValueOf behavior with missing vs empty attributes. |
| tests/FeatBit.ServerSdk.Tests/Evaluation/ConditionMatcherTests.cs | Adds coverage ensuring missing/invalid attributes do not match (including negative/unknown operators) and built-in precedence. |
| src/FeatBit.ServerSdk/Model/FbUser.cs | Implements presence-aware attribute retrieval via TryGetValue and updates ValueOf semantics. |
| src/FeatBit.ServerSdk/Events/DefaultEventSerializer.cs | Uses centralized attribute-name constants for built-in user fields. |
| src/FeatBit.ServerSdk/Evaluation/Evaluator.ConditionMatcher.cs | Treats missing/invalid attributes as non-matching before applying operators. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
according to the User Context Spec
Greptile Summary
This PR makes condition matching distinguish missing attributes from attributes containing an empty string while preserving the public
ValueOffallback.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
ValueOfcompatibility while exposing presence-aware lookup internally.Reviews (2): Last reviewed commit: "pr feedback" | Re-trigger Greptile
Summary by CodeRabbit
Bug Fixes
Tests