Skip to content

fix(snapshot): store function source alongside ast#1332

Merged
chaliy merged 1 commit intomainfrom
fix/snapshot-function-source-fallback
Apr 16, 2026
Merged

fix(snapshot): store function source alongside ast#1332
chaliy merged 1 commit intomainfrom
fix/snapshot-function-source-fallback

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 16, 2026

What

  • store function source alongside serialized AST in shell snapshots
  • restore functions from source when AST is missing
  • add exclude_functions snapshot option so prompt-oriented snapshots can skip cloning function state
  • expose the new option in Python and JS bindings and document it
  • update the local ship skill to create a branch when shipping from detached HEAD

Why

  • AST-only function snapshots are brittle across parser/schema evolution
  • prompt/state inspection flows should avoid cloning AST-heavy function maps when they do not need function restore

How

  • capture original function source during parse
  • serialize snapshots as source plus AST, with source fallback on deserialize
  • thread exclude_functions through Rust, Python, and JS snapshot APIs
  • add regression tests for source-only restore and function-free snapshots

Validation

  • cargo test -p bashkit --test snapshot_tests
  • cargo test -p bashkit-python --no-run
  • cargo test -p bashkit-js --no-run
  • just test
  • just pre-pr

@chaliy chaliy force-pushed the fix/snapshot-function-source-fallback branch from e1b3387 to dfbbb2b Compare April 16, 2026 22:26
@chaliy chaliy merged commit d0e5f67 into main Apr 16, 2026
32 checks passed
@chaliy chaliy deleted the fix/snapshot-function-source-fallback branch April 16, 2026 22:36
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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