Skip to content

Stage 6b: graph 스토어 SQLite↔PG 방언 통합 (-1245줄) + pack_id str·kuzu·rowid 실버그 3건#31

Merged
epruseal merged 3 commits into
mainfrom
refactor/s6b-graphstores
Jul 5, 2026
Merged

Stage 6b: graph 스토어 SQLite↔PG 방언 통합 (-1245줄) + pack_id str·kuzu·rowid 실버그 3건#31
epruseal merged 3 commits into
mainfrom
refactor/s6b-graphstores

Conversation

@epruseal

@epruseal epruseal commented Jul 5, 2026

Copy link
Copy Markdown
Owner

프로그램 Stage 6/9 (6b — graph 스토어, 방언 통합 마무리). 20메서드·배치 prefetch·BFS 순서 계약이 얽힌 가장 어려운 리팩토링.

통합

  • _sql_graph_base.py: _SqlGraphStoreBase(17 공유 메서드, _prefetch_frontier/_batch_node_props 훅으로 PG 배치 prefetch를 override 보존, GRAPH_STORE_SCHEMA 단일 스펙)
  • local_graph(-706)·pg_graph(-539)가 base 상속. 합계 -1245줄
  • PG 배치 override 활성 call-counter로 증명(base per-node 기본 미사용). 허브 팬아웃 벤치 1.17~1.29x(3x 이하) — 32x 최적화 회귀 없음
  • 공개 클래스명·모듈 경로 불변(factory 무접촉)

pack_id str 통일 (사용자 결정)

list_packs가 양 백엔드 str 반환(SQLite json_extract int → str 강제). Stage 2 판단보류 divergence를 긍정 계약으로 전환.

발견·수정한 실버그 3건 (전부 red-first / 골든 parity가 포착)

  1. PG || 연산자 우선순위: base.list_packs의 'dataset:' || properties->>'pack_id'가 괄호 누락으로 ('dataset:'||properties)->>...로 파싱→jsonb 캐스팅 에러. 괄호 추가 + dialect-레벨 회귀 가드(in-memory 유닛이 놓친 지점)
  2. kuzu delete_node(Stage 5 이관): node_type 무시하고 node_id만 매칭 → 잘못된 타입으로도 노드 삭제되며 False 반환(조용한 데이터 손실). (node_type,node_id) 쌍 매칭으로 수정
  3. SQLite upsert rowid 회귀(검증자 발견): 방언 통합이 INSERT OR REPLACE(삭제+재삽입→rowid 갱신)를 도입해, 재-upsert 후 find_neighbors/export 스캔 순서가 main과 달라짐(limit 허브에선 부분집합까지). ON CONFLICT DO UPDATE(rowid 보존)로 통일 복원, 재-upsert 순서 안정성 테스트로 고정

원장

시점 passed skipped cov
Stage 6a 1599 3 86%
Stage 6b 1635 3 86% (래칫 82)

fable 검증 PASS

조건부 PASS → rowid 회귀 수정 반영. 독립 드리프트 프로브 40+케이스(양 백엔드 전 메서드 왕복) — rowid 순서 건 외 차이 0. 배치 override 활성 증명, DDL parity, kuzu 버그 관통 확인. 시뮬레이션-CI 1635/0 failed.

epruseal added 3 commits July 6, 2026 08:18
…r·kuzu delete_node RED 계약

- _sql_graph_base.py: 17 공유 메서드, _prefetch_frontier/_batch_node_props 훅(PG 배치 override 보존), GRAPH_STORE_SCHEMA 단일 스펙
- _sql_dialect 확장: json_index_expr/IndexSpec.json_key(PG 함수형 인덱스 괄호)
- pack_id str 통일: base list_packs가 str() 강제, parity 테스트 긍정 계약으로 재작성(xfail-pending-F3)
- kuzu delete_node node_type 무시 RED 계약(xfail-pending-F4 수정)
- graph parity: 엣지 upsert-overwrite 추가. test_sql_graph_base 28건
- perf FINDING(docstring): base 정적 cap이 Local의 remaining-aware LIMIT 32배 최적화 느슨화 가능 — F3 벤치 필수
…elete_node 수정

- local_graph(-706줄)·pg_graph(-539줄)가 _SqlGraphStoreBase 상속, 17 공유 메서드 본문 삭제
- PG는 _prefetch_frontier/_batch_node_props를 기존 배치 prefetch로 override 보존(call-counter로 활성 증명)
- 허브 팬아웃 벤치 1.17~1.29x(3x 임계 이하) — base 정적 cap OK, 32x 최적화 회귀 없음 확정
- pack_id str 통일: base list_packs가 str() 강제(SQLite int 반환 해소), parity 긍정 계약 전환
- fix: base list_packs의 PG || 연산자 우선순위 버그(괄호 누락 → jsonb 캐스팅 에러) + dialect-레벨 회귀 가드
- fix(kuzu): delete_node가 node_type 무시하고 node_id만 매칭(Stage 5 이관) → (node_type,node_id) 쌍 매칭
- SqlDialect.upsert: SQLite INSERT OR REPLACE(삭제+재삽입→rowid 갱신) → ON CONFLICT DO UPDATE로 통일(doc/graph 공통), rowid 보존해 재-upsert 후 find_neighbors/export 스캔 순서 main과 동일 유지
- red→green 실증: 재-upsert 순서 안정성 테스트(OR REPLACE면 재-upsert된 엣지가 tail로 이동, 수정 후 불변)
- docstring 스테일 bench 참조·OR REPLACE 주석 정정
@epruseal
epruseal merged commit 07e1623 into main Jul 5, 2026
1 check passed
@epruseal
epruseal deleted the refactor/s6b-graphstores branch July 5, 2026 23:55
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