Skip to content

Incremental indexing: HEAD 변경 시 delta만 재인덱싱#2

Merged
soomtong merged 14 commits into
mainfrom
incremental-indexing
May 26, 2026
Merged

Incremental indexing: HEAD 변경 시 delta만 재인덱싱#2
soomtong merged 14 commits into
mainfrom
incremental-indexing

Conversation

@soomtong

@soomtong soomtong commented May 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • glc index가 HEAD 변경 시 전체 재구축 대신 변경된 파일/커밋만 BM25 + turbovec 인덱스에 적용
  • git2::diff_tree_to_tree로 added/modified/deleted 파일 산출, revwalk + hide로 신규 커밋만 추출 → tantivy delete_term / turbovec remove로 stale 문서 제거 후 delta만 임베딩
  • Fallback 경로: schema 불일치, old HEAD가 현재 HEAD의 ancestor가 아님(rebase/force-push), embedding dim 변경, incremental 단계 에러 — 모든 경우 full rebuild로 안전 회귀
  • 부가 변경: SearchError::Git variant 신설, INDEX_VERSION 4→5 (id 필드 INDEXED 추가로 인한 BM25 스키마 마이그레이션)

Test Plan

  • 신규 unit tests: Bm25Index::delete_doc, VectorIndex::remove, compute_file_changes, commits_since, collect_path_doc_ids
  • e2e 통합 테스트 (#[ignore]): full index → 새 커밋 추가 → 재인덱스 시 incremental 경로 진입 + doc_count 증가 + 새 파일 path 인덱싱 확인 (41s, 모델 캐시 기준)
  • cargo test --lib search:: 58 passed, 0 failed
  • cargo clippy --all-targets 무경고
  • Manual smoke test (plan Task 9): 실제 repo에서 glc index → commit 추가 → 재실행 시 "Incremental update: ..." 메시지 확인
  • Manual rebase 시나리오: git reset --hard HEAD~1 → 재인덱스 시 "Old head not an ancestor of current HEAD; full rebuild required" 메시지 확인

Plan

docs/superpowers/plans/2026-05-26-incremental-indexing.md

@soomtong soomtong merged commit d09861e into main May 26, 2026
3 checks passed
@soomtong soomtong deleted the incremental-indexing branch May 26, 2026 07:19
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