ceramicnetwork / js-ceramic

Typescript implementation of the Ceramic protocol
http://ceramic.network
Other
414 stars 127 forks source link

feat: update how we check immutability #3188

Closed JulissaDantes closed 6 months ago

JulissaDantes commented 7 months ago

Description

We used the payload data to determine if an immutable field was being altered, but this caused 2 problems:

linear[bot] commented 7 months ago

WS2-3139 Models with set relation and immutable fields

JulissaDantes commented 7 months ago

Is there a test that reproduces the issue you are trying to solve here, using the standard ModelInstanceDocument.replace method? That method already constructs the json-patch to only include fields that actually changed, so I'm not sure how this could ever be a problem in practice.

Yes regarding the test, I changed the model for the set test to include an immutable field. The jsonpatch construction is not the problem, its how we validate immutability on locked fields, thats why we now will compare the previous value with the value post jsonpatch.

Also this is a problem we are currently having, you can check the linear task for a step by step reproduction, those steps will trigger the ModelInstanceDocument.replace method.