Skip to content

[ai-assisted] fix(vector): projection 조회 SQL 오류 수정#383

Merged
donghyuck merged 1 commit into2.xfrom
codex/issue-382-vector-projection-500
Apr 30, 2026
Merged

[ai-assisted] fix(vector): projection 조회 SQL 오류 수정#383
donghyuck merged 1 commit into2.xfrom
codex/issue-382-vector-projection-500

Conversation

@donghyuck
Copy link
Copy Markdown
Owner

@donghyuck donghyuck commented Apr 30, 2026

Why

  • GET /api/mgmt/ai/vectors/projections/{projectionId}/pointsPOST /api/mgmt/ai/vectors/search-visualization 호출 시 PostgreSQL JSON key literal이 따옴표 없이 생성되어 런타임 SQL 오류와 500 응답이 발생할 수 있습니다.
  • 완료된 Projection의 point 저장 건수와 tb_ai_document_chunk join 결과가 일치해야 관리자 산점도 화면이 렌더링됩니다.
  • Vector Map 클라이언트가 필터와 범례를 정확히 구성하려면 targetTypes가 UI 문서 분류가 아니라 RAG index objectType 기준임이 API 계약으로 명확해야 합니다.

What

  • PostgreSQL JSON literal key를 metadata ->> 'key' 형태로 생성하도록 JdbcVectorProjectionSql을 수정했습니다.
  • named parameter 기반 metadata filter는 기존처럼 metadata ->> :param 형태를 유지했습니다.
  • projection 완료 시 실제 좌표에 포함된 VectorItem.targetType, 즉 tb_ai_document_chunk.object_type 목록을 저장합니다.
  • projection 목록 응답에도 targetTypes를 포함해 클라이언트가 목록 단계에서 필터/범례 후보를 구성할 수 있게 했습니다.
  • README에 targetTypes / targetType / search-visualization targetTypes가 모두 RAG index objectType 기준이라는 계약을 문서화했습니다.
  • PostgreSQL/MySQL JSON path SQL 생성과 targetTypes 응답 회귀 테스트를 추가했습니다.

Related Issues

Validation

  • Command: ./gradlew :starter:studio-platform-starter-ai:test --tests '*JdbcVectorProjectionSqlTest' --tests '*DefaultVectorSearchVisualizationServiceTest' --tests '*DefaultVectorProjectionServiceTest'
  • Result: PASS
  • Command: ./gradlew :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test && git diff --check
  • Result: PASS
  • Command: ./gradlew :studio-platform-ai:test :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test && git diff --check
  • Result: PASS
  • Command: 로컬 PostgreSQL smoke query
  • Result: 최신 COMPLETED projection proj-20260430044829-105b3fa0의 point join 122건 확인

Risk / Rollback

  • Risk: projection 완료 시 target_types가 요청값이 아니라 실제 포함된 objectType 목록으로 갱신됩니다. 클라이언트 계약에는 더 적합하지만, 기존에 요청값 자체를 감사 용도로 사용했다면 의미가 달라질 수 있습니다.
  • Rollback: 문제가 있으면 이 커밋을 revert하면 기존 SQL 생성 및 targetTypes 저장 방식으로 돌아갑니다.

AI / Subagent Usage

  • AI-assisted: Yes
  • Subagent used: No
  • Delegated scope: N/A
  • Main author validation: 관련 단위 테스트, AI web 테스트, git diff --check, 로컬 PostgreSQL join smoke를 수행했습니다.

Checklist

  • commit message follows policy
  • issue template used or exception recorded
  • AI-Assisted value is correct
  • validation recorded
  • subagent usage recorded when used
  • CI / repository verification passed
  • human review completed before merge
  • no unrelated changes included

Issue:
- #382

Why:
- PostgreSQL JSON key literal이 따옴표 없이 생성되어 completed projection의 points/search-visualization 조회 SQL이 500 오류를 유발할 수 있었다.
- Vector Map 클라이언트가 필터와 범례를 구성하려면 targetTypes가 UI 문서 분류가 아니라 RAG index objectType 기준임이 명확해야 한다.

What:
- PostgreSQL JSON literal key는 metadata ->> 'key' 형태로 생성하고, named parameter key는 metadata ->> :param 형태로 유지했다.
- PostgreSQL/MySQL JSON path SQL 생성 회귀 테스트를 추가했다.
- projection 완료 시 실제 좌표에 포함된 VectorItem targetType 목록을 저장하고, projection 목록 응답에도 targetTypes를 포함했다.
- README에 targetTypes가 tb_ai_document_chunk.object_type 기준이라는 API 계약을 문서화했다.

Validation:
- ./gradlew :starter:studio-platform-starter-ai:test --tests '*JdbcVectorProjectionSqlTest' --tests '*DefaultVectorSearchVisualizationServiceTest' --tests '*DefaultVectorProjectionServiceTest' : PASS
- ./gradlew :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test && git diff --check : PASS
- ./gradlew :studio-platform-ai:test :starter:studio-platform-starter-ai:test :starter:studio-platform-starter-ai-web:test && git diff --check : PASS
- 로컬 PostgreSQL smoke: 최신 COMPLETED projection proj-20260430044829-105b3fa0의 point join 122건 확인
@donghyuck donghyuck force-pushed the codex/issue-382-vector-projection-500 branch from 6e82048 to 3654e94 Compare April 30, 2026 05:11
@donghyuck donghyuck merged commit d88d35d into 2.x Apr 30, 2026
2 checks passed
@donghyuck donghyuck deleted the codex/issue-382-vector-projection-500 branch April 30, 2026 05:26
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