Skip to content

feat(graph-rag): add shared PostgreSQL snapshots - #33

Merged
kl3inIT merged 3 commits into
light-ragfrom
kl3inIT/light-rag-pr08-postgres-parity
Jul 24, 2026
Merged

kl3inIT merged 3 commits into
light-ragfrom
kl3inIT/light-rag-pr08-postgres-parity

Conversation

@kl3inIT

@kl3inIT kl3inIT commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • carry all five late CodeRabbit fixes from PR feat(graph-rag): implement full query runtime #32 into the integration line
  • add one durable publication head across content, lexical, vector, and graph projections
  • implement permission-prefiltered PostgreSQL FTS, pgvector, and snapshot graph adapters
  • retain immutable published history while preventing losing/aborted staged batches from leaking
  • add Flyway V34, Spring Boot auto-configuration, ANN index provisioning, and PostgreSQL 18 Testcontainers coverage

Architecture

  • staged records are keyed by batch_id, never made visible by generation alone
  • publication serializes per namespace, verifies exact preparation receipts, and advances the head only from the expected predecessor
  • readers validate the exact winning batch and filter organization + authorized Knowledge Asset IDs before ranking or traversal
  • PostgreSQL remains an adapter behind pure-Java contracts; PR9/PR10 can implement the same boundary

Verification

  • ./gradlew.bat :components:graph-rag-core:test :components:graph-rag-testkit:test :integrations:graph-rag-spring-ai:test :integrations:graph-rag-postgres:test --no-daemon
  • ./gradlew.bat --no-daemon clean test
  • git diff --check
  • migration/package/zero-byte mechanical checks

Base is light-rag; this PR does not target or modify main.

Summary by CodeRabbit

  • New Features

    • Added PostgreSQL-backed storage for content, lexical search, vector search, and graph data.
    • Added shared publication snapshots with authorization, version validation, history retention, and safe batch publishing.
    • Improved graph retrieval, vector candidate filtering, and snapshot-aware query results.
    • Spring AI requests now preserve configured model options, including topP.
  • Bug Fixes

    • Prevented stale or unscored chunks from appearing in query results.
    • Ensured chunk retrieval works when graph keyword planning produces no keywords.
  • Documentation

    • Expanded architecture documentation for shared projection snapshots and publication behavior.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kl3inIT, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7d01e55a-8280-4285-8198-088150322f26

📥 Commits

Reviewing files that changed from the base of the PR and between 0a036d3 and 3d881bb.

📒 Files selected for processing (3)
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/ProjectionPublicationStore.java
  • components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java
📝 Walkthrough

Walkthrough

This PR adds shared PostgreSQL projection snapshots with batch publication, authorization-aware content, lexical, vector, and graph adapters, generation-aware query behavior, integration coverage, and Spring AI chat-option inheritance.

Changes

Shared projection snapshots

Layer / File(s) Summary
Query and storage contracts
components/graph-rag-core/..., components/graph-rag-testkit/...
Adds graph/vector contracts, subject-aware vector searches, generation-aware chunks, store-backed authorized querying, stale-generation filtering, chunk-seed fallback behavior, and stricter reranking.
Publication schema and lifecycle
core/src/main/resources/db/migration/..., integrations/graph-rag-postgres/.../PostgresProjection*
Adds batch-scoped projection tables, preparation receipts, namespace publication heads, predecessor staging, authorization checks, idempotent publication, and single-winner namespace locking.
PostgreSQL projection adapters
integrations/graph-rag-postgres/src/main/java/...
Implements PostgreSQL content, lexical, vector, and graph stores, serialization codecs, visibility-filtered graph traversal, and table-aware vector index management.
PostgreSQL wiring and validation
integrations/graph-rag-postgres/...
Registers the new adapters as Spring beans and adds Testcontainers coverage for authorized snapshots, retained history, competing batches, and loser cleanup.
Architecture documentation
ARCHITECTURE.md
Documents the shared namespace snapshot, durable preparation receipts, publication locking, reader validation, predecessor access, and exclusion of losing or aborted batches.

Spring AI option propagation

Layer / File(s) Summary
Chat model option propagation
integrations/graph-rag-spring-ai/src/main/java/..., integrations/graph-rag-spring-ai/src/test/java/...
Prompt construction now mutates each chat model’s configured options, while tests verify that topP is preserved.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ProjectionAdapter
  participant PublicationStore
  participant PostgreSQL
  Client->>ProjectionAdapter: stage projection records
  ProjectionAdapter->>PostgreSQL: write batch-scoped staged data
  PublicationStore->>PostgreSQL: record preparation receipts
  PublicationStore->>PostgreSQL: lock namespace and publish batch
  PostgreSQL-->>PublicationStore: return published snapshot
  Client->>ProjectionAdapter: query authorized snapshot
  ProjectionAdapter->>PostgreSQL: validate batch and visibility
  PostgreSQL-->>ProjectionAdapter: return filtered projection data
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding shared PostgreSQL snapshots to graph-rag.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kl3inIT/light-rag-pr08-postgres-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java`:
- Around line 567-572: Remove the unused private three-argument
provenance(String, UUID, UUID) overload; retain the four-argument provenance
implementation and all callers that invoke it directly.

In
`@integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java`:
- Around line 315-318: Update the DataIntegrityViolationException handler in
PostgresProjectionPublicationStore to pass the caught conflict as the cause when
creating PublicationConflictException. Ensure PublicationConflictException
provides a compatible (String, Throwable) constructor while preserving the
existing conflict message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5aa1c36f-f57c-4ad6-aae8-0fb649464f29

📥 Commits

Reviewing files that changed from the base of the PR and between 6c899a2 and 0a036d3.

⛔ Files ignored due to path filters (5)
  • docs/increments/active/2026-07-23-full-lightrag-semantic-port/design.md is excluded by !docs/**
  • docs/increments/active/2026-07-23-full-lightrag-semantic-port/plan.md is excluded by !docs/**
  • docs/research/lightrag-v1.5.4-parity-manifest.md is excluded by !docs/**
  • docs/specs/domains/secure-graph-rag.md is excluded by !docs/**
  • docs/tests/domains/secure-graph-rag.md is excluded by !docs/**
📒 Files selected for processing (28)
  • ARCHITECTURE.md
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/AuthorizedQueryProjection.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/LightRagQueryEngine.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/StoreBackedAuthorizedQueryProjection.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/GraphStore.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/ProjectionKind.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/VectorIndex.java
  • components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryAuthorizedQueryProjection.java
  • components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java
  • core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql
  • integrations/graph-rag-postgres/build.gradle.kts
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresContentStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagAutoConfiguration.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresLexicalIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionCodec.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionSupport.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndex.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresSharedProjectionIntegrationTests.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiDescriptionSummaryModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiExtractionModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiMultimodalAnalyzer.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModel.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModelTests.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModelTests.java
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Backend · Java 25
🧰 Additional context used
📓 Path-based instructions (4)
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

**/*: Before changing unfamiliar Spring Boot 4, Spring Modulith 2, Spring AI 2, Gradle, React, Vite, Tailwind, or TypeScript APIs, consult Context7/current official documentation and the project orgmemory-* verification skills.
Read docs/guidelines/agent-safety.md before retrieval, AI, MCP, permission, upload, graph, or export work.
Never commit .env files, provider keys, tokens, or customer data.
Run the relevant gates from docs/guidelines/testing-harness.md; use a terminating clean test as the context gate, and do not treat bootRun as verification.
Current behavior belongs in architecture/specs only after it exists in code; intent belongs in vision, roadmap, or an active increment, and repository state must not be duplicated across documents.

Files:

  • integrations/graph-rag-postgres/build.gradle.kts
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/ProjectionKind.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/AuthorizedQueryProjection.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresLexicalIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/GraphStore.java
  • ARCHITECTURE.md
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiDescriptionSummaryModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiExtractionModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModel.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModelTests.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModelTests.java
  • components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryAuthorizedQueryProjection.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/LightRagQueryEngine.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiMultimodalAnalyzer.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionCodec.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/VectorIndex.java
  • core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModel.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionSupport.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresContentStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagAutoConfiguration.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresSharedProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/StoreBackedAuthorizedQueryProjection.java
  • components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStore.java
**/*.{java,sql}

📄 CodeRabbit inference engine (CLAUDE.md)

Pair JPA schema changes with a Flyway migration.

Files:

  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/ProjectionKind.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/AuthorizedQueryProjection.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresLexicalIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/GraphStore.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiDescriptionSummaryModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiExtractionModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModel.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModelTests.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModelTests.java
  • components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryAuthorizedQueryProjection.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/LightRagQueryEngine.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiMultimodalAnalyzer.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionCodec.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/VectorIndex.java
  • core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModel.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionSupport.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresContentStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagAutoConfiguration.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresSharedProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/StoreBackedAuthorizedQueryProjection.java
  • components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStore.java
**/*.java

📄 CodeRabbit inference engine (CLAUDE.md)

JetBrains IDE inspection is a Java-backend gate only.

Files:

  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/ProjectionKind.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/AuthorizedQueryProjection.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresLexicalIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/GraphStore.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiDescriptionSummaryModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiExtractionModel.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModel.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModelTests.java
  • integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModelTests.java
  • components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryAuthorizedQueryProjection.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/LightRagQueryEngine.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiMultimodalAnalyzer.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionCodec.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/VectorIndex.java
  • integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModel.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionSupport.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresContentStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagAutoConfiguration.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresSharedProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/StoreBackedAuthorizedQueryProjection.java
  • components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStore.java
core/src/main/resources/db/migration/*.sql

⚙️ CodeRabbit configuration file

core/src/main/resources/db/migration/*.sql: Flyway migrations are immutable after release. Check tenant isolation,
foreign keys, uniqueness, indexes, append-only evidence semantics, safe
defaults, and compatibility with PostgreSQL 18 plus pgvector.

Files:

  • core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql
🧠 Learnings (1)
📚 Learning: 2026-07-23T23:30:44.585Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 30
File: core/src/main/resources/db/migration/V32__evidence_scoped_graph_semantics.sql:0-0
Timestamp: 2026-07-23T23:30:44.585Z
Learning: For OrgMemory PostgreSQL Flyway migrations under core/src/main/resources/db/migration, do not recommend using `CREATE INDEX CONCURRENTLY` or `DROP INDEX CONCURRENTLY` inside application-owned Flyway migration SQL. Flyway’s schema-history connection may hold a transaction that can cause concurrent index operations to wait indefinitely (e.g., on a `virtualxid`), and docs/conventions.md forbids this pattern. If you need large production-table index replacement, pre-stage online index operations via the deployment pipeline (outside Flyway) rather than inside the migration; “ordinary” index replacement is acceptable for unreleased projections before production traffic.

Applied to files:

  • core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql
🪛 ast-grep (0.44.1)
integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresSharedProjectionIntegrationTests.java

[warning] 153-157: Avoid LDAP injections
Context: lexical.search(
allowed,
firstSnapshot,
new LexicalIndex.SearchRequest(
"probation", Set.of(), 10, 0, null))
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)


[warning] 163-172: Avoid LDAP injections
Context: vectors.search(
allowed,
firstSnapshot,
new VectorIndex.SearchRequest(
PROFILE_ID,
Set.of(VectorIndex.VectorKind.CHUNK),
Set.of(),
vector(1, 0, 0),
10,
0))
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)


[warning] 184-188: Avoid LDAP injections
Context: lexical.search(
denied,
firstSnapshot,
new LexicalIndex.SearchRequest(
"probation", Set.of(), 10, 0, null))
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)


[warning] 191-200: Avoid LDAP injections
Context: vectors.search(
denied,
firstSnapshot,
new VectorIndex.SearchRequest(
PROFILE_ID,
Set.of(VectorIndex.VectorKind.CHUNK),
Set.of(),
vector(1, 0, 0),
10,
0))
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/StoreBackedAuthorizedQueryProjection.java

[warning] 184-193: Avoid LDAP injections
Context: vectors.search(
scope,
snapshot,
new VectorIndex.SearchRequest(
search.embeddingProfileId(),
Set.of(kind),
candidates,
search.vector(),
search.limit(),
search.minimumSimilarity()))
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)

🪛 PMD (7.26.0)
integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java

[Medium] 316-317: PreserveStackTrace (Best Practices): Thrown exception does not preserve the stack trace of exception 'conflict' on all code paths

(PreserveStackTrace (Best Practices))

components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java

[Medium] 567-567: UnusedPrivateMethod (Best Practices): Avoid unused private methods such as 'provenance(String, UUID, UUID)'.

(UnusedPrivateMethod (Best Practices))

🪛 SQLFluff (4.2.2)
core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql

[error] 110-116: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 137-138: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 140-146: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 172-179: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 181-182: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 206-207: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 209-210: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 243-249: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 251-252: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 288-294: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 296-297: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)

🪛 Squawk (2.59.0)
core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql

[warning] 4-4: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 5-5: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 8-8: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 9-9: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 11-11: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 50-50: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 61-61: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 62-62: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 64-64: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 72-72: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 73-73: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 84-84: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 94-94: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 101-101: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 103-103: Using 32-bit integer fields can result in hitting the max int limit. Use 64-bit integer values instead to prevent hitting this limit.

(prefer-bigint-over-int)


[warning] 121-121: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 151-151: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 152-152: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 159-159: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 161-161: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 162-162: Using 32-bit integer fields can result in hitting the max int limit. Use 64-bit integer values instead to prevent hitting this limit.

(prefer-bigint-over-int)


[warning] 198-198: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 217-217: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 226-226: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 227-227: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 228-228: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 229-229: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 259-259: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 270-270: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 271-271: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 272-272: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 273-273: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)

🔇 Additional comments (31)
integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiDescriptionSummaryModel.java (1)

11-12: LGTM!

Also applies to: 50-56

integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiExtractionModel.java (1)

22-23: LGTM!

Also applies to: 51-56

integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModel.java (1)

12-13: LGTM!

Also applies to: 34-45

integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiMultimodalAnalyzer.java (1)

17-18: LGTM!

Also applies to: 166-174

integrations/graph-rag-spring-ai/src/main/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModel.java (1)

13-14: LGTM!

Also applies to: 57-69

integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiKeywordPlanningModelTests.java (1)

14-14: LGTM!

Also applies to: 37-37, 56-57, 70-74

integrations/graph-rag-spring-ai/src/test/java/com/orgmemory/integrations/graphrag/springai/SpringAiQueryAnswerModelTests.java (1)

16-16: LGTM!

Also applies to: 52-52, 86-87, 103-107

core/src/main/resources/db/migration/V34__shared_projection_publication_snapshots.sql (2)

110-116: Not recommending CONCURRENTLY for these CREATE INDEX statements.

SQLFluff (PG01) flags these as lock risks, but per this repo's established convention, CREATE INDEX CONCURRENTLY/DROP INDEX CONCURRENTLY should not be used inside Flyway migrations here — Flyway's schema-history connection can hold a transaction that stalls concurrent index builds, and "ordinary" index creation is acceptable for these new, pre-traffic projection tables.

Based on learnings, "do not recommend using CREATE INDEX CONCURRENTLY or DROP INDEX CONCURRENTLY inside application-owned Flyway migration SQL... 'ordinary' index replacement is acceptable for unreleased projections before production traffic."

Also applies to: 137-146, 172-182, 206-210, 243-252, 288-297

Source: Learnings


1-298: LGTM!

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/AuthorizedQueryProjection.java (1)

109-133: LGTM!

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/ProjectionKind.java (1)

3-8: LGTM!

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/VectorIndex.java (1)

34-118: LGTM!

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/storage/GraphStore.java (1)

1-77: LGTM!

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/StoreBackedAuthorizedQueryProjection.java (1)

26-244: LGTM!

components/graph-rag-core/src/main/java/com/orgmemory/graphrag/query/LightRagQueryEngine.java (1)

65-72: LGTM!

Also applies to: 489-499

components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryAuthorizedQueryProjection.java (1)

324-334: LGTM!

components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java (1)

66-68: LGTM!

Also applies to: 157-196, 239-261, 297-314, 381-406, 448-455, 526-566, 573-581, 595-614, 732-736

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagAutoConfiguration.java (2)

8-12: LGTM!


41-88: 🩺 Stability & Availability

No action needed.

A custom ProjectionPublicationStore implementation would satisfy @ConditionalOnMissingBean(ProjectionPublicationStore.class) and be injected here, so these parameters do not break override support.

			> Likely an incorrect or invalid review comment.
integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionSupport.java (1)

35-118: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionPublicationStore.java (1)

204-294: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresContentStore.java (1)

46-149: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresLexicalIndex.java (1)

102-217: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionCodec.java (1)

17-89: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStore.java (2)

136-357: LGTM!


388-457: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java (1)

15-191: LGTM!

integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndex.java (1)

47-234: LGTM!

integrations/graph-rag-postgres/build.gradle.kts (1)

14-14: LGTM!

integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresSharedProjectionIntegrationTests.java (1)

105-271: LGTM!

ARCHITECTURE.md (1)

201-208: LGTM!

@kl3inIT
kl3inIT merged commit 0689116 into light-rag Jul 24, 2026
5 checks passed
@kl3inIT
kl3inIT deleted the kl3inIT/light-rag-pr08-postgres-parity branch July 24, 2026 04:59
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