Skip to content

refactor(knowledge): isolate Graph from Asset persistence - #221

Merged
kl3inIT merged 1 commit into
mainfrom
refactor/modulith-next-knowledge
Aug 1, 2026
Merged

refactor(knowledge): isolate Graph from Asset persistence#221
kl3inIT merged 1 commit into
mainfrom
refactor/modulith-next-knowledge

Conversation

@kl3inIT

@kl3inIT kl3inIT commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an Asset-owned query for immutable graph asset, version, and chunk facts
  • remove Graph injection of Asset repositories, JPA entities/status, and the chunk projection store
  • pin the four allowed Graph-to-Asset contracts and reject persistence leakage with ArchUnit

Architecture

Removes the Graph-to-Asset implementation edge before Graph closure, following the existing Claude Fable 5 architecture verdict.

Verification

  • focused Asset query, Graph, and Modulith tests: passed in 21s
  • :core:test: passed in 1m12s
  • python scripts/check_docs.py: passed (427 Markdown files, 8 mirrored domain pairs)
  • pnpm release:check under Node 24.15: passed (37 tests)
  • gradlew clean test --no-daemon: passed in 4m57s (99 tasks)
  • zero Graph-to-Asset-persistence import scan: passed
  • PR scope: 16 changed paths

Summary by CodeRabbit

  • New Features

    • Added immutable asset, version, and chunk information for knowledge graph operations.
    • Added organization- and space-scoped lookups with validation for missing or mismatched assets.
  • Improvements

    • Graph indexing and curation now use consistent asset-owned data contracts.
    • Added safeguards for invalid identifiers, negative values, inactive versions, and archived assets.
  • Tests

    • Expanded coverage for asset queries, chunk loading, access validation, and graph architecture boundaries.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 257ec173-af55-4709-84e1-a4b139514735

📥 Commits

Reviewing files that changed from the base of the PR and between 285261b and 286628d.

⛔ Files ignored due to path filters (1)
  • docs/increments/active/2026-07-31-spring-modulith-package-refactor/plan.md is excluded by !docs/**
📒 Files selected for processing (15)
  • .tegami/graph-asset-query-boundary.md
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphChunk.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetVersionGraphRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexJobQueue.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleService.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinator.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationService.java
  • core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQueryTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinatorTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationServiceTests.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Backend · Java 25
🧰 Additional context used
📓 Path-based instructions (3)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Treat the repository and runtime evidence as the engineering system of record; do not treat chat or Northstar as authoritative.
Before changing a domain, read its specification, test-coverage document, and applicable decision filenames.
Material decisions about domain boundaries, authorization, persistence, publication, concurrency, cache isolation, parity scope, or deployment require an independent architecture challenge and documented alternatives before implementation.
Do not use completed increment documents as the source for current behavior; use them only for history or archaeology.
Before using unfamiliar Spring Boot, Spring Modulith, Spring AI, Gradle, React, Vite, Tailwind, TypeScript, Next.js, or Fumadocs APIs, consult current official documentation, Context7, and the relevant verification skill.
Read docs/guidelines/agent-safety.md before retrieval, AI, MCP, permission, upload, graph, or export work; never commit secrets or customer data.
Keep ddl-auto=validate and pair every persisted-model change with a Flyway migration.
Use the testing harness; a terminating clean test is the JVM context gate, and bootRun is not verification.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/asset/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleService.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphChunk.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetVersionGraphRef.java
  • core/src/test/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQueryTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexJobQueue.java
  • core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationServiceTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinator.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationService.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinatorTests.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

Apply IDE inspection only to edited backend Java files.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/asset/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleService.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphChunk.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetVersionGraphRef.java
  • core/src/test/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQueryTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexJobQueue.java
  • core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationServiceTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinator.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationService.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinatorTests.java
core/src/main/java/com/orgmemory/core/{authorization,knowledge,permission}/**/*.java

⚙️ CodeRabbit configuration file

core/src/main/java/com/orgmemory/core/{authorization,knowledge,permission}/**/*.java: Treat PostgreSQL ACL evidence as canonical and OpenFGA as the relationship
authorization decision point. Authorization must fail closed. Filtering
must happen before ranking, LIMIT, graph traversal, answer generation,
export, and citation rendering. Flag metadata or timing leak paths.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/asset/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleService.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphChunk.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetVersionGraphRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexJobQueue.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinator.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationService.java
🪛 LanguageTool
.tegami/graph-asset-query-boundary.md

[style] ~7-~7: Consider using a different verb to strengthen your wording.
Context: ...raph access to Asset persistence --- # Remove Graph access to Asset persistence ## I...

(REMOVE_REVOKE)

🔇 Additional comments (16)
core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphRef.java (1)

1-17: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetVersionGraphRef.java (1)

1-20: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/asset/package-info.java (1)

4-6: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexJobQueue.java (1)

3-4: LGTM!

Also applies to: 24-38, 51-58, 67-67, 95-99, 109-109

core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleService.java (1)

3-5: LGTM!

Also applies to: 36-46, 85-103

core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinator.java (1)

6-8: LGTM!

Also applies to: 29-47, 149-153, 162-162, 173-173, 196-208, 210-220, 240-249

core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexLifecycleServiceTests.java (1)

3-5: LGTM!

Also applies to: 36-64, 94-94

core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphChunk.java (1)

1-27: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQuery.java (1)

1-102: LGTM!

core/src/test/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQueryTests.java (1)

1-102: LGTM!

core/src/test/java/com/orgmemory/core/knowledge/graph/GraphIndexingCoordinatorTests.java (1)

7-10: LGTM!

Also applies to: 51-67, 80-88, 106-109, 131-143, 191-193, 208-210, 316-316, 348-354

core/src/main/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationService.java (1)

10-10: LGTM!

Also applies to: 46-57, 236-237

core/src/test/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationServiceTests.java (1)

8-16: LGTM!

Also applies to: 50-51, 82-82, 166-168

core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java (2)

297-340: LGTM!


508-518: LGTM!

.tegami/graph-asset-query-boundary.md (1)

1-15: LGTM!


📝 Walkthrough

Walkthrough

Graph services now use Asset-owned immutable query contracts for asset, version, and chunk data. New contracts centralize organization and space validation. Tests verify mappings, indexing behavior, curation behavior, and module boundaries.

Changes

Asset Graph Boundary

Layer / File(s) Summary
Graph query contracts and mappings
core/src/main/java/com/orgmemory/core/knowledge/asset/*, core/src/test/java/com/orgmemory/core/knowledge/asset/KnowledgeAssetGraphQueryTests.java
Added immutable asset, version, and chunk graph records. Added organization-scoped lookups, active chunk loading, space validation, and mapping tests.
Graph indexing migration
core/src/main/java/com/orgmemory/core/knowledge/graph/GraphIndexJobQueue.java, GraphIndexLifecycleService.java, GraphIndexingCoordinator.java, core/src/test/java/com/orgmemory/core/knowledge/graph/*Tests.java
Replaced repository, entity, and chunk-store dependencies with KnowledgeAssetGraphQuery and graph reference types. Updated indexing state checks and test fixtures.
Curation space validation
core/src/main/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationService.java, core/src/test/java/com/orgmemory/core/knowledge/graph/KnowledgeGraphCurationServiceTests.java
Delegated asset-space validation to requireInSpace(...) and updated cross-space tests.
Architecture boundary verification
core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java, .tegami/graph-asset-query-boundary.md, core/src/main/java/com/orgmemory/core/knowledge/asset/package-info.java
Added tests and documentation for the graph-to-asset query boundary.

Estimated code review effort: 3 (Moderate) | ~25 minutes

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
Title check ✅ Passed The title clearly and concisely describes the main refactor that isolates Graph from Asset persistence.
Description check ✅ Passed The description includes a clear summary and detailed verification evidence; the missing Documentation impact section is non-critical for this internal refactor.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/modulith-next-knowledge

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.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Tegami

This repository uses Tegami to manage releases. When your changes affect published packages, add a changelog file under .tegami/ before merging.

Create a changelog → · Changelog format

Release preview

Package Bump Version
orgmemory minor 0.1.10.2.0

Changelogs in this PR

Changelog Title
graph-asset-query-boundary.md Remove Graph access to Asset persistence
graph-asset-query-boundary.md Improvements

Run pnpm run tegami locally to create a changelog interactively.

Managed by Tegami.

@kl3inIT
kl3inIT merged commit 5849afb into main Aug 1, 2026
18 checks passed
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