You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tag import matches tags differently than the database #956
TagImportPlan in src/openedx_tagging/import_export/import_plan.py decides in Python whether a file row's id names an existing tag, by comparing external_id.casefold(). The database decides the same question with the column collation, and the two disagree: casefold() matches more than SQLite's NOCASE (for example Straße and STRASSE) and less than MySQL's utf8mb4_unicode_ci (for example Café and Cafe).
Three places are affected: _existing_tags(), _end_state(), and the replace sweep in generate_actions(). The checks that compare one file row to another can stay as they are, because those ids are not in the database yet.
Known failures, as reported in the linked comments. They were not reproduced again for this issue:
MySQL, cycle check: with Café as the parent of kid, a row with the id Cafe and parent_idkid passes _validate_hierarchy() and writes a parent cycle. Reported in the same comment.
Likely fix, from the first comment linked above: have the replace sweep ask the database which existing tags the file names, with one external_id__in query per chunk of rows, and key the existing-tag lookup by primary key so that _end_state() resolves each row's tag through the database. Add regression tests for the three cases above.
Asked for during review of #927. The code predates that PR.
Activity