fix: forward hydration runtime delegate attributes#143
Closed
andreitava-uip wants to merge 2 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the HydrationRuntime wrapper so that runtime-specific “delegate attributes” (e.g., runtime_id) remain accessible through the wrapper instance, and adds a regression test intended to validate that behavior.
Changes:
- Add
HydrationRuntime.__getattr__to forward unknown attribute access to the wrapped delegate runtime. - Extend workspace hydration tests with a regression case for “runtime_id-style” delegate attributes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/uipath/runtime/workspace/hydration.py |
Adds attribute forwarding to the wrapped runtime via __getattr__. |
tests/workspace/test_workspace_hydration.py |
Adds a regression test for delegate attribute forwarding and updates the test runtime stub. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+261
to
+276
| def test_hydration_runtime_forwards_delegate_attributes(tmp_path: Path) -> None: | ||
| workspace = Workspace.create(tmp_path / "workspace") | ||
| delegate = WritingRuntime(workspace.path, UiPathRuntimeStatus.SUCCESSFUL) | ||
| runtime = HydrationRuntime( | ||
| delegate, | ||
| workspace=workspace, | ||
| hydrator=WorkspaceHydrator( | ||
| workspace_path=workspace.path, | ||
| attachments=FakeAttachments(), | ||
| ), | ||
| registry_store=WorkspaceRegistryStore(MemoryStorage(), "runtime-1"), | ||
| ) | ||
|
|
||
| forwarded_runtime = cast(Any, runtime) | ||
| assert forwarded_runtime.runtime_id == "runtime-1" | ||
| assert forwarded_runtime.workspace_path == workspace.path |
Comment on lines
+97
to
+99
| def __getattr__(self, name: str) -> Any: | ||
| """Forward unknown attributes to the wrapped runtime.""" | ||
| return getattr(self.delegate, name) |
|
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
Validation