feat(vector): index files in real time on vector-index tag changes
Tagging an existing file/folder emits only OCP\SystemTag\MapperEvent — never a Node*Event — so tagged PDFs were previously only picked up by the hourly scanner. Subscribe to the tag event and reconcile membership so adding/removing the `vector-index` tag (re)indexes in near-real time. - webhook_presets: add OCP\SystemTag\MapperEvent to the files_sync preset (NC 32+, where MapperEvent gained getWebhookSerializable(); harmless on older servers — it just never fires). - webhook_parser: parse MapperEvent (objectType=files) into a path-less file "reconcile" task. The payload carries only a fileid + tagIds (no name/path), so assign and unassign both collapse to a reconcile. - processor._reconcile_tag_event: resolve the fileid against the user's current vector-index PDFs (find_files_by_tag). Present -> index with the resolved path/etag; absent -> flip to delete. Naturally handles "an unrelated tag changed" and a tagged folder's own fileid (no-op; the scanner still expands folders to descendants). - Unit tests for the parser branch and the reconcile. The matching admin-UI preset change ships separately in the astrolabe app repo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
78f3f284a6
commit
1322e5aba0
@@ -89,6 +89,18 @@ def test_get_deck_preset():
|
||||
assert "OCA\\Deck\\Event\\BoardUpdatedEvent" in event_classes
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_files_sync_includes_systemtag_event():
|
||||
"""files_sync registers the SystemTag MapperEvent so tag changes (NC 32+)
|
||||
drive vector-index (re)indexing, alongside the node create/write/delete
|
||||
events."""
|
||||
preset = get_preset("files_sync")
|
||||
assert preset is not None
|
||||
event_classes = [e["event"] for e in preset["events"]]
|
||||
assert "OCP\\SystemTag\\MapperEvent" in event_classes
|
||||
assert "OCP\\Files\\Events\\Node\\NodeCreatedEvent" in event_classes
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_filter_presets_subset_installed():
|
||||
"""Test filtering when only some apps are installed."""
|
||||
|
||||
Reference in New Issue
Block a user