Repository navigation
[runtime_env] Support .tar.gz archives for remote working_dir URIs - #62813
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
5e7e2f0 to
42b18b7
Compare
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
edoakes
left a comment
There was a problem hiding this comment.
The code changes largely LGTM. I triggered the premerge CI build to run tests.
Can you please update the docstring to indicate the zip files and tar archives are
supported? https://docs.ray.io/en/latest/ray-core/api/doc/ray.runtime_env.RuntimeEnv.html
Thanks, updated |
1b8d094 to
090313f
Compare
|
Some relevant python tests and linter are failing: https://buildkite.com/ray-project/premerge/builds/65878 |
e5878a5 to
6617d7e
Compare
@edoakes Fixed it. Can I trigger those tests myself? They didn't seem to run in the default CI stages |
|
@ankushbbbr they are running in the premerge test pipeline: https://buildkite.com/ray-project/premerge/builds/66196#019e1813-794c-47c2-8b6d-22949d21a92b/L1836 The linter is now failing: https://buildkite.com/ray-project/premerge/builds/66196#019e1819-fea4-47c4-9074-f1f89112b176/L316 You can run it locally following these instructions: https://docs.ray.io/en/latest/ray-contribute/getting-involved.html#lint-and-formatting |
Thanks. Fixed all lint errors and verified |
9531422 to
ddb5f19
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 458cfbec6b4d41b28eb4bdbfe69b8d25afc32e41. Configure here.
| if remove_top_level_directory: | ||
| top_level_directory = get_top_level_dir_from_tar_package(package_path) | ||
| if top_level_directory is not None: | ||
| remove_dir_from_filepaths(target_dir, top_level_directory) |
There was a problem hiding this comment.
Tar archive fully decompressed twice during extraction
Low Severity
untar_package fully reads and decompresses the tar archive twice when remove_top_level_directory is True: once during the extraction loop via tar.getmembers(), and again in get_top_level_dir_from_tar_package which re-opens the file and calls tar.getmembers() a second time. Unlike zip files where the central directory is a quick O(1) seek, tar requires a full sequential scan and decompression of the entire archive. For large .tar.gz working directories this doubles the I/O and CPU cost. The top-level directory could be determined during the initial extraction pass instead.
Reviewed by Cursor Bugbot for commit 458cfbec6b4d41b28eb4bdbfe69b8d25afc32e41. Configure here.
Many CI/build systems (Bazel, pip, conda) produce .tar.gz archives as their primary artifact format. The previous .zip-only restriction forced users to add costly conversion steps. This extends remote URI support to accept .tar.gz and .tgz archives in addition to .zip. Changes: - Update parse_uri to preserve compound extensions (.tar.gz, .tar.bz2) - Add untar_package with path traversal protection - Update validation in working_dir, py_modules, and validation modules - Update get_local_dir_from_uri and delete_package for compound extensions - Add comprehensive tests for tar.gz support Closes ray-project#62811 Signed-off-by: Ankush Babbar <[email protected]> Made-with: Cursor Committed-By-Agent: cursor
get_uri_for_package unconditionally hardcoded .zip for GCS URIs, so local .tar.gz/.tgz working_dir archives were uploaded under a .zip URI. Workers then called unzip_package on tar content, crashing with BadZipFile. Preserve the original archive extension and add tar.gz handling to the GCS download path in download_and_unpack_package. Signed-off-by: Ankush Babbar <[email protected]> Made-with: Cursor Committed-By-Agent: cursor
…members
GNU tar commonly prefixes archive members with "./" (e.g.,
./mydir/file.txt). The split("/")[0] check returned "." as the
top-level directory, causing remove_dir_from_filepaths(target_dir, ".")
to move the entire target directory into a temp dir and destroy the
extracted contents. Normalize member names by stripping leading "./"
and skipping bare "." entries.
Signed-off-by: Ankush Babbar <[email protected]>
Made-with: Cursor
Committed-By-Agent: cursor
Update RuntimeEnv class docstring and handling-dependencies.rst to document that working_dir and py_modules now accept .tar.gz and .tgz archives in addition to .zip for remote URIs. Signed-off-by: Ankush Babbar <[email protected]> Co-authored-by: Cursor <[email protected]> Committed-By-Agent: cursor
…ri message The test expected "Only .zip, .tar.gz, and .tgz files supported..." but validate_uri() (which parse_and_validate_working_dir calls) raises "Only .zip, .whl, .tar.gz, and .tgz files supported...". Update the test regex to match the actual error message. Signed-off-by: Ankush Babbar <[email protected]> Made-with: Cursor Committed-By-Agent: cursor
Signed-off-by: Ankush Babbar <[email protected]> Made-with: Cursor Committed-By-Agent: cursor
458cfbe to
b3aa6a9
Compare
|
@edoakes Thanks for reviewing & merging my PR! QQ: When will this get released? We need to integrate these changes in our Ray platform at Stripe for tar remote working_dir support |
|
@ankushbbbr we are targeting a release ~next week. If you want to test earlier, you can use the nightly wheels: https://docs.ray.io/en/latest/ray-overview/installation.html#daily-releases-nightlies |
…ay-project#62813) ## Summary - Extends `working_dir` (and `py_modules`) remote URI support to accept `.tar.gz` and `.tgz` archives in addition to `.zip` - Adds `untar_package` with path traversal protection (skips symlinks, validates resolved paths stay within target) - Updates `parse_uri` to preserve compound extensions (`.tar.gz`, `.tar.bz2`) so that local directory naming and suffix detection work correctly ## Why is this change needed? Many CI/build systems (Bazel, pip, conda) produce `.tar.gz` archives as their primary artifact format. The previous `.zip`-only restriction forced users to add a costly conversion step (download tar.gz → repackage as zip → re-upload), adding latency, storage overhead, and complexity — especially in KubeRay/RayJob workflows. Closes ray-project#62811 ## Changes | File | Change | |------|--------| | `packaging.py` | Add `import tarfile`, `is_tar_gz_uri`, `untar_package`, `get_top_level_dir_from_tar_package`; update `parse_uri` for compound extensions; update `download_and_unpack_package` to handle tar; fix `get_local_dir_from_uri` and `delete_package` for double extensions | | `working_dir.py` | Accept `.tar.gz`/`.tgz` in remote URI validation and local archive detection | | `py_modules.py` | Accept `.tar.gz`/`.tgz` in remote URI validation | | `validation.py` | Accept `.tar.gz`/`.tgz` in generic URI validation | | `protocol.py` | Update comment to reflect new supported formats | | Tests | Add unit tests for `untar_package`, `parse_uri` with tar.gz, `is_tar_gz_uri`, `get_local_dir_from_uri` with tar.gz, `download_and_unpack_package` with `file://` tar.gz URI, path traversal protection; update error message assertions | ## Test plan - [x] `test_parse_uri_tar_gz` — verifies compound extension preservation - [x] `test_is_tar_gz_uri` — verifies URI detection - [x] `test_get_local_dir_from_uri_tar_gz` — verifies directory naming - [x] `test_untar_package_without_top_level_dir` — basic extraction - [x] `test_untar_package_with_top_level_dir` — top-level directory stripping - [x] `test_untar_package_path_traversal` — security: blocks `../` attacks - [x] `test_get_top_level_dir_from_tar_package` — top-level detection - [x] `test_download_and_unpack_package_with_file_uri_tar_gz` — end-to-end with `file://` protocol - [x] Updated validation tests pass with new error messages and `.tar.gz`/`.tgz` as valid inputs Made with [Cursor](https://cursor.com) --------- Signed-off-by: Ankush Babbar <[email protected]> Signed-off-by: Ankush Babbar <[email protected]> Co-authored-by: Ankush Babbar <[email protected]> Co-authored-by: Cursor <[email protected]> Signed-off-by: phattruong <[email protected]>
…ay-project#62813) ## Summary - Extends `working_dir` (and `py_modules`) remote URI support to accept `.tar.gz` and `.tgz` archives in addition to `.zip` - Adds `untar_package` with path traversal protection (skips symlinks, validates resolved paths stay within target) - Updates `parse_uri` to preserve compound extensions (`.tar.gz`, `.tar.bz2`) so that local directory naming and suffix detection work correctly ## Why is this change needed? Many CI/build systems (Bazel, pip, conda) produce `.tar.gz` archives as their primary artifact format. The previous `.zip`-only restriction forced users to add a costly conversion step (download tar.gz → repackage as zip → re-upload), adding latency, storage overhead, and complexity — especially in KubeRay/RayJob workflows. Closes ray-project#62811 ## Changes | File | Change | |------|--------| | `packaging.py` | Add `import tarfile`, `is_tar_gz_uri`, `untar_package`, `get_top_level_dir_from_tar_package`; update `parse_uri` for compound extensions; update `download_and_unpack_package` to handle tar; fix `get_local_dir_from_uri` and `delete_package` for double extensions | | `working_dir.py` | Accept `.tar.gz`/`.tgz` in remote URI validation and local archive detection | | `py_modules.py` | Accept `.tar.gz`/`.tgz` in remote URI validation | | `validation.py` | Accept `.tar.gz`/`.tgz` in generic URI validation | | `protocol.py` | Update comment to reflect new supported formats | | Tests | Add unit tests for `untar_package`, `parse_uri` with tar.gz, `is_tar_gz_uri`, `get_local_dir_from_uri` with tar.gz, `download_and_unpack_package` with `file://` tar.gz URI, path traversal protection; update error message assertions | ## Test plan - [x] `test_parse_uri_tar_gz` — verifies compound extension preservation - [x] `test_is_tar_gz_uri` — verifies URI detection - [x] `test_get_local_dir_from_uri_tar_gz` — verifies directory naming - [x] `test_untar_package_without_top_level_dir` — basic extraction - [x] `test_untar_package_with_top_level_dir` — top-level directory stripping - [x] `test_untar_package_path_traversal` — security: blocks `../` attacks - [x] `test_get_top_level_dir_from_tar_package` — top-level detection - [x] `test_download_and_unpack_package_with_file_uri_tar_gz` — end-to-end with `file://` protocol - [x] Updated validation tests pass with new error messages and `.tar.gz`/`.tgz` as valid inputs Made with [Cursor](https://cursor.com) --------- Signed-off-by: Ankush Babbar <[email protected]> Signed-off-by: Ankush Babbar <[email protected]> Co-authored-by: Ankush Babbar <[email protected]> Co-authored-by: Cursor <[email protected]> Signed-off-by: Alexandr Plashchinsky <[email protected]>
Replace the duplicated .tar.gz / .tar.bz2 detection inside the length check with `compound_ext or Path(package_name).suffix`. The compound extension is already extracted earlier in the function (added in ray-project#62813), so reusing it removes the duplication and means any new compound type added upstream is picked up automatically.
Replace the duplicated .tar.gz / .tar.bz2 detection inside the length check with `compound_ext or Path(package_name).suffix`. The compound extension is already extracted earlier in the function (added in ray-project#62813), so reusing it removes the duplication and means any new compound type added upstream is picked up automatically. Signed-off-by: jpatra72 <[email protected]>
…ay-project#62813) ## Summary - Extends `working_dir` (and `py_modules`) remote URI support to accept `.tar.gz` and `.tgz` archives in addition to `.zip` - Adds `untar_package` with path traversal protection (skips symlinks, validates resolved paths stay within target) - Updates `parse_uri` to preserve compound extensions (`.tar.gz`, `.tar.bz2`) so that local directory naming and suffix detection work correctly ## Why is this change needed? Many CI/build systems (Bazel, pip, conda) produce `.tar.gz` archives as their primary artifact format. The previous `.zip`-only restriction forced users to add a costly conversion step (download tar.gz → repackage as zip → re-upload), adding latency, storage overhead, and complexity — especially in KubeRay/RayJob workflows. Closes ray-project#62811 ## Changes | File | Change | |------|--------| | `packaging.py` | Add `import tarfile`, `is_tar_gz_uri`, `untar_package`, `get_top_level_dir_from_tar_package`; update `parse_uri` for compound extensions; update `download_and_unpack_package` to handle tar; fix `get_local_dir_from_uri` and `delete_package` for double extensions | | `working_dir.py` | Accept `.tar.gz`/`.tgz` in remote URI validation and local archive detection | | `py_modules.py` | Accept `.tar.gz`/`.tgz` in remote URI validation | | `validation.py` | Accept `.tar.gz`/`.tgz` in generic URI validation | | `protocol.py` | Update comment to reflect new supported formats | | Tests | Add unit tests for `untar_package`, `parse_uri` with tar.gz, `is_tar_gz_uri`, `get_local_dir_from_uri` with tar.gz, `download_and_unpack_package` with `file://` tar.gz URI, path traversal protection; update error message assertions | ## Test plan - [x] `test_parse_uri_tar_gz` — verifies compound extension preservation - [x] `test_is_tar_gz_uri` — verifies URI detection - [x] `test_get_local_dir_from_uri_tar_gz` — verifies directory naming - [x] `test_untar_package_without_top_level_dir` — basic extraction - [x] `test_untar_package_with_top_level_dir` — top-level directory stripping - [x] `test_untar_package_path_traversal` — security: blocks `../` attacks - [x] `test_get_top_level_dir_from_tar_package` — top-level detection - [x] `test_download_and_unpack_package_with_file_uri_tar_gz` — end-to-end with `file://` protocol - [x] Updated validation tests pass with new error messages and `.tar.gz`/`.tgz` as valid inputs Made with [Cursor](https://cursor.com) --------- Signed-off-by: Ankush Babbar <[email protected]> Signed-off-by: Ankush Babbar <[email protected]> Co-authored-by: Ankush Babbar <[email protected]> Co-authored-by: Cursor <[email protected]> Signed-off-by: 400Ping <[email protected]>
…66791) ## Why are these changes needed? The Ray Core style-pass stack, #66642 through #66677, flagged pre-existing claims that looked inconsistent with the source, and kept them as written. This PR corrects the ones that current source settles. Each one either lags a deliberate code change or never matched the code. None traces to a code regression, so for each one the source describes the intended behavior. It's stacked on #66790, the mechanical fixes for the same pages, which is stacked on #66677. **For Core reviewers:** these corrections change what the docs say, so please confirm them. Each item cites the source it rests on, at master `5cf675f`, and the history of the disagreement. Items marked **confirm** carry a specific point to check. ### Top-level pages - `head-node-memory-management.md`: the note claimed KubeRay ignores memory and CPU requests, but KubeRay uses the CPU request when the CPU limit is absent (`ray-operator/controllers/ray/common/pod.go`). Per review, the note now states the general rule without naming resource types: set requests equal to limits, because KubeRay configures Ray's logical resources from the limits. The note was wrong from the start, in #58695. - `handling-dependencies.md`, the paths and URIs rules: a local path can also be a file, such as a local archive for `working_dir` or a `.whl` for `py_modules`, as the page's own API reference says. Remote URIs can be `.zip`, `.tar.gz`, `.tgz`, or `.tar.xz` archives, per `python/ray/_private/runtime_env/packaging.py`. Remote tar archives arrived in #62813, first released in 2.56.0, and #65742. **Confirm** that the single top-level directory rule applies to tar archives too. - `handling-dependencies.md`: `image_uri` is a `str` (`python/ray/runtime_env/runtime_env.py`), not a `dict`. #49752 carried `(dict)` over from the `container` field. - `ray-generator.md`: `ObjectRefGenerator` isn't a Python generator and doesn't fully implement the generator interface: `send`, `throw`, and `close` raise `NotImplementedError` (`python/ray/_private/object_ref_generator.py`). The sentence now says only that you can iterate with a `for` loop. - `tips-for-first-time.md`: the first value `ray.wait()` returns is a list of ready refs (`python/ray/_private/worker.py`), as the page's API table and sample, which indexes `done_id[0]`, already show. - `resource-isolation-with-cgroupv2.md`: the default minimum reserved system memory is `500 * (1024**2)` (`python/ray/_private/ray_constants.py`). The listing wrote `0.5 * 1024**3`, which is 512 MiB, beside a `#500MiB` comment. - `type-hint.md`: the `ActorProxy` handle sample called `func.remote()` on an undecorated function and omitted its `actor` argument and its imports. It now decorates `func`, passes the handle, and imports what it uses. **Confirm** that passing the handle into a task is the intended illustration. ### Tasks, actors, and objects - `tasks/nested-tasks.md`: Ray pickles and exports a remote function on its first `.remote()` call, in `RemoteFunction._remote()` (`python/ray/remote_function.py`), not at definition. Export has been lazy since before the note was written, in Ray 0.7. **Confirm** that cloudpickle captures `f` at that point, or say if the note should go. - `actors/concurrency-group-api.md`: the Java sample set both groups to a maximum concurrency of 1, while the prose and the Python sample say 2 for `io` and 4 for `compute`. The Java sample now matches. This is a code change in an untested `java` block. - `objects/serialization.md`: drops "Most Python distributions default to Pickle protocol 3". No supported Python does: `python/setup.py` requires 3.10 or later, where the default is 4 or 5. The sentence went stale when Ray dropped Python 3.7 in 2.9.0. - `actors/index.md`: `ray.cancel` defaults `recursive` to `True` (`python/ray/_private/worker.py`), and always has, so recursive cancellation is the default and `recursive=False` opts out. - `tasks/dynamic-generators.md`: adds the caveat from the page's own sample, `doc_code/generator.py` (`__dynamic_generator_pass_start__`), which says to avoid passing the generator because the extra `ray.get` blocks the driver. ### Design patterns - `patterns/ray-get-too-many-objects.md`: fetching too many objects "can lead to" failure rather than "leads to" it, matching the next paragraph and the sample's "if NUM_TASKS is large enough". - `patterns/out-of-band-object-ref-serialization.md`: the pin lasts for the lifetime of the worker that serialized the ref. `python/ray/_private/serialization.py` adds a never-removed local reference in the serializing process. The object is also gone if its owner dies. **Confirm** the borrower case: when the serializer isn't the owner, the owner cleans up a failed borrower's references (`src/ray/core_worker/reference_counter.cc`). An automated review on #66667 said the deserializing worker holds the pin instead. The source comment at the pin site says the serializing worker does. ### Fault tolerance and scheduling - `scheduling/index.md`: `k` is the larger of `RAY_scheduler_top_k_absolute` and the rounded-down product of the node count and `RAY_scheduler_top_k_fraction` (`src/ray/raylet/scheduling/policy/hybrid_scheduling_policy.cc`). With the defaults, that's 20% of nodes, rounded down, and at least 1. - `scheduling/placement-group.md`: PACK is a soft policy, as the same paragraph says, so Ray "tries to" put both bundles on one node. Only STRICT_PACK requires it. - `scheduling/ray-oom-prevention.md`: the policy ranks workers, and `LeaseSpecification::IsRetriable()` (`src/ray/common/lease/lease_spec.cc`) treats any nonzero `max_retries` or `max_restarts`, including `-1`, as retryable. - `fault-tolerance/objects.md`: `RAY_TASK_MAX_RETRIES` overrides only the default `max_retries` for remote functions, when the option isn't set (`python/ray/remote_function.py`). Tasks that set `max_retries`, and actor tasks with `max_task_retries`, still reconstruct. The "entirely" wording came in #27573, after #25189 introduced the variable as a default override. - `fault-tolerance/actors.md`: `ActorUnavailableError` retries apply to any nonzero `max_task_retries`. `-1` retries without limit (`src/ray/core_worker/task_manager.cc`, and the `max_task_retries` docstring in `python/ray/actor.py`), as L21 of the same page already counts it. - `fault-tolerance/index.md`: a task pinned by a node-specific custom resource "can't be retried on other nodes", the wording of the example's own comment in `doc_code/fault_tolerance_tips.py`, rather than "won't be retried". - `scheduling/resources.md`: the whole-number rule above 1 is enforced for GPUs (`python/ray/includes/task_options_utils.pxi`), while `neuron_cores` rejects any fractional value (`python/ray/_private/accelerators/neuron.py`) and TPU accepts only 1, 2, 4, or 8 (`python/ray/_private/accelerators/tpu.py`). - `scheduling/memory-management.md`: on macOS, Ray caps the default object store at 2 GiB (`MAC_DEGRADED_PERF_MMAP_SIZE_LIMIT` in `python/ray/_private/ray_constants.py`) and raises an error for a larger requested size unless `RAY_ENABLE_MAC_LARGE_OBJECT_STORE=1` (`python/ray/_private/services.py`). The cap arrived in #21224. - `scheduling/placement-group.md`: no code reads `NVIDIA_GPU_CLIQUE`. The variable supplies the value of the `ray.io/gpu-domain` label, which is what the feature acts on, as the example below the sentence shows. ### Compiled Graph, Ray Direct Transport, and internals - `direct-transport/index.md`: both the Gloo and NCCL examples call `create_collective_group`, so the difference worth listing is `backend="nccl"` against `backend="torch_gloo"` (`doc_code/direct_transport_gloo.py` and `direct_transport_nccl.py`). - `internals/task-lifecycle.md`: for a normal task, the executor's raylet pulls remote arguments before it grants the lease (`src/ray/raylet/local_lease_manager.cc`, `lease_dependency_manager.cc`), as a later step on the same page says. The executor reads them from the local store. - `internals/port-service-discovery.md`: the raylet spawns worker processes, and the core worker inside each one is a C++ library. #66677 restores the original wording, and this states it precisely. - `internals/object-spilling.md`: - Spill selection isn't LRU. `TryToSpillObjects` walks `pinned_objects_`, an unordered `absl::flat_hash_map` (`src/ray/raylet/local_object_manager.h`). LRU is the Plasma eviction policy for secondary copies, which the page covers separately. - Proactive spilling starts when the fraction of primary bytes is at least the threshold, `>=` in `src/ray/raylet/node_manager.cc`, as the page's trigger table says. - `object_spilling_threshold` is a fraction of object store capacity, the configured size, not of available memory (`node_manager.cc`, `ObjectManager::GetMemoryCapacity()`). - `max_io_workers` limits each IO worker type separately (`TryStartIOWorkers` in `src/ray/raylet/worker_pool.cc`), as the worker pool section of the page already says. - `internals/metric-exporter.md`: C++ metrics register in their `ray::stats` constructors when OpenTelemetry is on (`src/ray/stats/metric.h`), not lazily on first use. Recording an unregistered name fails a `RAY_CHECK` (`src/ray/observability/open_telemetry_metric_recorder.cc`). "Lazy registration" becomes "Idempotent registration", which is what that bullet describes. ## Related issue number None. Not a duplicate: I searched open PRs touching `doc/source/core/` and `doc/source/ray-core/`. Open PRs editing these pages are this stack, #66464 (Compiled Graph deprecation, on lines this PR doesn't touch), and #66550 (label selector operators, on lines this PR doesn't touch). Questions from the style pass that need a Core decision rather than a source check aren't in this PR. Examples are the `DAGNode.execute()` deprecation framing, the DEFAULT scheduling strategy's locality wording, the official KubeRay support scope for GCS fault tolerance, and the Ray event exporter baseline. They're tracked separately for Core engineering. ## Checks - Docs-only: every change is in a `.md` file under `doc/source/core/`, so no library tests run. The two sample edits, in `type-hint.md` and `concurrency-group-api.md`, are untested `python` and `java` blocks. - Every cited claim was re-checked on master `5cf675f`, and the disagreement's history was traced through release tags to rule out a code regression. - `vale` on the 26 changed files from the repo root: four alerts removed and one added, `Google.Parens` on `image_uri (str)`, which matches the field-type format of its sibling entries. - `codespell` on the changed files: clean. - `doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py --check` on the changed files: clean. - `pre-commit`: passed. - Full `-W` doc build: relying on the Read the Docs preview. AI assistance (Claude Code) was used to research and draft these edits. Draft until the submitter has reviewed every changed line and a Core reviewer has confirmed the claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>


Summary
working_dir(andpy_modules) remote URI support to accept.tar.gzand.tgzarchives in addition to.zipuntar_packagewith path traversal protection (skips symlinks, validates resolved paths stay within target)parse_urito preserve compound extensions (.tar.gz,.tar.bz2) so that local directory naming and suffix detection work correctlyWhy is this change needed?
Many CI/build systems (Bazel, pip, conda) produce
.tar.gzarchives as their primary artifact format. The previous.zip-only restriction forced users to add a costly conversion step (download tar.gz → repackage as zip → re-upload), adding latency, storage overhead, and complexity — especially in KubeRay/RayJob workflows.Closes #62811
Changes
packaging.pyimport tarfile,is_tar_gz_uri,untar_package,get_top_level_dir_from_tar_package; updateparse_urifor compound extensions; updatedownload_and_unpack_packageto handle tar; fixget_local_dir_from_urianddelete_packagefor double extensionsworking_dir.py.tar.gz/.tgzin remote URI validation and local archive detectionpy_modules.py.tar.gz/.tgzin remote URI validationvalidation.py.tar.gz/.tgzin generic URI validationprotocol.pyuntar_package,parse_uriwith tar.gz,is_tar_gz_uri,get_local_dir_from_uriwith tar.gz,download_and_unpack_packagewithfile://tar.gz URI, path traversal protection; update error message assertionsTest plan
test_parse_uri_tar_gz— verifies compound extension preservationtest_is_tar_gz_uri— verifies URI detectiontest_get_local_dir_from_uri_tar_gz— verifies directory namingtest_untar_package_without_top_level_dir— basic extractiontest_untar_package_with_top_level_dir— top-level directory strippingtest_untar_package_path_traversal— security: blocks../attackstest_get_top_level_dir_from_tar_package— top-level detectiontest_download_and_unpack_package_with_file_uri_tar_gz— end-to-end withfile://protocol.tar.gz/.tgzas valid inputsMade with Cursor