Repository navigation
fix(snapshot): preserve legacy function snapshot deserialization - #1467
Merged
chaliy merged 1 commit intoApr 25, 2026
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 687056f | Commit Preview URL | Apr 25 2026, 02:55 AM |
chaliy
force-pushed
the
2026-04-24-propose-fix-for-legacy-snapshot-restore-issue
branch
from
April 25, 2026 02:55
f9fcd0b to
687056f
Compare
chaliy
deleted the
2026-04-24-propose-fix-for-legacy-snapshot-restore-issue
branch
April 25, 2026 03:04
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
chaliy
added a commit
that referenced
this pull request
May 30, 2026
### Motivation - Legacy snapshots that stored function entries as raw `FunctionDef` stopped restoring because the new untagged enum attempted the new wrapper form first and optional fields allowed legacy objects to be misparsed as an empty wrapper. - Restore backward compatibility so older snapshots can still be deserialized and functions restored. ### Description - Add `#[serde(deny_unknown_fields)]` to `SnapshottedFunction` so objects with legacy `FunctionDef` fields do not deserialize into the wrapper and instead match the `Legacy(FunctionDef)` variant. - Add regression test `snapshot_restores_legacy_function_shape_without_wrapper` to assert a legacy-format function entry roundtrips and is registered on restore. - Tighten the existing source-only restore test to assert the function is actually registered (`type greet`) before invoking it. ### Testing - Ran `cargo fmt --check` which succeeded. - Ran `cargo test -p bashkit --test snapshot_tests snapshot_preserves_functions -- --exact` which passed. - Ran `cargo test -p bashkit --test snapshot_tests snapshot_restores_functions_from_source_when_ast_missing -- --exact` which passed. - Ran `cargo test -p bashkit --test snapshot_tests snapshot_restores_legacy_function_shape_without_wrapper -- --exact` which passed. ------ [Codex Task](https://chatgpt.com/codex/cloud/tasks/task_e_69eaf1c5cbd0832bbada3f4852597d1f)
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.
Motivation
FunctionDefstopped restoring because the new untagged enum attempted the new wrapper form first and optional fields allowed legacy objects to be misparsed as an empty wrapper.Description
#[serde(deny_unknown_fields)]toSnapshottedFunctionso objects with legacyFunctionDeffields do not deserialize into the wrapper and instead match theLegacy(FunctionDef)variant.snapshot_restores_legacy_function_shape_without_wrapperto assert a legacy-format function entry roundtrips and is registered on restore.type greet) before invoking it.Testing
cargo fmt --checkwhich succeeded.cargo test -p bashkit --test snapshot_tests snapshot_preserves_functions -- --exactwhich passed.cargo test -p bashkit --test snapshot_tests snapshot_restores_functions_from_source_when_ast_missing -- --exactwhich passed.cargo test -p bashkit --test snapshot_tests snapshot_restores_legacy_function_shape_without_wrapper -- --exactwhich passed.Codex Task