UN-2805 [FEAT] Add custom_data parameter for API deployment variable replacement overrides#202
Conversation
…nt overrides - Added USER_DATA constant to MetadataKey class for user data handling - Updated BaseTool to extract and store user_data from execution metadata - Version bump to v0.77.2 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Renamed USER_DATA constant to CUSTOM_DATA in MetadataKey class - Updated BaseTool to use custom_data instead of user_data - Version bump to v0.77.3 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary by CodeRabbit
WalkthroughBumps SDK version to v0.77.3. Adds MetadataKey.CUSTOM_DATA and updates BaseTool.from_tool_args to read metadata["custom_data"] (default {}) and assign it to tool.custom_data. Reformats a missing-file error message construction only. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant BaseTool as BaseTool.from_tool_args
participant Metadata as Execution Metadata
participant Tool as BaseTool instance
Caller->>BaseTool: from_tool_args(args)
BaseTool->>Metadata: load execution metadata (dict)
Note right of Metadata #D3E4CD: metadata may include "custom_data"
Metadata-->>BaseTool: metadata dict
BaseTool->>Tool: tool.custom_data = metadata.get("custom_data", {})
Note over BaseTool,Tool #F3E6FF: other init steps unchanged (args, files, etc.)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…yment-for-variable-replacement-overrides Signed-off-by: jagadeeswaran-zipstack <jagadeeswaran@zipstack.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/unstract/sdk/constants.py (1)
138-138: Add brief doc for CUSTOM_DATAAdd a one-liner in MetadataKey’s docstring (and any public docs) to state intended shape and usage (e.g., overrides for variable replacement).
src/unstract/sdk/tool/base.py (2)
136-138: Include absolute path in missing-file errorHelps debugging by showing where we looked.
- self.stream_error_and_exit( - f"{file_to_get} is missing in EXECUTION_DATA_DIR" - ) + self.stream_error_and_exit( + f"{file_to_get} is missing in EXECUTION_DATA_DIR at {file_path}" + )
267-272: Avoidisfor string comparison
ison strings is not reliable; use==.- if output_type is PropKey.OutputType.JSON and not isinstance(data, dict): + if output_type == PropKey.OutputType.JSON and not isinstance(data, dict):
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (3)
src/unstract/sdk/__init__.py(1 hunks)src/unstract/sdk/constants.py(1 hunks)src/unstract/sdk/tool/base.py(2 hunks)
🔇 Additional comments (1)
src/unstract/sdk/__init__.py (1)
1-1: Version bump to v0.77.3 — sync release artifactspyproject.toml is configured to read the version from src/unstract/sdk/init.py (dynamic = ['version']; [tool.hatch.version].path) — version in that file is "v0.77.3". Git tags and changelog/release-notes couldn't be verified here; confirm git tag v0.77.3 exists and that release notes/CHANGELOG reference v0.77.3, updating artifacts if missing.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/unstract/sdk/__init__.py (2)
3-5: LGTM; tiny optional hardening.Optionally mark the constant as Final and export via all.
+from typing import Final -__version__ = "v0.77.3" +__version__: Final[str] = "v0.78.0" # or the decided normalized value +__all__ = ("__version__", "get_sdk_version")
1-1: Hatch will strip the leading "v" for packaging; consider making version PEP‑440 in-code.pyproject.toml uses [tool.hatch.version] → src/unstract/sdk/init.py; Hatch's default regex accepts an optional leading "v" and normalizes versions per PEP 440 (built metadata will be "0.77.3"). (hatch.pypa.io)
version in src/unstract/sdk/init.py is currently "v0.77.3" — change to "0.77.3" if you want the runtime/in-code value to be PEP‑440 normalized.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (2)
src/unstract/sdk/__init__.py(1 hunks)src/unstract/sdk/constants.py(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/unstract/sdk/constants.py
🔇 Additional comments (1)
src/unstract/sdk/__init__.py (1)
1-1: Bump minor version (v0.78.0) or add back-compat for MetadataKey renameRename MetadataKey.USER_DATA → CUSTOM_DATA and BaseTool now reading metadata["custom_data"] is source‑breaking; a patch bump to v0.77.3 is misleading. Either:
- Bump minor: apply
-__version__ = "v0.77.3" +__version__ = "v0.78.0"
- Or keep patch and add back‑compat:
- alias USER_DATA → "custom_data" in constants (avoid @unique or duplicate-value Enum restriction).
- In BaseTool.from_tool_args use metadata.get("custom_data") or metadata.get("user_data") or {} and emit a DeprecationWarning.
Repo search returned no matches for "user_data" or "custom_data"; unable to confirm blast radius — manually verify downstream integrations and published SDK dependents.
What
Why
How
Can this PR break any existing features. If yes, please list possible items. If no, please explain why.
No, this PR should not break any existing features because:
Env Config
Related Issues or PRs
Dependencies Versions / Env Variables
Notes on Testing
Screenshots
N/A
Checklist
I have read and understood the Contribution Guidelines.