Skip to content

fix(retain): enqueue relink victims before delta chunk deletion - #3420

Open
koriyoshi2041 wants to merge 1 commit into
vectorize-io:mainfrom
koriyoshi2041:rios/fix-delta-relink-victims
Open

fix(retain): enqueue relink victims before delta chunk deletion#3420
koriyoshi2041 wants to merge 1 commit into
vectorize-io:mainfrom
koriyoshi2041:rios/fix-delta-relink-victims

Conversation

@koriyoshi2041

Copy link
Copy Markdown
Contributor

Problem

Delta retain deletes changed and removed chunks directly. The cascade drops their memory links, but unlike full document replacement, this path does not enqueue surviving units whose outgoing temporal or semantic links pointed at the deleted facts. Graph maintenance runs afterwards, but by then the links needed to discover those victims are gone.

This is the relink-victim residue called out as out of scope in #3384.

Fix

Reuse the outgoing fact IDs already collected for observation invalidation and enqueue relink victims before the chunk/link cascade. The store abstraction keeps this a no-op for stores that own links inline.

The existing real-Postgres endpoint-deletion test now also asserts that the surviving source whose outgoing link targeted the deleted chunk is present in graph_maintenance_queue.

Test

  • uv run pytest tests/test_chunk_storage_delete_ordering.py::test_delete_chunks_by_ids_sweeps_links_on_both_endpoints -q -n 0 (1 passed)
  • uv run ruff check hindsight_api/engine/retain/chunk_storage.py tests/test_chunk_storage_delete_ordering.py
  • uv run ruff format --check hindsight_api/engine/retain/chunk_storage.py tests/test_chunk_storage_delete_ordering.py
  • git diff --check

Fixes the relink-victim follow-up noted in #3384.

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.

1 participant