feat: added dynamic variable support#135
Conversation
There was a problem hiding this comment.
3 issues found across 8 files
Prompt for AI agents (all 3 issues)
Understand the root cause of the following 3 issues and fix them.
<file name="workflows/workflow_use/workflow/tests/test_variable_identifier.py">
<violation number="1" location="workflows/workflow_use/workflow/tests/test_variable_identifier.py:183">
`email_schema['type']` is asserted to equal `'email'`, but `_generate_input_schema` maps email variables to schema type `'string'` and uses the `'format'` field for email specificity. Update the test to check for `'string'` (and optionally the `'format'`) so it reflects the actual schema.</violation>
</file>
<file name="workflows/workflow_use/workflow/variable_config.py">
<violation number="1" location="workflows/workflow_use/workflow/variable_config.py:93">
`domain_config` should use `typing.Any` instead of the builtin `any`; otherwise static type checkers will flag invalid annotations.</violation>
</file>
<file name="workflows/workflow_use/workflow/variable_identifier.py">
<violation number="1" location="workflows/workflow_use/workflow/variable_identifier.py:287">
Context-based matches can return a None variable name, which ends up as `{None}` in the workflow and name=None in input_schema; this breaks the generated workflow defaults and schema consumers. Please fall back to a type-derived name when context is missing.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| group_related_fields: bool = True | ||
|
|
||
| # Domain-specific configurations | ||
| domain_config: Dict[str, any] = field(default_factory=dict) |
There was a problem hiding this comment.
domain_config should use typing.Any instead of the builtin any; otherwise static type checkers will flag invalid annotations.
Prompt for AI agents
Address the following comment on workflows/workflow_use/workflow/variable_config.py at line 93:
<comment>`domain_config` should use `typing.Any` instead of the builtin `any`; otherwise static type checkers will flag invalid annotations.</comment>
<file context>
@@ -0,0 +1,254 @@
+ group_related_fields: bool = True
+
+ # Domain-specific configurations
+ domain_config: Dict[str, any] = field(default_factory=dict)
+
+
</file context>
| for keyword, var_type in self.VARIABLE_KEYWORDS.items(): | ||
| if keyword in combined_hints: | ||
| # Generate variable name from context | ||
| var_name = self._generate_variable_name_from_context(context, var_type) |
There was a problem hiding this comment.
Context-based matches can return a None variable name, which ends up as {None} in the workflow and name=None in input_schema; this breaks the generated workflow defaults and schema consumers. Please fall back to a type-derived name when context is missing.
Prompt for AI agents
Address the following comment on workflows/workflow_use/workflow/variable_identifier.py at line 287:
<comment>Context-based matches can return a None variable name, which ends up as `{None}` in the workflow and name=None in input_schema; this breaks the generated workflow defaults and schema consumers. Please fall back to a type-derived name when context is missing.</comment>
<file context>
@@ -0,0 +1,526 @@
+ for keyword, var_type in self.VARIABLE_KEYWORDS.items():
+ if keyword in combined_hints:
+ # Generate variable name from context
+ var_name = self._generate_variable_name_from_context(context, var_type)
+ confidence = 0.85 # Good confidence for context matches
+ logger.debug(f"Context match: keyword '{keyword}' → {var_type} (name: {var_name})")
</file context>
✅ Addressed in 1fe6e86
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Reviewed changes from recent commits (found 1 issue).
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="workflows/workflow_use/workflow/tests/test_variable_identifier.py">
<violation number="1" location="workflows/workflow_use/workflow/tests/test_variable_identifier.py:183">
This line is indented with spaces while the rest of the block uses tabs, which will trigger a TabError when the test file is executed. Please switch the indentation to match the surrounding tabs.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| # Check schema structure | ||
| email_schema = next((s for s in schema if 'email' in s['name']), None) | ||
| assert email_schema is not None | ||
| assert email_schema['type'] == 'string' |
There was a problem hiding this comment.
This line is indented with spaces while the rest of the block uses tabs, which will trigger a TabError when the test file is executed. Please switch the indentation to match the surrounding tabs.
Prompt for AI agents
Address the following comment on workflows/workflow_use/workflow/tests/test_variable_identifier.py at line 183:
<comment>This line is indented with spaces while the rest of the block uses tabs, which will trigger a TabError when the test file is executed. Please switch the indentation to match the surrounding tabs.</comment>
<file context>
@@ -180,7 +180,7 @@ def test_input_schema_generation(self):
email_schema = next((s for s in schema if 'email' in s['name']), None)
assert email_schema is not None
- assert email_schema['type'] == 'email'
+ assert email_schema['type'] == 'string'
assert email_schema['required'] is True
</file context>
| assert email_schema['type'] == 'string' | |
| assert email_schema['type'] == 'string' |
Summary by cubic
Adds automatic variable identification and parameterization to workflows, generating an input_schema and replacing hardcoded values with placeholders. Integrates into the semantic converter and healing flow with a fast, pattern-based pass and optional YAML cleanup.
New Features
Migration
Written for commit 1fe6e86. Summary will update automatically on new commits.