Skip to content

Stage 6a: doc 스토어 SQLite↔PG 방언 통합 — _SqlDocStoreBase (-543줄)#30

Merged
epruseal merged 2 commits into
mainfrom
refactor/s6a-docstores
Jul 5, 2026
Merged

Stage 6a: doc 스토어 SQLite↔PG 방언 통합 — _SqlDocStoreBase (-543줄)#30
epruseal merged 2 commits into
mainfrom
refactor/s6a-docstores

Conversation

@epruseal

@epruseal epruseal commented Jul 5, 2026

Copy link
Copy Markdown
Owner

프로그램 Stage 6/9 (6a — doc 스토어, 방언 통합 2개 PR 중 첫째). 가장 위험한 리팩토링 클래스라 doc 스토어(13메서드, 단순)를 먼저, graph는 6b로 분리.

통합

  • _sql_dialect.py: SqlDialect 값객체(placeholder named 통일·json_get·insert/upsert의 jsonb CAST·render_ddl), SQLITE/POSTGRES
  • _sql_doc_base.py: _SqlDocStoreBase(13 공유 메서드, DDL 단일 스펙 DOC_STORE_SCHEMA→방언별 렌더)
  • local_sql_doc_store(-271)·pg_doc_store(-272)가 base 상속, 훅 5개 + keyword_search(FTS5/tsvector)만 오버라이드. 합계 -543줄
  • 공개 클래스명·모듈 경로 불변(factory 무접촉)

안전성 (Risk #3: json_extract vs ->> 방언 드리프트)

독립 드리프트 프로브로 8종 까다로운 페이로드(타입 혼합·NULL vs missing·bool·유니코드·60k자·경계 정수)를 양 백엔드에 왕복 → dict-equality + 재귀 type-signature 완전 일치, 드리프트 0. DDL byte-parity 확인. 주입면 없음(테이블/컬럼명 상수, schema는 IDENT_RE 검증). parity 골든 계약 doc 4건 증강(양 백엔드 동일 기대값).

원장

시점 passed skipped cov
Stage 5 1578 3 85.9%
Stage 6a 1599 3 86% (래칫 82)

fable 검증 PASS

독립 프로브 드리프트 0, DDL parity, jsonb CAST·_require_available byte-identical, 시뮬레이션-CI 1599/0 failed.

비차단 노트

  • upsert_source 2-커밋 델타: LocalSQLDocStore.upsert_source가 base write + FTS5 sync를 별도 커밋으로 수행(구: 단일 트랜잭션). 두 커밋 사이 프로세스 크래시 시 해당 source의 FTS가 stale 가능 — 극저확률·다음 재업서트로 자가치유·프로덕션 로더 flock 하 무영향. 완전 격리는 후속 하드닝.
  • execution PG 테스트 격리(기존 코드, 이 diff 무관): workflow PG fixture가 공유 public 스키마 사용 → 병렬 실행 시 상호 오염. CI는 단일 직렬이라 무노출. Stage 9 하드닝 이관.

epruseal added 2 commits July 6, 2026 07:43
… 계약 증강

- _sql_dialect.py: SqlDialect(placeholder named 통일·json_get·insert/upsert·render_ddl), SQLITE/POSTGRES
- _sql_doc_base.py: 13메서드 공유 ABC(DOC_STORE_SCHEMA 단일 스펙→방언별 DDL), 훅 5개+keyword_search 오버라이드
- doc parity +4(타입 props·NULL-vs-missing·유니코드·upsert overwrite) 전부 green — doc-store divergence 없음 확인
- test_sql_dialect 17건. 스토어/factory 무접촉
…qlDocStoreBase

- 두 스토어가 _SqlDocStoreBase 상속, 13메서드 공유 본문 삭제(-543줄)
- 훅 5개(_table/_fetch_all/_fetch_one/_exec_write/_row_get)+keyword_search(FTS5/tsvector) 오버라이드만 구현
- DDL 단일 스펙(DOC_STORE_SCHEMA)→방언별 렌더, jsonb CAST·_require_available 메시지 byte-identical 보존
- 공개 클래스명·모듈 경로 불변(factory 무접촉), parity 골든 계약 green
@epruseal
epruseal merged commit 5940a18 into main Jul 5, 2026
1 check passed
@epruseal
epruseal deleted the refactor/s6a-docstores branch July 5, 2026 23:05
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