Add a five-minute demo of persistence and sessions - #9
Merged
Conversation
A walkthrough built around the classic trick: one session puts an ASCII rabbit in gemdb.root["hat"], another pulls it out. Three runnable scripts in docs/demo/ and a doc that shows what each step proves -- no save step in act 1, a different process in act 2, the database fully stopped and restarted in act 3, and two shells with separate transactions in act 5, where B keeps seeing the rabbit after A commits until B asks for a new view. Every command and every line of output in the doc was run against a real database rather than composed: hide/reveal/tricks through the generated gemdb wrapper, the restart with the stone confirmed down first, and the two-session act through two GCI sessions. That is how the doc earned its keep. tricks.py was written with `with gemdb.transaction():` and it failed -- the block refuses to start, reporting pending changes the script never made. Walking the file-run preamble one send at a time from a clean session: ___canonicalClassesEnabled___ leaves needsCommit false, the #GrailConsole store leaves it false, and `importlib runPath:` sets it true, twice from clean. So a script is dirty before its first line: a file whose first statement is `import gemstone; print(gemstone.needs_commit)` prints True. Shell and notebook sessions are clean and run a transaction block as their first action, so this is the file-run path alone, and the fix belongs in Grail. tricks.py uses commit() instead, the doc says why in a Known gap, and CLAUDE.md records the measurement next to the claim in cli.ts that it contradicts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The rabbit-in-the-hat demo: one session puts an ASCII rabbit in
gemdb.root["hat"], another pulls it out. Three runnable scripts indocs/demo/and a walkthrough that says what each step proves.gemdb hide.pyopen(), no format, no schemagemdb reveal.pygemdb reveal.pygemdb tricks.py×3with gemdb.transaction():Every command and every line of output in the doc was run against a real database rather than composed: the scripts through the generated
gemdbwrapper, the restart with the stone confirmed down first, the two-session act through two live GCI sessions.Which is how it found a bug
tricks.pywas written withwith gemdb.transaction():. It failed — the block refuses to start, reporting pending changes the script never made.Walking the file-run preamble one send at a time, from a clean session:
System needsCommitfalseimportlib ___canonicalClassesEnabled___: truefalseSessionTemps … #'GrailConsole' put:falseimportlib runPath: '…py'truerunPathagaintrueSo a script is dirty before its first line runs — a file whose first statement is
import gemstone; print(gemstone.needs_commit)already printsTrue.transaction()'s entry check, which exists to stop the block sweeping your forgotten work into its commit, fires on Grail's own plumbing instead.This contradicts the claim in
cli.ts(and CLAUDE.md) that canonical modules makegemdb.transaction()work as a script's first statement. Shell and notebook sessions are unaffected — they evaluate throughevaluateSource:usingModuleScope:, and a fresh one runs a transaction block as its first action, verified. So it is the file-run path alone and the fix belongs in Grail.Handled here rather than papered over:
tricks.pyusescommit(), the doc carries a Known gap note saying what to do until it is fixed, and CLAUDE.md records the measurement next to the claim it contradicts.Scope
Documentation and demo scripts only —
docs/**is kept out of the.vsixby.vscodeignore, so nothing ships. No source change, and the suites are untouched at 109 unit / 46 integration.🤖 Generated with Claude Code