Skip to content

fix(memory): compat deserializer and migration for pre-v0.17.1 MessagePart format#2287

Merged
bug-ops merged 1 commit intomainfrom
2278-messagepart-summary-deser
Mar 27, 2026
Merged

fix(memory): compat deserializer and migration for pre-v0.17.1 MessagePart format#2287
bug-ops merged 1 commit intomainfrom
2278-messagepart-summary-deser

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 27, 2026

Fixes #2278.

Summary

  • Add try_parse_legacy_parts() compat fallback in parse_parts_json(): recognizes all 12 old externally-tagged variant keys ({"Summary":{"text":"..."}}) and converts to the current internally-tagged format ({"kind":"summary","text":"..."}); emits tracing::warn on the legacy path for observability
  • Add SQLite migration 045_fix_message_parts_legacy_format.sql that resets legacy-format parts rows to []; the content column is preserved as the plain-text fallback
  • Update existing test old_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 JSON

Test plan

  • cargo +nightly fmt --check — clean
  • cargo nextest run -p zeph-memory --lib — 835 passed, 0 failed
  • No new clippy errors introduced (pre-existing 45 errors in zeph-memory unchanged)
  • Compat path emits tracing::warn with "loaded legacy-format message parts via compat path" for observability

@github-actions github-actions bot added documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 27, 2026
@bug-ops bug-ops force-pushed the 2278-messagepart-summary-deser branch from b612244 to a02c502 Compare March 27, 2026 22:02
@bug-ops bug-ops enabled auto-merge (squash) March 27, 2026 22:04
…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.
@bug-ops bug-ops force-pushed the 2278-messagepart-summary-deser branch from a02c502 to 2b21ec1 Compare March 27, 2026 22:12
@bug-ops bug-ops merged commit 988e960 into main Mar 27, 2026
25 checks passed
@bug-ops bug-ops deleted the 2278-messagepart-summary-deser branch March 27, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation memory zeph-memory crate (SQLite) rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(memory): MessagePart::Summary deserialization fails for pre-v0.17.1 SQLite history

1 participant