Skip to content

Comments

refactor: Refactor FDV2 protocol handling.#1115

Draft
kinyoklion wants to merge 3 commits intomainfrom
rlamb/fdv2-refactoring
Draft

refactor: Refactor FDV2 protocol handling.#1115
kinyoklion wants to merge 3 commits intomainfrom
rlamb/fdv2-refactoring

Conversation

@kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Feb 20, 2026

This PR introduces a few refactoring changes to:

  • Better align FDv2 code with the java/dotnet implementations.
    • The protocol handler is its own entity.
    • The word "basis" is reserved for the header we use in the FDv2 protocol instead of being overloaded to represent a full set of data.
  • Better align the FDv2 code with the client-side requirements for JS in this repo. (Reducing usage of classes and other features that increase code size.)

Likely subsequent changes will be made to use a more "pull" based approach to the data sources instead of the callback based approach, but that is TBD.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

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

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

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

let tempType: PayloadType = 'partial';
let tempUpdates: Update[] = [];

function processObj(kind: string, jsonObj: any): any {
Copy link
Member Author

Choose a reason for hiding this comment

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

I am not convinced this is the best layer for this. I think it may be better one level up.

statusCallback(subsystemCommon.DataSourceState.Valid);

payloadProcessor.addPayloadListener((payload) => {
dataCallback(payload.basis, { initMetadata, payload });
Copy link
Member Author

Choose a reason for hiding this comment

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

Another PR will propagate the changeset type through the layers. I prefer an actual interface for this instead of a single field.

Like this: https://github.com/launchdarkly/java-core/blob/823d276b7e3fb9d0199ff091316fb4199e849a6e/lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/subsystems/DataStoreTypes.java#L396

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