Skip to content

fix: ConversationStore.save() setAttributes failure desynchronizes disk and in-memory state (M1) #46

Description

@sfegette

Summary

In ConversationStore.save(), the three operations (encode → write → setAttributes) share a single do/catch. If write succeeds but setAttributes throws, upsertInMemoryRecord is never called — the file lands on disk with new content but the in-memory sidebar shows stale state.

Fix

  1. Call upsertInMemoryRecord immediately after write succeeds (not after setAttributes).
  2. Change setAttributes to try? — treat it as best-effort; a permissions failure should not roll back an otherwise successful save.

Test coverage

This is test gap #2: add a test that stubs setAttributes to throw after a successful write and asserts in-memory state is updated correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions