Skip to content

fix(cli): raise on 404 from Studio Web project Structure - #1926

Merged
vldcmp-uipath merged 1 commit into
mainfrom
fix/structure-404-raises
Oct 15, 2026
Merged

vldcmp-uipath merged 1 commit into
mainfrom
fix/structure-404-raises

Conversation

@vldcmp-uipath

@vldcmp-uipath vldcmp-uipath commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

StudioClient.get_project_structure_async() returned an empty ProjectStructure when GET /studio_/backend/api/Project/{id}/FileOperations/Structure answered 404, instead of raising. ensure_coded_project_async treats an empty structure as a never-pushed project, so a failed fetch granted permission to push.

This bites with UIPATH_URL=https://cloud.uipath.com (bare host, no org segment): the cloud gateway returns 404 for the org-less /studio_/... path even with a valid token, the 404 was swallowed, and the push proceeded while the sibling Lock call failed with the real error.

Reproduced on uipath 2.14.32 against a freshly created cloud Function project:

UIPATH_URL Structure get_project_structure_async push gate
https://cloud.uipath.com/<org>/<tenant> 200, ['project.uiproj'] same allowed
https://cloud.uipath.com 404 empty structure allowed

The 404 handling was added in #1820 for Function projects whose file system was never initialized. That premise no longer holds: Studio Web now writes project.uiproj as a tracked resource with every project create, so a fresh Function project returns 200 with project.uiproj at the root (confirmed on both alpha and cloud). #1870 already admits such projects via the project-type fallback.

Fix

  • StudioClient.get_project_structure_async: no longer catches 404. Any non-2xx propagates as EnrichedException, whose message carries the request URL, method, status and response body.
  • SwFileHandler.upload_source_files: removed the older matching 404 fallback that created an empty structure and took a lock, so the error cannot be swallowed one layer up either. Docstring updated accordingly.
  • The empty-structure early return in ensure_coded_project_async is unchanged; it can now only be reached by a genuine 200 with no files.

With the fix, the same cloud project: bare host → EnrichedException 404 with the Structure URL, push blocked; scoped URL → ['project.uiproj'], push allowed.

Tests

  • Replaced test_first_push_to_uninitialized_project with test_push_fails_when_structure_returns_404: exit code 1, EnrichedException with status 404 and the Structure URL, nothing uploaded.
  • tests/cli/test_push.py: 35 passed; ruff + mypy clean.

Version

uipath 2.14.38 → 2.14.39

🤖 Generated with Claude Code

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.

Copilot review overview

🟢 Approval recommended

The focused error-handling correction is consistent across both affected layers and has appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Prevents Studio Web Structure 404 responses from being mistaken for empty projects, ensuring invalid push targets fail safely.

Changes:

  • Propagates Structure API errors instead of synthesizing empty structures.
  • Removes the upload-layer 404 fallback and adds regression coverage.
  • Bumps uipath to 2.14.33.
File Description
packages/​uipath/​src/​uipath/​_cli/​_utils/​_studio_project.py Propagates Structure request failures.
packages/​uipath/​src/​uipath/​_cli/​_push/​sw_file_handler.py Removes duplicate 404 recovery logic.
packages/​uipath/​tests/​cli/​test_push.py Verifies 404 blocks uploads.
packages/​uipath/​pyproject.toml Bumps package version.
packages/​uipath/​uv.lock Updates the locked project version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vldcmp-uipath
vldcmp-uipath force-pushed the fix/structure-404-raises branch from 9b40ecb to 8fbbb58 Compare October 8, 2026 11:09
@vldcmp-uipath
vldcmp-uipath force-pushed the fix/structure-404-raises branch from 8fbbb58 to c2d15a9 Compare October 13, 2026 15:00
@github-actions

Copy link
Copy Markdown

🚨 Heads up: uipath-integrations cross-tests are FAILING 🚨

Your changes may break one or more integrations in uipath-integrations-python:

  • uipath-openai-agents
  • uipath-google-adk
  • uipath-agent-framework
  • uipath-llamaindex
  • uipath-pydantic-ai

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

get_project_structure_async turned any 404 from
FileOperations/Structure into an empty ProjectStructure, so a failed
fetch was indistinguishable from a fresh project and the push gate
allowed the push. Studio Web now creates project.uiproj with every new
project, so a 404 only means the project id or the base URL is wrong
(e.g. UIPATH_URL without the organization segment).

Propagate the error, carrying the request URL and status, and drop the
matching 404 fallback in the push file handler.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vldcmp-uipath
vldcmp-uipath force-pushed the fix/structure-404-raises branch from c2d15a9 to ceca58e Compare October 15, 2026 09:33
@github-actions

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

@sonarqubecloud

Copy link
Copy Markdown

@vldcmp-uipath
vldcmp-uipath merged commit 234cd3e into main Oct 15, 2026
179 of 182 checks passed
@vldcmp-uipath
vldcmp-uipath deleted the fix/structure-404-raises branch October 15, 2026 10:05
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.

3 participants