Skip to content

fix(entities): route resolved entity sets by their resolved names [DS-9661] - #1978

Open
niket0503 wants to merge 1 commit into
mainfrom
fix/entity-routing-resolved-names
Open

niket0503 wants to merge 1 commit into
mainfrom
fix/entity-routing-resolved-names

Conversation

@niket0503

Copy link
Copy Markdown
Contributor

Summary

resolve_entity_set / resolve_entity_set_v3 (used by the Data Fabric and ontology tools in uipath-langchain-python) fetch an overwritten entity by its new name, so the SQL the agent writes uses that name. The routing context, however, keyed each entry by the original name and set overrideEntityName to the new one:

{ "entityName": "Customers", "overrideEntityName": "Overwritten Customers", "folderId": "…" }

The query engine can only match that entry through overrideEntityName. When an overwritten name equals another entity's original name, the lookup is ambiguous and can read the wrong entity, for example A → B, B → C. This was reproduced against the staging query API.

Change: in finalize_resolution_plan, key each routing entry by the resolved name, without an override:

{ "entityName": "Overwritten Customers", "folderId": "…" }

This is exactly the name the agent's SQL uses, so the query engine resolves it with a plain entityName match. Swaps and chains become unambiguous.

Scope

  • Only the resolved-entity-set path (finalize_resolution_plan, sync and async) changes.
  • Unchanged: direct SDK usage under resource overwrites (ContextOverwriteRoutingStrategy) and folders_map routing (FoldersMapRoutingStrategy). Their callers write SQL with the original names, so { entityName: original, overrideEntityName: new } remains correct there.
  • Works with the current query engine and with the companion CEP change (UiPath/CommonEntityPlatform#6605, entityName match first, overrideEntityName as fallback).
  • Known limitation, unchanged: two entities that resolve to the same name (e.g. A, B → B, B) cannot be told apart in SQL.

Testing

  • Updated the two resolve_entity_set routing tests to expect the resolved name.
  • Added test_resolve_entity_set_chained_overwrites_route_by_resolved_names (A → B, B → C).
  • uipath-platform: 2057 passed, 11 skipped (LLM integration tests needing credentials); ruff clean.

Version bumped to 0.3.1.

🤖 Generated with Claude Code

…-9661]

resolve_entity_set fetches overwritten entities by their new name, so the
SQL the agent writes uses that name. The routing context still keyed each
entry by the original name with overrideEntityName set, which the query
engine can only match through a fallback and resolves incorrectly when an
overwritten name equals another entity's original name (A->B, B->C, swaps).

Key each routing entry by the resolved name instead, without an override.
Direct SDK usage and folders-map routing are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:01
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Nov 6, 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.

🟢 Approval recommended

There are no active review issues requiring changes to the resolved entity-set routing update.

No open issues 🎉

What changed in this PR

This PR updates resolved entity-set routing in the UiPath Platform SDK to use resolved names directly, avoiding ambiguous lookups for chained or swapped entity overwrites. Direct SDK overwrite routing and folders_map routing remain unchanged.

Changes:

  • Build resolved-set routing entries using resolved entity names, without overrideEntityName.
  • Update sync and async routing expectations and add a chained-overwrite regression test.
  • Bump uipath-platform to 0.3.1 and align both lockfiles.
File Description
packages/​uipath/​uv.lock Aligns the platform dependency version to 0.3.1.
packages/​uipath-platform/​uv.lock Updates the local package version to 0.3.1.
packages/​uipath-platform/​tests/​services/​test_entities_service.py Updates routing assertions and adds chained-overwrite coverage.
packages/​uipath-platform/​src/​uipath/​platform/​entities/​_entity_resolution.py Keys resolved routing entries by effective entity names.
packages/​uipath-platform/​pyproject.toml Bumps the platform package version to 0.3.1.

Review effort: Balanced

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

2 participants