Skip to content

feat(entities): optional source header on datafabric query/execute#1808

Merged
milind-jain-uipath merged 3 commits into
mainfrom
feat/entities-query-source-header
Jul 13, 2026
Merged

feat(entities): optional source header on datafabric query/execute#1808
milind-jain-uipath merged 3 commits into
mainfrom
feat/entities-query-source-header

Conversation

@milind-jain-uipath

Copy link
Copy Markdown
Contributor

Summary

Adds an optional source parameter to EntitiesService.query_entity_records / query_entity_records_async. When provided, it is sent as the x-uipath-source request header on POST datafabric_/api/v1/query/execute, identifying the calling surface (e.g. LOW_CODE_AGENT).

Why

Companion to CommonEntityPlatform #5611: FQS types relationship (FK) fields as their underlying scalar id — so a raw-SQL join relationshipField = Other.Id validates and executes — only when the request carries x-uipath-source: LOW_CODE_AGENT. This change lets a caller (e.g. the Data Fabric agent tool in uipath-langchain-python) opt into that typing.

Scope

  • The header is set only when source is passed, and only in _query_entity_records_spec — the sole builder for the query/execute endpoint. _query_entities_for_records[_async] now forward spec.headers.
  • No other entity endpoint and no OData/by-id path is affected. Omitting source sends no x-uipath-source (behavior unchanged for all existing callers).

Tests

  • source provided → x-uipath-source header present on the request.
  • Default (no source) → header absent.
  • Existing query/routing/validation tests unchanged (136 passed).

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 12, 2026 21:23
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Jul 12, 2026

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

Adds an optional source argument to the Entities federated SQL query APIs so callers can opt into sending x-uipath-source on the datafabric_/api/v1/query/execute request.

Changes:

  • Add optional source: Optional[str] to EntitiesService.query_entity_records / query_entity_records_async.
  • Thread source through EntityDataService and emit x-uipath-source only for the query/execute endpoint via RequestSpec.headers.
  • Add tests validating header presence/absence for the sync query path.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/uipath-platform/tests/services/test_entities_service.py Adds tests asserting x-uipath-source header behavior for sync query_entity_records.
packages/uipath-platform/src/uipath/platform/entities/_entity_data_service.py Threads optional source through query helpers and attaches it as x-uipath-source in the query/execute RequestSpec.
packages/uipath-platform/src/uipath/platform/entities/_entities_service.py Extends public query APIs with optional source and documents the header behavior.

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

Comment on lines 476 to 477
@pytest.mark.anyio
async def test_query_entity_records_async_rejects_invalid_sql_before_network_call(
Add an optional `source` parameter to query_entity_records[_async]. When set,
it becomes the `x-uipath-source` request header on the datafabric
query/execute call, identifying the calling surface (e.g. LOW_CODE_AGENT).
Omitted when unset; no other entity endpoint is affected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@milind-jain-uipath milind-jain-uipath force-pushed the feat/entities-query-source-header branch from 3d887b6 to 5643def Compare July 12, 2026 21:27
milind-jain-uipath and others added 2 commits July 13, 2026 14:05
…ource-header

# Conflicts:
#	packages/uipath-platform/src/uipath/platform/common/constants.py
Version carrying the optional `source` parameter on
query_entity_records[_async] (the `x-uipath-source` header on
datafabric query/execute), so consumers can pin the version that has it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@milind-jain-uipath milind-jain-uipath enabled auto-merge (squash) July 13, 2026 12:50
@sonarqubecloud

Copy link
Copy Markdown

@milind-jain-uipath milind-jain-uipath merged commit 03a6dec into main Jul 13, 2026
125 checks passed
@milind-jain-uipath milind-jain-uipath deleted the feat/entities-query-source-header branch July 13, 2026 12:50
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants