feat(api): Add an evaluation context mapping layer - #8573
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (11)
💤 Files with no reviewable changes (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe changes add public type aliases for flag-engine evaluation contexts and metadata. New mapper functions convert environment feature states, identities, traits, segments, rules and conditions into these contexts. Identity overrides map to a synthetic segment. Identity hash-key methods use the persisted id when composite-key hashing is disabled and an id is available. Unit tests cover context mapping, trait precedence, identity hashing, segment rules and multivariate variants. Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to This change makes hashing use the stored identity ID for edge identities migrated from the database. The override-list endpoint may still hash on the identifier, so it can show a different multivariate value from the one that evaluation actually serves. Confirm or fix that path before merging. The new evaluation mapping layer itself is well covered by tests. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8573 +/- ##
========================================
Coverage 98.83% 98.84%
========================================
Files 1645 1650 +5
Lines 67921 68135 +214
========================================
+ Hits 67131 67345 +214
Misses 790 790 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
074f598 to
41d52d6
Compare
41d52d6 to
615865f
Compare
615865f to
f1f53ca
Compare
f1f53ca to
4feeae1
Compare
4feeae1 to
0e2a7f8
Compare
0e2a7f8 to
520084a
Compare
Docker builds report
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 5dae3463-070a-48f8-b314-f5591e4e6293
📒 Files selected for processing (4)
api/environments/identities/models.pyapi/tests/unit/environments/identities/test_unit_identities_models.pyapi/tests/unit/util/engine_models/identities/test_unit_identities_models.pyapi/util/engine_models/identities/models.py
Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review.
28d7d45 to
e095307
Compare
e095307 to
4c0221c
Compare
Transient identities all hashed to "None" when composite key hashing is off, so they shared one percentage split and multivariate bucket. They now hash by identifier, and edge identities by their Django id when they have one, both as Edge API does.
… mapper inputs The mapper now prefetches the identity's traits and each segment's rules itself, which is a no-op when the caller already has.
f27eaf9 to
cb0edd2
Compare
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #6654
In this PR, we add a new mapping layer intended to serve all parts of Core API that are supposed to invoke flag evaluation.
The gaps we close with the new mappers include the following:
In tests, we pin the behaviour that Core API maintained with ORM-based evaluation.
We also make hashing behaviour mirror Edge API for transient identities.
We're migrating to these mappers in following stacked PRs.
How did you test this code?
Added new tests.