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
feat: Respect context when creating MIDs #3077
Conversation
@oed would it make more sense to call this |
@dbcfd I don't have a strong stance, looks like Orbis is already using context. Maybe you can ask in the forum post linked above? |
I really want us to make sure we've thought about how this will interact with Recon and get fed down to lower levels (for example, for separator key we have an extra indirection layer where we have one field that says that name of the actual separator key field name is. Might we want something like this for context? Might it make sense to be able to take a field from the actual content of the document as the context?), as well as what, if any, constraints we want on this field. One of the problems we had with "family" was that it was so open-ended, every dev wound up using it differently, so it was hard to take advantage of in the protocol. Are we sure we're not going to wind up with the same problem here? I know Orbis has said they use it with a StreamID that references a different document that has information and details about the "context". Might we want to enforce that as the way this is always used? I think it's very possible this approach is totally fine, I just want to make sure we've thought it through before jamming it in just because this is what one partner asked for. Adding Nathaniel and Aaron for their takes |
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.
lgtm
@@ -70,6 +70,7 @@ const CONTENT0 = { myData: 0 } | |||
const CONTENT1 = { myData: 1 } | |||
const CONTENT2 = { myData: 2 } | |||
const METADATA = { controller: DID_ID, model: FAKE_MODEL_ID } | |||
const METADATA1 = { controller: DID_ID, model: FAKE_MODEL_ID, context: FAKE_MID_ID } |
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.
nitpick: maybe call this METADATA_WITH_CONTEXT
?
} | ||
const streamState = await handler.applyCommit(commitData, context) | ||
delete streamState.metadata.unique | ||
expect(streamState.metadata.context).toBeInstanceOf(StreamID) |
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.
expect(streamState.metadata.context).toBeInstanceOf(StreamID) | |
expect(streamState.metadata.context).toEqual(METADATA_WITH_CONTEXT.context) |
Enables adding context to genesis headers in MIDs.