Skip to content

Conversation

raju-opti
Copy link
Contributor

@raju-opti raju-opti commented Aug 29, 2025

Summary

The current type of activate listener payload is not backwards compatible with the type in v6.0.0. This PR makes it compatible.

Test plan

Issues

  • FSSDK-11823

@coveralls
Copy link

coveralls commented Aug 29, 2025

Coverage Status

coverage: 79.144% (+0.001%) from 79.143%
when pulling 6735577 on raju/holdout-noti
into fb5e012 on master.

@raju-opti raju-opti changed the title make Activate listener payload type backwards compatible [FSSDK-11823] make Activate listener payload type backwards compatible Sep 2, 2025
@raju-opti raju-opti force-pushed the raju/holdout-noti branch 2 times, most recently from e858feb to 2f090cc Compare September 2, 2025 14:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR makes the activate listener payload type backwards compatible with v6.0.0 by separating experiment and holdout fields instead of using a union type.

  • Separates the experiment field into distinct experiment and holdout fields in ActivateListenerPayload
  • Adds runtime type checking with isHoldout function to properly populate the correct field
  • Updates notification handling to conditionally set either experiment or holdout based on the decision object type

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/shared_types.ts Adds isHoldout type guard function to distinguish between experiments and holdouts
lib/optimizely/index.ts Updates activate notification logic to separate experiment and holdout into distinct fields
lib/optimizely/index.tests.js Updates test expectations to include the new holdout: null field
lib/optimizely/index.spec.ts Updates test spy names and adds validation for the new activate notification payload structure
lib/notification_center/type.ts Modifies ActivateListenerPayload type to have separate experiment and holdout fields
lib/feature_toggle.ts Updates holdout feature toggle and adds conditional type helper
Comments suppressed due to low confidence (1)

lib/feature_toggle.ts:1

  • Import statement references holdout and IfActive from a file that is being modified in this PR. The IfActive type is newly added but holdout is a function, not a type. This import may cause issues if the function is being used as a type in the import context.
/**

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

3 participants