Skip to content

fix: remove unneeded state variable - #4632

Open
fbiville wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/avoid_stateful_variable
Open

fbiville wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/avoid_stateful_variable

Conversation

@fbiville

Copy link
Copy Markdown
Collaborator

This is a leftover of dc52fae.

@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 improves the reliability of the Neo4j data ingestion process by removing a shared state variable that was causing issues during retries. By refactoring the parameter handling to be local to the execution scope, the code now ensures that failed batches do not pollute subsequent retry attempts, preventing inconsistent data states.

Highlights

  • Removed stateful parameters: Removed the 'parameters' list from the class state in Neo4jBlockingUnwindFn to prevent potential data corruption or reuse issues during retries.
  • Refactored parameter handling: Updated executeCypherUnwindStatement to accept parameters as an argument, ensuring that each execution uses a fresh, isolated batch of data.
  • Added regression test: Added a new test case in Neo4jBlockingUnwindFnTest to verify that failed batch parameters are not reused when the process is retried.
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 refactors Neo4jBlockingUnwindFn to use a local variable for parameters within processElement instead of maintaining it as an instance variable. This prevents the accumulation or reuse of failed batch parameters across retries. A corresponding unit test has been added to verify this behavior. I have no feedback to provide on these changes.

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.71%. Comparing base (3963e7c) to head (f0db47c).

Files with missing lines Patch % Lines
...ort/v2/neo4j/transforms/Neo4jBlockingUnwindFn.java 66.66% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #4632       +/-   ##
=============================================
+ Coverage     36.40%   59.71%   +23.31%     
- Complexity      752     7924     +7172     
=============================================
  Files           254     1123      +869     
  Lines         17601    72734    +55133     
  Branches       1853     8852     +6999     
=============================================
+ Hits           6407    43434    +37027     
- Misses        10668    26400    +15732     
- Partials        526     2900     +2374     
Components Coverage Δ
spanner-templates 84.03% <ø> (∅)
spanner-import-export 72.62% <ø> (∅)
spanner-live-forward-migration 87.65% <ø> (∅)
spanner-live-reverse-replication 79.94% <ø> (∅)
spanner-bulk-migration 88.29% <ø> (∅)
gcs-spanner-dv 86.58% <ø> (∅)
Files with missing lines Coverage Δ
...ort/v2/neo4j/transforms/Neo4jBlockingUnwindFn.java 60.29% <66.66%> (ø)

... and 893 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants