mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
[F011] playbook: de-index rejected/archived playbooks from the PLAYBOOKS RAG index
This commit is contained in:
@@ -38,3 +38,24 @@ def test_build_source_uri_with_id() -> None:
|
||||
|
||||
def test_build_source_uri_none_when_missing() -> None:
|
||||
assert _plugin().build_source_uri(doc_id=None) is None
|
||||
|
||||
|
||||
def test_delete_playbook_removes_its_chunks_by_source() -> None:
|
||||
"""F011: deleting a playbook removes its embedded chunks from the vector
|
||||
store by the playbook's source URI (idempotent — no-op if absent). A
|
||||
rejected/archived playbook must not stay retrievable in the PLAYBOOKS index."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
plugin = PlaybooksIndexPlugin.__new__(PlaybooksIndexPlugin)
|
||||
store = MagicMock()
|
||||
store.delete_by_source = AsyncMock(return_value=None)
|
||||
# Bypass the initialized-guard property so the unit test doesn't need a
|
||||
# live pgvector store.
|
||||
object.__setattr__(plugin, "_initialized", True)
|
||||
object.__setattr__(plugin, "_store", store)
|
||||
|
||||
import asyncio
|
||||
|
||||
asyncio.run(plugin.delete_playbook("pb-42"))
|
||||
|
||||
store.delete_by_source.assert_awaited_once_with("roboco://playbooks/pb-42")
|
||||
|
||||
Reference in New Issue
Block a user