Skip to content

fix: fail the import when schema initialization fails - #4647

Open
fbiville wants to merge 4 commits into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/schema-init-failures-abort-import
Open

fbiville wants to merge 4 commits into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/schema-init-failures-abort-import

Conversation

@fbiville

Copy link
Copy Markdown
Collaborator

BREAKING CHANGE: failing constraint/index creations now abort the
import to Neo4j.

BREAKING CHANGE: failing constraint/index creations now abort the
import to Neo4j.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a breaking change to the Neo4j schema initialization process. By transitioning from silent logging to throwing exceptions on failure, the system now ensures that any issues with constraint or index creation will correctly halt the import pipeline, preventing inconsistent database states.

Highlights

  • Error Handling: Updated schema initialization to throw a RuntimeException instead of logging errors, ensuring that failures in constraint or index creation properly abort the import process.
  • Testing: Added a new test class, Neo4jInitSchemaFnTest, to verify that schema initialization correctly propagates failures and halts execution upon encountering an error.
  • Code Cleanup: Removed unused edition() method from Neo4jCapabilities and updated Neo4jVersion to implement Serializable.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes an unused edition() method from Neo4jCapabilities and makes Neo4jVersion serializable. It also updates Neo4jInitSchemaFn to throw a RuntimeException instead of just logging an error when Cypher execution fails during schema initialization, and introduces a new test suite Neo4jInitSchemaFnTest to verify this behavior. Feedback on the tests suggests wrapping the shared static EXECUTED_STATEMENTS list in a synchronized list to prevent potential thread-safety issues and test flakiness.

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.72%. Comparing base (5145ec2) to head (81306c6).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4647      +/-   ##
============================================
+ Coverage     59.71%   59.72%   +0.01%     
+ Complexity     8384     7924     -460     
============================================
  Files          1123     1123              
  Lines         72736    72735       -1     
  Branches       8852     8852              
============================================
+ Hits          43435    43443       +8     
+ Misses        26402    26393       -9     
  Partials       2899     2899              
Components Coverage Δ
spanner-templates 84.03% <ø> (-0.01%) ⬇️
spanner-import-export 72.74% <ø> (+0.11%) ⬆️
spanner-live-forward-migration 87.64% <ø> (-0.02%) ⬇️
spanner-live-reverse-replication 79.93% <ø> (-0.02%) ⬇️
spanner-bulk-migration 88.28% <ø> (-0.01%) ⬇️
gcs-spanner-dv 86.56% <ø> (-0.02%) ⬇️
Files with missing lines Coverage Δ
.../teleport/v2/neo4j/database/Neo4jCapabilities.java 89.74% <ø> (+1.13%) ⬆️
...eleport/v2/neo4j/transforms/Neo4jInitSchemaFn.java 90.32% <100.00%> (+6.45%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@fbiville fbiville changed the title Neo4j/schema init failures abort import Nov 27, 2026

@joelsigurd joelsigurd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants