Skip to content

Add secure PostgreSQL GraphRAG projection - #22

Merged
kl3inIT merged 3 commits into
mainfrom
kl3inIT/graph-rag-postgres
Jul 23, 2026
Merged

kl3inIT merged 3 commits into
mainfrom
kl3inIT/graph-rag-postgres

Conversation

@kl3inIT

@kl3inIT kl3inIT commented Jul 23, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • add a secure PostgreSQL GraphRAG projection backed by relational tables, pgvector, and Apache AGE
  • preserve contribution-level provenance and authorization scope before ranking or graph traversal
  • support atomic generation replacement, bounded batching, configurable vector index strategies, and relational topology fallback
  • consolidate OrgMemory and OpenFGA onto one PostgreSQL 18 server while retaining separate databases and logins
  • pin and build PostgreSQL 18 with pgvector 0.8.2 and Apache AGE 1.7.0
  • add integration coverage and architecture/operations documentation

Why

OrgMemory needs a production-oriented graph projection that follows the useful storage boundaries from LightRAG without allowing a graph or vector store to become an authorization authority. The projection must remain rebuildable, tenant-isolated, permission-scoped, and replaceable by another topology backend such as Neo4j when measured workloads justify it.

Impact

  • graph entities, relations, contributions, and embeddings can be persisted and retrieved through framework-neutral ports
  • topology traversal is available through AGE with a bounded PostgreSQL recursive fallback
  • OpenFGA no longer requires a second PostgreSQL container or volume in local Compose
  • application worker/runtime wiring and user-facing graph retrieval remain separate increments

Validation

  • full Gradle build: 166 tests, 0 failures, 0 errors
  • real PostgreSQL 18 + pgvector 0.8.2 + Apache AGE 1.7.0 Testcontainers coverage
  • fresh-volume and existing-volume OpenFGA database bootstrap verified
  • docker compose config --quiet
  • git diff --check

JetBrains inspection was attempted, but the local IDE MCP transport was unavailable; Gradle compile/test and repository fallback checks were used.

Summary by CodeRabbit

  • New Features

    • Added PostgreSQL-backed GraphRAG capabilities, including secure graph projections, text search, vector search, and topology expansion.
    • Added configurable vector indexing strategies and Apache AGE support, with fallback behavior when AGE is unavailable.
    • Added local PostgreSQL setup with pgvector, Apache AGE, and isolated OpenFGA database bootstrapping.
  • Documentation

    • Updated architecture documentation with the PostgreSQL 18 GraphRAG design, authorization behavior, storage layout, and runtime configuration.
  • Tests

    • Added integration coverage for authorization filtering, graph traversal, vector indexing, projection replacement, and data validation.

@coderabbitai

coderabbitai Bot commented Jul 23, 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: 20 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: 2bd58ae0-22c3-4dc0-8472-ecc05899c84d

📥 Commits

Reviewing files that changed from the base of the PR and between 1db7fd1 and d8f1732.

⛔ Files ignored due to path filters (3)
  • docs/decisions/0011-postgresql-multimodel-graph-projection.md is excluded by !docs/**
  • docs/increments/completed/2026-07-23-graph-rag-postgres/design.md is excluded by !docs/**
  • docs/specs/domains/secure-graph-rag.md is excluded by !docs/**
📒 Files selected for processing (9)
  • ARCHITECTURE.md
  • core/src/main/resources/db/migration/V21__secure_graph_projection.sql
  • infrastructure/postgres-rag/prestage-graph-prerequisite-indexes.sql
  • integrations/graph-rag-postgres/build.gradle.kts
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjection.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.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/PostgresGraphProjectionStoreIntegrationTests.java
📝 Walkthrough

Walkthrough

Adds a PostgreSQL 18 GraphRAG integration with pgvector and Apache AGE, including relational schema, secure projection storage, vector search, topology traversal, Spring Boot configuration, local Compose wiring, and Testcontainers coverage.

Changes

PostgreSQL GraphRAG integration

Layer / File(s) Summary
Graph contracts and relational schema
components/graph-rag-core/..., core/src/main/resources/db/migration/V21__secure_graph_projection.sql
Adds embedding and topology ports plus canonical graph, contribution, projection-generation, embedding, constraints, and indexes.
PostgreSQL runtime and local wiring
infrastructure/postgres-rag/*, compose.yaml, .github/workflows/ci.yml, settings.gradle.kts, integrations/graph-rag-postgres/build.gradle.kts
Builds a PostgreSQL image with pgvector and AGE, provisions a separate OpenFGA database, updates Compose dependencies, registers the module, and builds the test image in CI.
Apache AGE topology projection
integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAge*
Adds AGE availability modes, graph lifecycle management, revision edge replacement, bounded authorized traversal, and AGE SQL/Cypher handling.
PostgreSQL projection store and search
integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.java, PostgresGraph*, PostgresVectorIndexStrategy.java
Adds transactional revision and embedding replacement, authorization-scoped loading, text/vector ranking, recursive traversal fallback, bounded batching, configurable vector indexes, and Spring Boot auto-configuration.
Integration validation
integrations/graph-rag-postgres/src/test/*
Tests AGE projection behavior, authorization filtering, tenant isolation, replacement and generation rules, vector index provisioning, embedding validation, and batching.
Architecture baseline
ARCHITECTURE.md
Documents PostgreSQL 18, pgvector, AGE, GraphRAG storage behavior, local database separation, and current worker wiring.

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

Sequence Diagram(s)

sequenceDiagram
  participant GraphRAGWorker
  participant PostgresGraphProjectionStore
  participant PostgreSQL
  participant ApacheAgeGraphTopologyProjection
  GraphRAGWorker->>PostgresGraphProjectionStore: replaceRevision contributions
  PostgresGraphProjectionStore->>PostgreSQL: lock revision and write projection
  PostgresGraphProjectionStore->>ApacheAgeGraphTopologyProjection: replaceRevision topology
  ApacheAgeGraphTopologyProjection->>PostgreSQL: update AGE graph
  GraphRAGWorker->>PostgresGraphProjectionStore: search or expand authorized graph
  PostgresGraphProjectionStore->>PostgreSQL: filter and rank visible data
  PostgreSQL-->>GraphRAGWorker: ranked results and candidate IDs
Loading

Possibly related PRs

  • kl3inIT/OrgMemory#20: Introduces the GraphRAG contracts and data models consumed by this PostgreSQL integration.
🚥 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 is concise and accurately reflects the main change: adding a secure PostgreSQL GraphRAG projection.
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/graph-rag-postgres

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: 6

🤖 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 `@ARCHITECTURE.md`:
- Around line 174-175: Update the vector-index documentation in ARCHITECTURE.md
to state that VChordRQ requires the separately installed vchord extension and is
unavailable in the pinned local image built by the postgres-rag Dockerfile.
Document the expected behavior when VChordRQ is configured but the extension is
absent, while preserving the descriptions of the other index types.

In `@integrations/graph-rag-postgres/build.gradle.kts`:
- Around line 7-9: Align the postgres integration dependency metadata with
PostgresGraphRagAutoConfiguration’s reference to JdbcTemplateAutoConfiguration
by adding the spring-boot-jdbc dependency in build.gradle.kts. Preserve the
existing spring-jdbc, spring-boot-autoconfigure, and spring-boot-sql
dependencies unless they are no longer required.

In
`@integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjection.java`:
- Around line 52-88: Update ensureGraph, used by replaceRevision, to handle
concurrent graph creation safely: when graphExists reports absent, attempt
create_graph and treat Apache AGE’s duplicate-graph error as successful
creation, while propagating other failures. Preserve existing behavior for
already-present graphs and return the graph name after either path completes.

In
`@integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.java`:
- Around line 185-186: Remove the synchronous ensureConfiguredIndexes call from
the PostgresGraphProjectionStore constructor and provision the configured
indexes through an external migration or startup mechanism that runs outside
bean construction. Ensure provisioning is idempotent and uses non-blocking
concurrent index creation where supported, while preserving normal store
initialization and request readiness.
- Around line 732-792: The recursive walk in expandEntityIdsRelationally
currently bounds only per-path visits, allowing duplicate expansion through
different paths before the outer LIMIT. Add a global emitted/expanded-entity
guard to the recursive state, enforce the requested limit and depth while
generating recursive rows, and stop expanding IDs once the global bound is
reached; retain visibility and cycle checks while removing reliance on the outer
DISTINCT/ORDER BY/LIMIT to control traversal work.

In
`@integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java`:
- Around line 97-102: Thread the selected vector index strategy from
PostgresGraphVectorIndexManager into the query builders, including
PostgresGraphProjectionStore, so HNSW_HALFVEC uses matching
content_vector::halfvec(dimension) <=> query::halfvec(dimension) expressions;
preserve ::vector expressions for all other strategies and update every affected
query path.
🪄 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: 16e328b5-0dd6-40f3-acf3-e99d6cb5b3da

📥 Commits

Reviewing files that changed from the base of the PR and between e03dfa7 and 1db7fd1.

⛔ Files ignored due to path filters (6)
  • docs/decisions/0011-postgresql-multimodel-graph-projection.md is excluded by !docs/**
  • docs/increments/completed/2026-07-23-graph-rag-postgres/design.md is excluded by !docs/**
  • docs/increments/completed/2026-07-23-graph-rag-postgres/plan.md is excluded by !docs/**
  • docs/roadmap.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 (26)
  • .github/workflows/ci.yml
  • ARCHITECTURE.md
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/model/ContributionEmbedding.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphEmbeddingIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphRevisionEmbeddings.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphTopologyCandidateIndex.java
  • compose.yaml
  • core/src/main/resources/db/migration/V21__secure_graph_projection.sql
  • infrastructure/postgres-rag/01-create-openfga-database.sh
  • infrastructure/postgres-rag/Dockerfile
  • integrations/graph-rag-postgres/build.gradle.kts
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjection.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeMode.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/BoundedBatcher.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.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/PostgresGraphRagProperties.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStoreOptions.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/PostgresVectorIndexStrategy.java
  • integrations/graph-rag-postgres/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/BoundedBatcherTests.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStoreIntegrationTests.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphStoreOptionsTests.java
  • settings.gradle.kts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Backend · Java 25
🧰 Additional context used
📓 Path-based instructions (6)
**/*

📄 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/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeMode.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/BoundedBatcher.java
  • settings.gradle.kts
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphTopologyCandidateIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndexStrategy.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphRevisionEmbeddings.java
  • integrations/graph-rag-postgres/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  • integrations/graph-rag-postgres/build.gradle.kts
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphEmbeddingIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/model/ContributionEmbedding.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/BoundedBatcherTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStoreOptions.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphVectorIndexManager.java
  • infrastructure/postgres-rag/Dockerfile
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphStoreOptionsTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagAutoConfiguration.java
  • infrastructure/postgres-rag/01-create-openfga-database.sh
  • compose.yaml
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphRagProperties.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjection.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStoreIntegrationTests.java
  • ARCHITECTURE.md
  • core/src/main/resources/db/migration/V21__secure_graph_projection.sql
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.java
**/*.{java,sql}

📄 CodeRabbit inference engine (CLAUDE.md)

Pair JPA schema changes with a Flyway migration.

Files:

  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeMode.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/BoundedBatcher.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphTopologyCandidateIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndexStrategy.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphRevisionEmbeddings.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphEmbeddingIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/model/ContributionEmbedding.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/BoundedBatcherTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStoreOptions.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/PostgresGraphStoreOptionsTests.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/PostgresGraphRagProperties.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjection.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStoreIntegrationTests.java
  • core/src/main/resources/db/migration/V21__secure_graph_projection.sql
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.java
**/*.java

📄 CodeRabbit inference engine (CLAUDE.md)

JetBrains IDE inspection is a Java-backend gate only.

Files:

  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeMode.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/BoundedBatcher.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphTopologyCandidateIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndexStrategy.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphRevisionEmbeddings.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/port/GraphEmbeddingIndex.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/model/ContributionEmbedding.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjectionIntegrationTests.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/BoundedBatcherTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStoreOptions.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/PostgresGraphStoreOptionsTests.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/PostgresGraphRagProperties.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphTopologyProjection.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStoreIntegrationTests.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStore.java
.github/**/*.{yml,yaml}

⚙️ CodeRabbit configuration file

.github/**/*.{yml,yaml}: Require least-privilege permissions, immutable action SHAs, bounded job
timeouts, concurrency cancellation, frozen lockfiles, and no secrets in
pull-request workflows. Keep Dependabot comments beside pinned action
SHAs so action updates remain discoverable.

Files:

  • .github/workflows/ci.yml
**/*.{yml,yaml,properties}

📄 CodeRabbit inference engine (CLAUDE.md)

Keep ddl-auto=validate in application configuration.

Files:

  • compose.yaml
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/V21__secure_graph_projection.sql
🪛 Hadolint (2.14.0)
infrastructure/postgres-rag/Dockerfile

[warning] 10-10: Pin versions in apt get install. Instead of apt-get install <package> use apt-get install <package>=<version>

(DL3008)

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

[ERROR] 119-124: SQL query built via string concatenation passed to Statement.execute*(). Use PreparedStatement with parameterized queries instead.

(coderabbit.sql-injection.java-statement-concat)


[ERROR] 142-143: SQL query built via string concatenation passed to Statement.execute*(). Use PreparedStatement with parameterized queries instead.

(coderabbit.sql-injection.java-statement-concat)

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

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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)


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

(PG01)

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

[warning] 21-22: By default new constraints require a table scan and block writes to the table while that scan occurs. Use NOT VALID with a later VALIDATE CONSTRAINT call.

(constraint-missing-not-valid)


[warning] 21-22: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads and writes to the table while the index is built. Create an index CONCURRENTLY and create the constraint using the index.

(disallowed-unique-constraint)


[warning] 25-26: By default new constraints require a table scan and block writes to the table while that scan occurs. Use NOT VALID with a later VALIDATE CONSTRAINT call.

(constraint-missing-not-valid)


[warning] 25-26: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads and writes to the table while the index is built. Create an index CONCURRENTLY and create the constraint using the index.

(disallowed-unique-constraint)


[warning] 29-30: By default new constraints require a table scan and block writes to the table while that scan occurs. Use NOT VALID with a later VALIDATE CONSTRAINT call.

(constraint-missing-not-valid)


[warning] 29-30: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads and writes to the table while the index is built. Create an index CONCURRENTLY and create the constraint using the index.

(disallowed-unique-constraint)


[warning] 33-40: By default new constraints require a table scan and block writes to the table while that scan occurs. Use NOT VALID with a later VALIDATE CONSTRAINT call.

(constraint-missing-not-valid)


[warning] 33-40: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads and writes to the table while the index is built. Create an index CONCURRENTLY and create the constraint using the index.

(disallowed-unique-constraint)


[warning] 45-45: 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] 46-46: 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] 66-66: 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] 67-67: 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] 123-123: 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] 124-124: 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] 125-125: 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] 199-199: 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] 202-202: 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] 203-203: 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] 204-204: 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] 282-282: 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] 327-327: 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)

🪛 Trivy (0.72.0)
infrastructure/postgres-rag/Dockerfile

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)


[info] 1-1: No HEALTHCHECK defined

Add HEALTHCHECK instruction in your Dockerfile

Rule: DS-0026

Learn more

(IaC/Dockerfile)

🔇 Additional comments (32)
ARCHITECTURE.md (5)

15-15: LGTM!


25-34: LGTM!


80-80: LGTM!


165-173: LGTM!


176-188: LGTM!

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

1-19: LGTM!

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

1-53: LGTM!

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

1-23: LGTM!

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

42-413: LGTM! New tables, constraints, and indexes are well-scoped for tenant isolation and provenance/authorization linkage.


20-40: 🩺 Stability & Availability

Verify production data impact before adding these UNIQUE constraints.

The four ADD CONSTRAINT ... UNIQUE statements run on existing tables, and PostgreSQL acquires an ACCESS EXCLUSIVE lock while scanning the table to build the supporting index. If these tables carry production rows, this migration can block reads/writes. NOT VALID does not apply to UNIQUE constraints; instead build each unique index CONCURRENTLY outside Flyway’s transaction, then attach it with UNIQUE USING INDEX.

infrastructure/postgres-rag/Dockerfile (1)

1-39: LGTM!

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

1-20: LGTM on remaining dependency declarations (test scope, Flyway/Testcontainers wiring).

integrations/graph-rag-postgres/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports (1)

1-1: LGTM!

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

1-173: LGTM!

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

1-29: LGTM!

infrastructure/postgres-rag/01-create-openfga-database.sh (1)

1-45: LGTM!

settings.gradle.kts (1)

26-26: LGTM!

.github/workflows/ci.yml (1)

39-45: LGTM!

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

1-8: LGTM!

integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresGraphProjectionStoreIntegrationTests.java (2)

50-52: LGTM! Confirmed the non-generic org.testcontainers.postgresql.PostgreSQLContainer usage matches the current Testcontainers 2.x API rather than being a raw-type mistake.


94-756: LGTM!

compose.yaml (1)

60-73: 🎯 Functional Correctness

No change needed.

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

142-176: 🩺 Stability & Availability

No change needed here.

PostgresGraphProjectionStore wraps ApacheAgeGraphTopologyProjection.replaceRevision() in a single TransactionTemplate, so SET LOCAL is issued inside the same transaction before the subsequent unqualified AGE catalog calls run.

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

119-124: The OpenGrep SQL-injection hints here are false positives: CREATE INDEX/DROP INDEX are DDL where identifiers cannot be parameterized, and the concatenated inputs are constrained (constant table names, integer dimension, regex-guarded quoteIdentifier, and quoteLiteral-escaped vchordBuildOptions).

Also applies to: 142-143

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

13-42: LGTM!

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

9-15: LGTM!

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

25-73: LGTM!

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

189-1005: LGTM!

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

16-44: Verified against Spring Boot 4 docs: FlywayAutoConfiguration now resides in org.springframework.boot.flyway.autoconfigure, matching the afterName string, so ordering resolves correctly.

LGTM!

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

10-33: LGTM!

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

11-43: LGTM!

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

11-35: LGTM!

Comment thread ARCHITECTURE.md Outdated
Comment thread integrations/graph-rag-postgres/build.gradle.kts
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