Closed m0ar closed 1 year ago
Set the convention that for certain types of objects in the protocol, we look at the state of the stream at the first commit instead of at the tail. This would render the data immutable from the protocol perspective.
Possible. Not satisfactory because of the rift between spec and composeDB/graphql types.
We/ceramic implements @readonly
directives on model fields, disallowing updates to their content in the commit validation stage.
This could enable a model like this:
type Claim
@createModel(accountRelation: LIST, description: "A reusable claim to be granted via attestation")
{
maintainer: DID! @documentAccount
title: String! @readonly @string(maxLength: 100)
description: @readonly String! @string(maxLength: 1000)
badge: CID! @readonly
}
where the maintainer
can create a reusable Claim, but not change the badge pic to a :hankey: when it's in wide use.
Equally important in attestations, where one shouldn't be able to switch the Claim
from Great
to Shitty
at any point in time but should have the ability to revoke it:
type Attestation
@createModel(accountRelation: LIST, description: "General attestation")
{
source: DID! @documentAccount
targetID: StreamID! @readonly
claimID: StreamID! @readonly @documentReference(model: "Claim")
claim: Claim! @relationDocument(property: "claimID")
revoked: Boolean!
}
Strongly preferable
All thingID
ref fields now have a thingVersion
companion with the specific commit ref. This solves the theoretical issue, but in practice the indexing can be flaky, as an incoming @relationFrom
edge can disappear if the latest version of the referrer has switched the streamID
field. This is an indexing issue, not a fundamental modelling one. With accountRelation: SET
it should be all good: https://github.com/orgs/ceramicstudio/projects/2
The fact that streams are mutable is what makes Ceramic/ComposeDB a great fit for managing research objects. But for certain models, we do not want it. In this issue we discuss potential solutions.
DOD: we have a solution for working around mutability for certain type of objects.