Repository navigation
test: confine snapshot copy mode to the workspace - #804
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Copy mode currently materializes any artifact URI stored in the catalog. These tests refuse local paths and object-store URLs that resolve outside the catalog's parent workspace, including symlink and lookup swaps, and they fail until that containment exists.
6 tasks done
cursor Bot
pushed a commit
that referenced
this pull request
Nov 20, 2026
Bring the copy-mode containment regressions from #804 into this change: absolute paths, the CLI, symlinks, parent segments, relative escapes, a file swapped for a symlink after its status lookup, and an object-store URL in a local catalog are refused without writing their bytes, while in-workspace artifacts still copy and references mode never reads URIs. The swapped-file case now requires refusal outright.
Contributor
|
Tracking the fix and regression coverage in #808. |
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.
Summary
Adds tests that snapshot export in copy mode must not read artifact URIs outside the workspace that owns the catalog. The workspace root is the parent of the catalog directory. Files inside that root are still copied. Paths that resolve outside it, including symlinks,
..segments, relative paths, and a path swapped for another file between lookup and read, are refused before their bytes are written. An object-store URL in a local catalog is refused the same way.These tests fail on purpose until that containment exists. No production code is changed here.
Why
export_dataset_snapshot(..., media_mode=copy)andhflow export snapshot --media copytake eachartifact/measurementvalue_textand pass it tofetch_uri, then copy the bytes intoassets/. The catalog row is data, not a path the operator typed. A local path outside the data root and ans3://URL are both copied with the exporting process's filesystem rights and ambient object-store configuration.References mode is unchanged: it keeps the URI as a pointer and does not read it.
Validation
uv run ruff check tests/test_snapshot_artifact_uri_containment.py— passed.uv run ty check tests/test_snapshot_artifact_uri_containment.py— passed.uv run pytest -q tests/test_snapshot_artifact_uri_containment.py— 7 failed, 2 passed. The failures are the containment cases and are expected until copy mode refuses outside URIs. The two passes are in-workspace copy and references mode.Checklist
uv run ruff check --fix,uv run ruff format, anduv run ty check.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.