Skip to content

fix: make logs immutable#139

Merged
KnorpelSenf merged 4 commits intomainfrom
immutable-logs
Apr 16, 2025
Merged

fix: make logs immutable#139
KnorpelSenf merged 4 commits intomainfrom
immutable-logs

Conversation

@KnorpelSenf
Copy link
Member

Currently, it is possible to mutate existing objects in the logs by returning their references from external, mutating them, and then using checkpoints to rewind the logs and access the mutated objects at a later point.

These changes fix that by returning a deep clone of all objects in the logs that are accessed via external. Note that (persistent) storage adapters have just deserialised the data before giving it back to the plugin at this point. In most cases, this means that it was parsed from JSON. It is therefore safe to clone it.

Regular wait calls and API calls are intentionally left unfixed. This is because it is extremely rare for people to mutate the update objects returned from wait calls or API calls. At the same time, those are a large part of the data in the logs. I feat that it would come at a significant runtime cost to always clone the entire log while it is being replayed.

Fixes #137.

@KnorpelSenf KnorpelSenf merged commit d097e84 into main Apr 16, 2025
6 checks passed
@KnorpelSenf KnorpelSenf deleted the immutable-logs branch April 16, 2025 10:27
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.

Determinism breaking in conversation

2 participants