Repository navigation
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
Draft
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: bot_apk <apk@cognition.ai>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou 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-rawPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JinjaInterpolation._literal_evalalways ranast.literal_evalon the rendered value. Withvalid_types=(str,)(i.e.value_type: stringonAddedFieldDefinition/ComponentMappingDefinition), a rendered value that is itself a Python string literal evaluated to an unquotedstr, passed the type check, and silently replaced the raw value:Fix:
value_type: stringnow means "return the rendered string unchanged" (main and default-value paths):Behaviour for
valid_types=Noneand every other type tuple ((int,),(complex,),ValidRequestTypes, …) is unchanged. Only rendered values that are Python string literals change, and only whenstrwas explicitly requested. This applies to every caller that passes(value_type,):AddFields,ConfigAddFields, and the config / parametrized / http components resolvers.ConfigComponentsResolveralready skipped YAML parsing for(str,), but the Jinja literal eval ran before that check.Known adopter:
source-google-search-consolebuilt-in streams castquerywithvalue_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: withvalid_types=(str,), double-quoted, single-quoted, plain, int-, float-, list- and bool-looking strings all come back unchanged asstr. The default-value path keeps its quotes. Regression checks confirmvalid_types=Noneand(int,)still literal-eval.test_add_fields.py: new cases for a double-quoted and a single-quoted value withvalue_type=str. The existing{{ 1 }}->'1'case still passes.test_config_components_resolver.py: a quoted value withvalue_type: stringstays quoted.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