<#723 fix(flyte serve): resolve include paths rela...
# flyte-github
a
#723 fix(flyte serve): resolve include paths relative to app dir when bundling for flyte serve Pull request opened by AdilFayyaz Summary: • When an AppEnvironment specifies include paths that escape the app script's directory (e.g. "../shared_utils.py"),
_deploy_app
was using
app_file.parent
as the tar bundle root. This caused tar entries with
../
components that Python 3.12+
tarfile.extractall()
rejects, silently crashing the container on startup. • Fixed by resolving include paths to absolute paths (anchored at the app script's directory) and using
serialization_context.root_dir
(the project root, autodetected from cwd()) as
from_dir
when building the bundle - ensuring all entries are valid relative paths under a common ancestor. • Added an example
(examples/apps/root_dir_bug/)
that reproduces the scenario: an app in a subdirectory including a shared utility from the parent
apps/
directory. Test plan: •
pytest tests/flyte/app/test_app_code_bundling.py
- all 14 tests pass, including: • Updated 3 existing tests to assert resolved absolute paths (matching what
build_code_bundle produces
at runtime) • New regression test
test_deploy_app_include_outside_app_dir_uses_bundle_root
directly exercises the
../
scenario and asserts both the resolved include path and that
from_dir == root_dir
• Deploy
examples/apps/root_dir_bug/app.py
to a live cluster and confirm the container starts and
GET /
returns
{"message": "Hello, World!"}
without a
500
flyteorg/flyte-sdk