Skip to content

fix(cache_page): use vary on header with env api key#5800

Merged
gagantrivedi merged 2 commits intomainfrom
fix/5001
Jul 22, 2025
Merged

fix(cache_page): use vary on header with env api key#5800
gagantrivedi merged 2 commits intomainfrom
fix/5001

Conversation

@gagantrivedi
Copy link
Copy Markdown
Member

@gagantrivedi gagantrivedi commented Jul 22, 2025

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

Use SDK_ENVIRONMENT_KEY_HEADER as part of cache key to make sure different response is cached for different environments

Closes: #5726, #5001

How did you test this code?

Add Unit test

@gagantrivedi gagantrivedi requested a review from a team as a code owner July 22, 2025 08:33
@gagantrivedi gagantrivedi requested review from emyller and removed request for a team July 22, 2025 08:33
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 22, 2025

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 Jul 22, 2025 9:23am
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 9:23am
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview Jul 22, 2025 9:23am

@github-actions github-actions bot added the api Issue related to the REST API label Jul 22, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 22, 2025

Docker builds report

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

@github-actions github-actions bot added the fix label Jul 22, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.81%. Comparing base (cd4f166) to head (5e2e714).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5800   +/-   ##
=======================================
  Coverage   97.81%   97.81%           
=======================================
  Files        1257     1257           
  Lines       44586    44667   +81     
=======================================
+ Hits        43612    43693   +81     
  Misses        974      974           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@gagantrivedi gagantrivedi merged commit 28821fa into main Jul 22, 2025
30 checks passed
@gagantrivedi gagantrivedi deleted the fix/5001 branch July 22, 2025 11:00
Comment thread api/core/constants.py
FLAGSMITH_SIGNATURE_HEADER = "X-Flagsmith-Signature"

FLAGSMITH_UPDATED_AT_HEADER = "X-Flagsmith-Document-Updated-At"
SDK_ENVIRONMENT_KEY_HEADER = "X_ENVIRONMENT_KEY"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Annoying that we have to use different formats here. Maybe vary_on_headers(snake_case(SDK_ENVIRONMENT_KEY_HEADER).upper())) would be nicer, but maybe it's just my OCD-ish tendencies in play here.

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 fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect redis caching Cache conflict in Redis for Get Flags and Get Identities endpoints in the Flagsmith API

2 participants