-
Notifications
You must be signed in to change notification settings - Fork 157
[WIP] Expand broadcast, raise*, and open methods to include metadata #1595
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
base: main
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for fdc3 failed. Why did it fail? →
|
| }) | ||
| ``` | ||
|
|
||
| ### Timestamp |
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.
do we need this? We already have a timestamp in the message meta I think
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.
I agree, tinestamp could/should be DA provided rather than app provided - even if it's the client code generating it
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.
It was in my notes as one of the few properties we should support. Let's discuss what metadata properties should be included at the next Web meeting.
| "payload": { | ||
| "$ref": "#/$defs/OpenRequestPayload" | ||
| }, | ||
| "metadata": { |
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.
I've been looking at this. It doesn't seem like this gets generated into OpenRequest object in BrowserTypes. I'm not enough of an expert on JSON schema to really say why, except that I can add the metadata into the base type, AppRequest and it seems to push through.
However, I think this is the wrong place for this: I think the context metadata belongs in the payload, along with the context. After all, the message already has a meta field (which is the meta of the message) so it seems like we need to have meta inside the payload (the meta of the payload).
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.
I agree that we should create fields in the payload, rather than as a sibling of it. That will move it further from the meta element that relates to the "envelope" or message format and more clearly tie it to a particular API call.
The reason that its not generating out in the current location is that the extra property is not allowed in the AppRequest schema, so when OpenRequest has AppRequest composed with it (as all requests do) the field gets dropped - that is part of the role of AppRequest: to govern the shape of those things derived from it and prevent additionalProperties that should not be there.
I'd say just go ahead and move it into the payload for every API message that should transmit either the app provided or super-set of app and DA-provided metadata (i.e. requests include appProvided, responses include both app and DA provided).
| context: Context, | ||
| app?: AppIdentifier, | ||
| metadata?: AppProvidableContextMetadata | ||
| ): Promise<IntentResolution>; |
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.
This allows metadata to go from the app raising the intent to the app receiving it. However, it doesn't on its own allow metadata to come back from the receiver back to the raiser. We might need to extend the IntentResolution interface to add getResultMetadata perhaps?
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.
Good point! Changing the return type of IntentResolution.getResult() would not be ideal (breaking).
However, we should also conider the fact that IntentResolution is itself a metadata object and returns the source for the resolution at least:
- what app did the DA deliver it to...,
- what was the intent (could have been chosen by the user or DA if there was only one)
But it is returned before the result (should come back at the same time that intent is delivered - so before the result). Hence, before we pick a solution here, what additional metadata might someone want? I'd argue timestamp isn't as interesting in intents (as you can't getCurrentContext() and pick it up later). Signatures are interesting (and would have to come from the app, rather than the DA). Anything else? Signature is probably enough of a use case...
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.
Spent some time with @julianna-ciq talking about this - its one of the harder parts to solve in the design because its difficult for IntentHandler functions to return metadata, currently they can return Context, Channel or void, but we'd need a compound type with the metadata to return.
Further, IntentResolution is itself a metadata object that overlaps with the ContextMetadata some already, in that it contains the source field. A trace_id is less useful as it should be the same value used in the original call if provided and its still connected to that call. timestamp is less interesting as we don't have a call like getCurrentCOntext to worry about where it will be received later.
The one case I thought it mattered on is signature, there is a workaround where an app could return a channel and deliver signed results over that instead.
Hence, with added complexity and reduced utility, we think this should just be left out for now, and revisited if anyone comes up with a solid us-case for needing it.
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.
Review comments for a week or two ago
| }, | ||
| context, | ||
| }, | ||
| metadata, |
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.
In all other cases, parameters to FDC3 functions go into the payload element... I think we should stick to that pattern
| app, | ||
| }, | ||
| meta: meta, | ||
| metadata: { |
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.
See previous comment about keeping this in the payload
| traceId?: string; | ||
| } | ||
|
|
||
| export interface DesktopAgentProvidableContextMetadata { |
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.
Given that most of these fields are forwarded on from app provided metadata, we should could/should just integrate it into ContextMetadata... I was expecting to see a relationship to that type as that is the one we currently return, containing source
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.
ContextMetadata appears defunct after this change, so it either needs to be removed or these changes integrated into it. I prefer the latter (put the new fileds into that type and keep it)
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.
Just in the #1644 meeting, we are discussing the CDM use case. In this case, a CDM message may be broken down into a number of different FDC3 contexts. e.g. a priceQuantity message contains, date, instrument, amount, exchange, each of which might be a different context broadcast.
In this case, to re-assemble the message, it would be nice to use a common traceId across them all, but also have a count metadata item, so you know how many broadcasts should be bundled together.
|
|
||
| Optional metadata about each context or intent message received SHOULD be provided by the desktop agent implementation to registered intent handlers. As this metadata is optional, apps making use of it MUST handle cases where it is not provided. | ||
|
|
||
| Registered listeners SHOULD receive the following properties: |
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.
YOu SHOULD be able to pass these - in which case it SHOULD or MUST be passed on. But it needs to be conditional on an app setting it (apart from source which DA MSUT provide and MUST NOT forward if passed by app to avoid spoofing).
|
|
||
| Apps SHOULD NOT provide timestamp information. If an app provides a timestamp, the Desktop Agent MUST ignore the timestamp. | ||
|
|
||
| ### Source |
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.
I'd use the original label (Originating App Metadata) in the content somewhere to retain the link to the use case.
| Intent handlers SHOULD be registered via [`fdc3.addIntentListener`](ref/DesktopAgent#addintentlistener) within 15 seconds of the application launch (the minimum timeout Desktop Agents are required to provide) in order to be widely compatible with Desktop Agent implementations. Individual Desktop Agent implementations MAY support longer timeouts or configuration to control or extend timeouts. | ||
|
|
||
| ### Originating App Metadata | ||
| ### Metadata |
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.
I'd add a brief textual description saying additional metadata may be passed ...
| }) | ||
| ``` | ||
|
|
||
| ### Timestamp |
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.
I agree, tinestamp could/should be DA provided rather than app provided - even if it's the client code generating it
| "payload": { | ||
| "$ref": "#/$defs/OpenRequestPayload" | ||
| }, | ||
| "metadata": { |
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.
I agree that we should create fields in the payload, rather than as a sibling of it. That will move it further from the meta element that relates to the "envelope" or message format and more clearly tie it to a particular API call.
The reason that its not generating out in the current location is that the extra property is not allowed in the AppRequest schema, so when OpenRequest has AppRequest composed with it (as all requests do) the field gets dropped - that is part of the role of AppRequest: to govern the shape of those things derived from it and prevent additionalProperties that should not be there.
I'd say just go ahead and move it into the payload for every API message that should transmit either the app provided or super-set of app and DA-provided metadata (i.e. requests include appProvided, responses include both app and DA provided).
| context: Context, | ||
| app?: AppIdentifier, | ||
| metadata?: AppProvidableContextMetadata | ||
| ): Promise<IntentResolution>; |
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.
Good point! Changing the return type of IntentResolution.getResult() would not be ideal (breaking).
However, we should also conider the fact that IntentResolution is itself a metadata object and returns the source for the resolution at least:
- what app did the DA deliver it to...,
- what was the intent (could have been chosen by the user or DA if there was only one)
But it is returned before the result (should come back at the same time that intent is delivered - so before the result). Hence, before we pick a solution here, what additional metadata might someone want? I'd argue timestamp isn't as interesting in intents (as you can't getCurrentContext() and pick it up later). Signatures are interesting (and would have to come from the app, rather than the DA). Anything else? Signature is probably enough of a use case...
|
|
Wouldn't you also have the single compound message with them all in? What is suggested in the current docs is that you compose one large context made up of smaller ones, broadcast all the smaller ones with the big one last. Apps can listen for whatever they support.
|
Yeah makes sense. |
Describe your change
Adds the
metadataproperty at the end of the.broadcast(),.raiseIntent(),.raiseIntentForContext(), and.open()methods.Includes schema updates, doc updates, and implementation updates.
Provides placeholder space for
signature(see #1571) andhostParams(#1546).Related Issue
Resolves #1290
Contributor License Agreement
Review Checklist
DesktopAgent,Channel,PrivateChannel,Listener,Bridging)?JSDoc comments on interfaces and types should be matched to the main documentation in /docs
Conformance test definitions should cover all required aspects of an FDC3 Desktop Agent implementation, which are usually marked with a MUST keyword, and optional features (SHOULD or MAY) where the format of those features is defined
The Web Connection protocol and Desktop Agent Communication Protocol schemas must be able to support all necessary aspects of the Desktop Agent API, while Bridging must support those aspects necessary for Desktop Agents to communicate with each other
npm run build) run and the results checked in?Generated code will be found at
/src/api/BrowserTypes.tsand/or/src/bridging/BridgingTypes.tsBaseContextschema applied viaallOf(as it is in existing types)?titleanddescriptionprovided for all properties defined in the schema?npm run build) run and the results checked in?Generated code will be found at
/src/context/ContextTypes.ts