Checklist
TagStudio Version
Alpha v9.6.0/main
Operating System & Version
Windows 11
Description
(Reporting on behalf of someone else on Discord) There's been a case of a tag parent relationship remaining in the database after a child tag in the relationship has been deleted. I can't currently reproduce the issue myself but have verified the extraneous relationship inside the DB. Note that this is the inverse issue that the DB 102 migration corrects for.
Quick info about the affected DB:
- Example of invalid relationship: parent_id 1038, child_id 1107
- Tag 1107 does not exist in the DB
- DB was created with version 102
This issue presents as strange tag search behavior, which can range from results that don't update to no results at all.


Discord thread: https://discord.com/channels/1229183630228848661/1522240701675606077
Affected library: https://cdn.discordapp.com/attachments/1522240701675606077/1522598055667568791/ts_library.sqlite?ex=6a490d70&is=6a47bbf0&hm=74c161e11cd5109ef2abdae305d900628a109c4543a6372cd2ac7bb3ebf880c0&
While it should be trivial to patch any existing libraries that are affected by this, finding the root cause and determining if it's still an active issue is critically important.
Expected Behavior
Tag parent relationships should be removed if either the parent or child tags referenced are deleted.
Steps to Reproduce
Currently unknown
Logs
Taken from my machine on main:
Traceback (most recent call last):
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/controllers/search_panel_controller.py", line 126, in on_search_query_changed
self.update_items(query)
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/controllers/search_panel_controller.py", line 170, in update_items
search_results: tuple[list[T], list[T]] = self.search_items(query_lower)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/qt/controllers/tag_search_panel_controller.py", line 145, in search_items
return self.__lib.search_tags(name=query, limit=self._get_limit()[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cyanvoxel/Local/Dev/TagStudio/src/tagstudio/core/library/alchemy/library.py", line 1316, in search_tags
descendant_tags = [hierarchy.pop(id) for id in all_ids]
^^^^^^^^^^^^^^^^^
KeyError: 1107
Checklist
TagStudio Version
Alpha v9.6.0/
mainOperating System & Version
Windows 11
Description
(Reporting on behalf of someone else on Discord) There's been a case of a tag parent relationship remaining in the database after a child tag in the relationship has been deleted. I can't currently reproduce the issue myself but have verified the extraneous relationship inside the DB. Note that this is the inverse issue that the DB 102 migration corrects for.
Quick info about the affected DB:
This issue presents as strange tag search behavior, which can range from results that don't update to no results at all.


Discord thread: https://discord.com/channels/1229183630228848661/1522240701675606077
Affected library: https://cdn.discordapp.com/attachments/1522240701675606077/1522598055667568791/ts_library.sqlite?ex=6a490d70&is=6a47bbf0&hm=74c161e11cd5109ef2abdae305d900628a109c4543a6372cd2ac7bb3ebf880c0&
While it should be trivial to patch any existing libraries that are affected by this, finding the root cause and determining if it's still an active issue is critically important.
Expected Behavior
Tag parent relationships should be removed if either the parent or child tags referenced are deleted.
Steps to Reproduce
Currently unknown
Logs
Taken from my machine on
main: