Skip to content

fix: false flag should not trigger linked flags #1944

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

Merged
merged 4 commits into from
May 7, 2025
Merged

Conversation

pauldambra
Copy link
Member

finally a false flag that isn't a conspiracy theory!

it used to be safe to check for the presence of a flag

but we recently started returning flags that are enabled but false

so, it's not safe any more and replay linked flags was broken as a result

i had seen that we changed that API but wrote this code so long ago I totally missed this consequence

Copy link

vercel bot commented May 7, 2025

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview May 7, 2025 3:28pm

@pauldambra pauldambra requested review from a team, sortafreel and veryayskiy and removed request for a team May 7, 2025 11:48
@pauldambra pauldambra added the bump patch Bump patch version when this PR gets merged label May 7, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR fixes session recording behavior when dealing with feature flags that are present but disabled, specifically addressing linked flag triggering logic.

  • Fixed LinkedFlagMatching in triggerMatching.ts to properly check both flag presence AND value before triggering recording
  • Added test case in sessionrecording.test.ts to verify recording stays in buffering state when linked flag is false
  • Addresses API behavior change where flags can now be present but disabled (previously only present flags were enabled)
  • Critical fix to prevent incorrect session recording activation when feature flags are disabled

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

github-actions bot commented May 7, 2025

Copy link

github-actions bot commented May 7, 2025

Size Change: +90 B (0%)

Total Size: 3.4 MB

Filename Size Change
dist/array.full.es5.js 296 kB +9 B (0%)
dist/array.full.js 361 kB +9 B (0%)
dist/array.full.no-external.js 360 kB +9 B (0%)
dist/array.js 164 kB +9 B (+0.01%)
dist/array.no-external.js 163 kB +9 B (+0.01%)
dist/main.js 165 kB +9 B (+0.01%)
dist/module.full.js 361 kB +9 B (0%)
dist/module.full.no-external.js 360 kB +9 B (0%)
dist/module.js 165 kB +9 B (+0.01%)
dist/module.no-external.js 164 kB +9 B (+0.01%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 216 kB
dist/customizations.full.js 11 kB
dist/dead-clicks-autocapture.js 12.7 kB
dist/exception-autocapture.js 9.63 kB
dist/external-scripts-loader.js 2.63 kB
dist/posthog-recorder.js 207 kB
dist/recorder-v2.js 113 kB
dist/recorder.js 113 kB
dist/surveys-preview.js 67.1 kB
dist/surveys.js 74.8 kB
dist/tracing-headers.js 1.64 kB
dist/web-vitals.js 10.4 kB

compressed-size-action

@pauldambra
Copy link
Member Author

@marandaneto @ioannisj looks like Android and iOS SDKs don't make this mistake - nice!

Do flutter and RN simply use Android and iOS behavior or do I need to look there as well

@marandaneto
Copy link
Member

@marandaneto @ioannisj looks like Android and iOS SDKs don't make this mistake - nice!

Do flutter and RN simply use Android and iOS behavior or do I need to look there as well

Flutter uses Android and iOS, RN has its own flag evaluation, but I think its correct already

@pauldambra pauldambra merged commit 8fdc89a into main May 7, 2025
27 checks passed
@pauldambra pauldambra deleted the fix/false-flag branch May 7, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants