perf(graphrag): bound relation authorization hot paths - #321
Conversation
Constrain relation contribution and weight authorization to requested candidates before endpoint visibility checks. Add transaction-local query budgets and payload-free per-operation retrieval tracing.
📝 WalkthroughWalkthroughThe change adds per-operation query telemetry across the graph-RAG query engine and retrieval service. It also adds query stages and tests, and updates PostgreSQL relation reads with timeouts and authorized candidate filtering. ChangesQuery operation observability
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant DefaultGraphRagKnowledgeRetrievalService
participant LightRagQueryEngine
participant PostgresGraphStore
participant GraphRagEventSink
DefaultGraphRagKnowledgeRetrievalService->>LightRagQueryEngine: executePrepared with operation observer
LightRagQueryEngine->>PostgresGraphStore: load graph and chunk data
PostgresGraphStore-->>LightRagQueryEngine: return authorized query data
LightRagQueryEngine-->>DefaultGraphRagKnowledgeRetrievalService: emit operation measurement
DefaultGraphRagKnowledgeRetrievalService->>GraphRagEventSink: emit staged query telemetry
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
TegamiThis repository uses Tegami to manage releases. When your changes affect published packages, add a changelog file under Create a changelog → · Changelog format Release preview
This PR does not add changelog files. Pending changelogs from other branches are included in the preview above. Run Managed by Tegami. |
Summary
Incident evidence
loadRelationContributionsat ~8.10s andloadVisibleRelationWeightsat ~8.32sSecurity and semantics
Verification
git diff --check: PASSProduction acceptance
After merge and immutable-image deployment, rerun authenticated P001 and the complete official P001-P050 evaluation. Verify retrieval/TTFT/total separately, exact permission/citation gates, zero long-running/orphan PostgreSQL backends, and DB CPU recovery before declaring fixed.
Summary by CodeRabbit
New Features
Bug Fixes