Skip to content

fix(low-code): keep rendered string as-is when value_type is string - #1209

Draft
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1791298520-jinja-value-type-string-raw
Draft

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1791298520-jinja-value-type-string-raw

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

JinjaInterpolation._literal_eval always ran ast.literal_eval on the rendered value. With valid_types=(str,) (i.e. value_type: string on AddedFieldDefinition / ComponentMappingDefinition), a rendered value that is itself a Python string literal evaluated to an unquoted str, passed the type check, and silently replaced the raw value:

value_type: string, value: "{{ record['keys'][0] }}"
'"nike shoes"'  -> 'nike shoes'   # before
"'abc'"         -> 'abc'          # before

Fix: value_type: string now means "return the rendered string unchanged" (main and default-value paths):

def _literal_eval(self, result, valid_types):
+    if valid_types == (str,):
+        return result
     ...

Behaviour for valid_types=None and every other type tuple ((int,), (complex,), ValidRequestTypes, …) is unchanged. Only rendered values that are Python string literals change, and only when str was explicitly requested. This applies to every caller that passes (value_type,): AddFields, ConfigAddFields, and the config / parametrized / http components resolvers. ConfigComponentsResolver already skipped YAML parsing for (str,), but the Jinja literal eval ran before that check.

Known adopter: source-google-search-console built-in streams cast query with value_type: string, so quoted search queries are being emitted without quotes today.

Resolves https://github.com/airbytehq/airbyte-internal-issues/issues/17745:

Close on merge: yes — internally filed, no customer to confirm with.

Breaking change evaluation

Not breaking: no schema, spec, stream, primary key, cursor or state change. It fixes data correctness for fields that are explicitly declared as strings.

Declarative-First Evaluation

N/A. This is a CDK core fix, not a connector change. No custom component was added. The fix lets adopters drop custom components that only exist to work around this bug (e.g. GSC CustomReportExtractDimensionsFromKeys, tracked separately).

Test Coverage

  • test_jinja.py: with valid_types=(str,), double-quoted, single-quoted, plain, int-, float-, list- and bool-looking strings all come back unchanged as str. The default-value path keeps its quotes. Regression checks confirm valid_types=None and (int,) still literal-eval.
  • test_add_fields.py: new cases for a double-quoted and a single-quoted value with value_type=str. The existing {{ 1 }} -> '1' case still passes.
  • test_config_components_resolver.py: a quoted value with value_type: string stays quoted.
  • Without the fix, 6 of the new tests fail (assert 'nike shoes' == '"nike shoes"'). With the fix, all 827 tests in the interpolation, transformations, resolvers and requesters suites pass, and ruff and mypy are clean.

Link to Devin session: https://app.devin.ai/sessions/50da3ef9fd7148e1a6e4ba4ccdf65dd8
Open in Devin Desktop: https://app.devin.ai/desktop/session/50da3ef9fd7148e1a6e4ba4ccdf65dd8?variant=devin

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1791298520-jinja-value-type-string-raw#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1791298520-jinja-value-type-string-raw

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

PyTest Results (Fast)

5 037 tests  +12   5 025 ✅ +12   11m 9s ⏱️ +5s
    1 suites ± 0      12 💤 ± 0 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 00c5eac. ± Comparison against base commit 5381b8f.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

PyTest Results (Full)

5 040 tests  +12   5 028 ✅ +12   16m 12s ⏱️ + 3m 32s
    1 suites ± 0      12 💤 ± 0 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 00c5eac. ± Comparison against base commit 5381b8f.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants