fix: raise CodeBundleError for bad Environment.include paths - #1232
Open
EngHabu wants to merge 3 commits into
Open
fix: raise CodeBundleError for bad Environment.include paths#1232EngHabu wants to merge 3 commits into
EngHabu wants to merge 3 commits into
Conversation
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
5 times, most recently
from
June 26, 2026 16:11
612973b to
c924bf1
Compare
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
5 times, most recently
from
July 3, 2026 02:52
d429394 to
9119a89
Compare
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
5 times, most recently
from
July 10, 2026 16:25
aa22f9a to
7c79cc8
Compare
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
2 times, most recently
from
July 14, 2026 17:35
ddef1f9 to
654f238
Compare
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
6 times, most recently
from
July 27, 2026 02:06
8d2b7e9 to
1e7422d
Compare
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
3 times, most recently
from
July 29, 2026 21:24
e137128 to
c5ee577
Compare
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
from
August 21, 2026 16:12
c5ee577 to
4a78071
Compare
… bundle root
An Environment.include path that resolves outside the bundle root (or matches
no file/dir/glob) raised a bare ValueError that leaked as a crash report
(FLYTE-SDK-5M outside-root, FLYTE-SDK-5Y no-match-glob), even though the
message is already user-actionable ("Pass --root-dir ..." / "is not a file,
directory, or matching glob pattern"). Convert these to CodeBundleError (a
RuntimeUserError), which keeps the same helpful message but is filtered from
Sentry as a user configuration error.
fixes FLYTE-SDK-5M
fixes FLYTE-SDK-5Y
Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
…one" path
`ls_relative_files` is the third site in `_code_bundle/_utils.py` that rejects an
`Environment.include` entry, and the only one still raising a bare `ValueError`.
It is reached from `build_code_bundle(copy_style="none", additional_files=...)`
via `build_code_bundle_from_relative_paths` -> `list_relative_files_to_bundle`,
so the path it complains about came straight from the user's `include=`.
Same reasoning as the two sites already converted in this PR: an include that
matches no file, directory or glob is the user's configuration, not an SDK bug,
so it should be a typed user error that crash reporting filters out instead of a
raw `ValueError` reported as a crash. The message is also reworded from
"File ... is not a valid file, directory, or glob pattern" to name the concept
the user actually typed ("include path ..."), matching its sibling in `ls_files`.
fixes FLYTE-SDK-5M
Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
EngHabu
force-pushed
the
fix/sentry-5m-bundle-root
branch
from
September 3, 2026 16:16
4a78071 to
87e82bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An
Environment.includepath that resolves outside the bundle root, or that matches no file / directory / glob, raised a bareValueErrorfromflyte._code_bundle._utilsthat leaked as a crash report:Both messages are already user-actionable; neither should have been an unhandled SDK crash.
Fix
Convert all three include-path validation
ValueErrors in_utils.pytoCodeBundleError— aRuntimeUserErrorthat keeps the same helpful message and is filtered from crash reporting via the_is_user_errorallowlist:ls_files— include path resolves outside the bundle root (FLYTE-SDK-5M).ls_files— include path matches no file, directory or glob (FLYTE-SDK-5Y).ls_relative_files— same no-match case on thecopy_style="none"route (build_code_bundle→build_code_bundle_from_relative_paths→list_relative_files_to_bundle). This is the same user error reached through a different code path; it had no Sentry issue of its own yet only becausecopy_style="none"is rarer. Its message is also reworded from "File … is not a valid file, directory, or glob pattern" to "include path …", naming the thing the user actually typed and matching its sibling inls_files.Tests
test_ls_files_rejects_path_outside_source,test_build_code_bundle_include_outside_source_raisesandtest_ls_relative_files_invalid_pathnow expectCodeBundleError.test_build_code_bundle_copy_style_none_missing_include_raisescovers the third site end-to-end through the publicbuild_code_bundleAPI. Verified failing on unpatchedsrc/, passing with the fix.fixes FLYTE-SDK-5M
fixes FLYTE-SDK-5Y