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(flags): Enjoy the benefits of /decide?v=4. $feature_flag_called events contain more details such as flag version #1838

Merged
merged 2 commits into from
Mar 20, 2025

Conversation

haacked
Copy link
Contributor

@haacked haacked commented Mar 19, 2025

This is a follow-up to #1837 where we added support for /decide?v=4 in a backwards compatible fashion, but still made requests to /decide?v=3

With this change, we should get more useful debug information in $feature_flag_called events.

Changes

Changes the library to request /decide?v=4 instead of /decide?v=3. All the substantial changes were made in #1837.

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented Mar 19, 2025

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

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Mar 20, 2025 4:01pm

@haacked haacked requested a review from a team March 19, 2025 23:50
@haacked haacked added the bump patch Bump patch version when this PR gets merged label Mar 19, 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 updates the PostHog JS library to use /decide?v=4 endpoint instead of /decide?v=3, enabling enhanced debugging capabilities for feature flag events.

  • Updates test assertions in src/__tests__/posthog-core.loaded.test.ts to expect /decide/?v=4 endpoint calls
  • Modifies network recording tests in playwright/session-recording/session-recording-network-recorder.spec.ts to validate v4 endpoint patterns
  • Adds support for additional metadata in feature flag events including flag versions, IDs, and evaluation reasons
  • Maintains backwards compatibility while providing more detailed debugging information in $feature_flag_called events
  • Follows up on PR feat(flags): Support /decide?v=4 and include version info flag called events #1837 which added initial v4 support but kept using v3 endpoint

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

Copy link

github-actions bot commented Mar 19, 2025

Size Change: +22.5 kB (+0.62%)

Total Size: 3.63 MB

Filename Size Change
dist/array.full.es5.js 301 kB +22.6 kB (+8.1%) 🔍
dist/customizations.full.js 14 kB -88 B (-0.63%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 220 kB
dist/array.full.js 381 kB
dist/array.full.no-external.js 380 kB
dist/array.js 188 kB
dist/array.no-external.js 187 kB
dist/dead-clicks-autocapture.js 14.5 kB
dist/exception-autocapture.js 9.94 kB
dist/external-scripts-loader.js 2.75 kB
dist/main.js 189 kB
dist/module.full.js 381 kB
dist/module.full.no-external.js 380 kB
dist/module.js 189 kB
dist/module.no-external.js 187 kB
dist/posthog-recorder.js 211 kB
dist/recorder-v2.js 115 kB
dist/recorder.js 115 kB
dist/surveys-preview.js 71.3 kB
dist/surveys.js 76.6 kB
dist/tracing-headers.js 1.76 kB
dist/web-vitals.js 10.4 kB

compressed-size-action

haacked added 2 commits March 20, 2025 08:54
This is a follow-up to #1837 where we added support for `/decide?v=4` in a backwards compatible fashion, but still made requests to `/decide?v=3`

With this change, we should get more useful debug information in `$feature_flag_called` events.
@haacked haacked force-pushed the haacked/turn-on-decide-v4 branch from a1c5b42 to 1c4318f Compare March 20, 2025 15:57
@haacked haacked changed the title feat: Enjoy the benefits of /decide?v=4 feat(flags): Enjoy the benefits of /decide?v=4. $feature_flag_called events will contain more details such as flag version Mar 20, 2025
@haacked haacked changed the title feat(flags): Enjoy the benefits of /decide?v=4. $feature_flag_called events will contain more details such as flag version feat(flags): Enjoy the benefits of /decide?v=4. $feature_flag_called events contain more details such as flag version Mar 20, 2025
Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

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

changes look good; CI looks annoyed. LMK if you want to untangle CI together!

@haacked
Copy link
Contributor Author

haacked commented Mar 20, 2025

changes look good; CI looks annoyed. LMK if you want to untangle CI together!

I think this might be a case of:

Have you tried turning it off and on again

@haacked haacked merged commit 4c25512 into main Mar 20, 2025
27 checks passed
@haacked haacked deleted the haacked/turn-on-decide-v4 branch March 20, 2025 17:18
dmarticus added a commit that referenced this pull request Mar 21, 2025
dmarticus added a commit that referenced this pull request Mar 21, 2025
haacked added a commit that referenced this pull request Mar 21, 2025
haacked added a commit that referenced this pull request Mar 21, 2025
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