# task-1120.1 체크포인트

## 작업: InsuWiki My Private 카드 조회 안 되는 버그

## 분석 완료
- **프로젝트**: /home/jay/projects/insuwiki/
- **버그 위치**: nextapp/src/app/page.tsx:104-133 `fetchDocuments()`
- **근본 원인**: `or(visibility=='public', authorId==user.uid)` + `limit(50)` 단일 쿼리
  - public 문서가 50개 이상이면 사용자의 private 문서가 결과에서 잘림
  - Wiki 탭은 정상(public 문서 풍부), My Private 탭은 빈 화면
- **보안 규칙**: firestore.rules OK (admin/member 접근 허용)
- **인덱스**: firestore.indexes.json에 (visibility, updatedAt DESC), (authorId, updatedAt DESC) 모두 존재

## 수정 방안
- 단일 `or()` 쿼리를 두 개의 병렬 쿼리로 분리:
  1. Public 쿼리: `where('visibility', '==', 'public')` + `orderBy('updatedAt', 'desc')` + `limit(50)`
  2. My 쿼리: `where('authorId', '==', user.uid)` + `orderBy('updatedAt', 'desc')` + `limit(50)`
- `Promise.all`로 병렬 실행 → Map으로 중복 제거 → 기존 client-side 필터링 유지
- 새로운 Firestore 인덱스 불필요 (기존 인덱스 활용)

## 상태
- [x] 리서치
- [ ] 구현 (사라스바티 위임)
- [ ] 테스트
- [ ] QC
- [ ] 보고서
