Skip to content

test(replay): keep trigger-started recording when remote config reloads unchanged event triggers - #852

Draft
ioannisj wants to merge 1 commit into
mainfrom
fix/replay-unchanged-event-triggers
Draft

ioannisj wants to merge 1 commit into
mainfrom
fix/replay-unchanged-event-triggers

Conversation

@ioannisj

@ioannisj ioannisj commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Parity check for posthog-ios#919. On iOS, every remote config load clears the event-trigger activation and stops replay, even when the trigger list is unchanged. So with a cached config, a trigger that fires right after launch starts recording and the first live /config response stops it.

Android doesn't have this bug. triggerActivatedSessionId is only set when a trigger matches and nothing on the onRemoteConfig path resets it. shouldWaitForEventTriggers only checks whether the current session was activated, so a config reload can only stop recording through the flag, master switch or sampling gates. That matches posthog-js, which also never resets activation on config.

Adds a regression test to keep it that way. Test only, no SDK change.

💚 How did you test it?

  • New test remote config with unchanged event triggers keeps a trigger started recording. It starts from the cached config only, fires a trigger, then delivers the first live config and a later reload with the same triggers (same order and reordered), and asserts replay stays active for the same session id.
  • I temporarily added the iOS reset-and-stop to onRemoteConfig and the test fails on the first live config, so it does catch the regression.
  • ./gradlew :posthog-android:testDebugUnitTest and make checkFormat pass.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

DRI: @ioannisj
Autonomy: Human-driven (agent-assisted)

@ioannisj ioannisj self-assigned this Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor
⚠️ `posthog-android` is modified but this PR has no changeset

This is informational — the PR is not blocked. Click the triangle above to collapse, or push a fix and this comment will auto-delete.

Modified in this PR but no changeset added:

  • posthog-android

If this change should ship, run pnpm changeset and select a bump level.
If it isn't user-facing (refactor with no behavior change, internal tooling, generated files), no action needed.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[Low impact] This test-only change appears safe to merge.

Reviews (1) · Last reviewed commit: "test(replay): keep trigger-started recor..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant