Skip to content

fix(core): match AttachmentsProtocol.upload_async to the concrete overloads#1765

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/core-attachments-protocol-overloads
Jun 26, 2026
Merged

fix(core): match AttachmentsProtocol.upload_async to the concrete overloads#1765
radu-mocanu merged 1 commit into
mainfrom
fix/core-attachments-protocol-overloads

Conversation

@radu-mocanu

Copy link
Copy Markdown
Collaborator

Summary

  • redefine AttachmentsProtocol.upload_async with @overloads (content XOR source_path) so the concrete AttachmentsService is a structural subtype, not just a runtime_checkable one
  • add a static + runtime conformance test asserting AttachmentsService satisfies AttachmentsProtocol

Why

the protocol shipped in #1744 declared a single over-broad upload_async (both content and source_path optional), which the overloaded concrete service does not structurally satisfy. it surfaced only when a consumer passes the real AttachmentsService into the runtime's WorkspaceHydrator (mypy error), since the protocol's own tests use a conforming fake. the new conformance test guards against this regressing.

Copilot AI review requested due to automatic review settings June 26, 2026 13:59
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Jun 26, 2026
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a type-contract mismatch between uipath-core’s AttachmentsProtocol and the concrete uipath-platform AttachmentsService by redefining upload_async using overloads that match the service’s “content XOR source_path” API. It also adds a conformance test to ensure this structural subtyping relationship (and the runtime-checkable contract) doesn’t regress.

Changes:

  • Redefine AttachmentsProtocol.upload_async with two @overloads (content vs. source_path) aligned to AttachmentsService.
  • Add a static + runtime conformance test asserting AttachmentsService satisfies AttachmentsProtocol.
  • Bump uipath-core version to 0.5.23 and update uv.lock files accordingly.

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/uipath-core/src/uipath/core/workspace/protocols.py Adds overloads to AttachmentsProtocol.upload_async to match the concrete service signatures for structural subtyping.
packages/uipath-platform/tests/services/test_attachments_service.py Adds a test that forces mypy to validate structural conformance and also checks the runtime-checkable protocol via isinstance.
packages/uipath-core/pyproject.toml Bumps uipath-core version to 0.5.23.
packages/uipath-core/uv.lock Updates lockfile to reflect uipath-core==0.5.23.
packages/uipath-platform/uv.lock Updates lockfile to reflect uipath-core==0.5.23 in the platform package environment.
packages/uipath/uv.lock Updates lockfile to reflect uipath-core==0.5.23 in the aggregate package environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@radu-mocanu radu-mocanu merged commit 9048932 into main Jun 26, 2026
96 checks passed
@radu-mocanu radu-mocanu deleted the fix/core-attachments-protocol-overloads branch June 26, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants