Repository navigation
Conversation
A vertex object read before the first edge of that vertex was committed held the old record version, so newEdge from it raised ConcurrentModificationException on the JVM build; the native build goes by record id and succeeded. Look the source up by id inside the active transaction and pass the target as its id. Regression test runs on both builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tae898
marked this pull request as ready for review
November 3, 2026 16:37
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #215
The JVM
Vertex.new_edgecallednewEdgeon the cachedImmutableVertexand passed the target as a Java vertex object. A vertex's first edge rewrites its record, so any object read before that commit is out of date and the update raisedConcurrentModificationException. The native wrapper already goes by record id.Decision: make the JVM match native. Neither the docs nor the docstrings say that records are snapshots that must be re-read before
new_edge; the docs say the native build sends record ids, and thenew_edgedocstring promises an edge between two vertices without any condition. So the source is looked up by its record id inside the active transaction (onelookupByRID), and the target goes in as its record id, which the engine loads itself. The wrapper object you hold is not refreshed.Behaviour change:
new_edgefrom a stale vertex object now succeeds on the JVM build instead of raising. No documented behaviour changes; I added a paragraph to the record-id section ofdatabases-and-queries.adocand a docstring note.Not changed:
modify().set().save()on a stale object. The JVM build uses the engine's version check (an out-of-date object conflicts at commit) and the native build writes the properties by record id. That is a separate difference and I did not alter it here.Tests:
tests/test_stale_vertex_new_edge.pyruns on both builds (objects read once, one edge per transaction; stale target only; stale after an SQL-made edge; several edges in one transaction) and checks the edge count and in and out degrees. I did not run it locally; CI runs both workflows on this branch.🤖 Generated with Claude Code