SDK relationship events, graph analytics, and bounded agent context#556
Conversation
Introduce append-only attributable relationship events with replayable snapshots and cursor pagination. Add registry-driven execution, impact, knowledge, and temporal analytics plus bounded agent context packing with exact cost metadata. Document and verify the public SDK through full 100% coverage, packed-package dogfood, latest pm-changelog generation, and GH-555 remediation.
|
@greptileai please review the current head. |
|
/gemini review |
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (34)
📝 WalkthroughWalkthroughAdds immutable relationship event history, deterministic graph analytics, bounded relationship-context generation, graph contract updates, public SDK exports, extensive tests, documentation, and related project-management records. ChangesRelationship SDK capabilities
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant RelationshipEventLog
participant RelationshipGraph
participant RelationshipAnalytics
participant buildRelationshipContext
Client->>RelationshipEventLog: append or select relationship history
RelationshipEventLog->>RelationshipGraph: materialize immutable snapshot
RelationshipGraph->>RelationshipAnalytics: analyze graph or compare snapshots
RelationshipGraph->>buildRelationshipContext: traverse bounded relationship context
buildRelationshipContext-->>Client: return explainable, token-bounded context
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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 |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 39 minutes. |
There was a problem hiding this comment.
Code Review
This pull request implements a comprehensive suite of relationship graph capabilities in the SDK, including an append-only event ledger (RelationshipEventLog) with optimistic concurrency, exact deterministic graph analytics (execution layering, impact, and knowledge graph analysis), and explainable, token-bounded context assembly. Feedback on these changes highlights a potential runtime crash in the longest-path calculation when cycles are present, non-deterministic snapshot comparisons due to JSON.stringify key ordering, environment portability limitations from Node-specific Buffer usage, and a performance bottleneck in the nodes() retrieval that can be resolved with caching.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request expands the public SDK with robust graph capabilities, introducing append-only immutable relationship event logs with optimistic concurrency, point-in-time snapshots, exact deterministic graph analytics (execution order, impact, and knowledge graph analysis), and explainable, token-bounded relationship context packets. The review feedback highlights two important areas for improvement: first, a potential runtime issue in the longest path calculation where a non-null assertion on a cyclic node's depth could fail; second, the use of Node.js-specific Buffer.byteLength which limits the SDK's portability in browser or edge environments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Greptile SummaryThis PR adds relationship graph history, analytics, and bounded SDK context. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code.
What T-Rex did
Important Files Changed
Reviews (12): Last reviewed commit: "perf(sdk): index relationship event vali..." | Re-trigger Greptile |
|
Review round 1 acknowledgement: every Gemini and Greptile inline finding was accepted, reacted to, answered with verification evidence, and resolved. The fixes add cycle-entry safety, recursively stable snapshot keys, TextEncoder portability, cached immutable node snapshots, explicit hierarchy orientation, and single-charge evidence accounting. Codecov confirmed complete patch coverage. CodeRabbit and Sourcery rate-limit notices were also read, reacted to, and recorded; they contained no code findings. Local verification is now 5,680 tests with exact 100/100/100/100 coverage. |
Address the complete first review round with explicit hierarchy orientation, stable temporal edge keys, cyclic-target guards, browser-safe token sizing, exact evidence accounting, and cached immutable node snapshots. Add adversarial regressions and pm evidence while preserving exact repository-wide coverage.
|
@greptileai please review the current head fbe8787 after all round-one findings were resolved. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 11 minutes. |
There was a problem hiding this comment.
Code Review
This pull request implements stable public SDK APIs for relationship registry, immutable event history, explainable graph analytics, and token-bounded agent context. The reviewer identified several performance bottlenecks and a bug: repeatedly filtering all graph edges in directReasons and instantiating TextEncoder on every token estimation in relationship-context.ts can be optimized by pre-filtering root edges and reusing a module-level encoder; instantiating RelationshipGraph with all nodes on every ledger append in relationship-history.ts should be avoided by validating endpoints first; and stableJsonValue in relationship-analytics.ts needs to handle objects with custom toJSON methods (like Date) while preserving the existing serialization contract.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Review round 2 acknowledgement: all six Gemini and Greptile findings were accepted, reacted to, answered inline with implementation evidence, and resolved. The response adds indexed incident-edge context, constant-size append normalization, reusable TextEncoder allocation, custom toJSON stability, and non-duplicated evidence projection with fail-closed baseline budgeting. The updated Greptile summary reports 5/5 and safe to merge; its separate evidence-budget repro was still addressed. CodeRabbit completed with a rate-limit notice and no code findings. Full local verification remains exact 100/100/100/100 across 5,680 tests. |
Address the complete second review round with indexed incident-edge reasoning, constant-size event normalization, reusable token encoding, stable custom JSON values, and single-projection evidence budgets. Add adversarial regressions, retain exact 100% coverage, and release the broader graph items back to open with remaining acceptance preserved.
|
@greptileai please review the current head 2f85b5e after all round-two findings were resolved. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
There was a problem hiding this comment.
Code Review
This pull request introduces robust graph analytics, an append-only relationship event ledger, and bounded agent context assembly to the SDK. Specifically, it adds relationship-analytics.ts for execution, impact, and knowledge graph analysis, relationship-context.ts for token-bounded context packets, and relationship-history.ts for immutable event logs and snapshots. It also updates the core relationship definitions to support explicit precedence and hierarchy directions. The review feedback suggests adding inline comments to document deliberate defensive guards (nullish coalescing operators) on recently added fields to explain their role in backward compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Document why public relationship definitions retain precedence and hierarchy defaults for legacy and JSON-parsed callers. Record the final review evidence in pm-7ob5 and pm-8xr8, release both items back to open, and refresh the managed pm-changelog metadata at the latest installed version.
|
Review round 3 acknowledgement: all three Gemini compatibility-documentation findings were accepted, reacted to, answered inline with verification evidence, and resolved. The SDK now documents why precedence and hierarchy defaults remain deliberate at legacy and JSON-parsed public boundaries. Greptile completed at 5/5 with no blocking issues; CodeRabbit completed with a rate-limit notice and no code findings. Focused SDK tests (23), lint, duplicate detection, CodeFactor rules, and typecheck pass, and the final tracker state has zero in-progress items. |
|
@greptileai please review the current head 63329c0 after all round-three findings were resolved. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 46 minutes. |
There was a problem hiding this comment.
Code Review
This pull request significantly expands the relationship graph SDK by introducing an append-only event ledger (RelationshipEventLog), point-in-time snapshots, deterministic graph analytics (execution, impact, and knowledge analysis), and token-bounded explainable context packets (buildRelationshipContext). It also updates the relationship registry to support explicit precedence and hierarchy directions, accompanied by comprehensive unit tests and documentation. Review feedback focuses on critical performance optimizations to ensure scalability up to one million items, specifically recommending a single-pass BFS for impact analysis, eliminating incidentEdges.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Replace repeated shortest-path impact analysis with one parent-map BFS, stream relationship cardinality checks without map copies, stop redundant boundary adjacency reads, and merge sorted incident indexes without Set or re-sort allocation. Preserve undirected and self-loop correctness, add installed-package scale proof and behavioral regressions, retain exact 100/100/100/100 coverage, and record all review evidence in pm-7ob5, pm-ju83, and pm-8xr8 before releasing them back to open.
|
Review round 4 acknowledgement: all five Gemini scalability findings were accepted, reacted to, answered inline with evidence, and resolved. Impact traversal is one BFS; ledger validation allocates neither a full comparable array nor a copied active map; bounded context skips redundant boundary reads; incident-edge lookup linearly merges sorted indexes while retaining undirected/self-loop correctness. Fresh installed-package proof traversed 10,000 affected nodes in 27.28 ms, and the final local gate is exact 100/100/100/100 across 5,681 tests. All active items were returned to open and released; in-progress count is zero. |
|
@greptileai please review the current head c2f21cd after all round-four scalability findings were resolved. |
|
/gemini review |
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 21 minutes. |
There was a problem hiding this comment.
Code Review
This pull request introduces robust graph capabilities to the SDK, including an append-only relationship event ledger (RelationshipEventLog) with deterministic replay and snapshots, exact execution and impact analytics, and a token-bounded graph-context assembler (buildRelationshipContext). It also extends the relationship registry to support explicit precedence and hierarchy directions. Feedback on these changes highlights two critical areas: first, snapshot({ atTimestamp }) should replay a contiguous prefix up to the target timestamp rather than filtering the entire log to prevent sequential consistency violations from non-monotonic timestamps; second, the linear scan in assertCardinality should be optimized using Map-based indexing to avoid severe performance degradation in large workspaces.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Maintain constant-time relationship identity and cardinality indexes across add, supersede, and remove mutations. Preserve sequence-consistent snapshot semantics for non-monotonic timestamps, add regression and scale coverage, and record complete pm verification evidence.
|
Review round 5 complete on prior head c2f21cd: both new Gemini findings were implemented, reacted to, replied to inline with verification evidence, and resolved. Head 80ff7b7 now maintains O(1) relationship validation indexes and sequence-consistent timestamp snapshots. Local proof: 5,683 tests, exact 100/100/100/100 coverage, all static gates, and a fresh packed-package 10,000-append proof in 207 ms. Requesting a complete fresh review of the new head. |
|
@greptileai please review the current head 80ff7b7 in full and report any remaining actionable findings. |
|
/gemini review |
|
@coderabbitai full review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
|
Final exact-head review inventory for 80ff7b7: Greptile completed after 18m03s with 5/5 confidence, installed-package execution proof, and no blocking issues. Gemini replied that its daily quota is exhausted; its two prior actionable findings were implemented, evidenced, reacted to, replied to, and resolved on this head. CodeRabbit acknowledged the full-review trigger but reported a 59-minute plan rate limit; after the requested 20-minute maximum wait its status remains in progress with no new inline findings. Both quota/rate-limit replies have been reacted to. All 25 executable hosted checks are green, all review threads are resolved, and the local exact-coverage and installed-package proofs are clean. |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 29 minutes. |
…backfill, frontier notes - file pm-albl for GH-557 (contract layer intercepts -h/--help before variadic-positional handlers) under pm-ugqx - backfill estimate/risk/confidence on pm-d4ns/pm-evav/pm-topu/pm-zt1c (clears missing_estimate warning) - frontier notes on pm-usfg (remaining slices 3mna -> oxrw -> oslr) and pm-4k6b (catalog-to-shipped map for PR#546/#549/#554/#556/#559) - files-missing 162 drift comment on pm-j8z6; pass summary on pm-doxj Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDJ1m5HDPDBVp8BBAixtnP
Summary
pm items
Verification
Closes #555
Summary by cubic
Adds an append-only relationship event history with replayable snapshots and cursor pagination, plus registry-driven graph analytics and a bounded, explainable agent context in the SDK. Docs clarify legacy precedence/hierarchy defaults, traversal is linear-time via parent-map BFS, and event validation is now indexed for constant-time checks with sequence-consistent snapshots.
New Features
relationship-history).relationship-analytics).relationship-context).index.ts; relationship kinds support optionalprecedenceand explicithierarchyDirection(defaults remainsource_before_target); docs expanded for graph behavior, guarantees, and legacy/JSON-caller fallbacks.Bug Fixes
Written for commit 80ff7b7. Summary will update on new commits.