Skip to content

Fix the workspace shelf aliasing live state, and rec-save-as! message#136

Merged
bbatsov merged 1 commit into
masterfrom
fix-shelf-snapshot
Jul 11, 2026
Merged

Fix the workspace shelf aliasing live state, and rec-save-as! message#136
bbatsov merged 1 commit into
masterfrom
fix-shelf-snapshot

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 11, 2026

Copy link
Copy Markdown
Member

Two bugs surfaced while documenting the recording features (from the README docs PR):

Workspace shelf didn't snapshot. 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 ws-load! restored nothing. Now it shelves a fully-dereferenced snapshot (the same thing recordings already do), via a small optional prep hook on sayid.shelf, and re-atomizes the root on load so the restored workspace can record again.

rec-save-as! printed id 'null' to slot 'null'. It ran (juxt :id :rec-slot) over the recording atom instead of its value - just a missing deref. 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.

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).
@bbatsov
bbatsov merged commit 7088f32 into master Jul 11, 2026
17 checks passed
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.

1 participant