Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: AgentSettings Circular Structure and improve internals #4626

Conversation

sw-joelmut
Copy link
Collaborator

#minor

Description

This PR replaces the skipProperties functionality with an internal _replacer function when the JSON.stringify function gets called in the calculateChangeHash.
The calculateChangeHash has been changed to use a new internal stringify function, that allows to detect and handle Circular Structures.
Additionally, the AgentSettings configuration has being added to the getRuntimeServices function, so internal functionalities can use them. Not only that, the SkillClient has being updated based on this configuration, that work for both Composer and non-Composer bots.

Specific Changes

  • The BotState class has being updated, removing all the skipProperties functionality.
  • The calculateChangeHash has being refactored to handle Circular Structures and generate a hash, instead of a plain JSON.stringify value, so it is easier to debug and identify.
  • Added the ConnectorClientOptions to the start and getRuntimeServices functions for Composer bots, so it can be customizable, and delegate to the internal CoreBot to use.
  • The BeginSkill has being updated, removing the skipProperties and introducing the new internal _replace function, for the stringify functionality to execute.
  • Added a new stringify function that encapsulates the native JSON.stringify function, with the addition to handle Circular Structures and expose the internal _replacer function to customize it.
  • Updated the internal botFrameworkClientFetchImpl function to use a single instance of axios and handle its configuration from ConnectorClientOptions.

Testing

The following images show how the ConnectorClientOptions can be provided from a Composer bot perspective, the new stringify functionality that detects and replaces circular references, and the generated hash string.
image
image
image

@sw-joelmut sw-joelmut requested a review from tracyboehrer March 1, 2024 13:56
@sw-joelmut sw-joelmut requested review from stevengum and a team as code owners March 1, 2024 13:56
@tracyboehrer tracyboehrer merged commit 57f26a6 into customer/caip-4.14.1-dev Mar 4, 2024
3 checks passed
@tracyboehrer tracyboehrer deleted the southworks/fix/agent-settings-and-circular-structure branch March 4, 2024 15:12
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.

2 participants