Skip to content

SWF(bug): stop item delete reviving expired conversations - #10

Merged
maplepaladin73 merged 2 commits into
mainfrom
devin/1794943750-remove-item-ttl
Nov 17, 2026
Merged

maplepaladin73 merged 2 commits into
mainfrom
devin/1794943750-remove-item-ttl

Conversation

@maplepaladin73

@maplepaladin73 maplepaladin73 commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Deleting an item from a TTL-expired conversation no longer revives it: remove_item now evicts expired conversations like get, update_metadata and add_items already do.

Summary

ConversationStore::remove_item looked up the conversation with no TTL check and, on a successful removal, set last_access = Instant::now(). So DELETE of an item on an expired conversation succeeded and made the conversation readable again. The fix applies the store's existing expire-and-evict block (copied from the sibling methods) before touching items: an expired conversation is removed from map and order and remove_item returns false.

Evidence

Before (regression test added first, fix not applied):

test conversation_store::tests::delete_item_by_id ... ok
test conversation_store::tests::remove_item_returns_false_when_missing ... ok
test conversation_store::tests::remove_item_evicts_expired_conversation ... FAILED
thread 'conversation_store::tests::remove_item_evicts_expired_conversation' panicked at crates/spark-server/src/conversation_store.rs:338:9:
expired conversation must stay unreadable
test result: FAILED. 7 passed; 1 failed; 0 ignored; 0 measured; 3154 filtered out

After fix (rerun after merging main with #9):

test conversation_store::tests::delete_item_by_id ... ok
test conversation_store::tests::add_items_after_removal_keeps_ids_unique ... ok
test conversation_store::tests::remove_item_returns_false_when_missing ... ok
test conversation_store::tests::remove_item_evicts_expired_conversation ... ok
test conversation_store::tests::ttl_evicts ... ok
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 3154 filtered out

Cases covered: expired (new remove_item_evicts_expired_conversation: returns false, stays unreadable, evicted from map and LRU order), live (existing delete_item_by_id), missing conversation / missing item / empty conversation (new remove_item_returns_false_when_missing).

Root cause: remove_item was the only accessor that mutated a conversation without the TTL gate the other accessors share, and its last_access refresh is what turned an expired entry back into a live one. Gating it with the same rule removes the revival path without changing live-conversation behavior.

Try it:

bash scripts/ci_gpu_stubs.sh && ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server conversation_store

(ci_gpu_stubs.sh is only needed on a host without CUDA/NCCL libs, to satisfy the linker.)

Test plan

  • cargo fmt --all -- --check
  • ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests (exit 0)
  • bash scripts/check-license-headers.sh (4163 valid, 0 invalid)
  • typos (clean)
  • Tested against a real model / hardware: not applicable (CPU-only store logic); the HTTP delete-item route was not exercised end to end.
  • Added tests

Notes for reviewers

Scoped to this bug only; the duplicate-item-ID-after-delete and LRU-refresh-on-writes issues in the same file are separate PRs. The not-found path still does not refresh last_access, as before.


Software Factory opened this PR for Robert
Implemented in session Stop item delete reviving expired conversations
Review with Devin · Open in Devin Desktop


Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

…ve-item-ttl

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	crates/spark-server/src/conversation_store.rs
@maplepaladin73
maplepaladin73 merged commit 8848a20 into main Nov 17, 2026
1 check passed
maplepaladin73 added a commit that referenced this pull request Nov 29, 2026
…-and-p3-guards

spark-model(hy4): add chunk-aligned prefix caching (P2 #7) and process guards (P3 #10, #11)
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