Skip to content

feat: snapshot/resume — serialize interpreter state mid-execution#954

Merged
chaliy merged 1 commit intomainfrom
claude/issue-930-snapshot-resume
Apr 2, 2026
Merged

feat: snapshot/resume — serialize interpreter state mid-execution#954
chaliy merged 1 commit intomainfrom
claude/issue-930-snapshot-resume

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 2, 2026

Summary

  • Add Bash::snapshot() -> Vec<u8> and Bash::from_snapshot(&[u8]) for serializing/restoring interpreter state between exec() calls
  • Captures shell state (variables, env, arrays, cwd, aliases, traps), VFS contents, and session counters
  • JSON serialization for Phase 1 (debuggable, human-readable)
  • JS/TS bindings: snapshot(), restoreSnapshot(), Bash.fromSnapshot()
  • vfs_snapshot()/vfs_restore() on FileSystemExt trait for InMemoryFs, MountableFs, OverlayFs

Test plan

  • 10 new snapshot tests pass (cargo test --test snapshot_tests)
  • Full build clean (cargo build)
  • cargo fmt --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean

Closes #930

@chaliy chaliy force-pushed the claude/issue-930-snapshot-resume branch from 1ad7965 to ceeec50 Compare April 2, 2026 04:50
Add Bash::snapshot() -> Vec<u8> and Bash::from_snapshot(&[u8]) to capture
and restore interpreter state between exec() calls:
- Shell state (variables, env, arrays, cwd, aliases, traps, exit code)
- VFS contents (files, directories, symlinks via VfsSnapshot)
- Session-level counters (commands used, exec calls)

Implementation:
- New Snapshot struct combining ShellState + VfsSnapshot + counters
- JSON serialization for Phase 1 (debuggable, human-readable)
- vfs_snapshot()/vfs_restore() on FileSystemExt trait for InMemoryFs,
  MountableFs, and OverlayFs
- JS/TS bindings: snapshot(), restoreSnapshot(), Bash.fromSnapshot()
- 10 new tests covering byte roundtrip, arrays, env, cwd, restore-in-place

Closes #930
@chaliy chaliy force-pushed the claude/issue-930-snapshot-resume branch from ceeec50 to 38e2ac0 Compare April 2, 2026 04:56
@chaliy chaliy merged commit bd4d2a5 into main Apr 2, 2026
27 checks passed
@chaliy chaliy deleted the claude/issue-930-snapshot-resume branch April 2, 2026 05:04
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.

feat: Snapshot/resume — serialize interpreter state mid-execution

1 participant