Fix the workspace shelf aliasing live state, and rec-save-as! message#136
Merged
Conversation
Two bugs found while documenting the recording features: - ws-save!/ws-save-as! shelved @workspace directly, so the stored copy shared the live workspace's :children atom. Mutating the workspace after saving (clearing the log, tracing more) corrupted the shelved copy, and a later load restored nothing. Shelve a fully-dereferenced snapshot instead - the same thing recordings already do - via a new optional `prep` hook on the shelf, and re-atomize the root on load so the restored workspace can record again. - rec-save-as! reported "id 'null' to slot 'null'": it ran (juxt :id :rec-slot) over the recording atom instead of its value. Deref first. Adds a regression test that mutates the workspace after saving and asserts the reload is unaffected (fails without the snapshot fix).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs surfaced while documenting the recording features (from the README docs PR):
Workspace shelf didn't snapshot.
ws-save!/ws-save-as!shelved@workspacedirectly, so the stored copy shared the live workspace's:childrenatom. Mutating the workspace after saving - clearing the log, tracing more - corrupted the shelved copy, and a laterws-load!restored nothing. Now it shelves a fully-dereferenced snapshot (the same thing recordings already do), via a small optionalprephook onsayid.shelf, and re-atomizes the root on load so the restored workspace can record again.rec-save-as!printedid 'null' to slot 'null'. It ran(juxt :id :rec-slot)over the recording atom instead of its value - just a missingderef. It saved correctly; only the confirmation was wrong.Adds a regression test that mutates the workspace after saving and asserts the reload is unaffected - verified to fail without the snapshot fix. Full suite (72) and clj-kondo green.