Files
stack/tests/llm/test_migrate.py
kert b1e6d6ef3a fix(llm): restamp must not rebuild the HNSW index (F6)
`stack llm restamp` called `ensure_hnsw`, which ALTERs the embedding
column's type and rebuilds the HNSW index — ACCESS EXCLUSIVE for the
life of a rebuild over 1M+ rows, locking out every reader for a
metadata-only backfill that never touches embeddings.

Split `_HNSW_DDL` into the column/HNSW part (unchanged `ensure_hnsw`,
still called by `stack llm index` after a fresh run) and a new
`ensure_metadata_indexes(engine)` holding only the three GIN indexes
on codes/families/elements — no ACCESS EXCLUSIVE lock, safe on a live
table. Restamp now calls only the latter, and skips it entirely under
--dry-run.
2026-09-09 21:03:56 -04:00

3.2 KiB