fix(memory): compat deserializer and migration for pre-v0.17.1 MessagePart format#2287
Merged
fix(memory): compat deserializer and migration for pre-v0.17.1 MessagePart format#2287
Conversation
b612244 to
a02c502
Compare
…ePart format (#2278) SQLite records written before v0.17.1 use the old externally-tagged format ({"Summary":{"text":"..."}}). After #2271 introduced the internally-tagged format ({"kind":"summary","text":"..."}), these rows silently deserialized to vec![] — 80 failures observed in a single session log. - Add `try_parse_legacy_parts()` compat fallback in `parse_parts_json()`: recognizes all 12 old-format variant keys and converts to new format; emits tracing::warn on the legacy path for observability. - Add migration 045 that resets legacy-format `parts` rows to `[]`; the plain-text `content` column is preserved as the display fallback. - Update and extend unit tests; rename test that previously asserted the old format fails to assert it now succeeds via the compat path.
a02c502 to
2b21ec1
Compare
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.
Fixes #2278.
Summary
try_parse_legacy_parts()compat fallback inparse_parts_json(): recognizes all 12 old externally-tagged variant keys ({"Summary":{"text":"..."}}) and converts to the current internally-tagged format ({"kind":"summary","text":"..."}); emitstracing::warnon the legacy path for observability045_fix_message_parts_legacy_format.sqlthat resets legacy-formatpartsrows to[]; thecontentcolumn is preserved as the plain-text fallbackold_external_tag_summary_format_fails_to_deserialize→ now asserts the old format succeeds via the compat path; add 4 new compat tests covering all major variants, mixed arrays, new-format passthrough, and garbage JSONTest plan
cargo +nightly fmt --check— cleancargo nextest run -p zeph-memory --lib— 835 passed, 0 failedtracing::warnwith"loaded legacy-format message parts via compat path"for observability