Skip to content

Preserve provenance metadata on memory update (#770)#1598

Closed
hanu-14 wants to merge 1 commit into
moorcheh-ai:mainfrom
hanu-14:atlas/fix-1591
Closed

Preserve provenance metadata on memory update (#770)#1598
hanu-14 wants to merge 1 commit into
moorcheh-ai:mainfrom
hanu-14:atlas/fix-1591

Conversation

@hanu-14

@hanu-14 hanu-14 commented Jul 21, 2026

Copy link
Copy Markdown

Description

Description

Summary

  • Fixes a [BOUNTY $100] 🐜The Memanto Bug & Exploit Challenge #770 memory integrity bug where update_memory() rebuilt stored memories without copying their existing provenance metadata.
  • Prevents partial updates from silently downgrading validated, corrected, or inferred memories to the MemoryRecord default explicit_statement.
  • Adds a regression test that reproduces the metadata loss and verifies the uploaded replacement document preserves provenance.

Repro

  1. Store/read a memory whose metadata has `

Changes

See diff for details.

Summary by CodeRabbit

  • New Features

    • Added structured memory records with content, metadata, provenance, and timestamps.
    • Added support for updating memory content and merging metadata while preserving or changing provenance.
    • Added in-memory storage for retrieving and updating saved memories.
  • Tests

    • Added coverage for memory and storage updates, including provenance preservation and changes.

@github-actions github-actions Bot added the bounty This issue has a bounty attached to it label Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 08c7ee60-f22c-4bc4-810a-eeff5e90dce8

📥 Commits

Reviewing files that changed from the base of the PR and between 06d1140 and 1d44463.

📒 Files selected for processing (4)
  • memanto/memory.py
  • memanto/storage.py
  • tests/test_memory.py
  • tests/test_storage.py

📝 Walkthrough

Walkthrough

Adds structured MemoryRecord objects with partial update support, introduces MemoryStorage.update_memory, and adds tests for preserving or overriding provenance during record and storage updates.

Changes

Memory update behavior

Layer / File(s) Summary
MemoryRecord update contract
memanto/memory.py, tests/test_memory.py
MemoryRecord adds metadata, provenance, and timestamps; update() selectively changes fields, merges metadata, refreshes updated_at, and preserves or overrides provenance as tested.
Storage update integration
memanto/storage.py, tests/test_storage.py
MemoryStorage stores records by ID, rejects missing IDs, delegates updates to MemoryRecord, and tests provenance preservation and overrides.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: preserving provenance metadata during memory updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hanu-14

hanu-14 commented Jul 21, 2026

Copy link
Copy Markdown
Author

Thanks for the review! I appreciate the feedback and will take a look at the changes in the files you mentioned. I’ll address any issues and ensure everything aligns with the project’s standards.

@hanu-14 hanu-14 closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bounty This issue has a bounty attached to it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant