Skip to content

Commit bb02d33

Browse files
authored
fix: skip root evals folder files in push and add telemetry error logging (#1356)
1 parent 9029e3e commit bb02d33

7 files changed

Lines changed: 309 additions & 20 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.8.48"
3+
version = "2.8.49"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/_cli/_push/sw_file_handler.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,25 @@ async def upload_source_files(
527527
remote_files = self._get_remote_files(structure)
528528

529529
# Get files to upload and process them
530-
local_files = files_to_include(
530+
local_files, skipped_files = files_to_include(
531531
pack_options,
532532
self.directory,
533533
self.include_uv_lock,
534534
)
535535

536+
# Log skipped files from root evals folder
537+
if skipped_files:
538+
evals_folder_path = os.path.join(self.directory, "evals")
539+
logger.info(
540+
f"Skipping {len(skipped_files)} file(s) in evals folder ({evals_folder_path}): {', '.join(skipped_files)}"
541+
)
542+
for skipped_file in skipped_files:
543+
yield UpdateEvent(
544+
file_path=skipped_file,
545+
status="skipped",
546+
message=f"Skipping '{skipped_file}' (evals folder)",
547+
)
548+
536549
updates = await self._process_file_uploads(local_files, remote_files)
537550

538551
# Yield all updates

src/uipath/_cli/_utils/_project_files.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def files_to_include(
373373
directory: str,
374374
include_uv_lock: bool = True,
375375
directories_to_ignore: list[str] | None = None,
376-
) -> list[FileInfo]:
376+
) -> tuple[list[FileInfo], list[str]]:
377377
"""Get list of files to include in the project based on configuration.
378378
379379
Walks through the directory tree and identifies files to include based on extensions
@@ -386,7 +386,7 @@ def files_to_include(
386386
directories_to_ignore: List of directories to ignore
387387
388388
Returns:
389-
list[FileInfo]: List of file information objects for included files
389+
tuple[list[FileInfo], list[str]]: Tuple of (included files, skipped file paths)
390390
"""
391391
file_extensions_included = [".py", ".mermaid", ".json", ".yaml", ".yml", ".md"]
392392
files_included = ["pyproject.toml"]
@@ -422,8 +422,15 @@ def is_venv_dir(d: str) -> bool:
422422
)
423423

424424
extra_files: list[FileInfo] = []
425+
skipped_files: list[str] = []
426+
425427
# Walk through directory and return all files in the allowlist
426428
for root, dirs, files in os.walk(directory):
429+
# Determine if we're in the root evals folder
430+
root_rel_path = os.path.relpath(root, directory)
431+
normalized_root_rel_path = root_rel_path.replace(os.sep, "/")
432+
is_root_evals_folder = normalized_root_rel_path == "evals"
433+
427434
# Skip all directories that start with . or are a venv or are excluded
428435
included_dirs = []
429436
for d in dirs:
@@ -461,6 +468,11 @@ def is_venv_dir(d: str) -> bool:
461468
# Normalize the path
462469
normalized_rel_path = rel_path.replace(os.sep, "/")
463470

471+
# Skip files in the root evals folder (but allow eval-set and evaluators subdirectories)
472+
if is_root_evals_folder:
473+
skipped_files.append(normalized_rel_path)
474+
continue
475+
464476
# Check inclusion: by extension, by filename (for base directory), or by relative path
465477
should_include = (
466478
file_extension in file_extensions_included
@@ -489,7 +501,7 @@ def is_venv_dir(d: str) -> bool:
489501
is_binary=is_binary_file(file_extension),
490502
)
491503
)
492-
return extra_files
504+
return extra_files, skipped_files
493505

494506

495507
def compute_normalized_hash(content: str) -> str:

src/uipath/_cli/cli_pack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def pack_fn(
283283
z.writestr(f"{project_name}.nuspec", nuspec_content)
284284
z.writestr("_rels/.rels", rels_content)
285285

286-
files = files_to_include(
286+
files, skipped_files = files_to_include(
287287
config_data.pack_options,
288288
directory,
289289
include_uv_lock,

src/uipath/telemetry/_track.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ def _initialize() -> None:
161161

162162
# Set application version
163163
_AppInsightsEventClient._client.context.application.ver = version("uipath")
164-
except Exception:
165-
# Silently fail - telemetry should never break the main application
166-
pass
164+
except Exception as e:
165+
# Log but don't raise - telemetry should never break the main application
166+
_logger.warning(f"Failed to initialize Application Insights client: {e}")
167+
_logger.debug("Application Insights initialization error", exc_info=True)
167168

168169
@staticmethod
169170
def track_event(
@@ -193,18 +194,21 @@ def track_event(
193194
)
194195
# Note: We don't flush after every event to avoid blocking.
195196
# Events will be sent in batches by the SDK.
196-
except Exception:
197-
# Telemetry should never break the main application
198-
pass
197+
except Exception as e:
198+
# Log but don't raise - telemetry should never break the main application
199+
_logger.warning(f"Failed to track event '{name}': {e}")
200+
_logger.debug(f"Event tracking error for '{name}'", exc_info=True)
199201

200202
@staticmethod
201203
def flush() -> None:
202204
"""Flush any pending telemetry events."""
203205
if _AppInsightsEventClient._client:
204206
try:
205207
_AppInsightsEventClient._client.flush()
206-
except Exception:
207-
pass
208+
except Exception as e:
209+
# Log but don't raise - telemetry should never break the main application
210+
_logger.warning(f"Failed to flush telemetry events: {e}")
211+
_logger.debug("Telemetry flush error", exc_info=True)
208212

209213

210214
class _TelemetryClient:
@@ -238,8 +242,10 @@ def _initialize():
238242
_logger.setLevel(INFO)
239243

240244
_TelemetryClient._initialized = True
241-
except Exception:
242-
pass
245+
except Exception as e:
246+
# Log but don't raise - telemetry should never break the main application
247+
_logger.warning(f"Failed to initialize telemetry client: {e}")
248+
_logger.debug("Telemetry initialization error", exc_info=True)
243249

244250
@staticmethod
245251
def _track_method(name: str, attrs: Optional[Dict[str, Any]] = None):
@@ -278,9 +284,10 @@ def track_event(
278284

279285
try:
280286
_AppInsightsEventClient.track_event(name, properties)
281-
except Exception:
282-
# Telemetry should never break the main application
283-
pass
287+
except Exception as e:
288+
# Log but don't raise - telemetry should never break the main application
289+
_logger.warning(f"Failed to track event '{name}': {e}")
290+
_logger.debug(f"Event tracking error for '{name}'", exc_info=True)
284291

285292

286293
def track_event(

0 commit comments

Comments
 (0)