Skip to content

Conversation

@tanderson-ld
Copy link
Contributor

@tanderson-ld tanderson-ld commented Apr 17, 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
    To be done on target branch.

@tanderson-ld tanderson-ld marked this pull request as ready for review April 18, 2025 14:16
@tanderson-ld tanderson-ld requested a review from a team as a code owner April 18, 2025 14:16
expect(statusCallback).toHaveBeenCalledTimes(4);
});

// it('it reports DataSourceState Off when all synchronizers report Off', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Still tweaking this test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CompositeDataSource is now stitching together status of underlying datasources into a cohesive series, so most of the changes in here are to enhance the existing tests to check the status sequences.

expect(statusCallback).toHaveBeenNthCalledWith(1, DataSourceState.Initializing, undefined);
expect(statusCallback).toHaveBeenNthCalledWith(2, DataSourceState.Valid, undefined);
expect(statusCallback).toHaveBeenNthCalledWith(3, DataSourceState.Interrupted, undefined);
expect(statusCallback).toHaveBeenNthCalledWith(4, DataSourceState.Valid, undefined);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Here it is now checking the top level status updates are a proper merging of the underlying data source statuses.

*/
stop(): 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.

For reviewers: The initializer and synchronizer factory distinction was making writing the logic related to culling a blacklist datasource cumbersome. So removed that distinction to make the logic the same for both types.

// Data source was closed and will not retry
Closed,
// This datasource encountered an unrecoverable error and it is not expected to be resolved through trying again in the future
Off,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Added Off and reordered so Valid would be 0 (positive result).

Copy link
Member

Choose a reason for hiding this comment

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

Is that considered a breaking change then?

* Represents a transition between data sources.
*/
export type Transition = 'none' | 'switchToSync' | 'fallback' | 'recover' | 'stop';
export type Transition = 'switchToSync' | 'fallback' | 'recover' | 'stop';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Undefined transition takes the place of none now.

}
break;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: All the position tracking logic is now in the dataSourceList class to encapsulate iteration.

if (!condition || (excludeRecover && condition.transition === 'recover')) {
if (excludeRecover && condition?.transition === 'recover') {
return undefined;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: No logical change intended here.

subsystemCommon.DataSourceState.Closed,
subsystemCommon.DataSourceState.Off,
new LDPollingError(DataSourceErrorKind.ErrorResponse, message, status),
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: This is what leads to blacklisting after unrecoverable error.

@tanderson-ld tanderson-ld requested a review from keelerm84 April 18, 2025 14:32
Copy link
Member

@keelerm84 keelerm84 left a comment

Choose a reason for hiding this comment

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

Looks good overall. Not approving since there is a pending test commented out, but otherwise 👍🏼

// Data source was closed and will not retry
Closed,
// This datasource encountered an unrecoverable error and it is not expected to be resolved through trying again in the future
Off,
Copy link
Member

Choose a reason for hiding this comment

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

Is that considered a breaking change then?

@tanderson-ld tanderson-ld changed the title feat: CompositeDataSource blacklists DataSources that report Off feat: CompositeDataSource blacklists DataSources that report unrecoverable error Apr 22, 2025
@tanderson-ld
Copy link
Contributor Author

Looks good overall. Not approving since there is a pending test commented out, but otherwise 👍🏼

Addressed!

@tanderson-ld tanderson-ld requested a review from keelerm84 April 22, 2025 17:04
@tanderson-ld tanderson-ld merged commit aee6479 into ta/fdv2-temporary-holding Apr 22, 2025
2 checks passed
@tanderson-ld tanderson-ld deleted the ta/sdk-1137/blacklisting-datasources branch April 22, 2025 17:10
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