Skip to content

capture Cypher queries run inside transactions - #1763

Merged
arcuri82 merged 1 commit into
masterfrom
neo4j-transactional-capture
Sep 17, 2026
Merged

arcuri82 merged 1 commit into
masterfrom
neo4j-transactional-capture

Conversation

@andyfelder16

Copy link
Copy Markdown
Collaborator

Looking at candidate SUTs for the Neo4j experiments, most queries are not run on the session directly: Spring Data Neo4j runs them inside a transaction, and driver code tends to use session.beginTransaction() or session.executeRead(...). Those go through Transaction, TransactionContext and QueryRunner, which expose the same run overloads as Session but were not instrumented.

  • One replacement class per type, since call sites are matched on the exact owner name: Neo4JTransactionClassReplacement, Neo4JTransactionContextClassReplacement, Neo4JQueryRunnerClassReplacement
  • The tracking logic moved to Neo4JOperationClassReplacement, so each class only declares its five run overloads
  • The existing test became an abstract base with one small subclass per type, so all four run the same 8 tests against a Testcontainers Neo4j
  • Test driver bumped from 4.4.12 to 5.20.0, TransactionContext only exists in driver 5

@jgaleotti
jgaleotti requested a review from arcuri82 September 15, 2026 13:20
@@ -4,12 +4,29 @@
import org.evomaster.client.java.instrumentation.coverage.methodreplacement.ThirdPartyMethodReplacementClass;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyfelder16 @jgaleotti shouldn't we have at least 1 E2E test for this PR? or is support for Neo4J not ready yet for E2E?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am currently working on data insertion for Neo4j. I can add E2E tests to this PR now, or add them together with the insertion PR, so they cover everything end to end. I am happy to go with whichever you prefer.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyfelder16 thx! you can have them on a different PR (so I review this one here now). but, in future, might be best to have E2E in same PR of a new introduced feature if that feature is finished and ready to have a E2E (PRs that are work-in-progress feature of course can't have E2E yet, as they would fail)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created this PR of E2E tests: #1773

I'm working on the data insertion logic, once I finish it I will also add E2E tests with it.

@arcuri82
arcuri82 merged commit 1f40064 into master Sep 17, 2026
31 checks passed
@arcuri82
arcuri82 deleted the neo4j-transactional-capture branch September 17, 2026 12:40
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.

3 participants