<#1109 fix: filter ConnectError(Unauthenticated/Pe...
# flyte-github
a
#1109 fix: filter ConnectError(Unauthenticated/PermissionDenied/FailedPrecondition) from Sentry Pull request opened by EngHabu Summary Three live Sentry issues are user-config or user-credentials problems that nonetheless slip past the existing
_is_user_error
filter and surface in
flyte-sdk
as if they were SDK crashes: • FLYTE-SDK-33 —
ConnectError: code = Unauthenticated, transport: per-RPC creds failed (oauth2 access_denied)
— IDP policy denial / expired token, raised from
flyte/remote/_client/auth/_interceptors/auth.py
. • FLYTE-SDK-3S —
RuntimeSystemError: Failed to create run: no enabled clusters found for org union-nav
— backend returns
FailedPrecondition
, surfaced from
_run.py
via
capture_exception(e)
for any
RuntimeSystemError
. • FLYTE-SDK-40 —
RuntimeSystemError: Failed to get signed url for /var/folders/.../fast….tar.gz
whose cause chain terminates in
ConnectError: code = PermissionDenied desc = cross org calls are not allowed for organization [demo] on behalf of [default]
. The user pointed the SDK at the wrong org. The CLI's
InvokeBaseMixin
(
flyte/cli/_common.py
) already maps the same set of
connectrpc.code.Code
values to
ClickException
and treats them as user-actionable — that mapping just doesn't cover the non-CLI capture paths. This change extends
flyte/_sentry.py:_is_user_error
to inspect every link of the `__cause__`/`__context__` chain for a
ConnectError
with one of:
Copy code
UNAUTHENTICATED, PERMISSION_DENIED, FAILED_PRECONDITION,
INVALID_ARGUMENT, NOT_FOUND, ALREADY_EXISTS
INTERNAL
,
UNAVAILABLE
, and
UNKNOWN
are deliberately excluded — those indicate backend bugs or outages and should still reach Sentry.
connectrpc
is imported lazily, so the filter still degrades gracefully if it isn't installed. Closes • FLYTE-SDK-33 • FLYTE-SDK-3S • FLYTE-SDK-40
fixes FLYTE-SDK-33
fixes FLYTE-SDK-3S
fixes FLYTE-SDK-40
Test plan •
test_capture_exception_skips_connect_error_unauthenticated
— bare
ConnectError(Unauthenticated)
is filtered. •
test_capture_exception_skips_connect_error_permission_denied_wrapped_as_system_error
— reproduces the FLYTE-SDK-40 chain shape (
ConnectError -> RuntimeError -> RuntimeSystemError
) and verifies it is filtered. •
test_capture_exception_skips_connect_error_failed_precondition_wrapped_as_system_error
— reproduces the FLYTE-SDK-3S chain shape. •
test_capture_exception_still_reports_connect_error_internal
—
ConnectError(Internal)
is NOT filtered (regression guard against over-broad suppression). • All 20 tests in
tests/flyte/test_sentry.py
pass. •
ruff format
+
ruff check
clean. 🤖 Generated with Claude Code flyteorg/flyte-sdk