Skip to content

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Dec 10, 2025

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Describe the solution you've provided

  • Added LDDebugOverride interface to manage flag value overrides during development.
  • Introduced safeRegisterDebugOverridePlugins function to register plugins with debug capabilities.
  • Updated FlagManager to support debug overrides, including methods to set, remove, and clear overrides.
  • Enhanced LDClientImpl to utilize debug overrides during client initialization.
  • Refactored LDPlugin interface to include optional registerDebug method for plugins.

This PR will enable @launchdarkly/toolbar to use 4.x

Additional context

- Added `LDDebugOverride` interface to manage flag value overrides during development.
- Introduced `safeRegisterDebugOverridePlugins` function to register plugins with debug capabilities.
- Updated `FlagManager` to support debug overrides, including methods to set, remove, and clear overrides.
- Enhanced `LDClientImpl` to utilize debug overrides during client initialization.
- Refactored `LDPlugin` interface to include optional `registerDebug` method for plugins.

This commit will enable `@launchdarkly/toolbar` to use 4.x
@github-actions
Copy link
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 169118 bytes
Compressed size limit: 200000
Uncompressed size: 789399 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25394 bytes
Compressed size limit: 26000
Uncompressed size: 124693 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 18097 bytes
Compressed size limit: 20000
Uncompressed size: 93036 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 22658 bytes
Compressed size limit: 25000
Uncompressed size: 78287 bytes

@joker23 joker23 changed the base branch from main to skz/sdk-1360/browser-4.x-waitforinit December 10, 2025 19:32
@joker23 joker23 changed the base branch from skz/sdk-1360/browser-4.x-waitforinit to main December 10, 2025 19:32
* Unregister a flag change callback.
*/
off(callback: FlagsChangeCallback): void;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blocking until we have some eyes on this - ultimately want to make sure we are fine with having the flag override functionality handled by the flag manager. I think this makes sense, but I can also see how having this implemented as part of the client impl give us a bit more flexibility.

* This event does not include the value of the flag. It is expected that you
* will call a variation method for flag values which you require.
*/
export type FlagsChangeCallback = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blocking until we get some eyes on this - main reason to add null as a valid context to pass in for these events is to support flag changes that are triggered by an override... An alternative is to somehow designate a special context for the override event?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should just include whatever context is associated with the currently active payload. Because this would propagate all the way to the events emitted by the LD client.

    this._flagManager.on((context, flagKeys, type) => {
      this._handleInspectionChanged(flagKeys, type);
      const ldContext = Context.toLDContext(context);
      this.emitter.emit('change', ldContext, flagKeys);
      flagKeys.forEach((it) => {
        this.emitter.emit(`change:${it}`, ldContext);
      });
    });

From a consuming standpoint the override changing is changing the value for the current context.

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