Skip to content

feat: add support for variable interpolation in import-spec documents - #4415

Open
fbiville wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/variable-interpolation
Open

fbiville wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
fbiville:neo4j/variable-interpolation

Conversation

@fbiville

Copy link
Copy Markdown
Collaborator

No description provided.

@fbiville fbiville changed the title Neo4j/variable interpolation feat: add support for variable interpolation in import-spec documents Oct 13, 2026
@fbiville fbiville added the addition New feature or request label Oct 13, 2026
@fbiville
fbiville force-pushed the neo4j/variable-interpolation branch from c3ecfca to e89c069 Compare October 22, 2026 15:24
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Oct 22, 2026
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.79%. Comparing base (5145ec2) to head (3fb2e9c).

Files with missing lines Patch % Lines
...ort/v2/neo4j/model/helpers/OverlayTokenParser.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4415      +/-   ##
============================================
+ Coverage     59.71%   59.79%   +0.07%     
+ Complexity     8384     7944     -440     
============================================
  Files          1123     1124       +1     
  Lines         72736    72735       -1     
  Branches       8852     8851       -1     
============================================
+ Hits          43435    43490      +55     
+ Misses        26402    26343      -59     
- Partials       2899     2902       +3     
Components Coverage Δ
spanner-templates 84.03% <ø> (-0.01%) ⬇️
spanner-import-export 72.72% <ø> (+0.08%) ⬆️
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/model/helpers/JobSpecMapper.java 80.30% <100.00%> (+4.37%) ⬆️
...oud/teleport/v2/neo4j/model/job/OverlayTokens.java 100.00% <100.00%> (ø)
...eo4j/model/validation/NoRowsVariableValidator.java 100.00% <100.00%> (ø)
...ogle/cloud/teleport/v2/neo4j/utils/ModelUtils.java 62.80% <100.00%> (+8.90%) ⬆️
...ort/v2/neo4j/model/helpers/OverlayTokenParser.java 68.42% <50.00%> (ø)

... and 18 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 marked this pull request as ready for review November 27, 2026 14:28
@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 support for variable interpolation in import-spec documents, allowing users to dynamically inject runtime values into their configurations. By updating the deserialization logic and providing a whitelist of allowed interpolation paths, the change enables more flexible and reusable job specifications. Additionally, the PR includes robust validation to prevent naming conflicts with reserved keywords and expands the supported data types for interpolation variables.

Highlights

  • Variable Interpolation Support: Enabled variable interpolation within import-spec documents by configuring the deserializer with specific allowed paths for BigQuery and HTTP actions/sources.
  • Type Flexibility: Updated OverlayTokens and related parsing logic to support Object values instead of strictly String, allowing for more diverse variable types.
  • Validation and Safety: Added a NoRowsVariableValidator to prevent the use of 'rows' as an interpolation variable, as it is a reserved keyword for query targets.
  • Dependency Update: Upgraded import-spec dependency to version 1.0.0-rc23 to support the new interpolation features.
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 updates the import-spec dependency to version 1.0.0-rc23 and introduces support for token interpolation within import specifications, allowing dynamic values in BigQuery and HTTP actions as well as BigQuery and text sources. It changes token maps from Map<String, String> to Map<String, Object> to support arbitrary types, adds a custom validator to reserve the variable name 'rows', and cleans up unused code in ModelUtils. The review feedback suggests enhancing robustness by adding null checks in OverlayTokens.tokens() and ModelUtils.replaceVariableTokens() to prevent potential NullPointerExceptions and optimize execution.

This finally brings parity with the legacy job spec format.

Users can now both use the import-spec format AND the runtime
tokens field available at runtime.

Note that runtime tokens are now strictly limited to string,
number and boolean values.

Moreover, they cannot be named "rows" as this clashes with
the pre-reserved Cypher variable "$rows" available in custom
query targets.

If no runtime token is specified, interpolation is disabled.
@fbiville
fbiville force-pushed the neo4j/variable-interpolation branch from e89c069 to 3fb2e9c Compare November 27, 2026 14:57
var httpAction = (HttpAction) actions.get(1);
assertThat(httpAction.url()).isEqualTo("https://example.com/test_dataset");
assertThat(httpAction.getName()).isEqualTo("notify-$dataset");
assertThat(httpAction.headers()).containsExactly("X-Dataset", "$dataset");

@sandhyaakula-pr sandhyaakula-pr Dec 1, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't the header value to check be test_dataset here and not $dataset ? Do we not want to allow interpolation for http headers?

var tokenName = tokens.next();
var rawTokenValue = jsonToken.opt(tokenName);
var tokenValue = JSONObject.NULL.equals(rawTokenValue) ? null : String.valueOf(rawTokenValue);
var tokenValue = JSONObject.NULL.equals(rawTokenValue) ? null : rawTokenValue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

qq : I hope this will not break serializability promise ?public record OverlayTokens(Map<String, Object> tokens) implements Serializable

@sandhyaakula-pr sandhyaakula-pr 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.

LGTM, have left a couple of questions though.

@Abacn

Abacn commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Please address sandhyaakula-pr's two open questions before merge

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

Labels

addition New feature or request size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants