Skip to content

Merge FTS re-sync tags across import chunks - #990

Merged
ajslater merged 1 commit into
developfrom
fix-fts-updated-chunk-merge
Oct 20, 2026
Merged

ajslater merged 1 commit into
developfrom
fix-fts-updated-chunk-merge

Conversation

@ajslater

Copy link
Copy Markdown
Owner

Problem

The importer runs read → query → create_and_update → link once per chunk of paths, then syncs the search index once at the end. _bulk_update_models assigned each chunk's updated universes to FTS_UPDATED_M2MS["universes"], so a later chunk replaced the earlier chunk's set. When an import spanned more than one chunk (big libraries, memory-capped hosts), only the last chunk's universes had their comics re-indexed. Other comics kept the old designation in search.

Fix

One helper, _add_fts_updated_pks, now merges pks into FTS_UPDATED_M2MS with setdefault().update(). Universes and the series-summary re-sync from #989 both use it.

Test

tests/importer/test_fts_chunked_resync.py:

  • imports four comics in two universes;
  • re-imports one comic per universe with a new designation, with the chunk size forced to 1;
  • asserts that the sibling comics outside the re-import show both new designations.

The test fails on the old assignment ('Alpha' != '11,Alpha') and passes with the fix.

make fix, make lint, make ty are clean, and the full make test passes (1735 Python, 1033 frontend).

Found while testing, not fixed here

The inline importer path gives a universe's designation to only some comics' search rows:

  • it pops a newly created universe's designation, so only the first comic linked to it in a batch gets it;
  • comics newly linked to an existing universe get no designation;
  • FTS_CREATED_M2MS is also assigned per chunk.

A full search-index rebuild corrects all of these.

🤖 Generated with Claude Code

read -> query -> create_and_update -> link runs once per chunk of paths,
but the search index syncs once afterwards. _bulk_update_models assigned
each chunk's updated universes to FTS_UPDATED_M2MS, so a later chunk
replaced an earlier one's and only the last chunk's universes had their
comics re-indexed. Universes now accumulate like series summaries do,
through one helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ajslater
ajslater merged commit d790deb into develop Oct 20, 2026
9 checks passed
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