Skip to content

[browser-next] resetGroups retains persisted group flag properties when flags is absent #5673

Open

Description

@dustinbyrne

Bug description

In experimental @posthog/browser, analytics.resetGroups() clears group membership but leaves persisted group properties used for flag evaluation when the flags product is absent. A later client that installs flags can send that retained context again.

Reproduction

Use the same project token and storage across these loads:

  1. Install analytics and flags, then call:
    await analytics.group('company', 'company-1', { plan: 'paid' })
  2. Reload with flags: false, acquire analytics, and call:
    analytics.resetGroups()
  3. Reload with flags installed and inspect the next flag-evaluation request.

Membership is cleared, but $stored_group_properties in the featureFlags storage namespace still contains { company: { plan: 'paid' } } and can appear in group_properties.

Expected behavior

Group-only reset durably clears both memberships and group flag-property overrides, independently of whether flags is installed. Identity, sessions, person properties, cached flag values and unrelated stored context remain intact.

Evidence and scope

Follow-up to #5655 and its review finding. Reproduced against the stack's built output at 728e13f70ddf55812ea85696e0c700ab66e5d52d: memberships became {}, while the stored company properties remained.

Core reset currently clears only memberships. Durable flag-property removal depends on the optional flags product's onGroupsReset listener. Cleanup should remain Core-owned and should not require loading the flags implementation.

Activity

  1. posthog commented on Nov 11, 2026

    @posthog
    Contributor

    PostHog self-driving picked up this issue. Status: Research is done.

    Somebody may already be working on it, so ask before you start a fix.

    Report (team access only): https://us.posthog.com/project/2/inbox/reports/01a1cc1f-28ca-75d9-ba3b-0d8161fbd9d1?link_source=github_comment

  2. rahulsjha commented on Nov 14, 2026

    @rahulsjha

    Hi @dustinbyrne, I'd like to work on this if it's still open for outside help.

    Plan:

    • Make analytics.resetGroups() in @posthog/browser clear $stored_group_properties in the featureFlags storage namespace directly, rather than relying on the flags product being installed. Keep identity, sessions, person properties and cached flag values untouched.
    • Add a test for your reproduction: group with properties → reload with flags: false → resetGroups() → reload with flags, and assert the next flag request has no group_properties for the reset group.

    Would you like it as a follow-up PR on top of the #5655 work, or against main?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions