-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Graph backend phase 1 #5622
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
Merged
Merged
Graph backend phase 1 #5622
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OEvgeny
reviewed
Nov 12, 2025
Collaborator
OEvgeny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits and questions
Contributor
OEvgeny
approved these changes
Nov 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog Entry
Added
Description
We are introducing a new JSON-LD graph backend. This new backend is paving the way towards replacing Redux as the single source of truth. And in future, next generation chat adapter will emit nodes and edges, instead of activities.
The graph backend use JSON-LD to ensure data are linked in a standardized manner. The schema will be largely backed by Schema.org along with some custom fields to support backward compatibility.
In this pull request:
channelData['webchat:internal:id']: stringkeeps the (semi-)permanent ID, similar to<ActivityKeyer>and is intended to replace<ActivityKeyer>in the futurechannelData['webchat:internal:position']: numberkeeps the positional index of the activity in the chat historyurn:microsoft:webchat:direct-line-activity:raw-jsonMessagenodes and sort them into an arrayorderedActivities: readonly WebChatActivity[]useActivities()will read from the neworderedActivities, instead of from Redux store stateorderedActivitiesis 100% same as Redux store stateWhat is (obviously) missing from this phase:
activity.attachments[]andactivity.entities[]are not serialized to the graph yetnode.senderproperty is of typeAudienceand this is not coerrect, should be more targeted thing, such asPersonorOrganizationactivity:raw-jsonshould be JSON literals (all values must be serializable as JSON)<ActivityKeyer>with the new permanent IDDesign
JSON-LD Opinions: halfway between styles
JSON-LD is great for storing node and edges. However, to effectively access and retrieve data from the graph for our use, the data is shaped with opinions, around a few principles:
@id: every node in the graph must be identifiable@contextand@id{ "@id": string }to reduce confusion with plain string@typemust be an array of stringnullis removed[]andnullare same as if the property is removednullis not supported and will throw unless it is JSON literal, as it is likely a bug in code{ '@type': '@json', '@value': JSONValue }@valuecould be null, if unwrapped, will be confusing as we removed nulls@contextis an opaque string and its schema is not honored@idand it should not contain@typehasPartandisPartOfare auto-inversed@typeThe end result is still 100% legit JSON-LD. However, they are not 100% styled as flattened nor compact. In other words, the final data shape is not absolutely styled, but halfway between each style to better fit our scenario.
Refactoring insertion sort algorithm
This refactoring allows us to have a new
channelData['webchat:internal:position']: numberproperty to keep the positional index of the activity. We will put this number intoMessage.positionproperty.Specific Changes
-
CHANGELOG.mdI have updated documentationReview Checklist
Accessibility reviewed (tab order, content readability, alt text, color contrast)Browser and platform compatibilities reviewedCSS styles reviewed (minimal rules, noz-index)Documents reviewed (docs, samples, live demo)Internationalization reviewed (strings, unit formatting)package.jsonandpackage-lock.jsonreviewedSecurity reviewed (no data URIs, check for nonce leak)