Stage 6b: graph 스토어 SQLite↔PG 방언 통합 (-1245줄) + pack_id str·kuzu·rowid 실버그 3건#31
Merged
Conversation
…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 주석 정정
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
프로그램 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 단일 스펙)pack_id str 통일 (사용자 결정)
list_packs가 양 백엔드 str 반환(SQLite json_extract int → str 강제). Stage 2 판단보류 divergence를 긍정 계약으로 전환.
발견·수정한 실버그 3건 (전부 red-first / 골든 parity가 포착)
||연산자 우선순위: base.list_packs의'dataset:' || properties->>'pack_id'가 괄호 누락으로('dataset:'||properties)->>...로 파싱→jsonb 캐스팅 에러. 괄호 추가 + dialect-레벨 회귀 가드(in-memory 유닛이 놓친 지점)INSERT OR REPLACE(삭제+재삽입→rowid 갱신)를 도입해, 재-upsert 후 find_neighbors/export 스캔 순서가 main과 달라짐(limit 허브에선 부분집합까지).ON CONFLICT DO UPDATE(rowid 보존)로 통일 복원, 재-upsert 순서 안정성 테스트로 고정원장
fable 검증 PASS
조건부 PASS → rowid 회귀 수정 반영. 독립 드리프트 프로브 40+케이스(양 백엔드 전 메서드 왕복) — rowid 순서 건 외 차이 0. 배치 override 활성 증명, DDL parity, kuzu 버그 관통 확인. 시뮬레이션-CI 1635/0 failed.