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

feat: Respect context when creating MIDs #3077

Merged
merged 9 commits into from Jan 23, 2024
Merged

feat: Respect context when creating MIDs #3077

merged 9 commits into from Jan 23, 2024

Conversation

oed
Copy link
Member

@oed oed commented Dec 29, 2023

Enables adding context to genesis headers in MIDs.

@oed oed requested review from stbrody and dbcfd December 29, 2023 11:30
@oed oed self-assigned this Dec 29, 2023
@dbcfd
Copy link
Contributor

dbcfd commented Jan 2, 2024

@oed would it make more sense to call this appData or userData?

@oed
Copy link
Member Author

oed commented Jan 2, 2024

@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?

@stbrody
Copy link
Contributor

stbrody commented Jan 2, 2024

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

@oed oed requested a review from stbrody January 20, 2024 20:57
Copy link
Contributor

@stbrody stbrody left a 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 }
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
expect(streamState.metadata.context).toBeInstanceOf(StreamID)
expect(streamState.metadata.context).toEqual(METADATA_WITH_CONTEXT.context)

@oed oed merged commit 8b7c742 into develop Jan 23, 2024
6 checks passed
@oed oed deleted the feat/mid-context branch January 23, 2024 11:57
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.

None yet

3 participants