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: Support blank identifiers, assume transient #4449

Merged
merged 10 commits into from
Aug 9, 2024

Conversation

khvn26
Copy link
Member

@khvn26 khvn26 commented Aug 2, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Closes #4448.

This PR adds the following for POST /api/v1/identities:

  • Allow users to provide null/blank identifiers. The identity is assigned a UUID identifier to evaluate against and is not persisted in this case.
  • If an identity is provided with "transient": true, all provided traits are automatically considered transient.
  • If an identifier is provided, the existing persisted traits and overrides are loaded for evaluation. In case of collisions, transient traits take precedence during evaluation but are not persisted.
  • Identifiers are returned to keep consistency with Edge API.

How did you test this code?

Updated integration and unit tests with new cases.

@khvn26 khvn26 requested a review from a team as a code owner August 2, 2024 18:57
@khvn26 khvn26 requested review from matthewelwell and removed request for a team August 2, 2024 18:57
Copy link

vercel bot commented Aug 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Aug 8, 2024 1:03pm
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview Aug 8, 2024 1:03pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview Aug 8, 2024 1:03pm

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Aug 2, 2024
Copy link
Contributor

github-actions bot commented Aug 2, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-4449 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-4449 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-4449 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-4449 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4449 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4449 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Aug 2, 2024

Uffizzi Preview deployment-54947 was deleted.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.89%. Comparing base (e2853d7) to head (2f3af09).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4449      +/-   ##
==========================================
+ Coverage   96.85%   96.89%   +0.04%     
==========================================
  Files        1170     1174       +4     
  Lines       38812    39161     +349     
==========================================
+ Hits        37592    37947     +355     
+ Misses       1220     1214       -6     

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

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 4, 2024
@khvn26 khvn26 requested a review from novakzaballa August 5, 2024 13:42
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 6, 2024
Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

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

I've added some comments to some specific areas in the code, but I also had one more general comment regarding the PR description.

Identifiers are returned to keep consistency with Edge API.

I'm not quite clear on this? I think perhaps it's just related to including the identifier in the API response, as we do in the Edge API.

api/environments/identities/models.py Outdated Show resolved Hide resolved
api/environments/sdk/serializers.py Show resolved Hide resolved
api/environments/sdk/serializers.py Outdated Show resolved Hide resolved
api/environments/sdk/serializers.py Outdated Show resolved Hide resolved
api/environments/sdk/serializers.py Show resolved Hide resolved
api/environments/sdk/services.py Outdated Show resolved Hide resolved
api/environments/sdk/services.py Show resolved Hide resolved
Co-authored-by: Matthew Elwell <matthew.elwell@flagsmith.com>
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 7, 2024
@github-actions github-actions bot removed the feature New feature or request label Aug 7, 2024
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 7, 2024
@khvn26 khvn26 requested a review from matthewelwell August 7, 2024 17:32
@github-actions github-actions bot removed the feature New feature or request label Aug 7, 2024
@github-actions github-actions bot added the feature New feature or request label Aug 7, 2024
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 7, 2024
@khvn26 khvn26 force-pushed the feat/optional-identifier branch from ada1826 to 2f3af09 Compare August 8, 2024 10:38
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 8, 2024
@khvn26
Copy link
Member Author

khvn26 commented Aug 8, 2024

Note: changed transient identifier generation to a hash of traits as advised by Gagan's review of the Edge API PR.

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Aug 8, 2024
@khvn26 khvn26 requested a review from matthewelwell August 8, 2024 14:17
@khvn26 khvn26 added this pull request to the merge queue Aug 9, 2024
Merged via the queue into main with commit 0014a5b Aug 9, 2024
33 checks passed
@khvn26 khvn26 deleted the feat/optional-identifier branch August 9, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support blank identifiers, assume transient
3 participants