Skip to content

fix(retain): sync metadata to unchanged memories - #3011

Merged
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
Sanderhoff-alt:agent/fix-retain-metadata-sync
Aug 4, 2026
Merged

fix(retain): sync metadata to unchanged memories#3011
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
Sanderhoff-alt:agent/fix-retain-metadata-sync

Conversation

@Sanderhoff-alt

Copy link
Copy Markdown
Contributor

Summary

Keep metadata on memory units aligned with document_metadata when delta retain preserves unchanged chunks.

Closes #3008.

Root cause

Delta retain already updated the document row and propagated tags to existing memory units. It did not propagate metadata, so preserved memories kept the previous value while rebuilt or newly inserted memories used the current retain metadata.

Chunk state Existing behavior Result after this change
unchanged Preserve memory units with stale metadata Preserve memory units and synchronize metadata and tags
changed Delete and rebuild with current metadata Unchanged
new Insert with current metadata Unchanged
removed Delete chunk and memory units Unchanged

Implementation

  • Replace the tags-only delta helper with one focused update that synchronizes metadata and tags in a single SQL statement.
  • Reuse that helper in metadata-only retain and partial-delta retain.
  • Keep changed/new insertion and changed/removed deletion paths unchanged.
  • Add regression coverage for metadata-only replace and append with preserved plus new chunks.

Impact

After retain completes, every surviving direct memory unit for the document has metadata consistent with document_metadata, regardless of whether delta retain preserved or rebuilt its chunk.

The change adds no schema migration, JSON-specific branch, or extra database round trip.

Validation

Check Result
Delta retain and append test files 29 passed
Focused metadata and tags regressions after simplification 3 passed
Ruff Passed
ty Passed
Repository pre-commit hooks and lint Passed
git diff --check Passed

Keep metadata and tags on unchanged memory units aligned with their
document during delta retain.

Cover metadata-only replace and append paths with regression tests.

Closes vectorize-io#3008
@nicoloboschi
nicoloboschi merged commit 751deb4 into vectorize-io:main Aug 4, 2026
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delta retain does not propagate document metadata to unchanged memory units

2 participants