Skip to content

feat: terrio vsi list/copy/delete/move/sync (gdal vsi parity) - #302

Merged
giswqs merged 39 commits into
mainfrom
feat/289-vsi-dataset
Oct 27, 2026
Merged

giswqs merged 39 commits into
mainfrom
feat/289-vsi-dataset

Conversation

@giswqs

@giswqs giswqs commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Adds VSI file management through Rust, CLI/MCP, Python and JavaScript/WebAssembly. Part of #289.

Behavior

  • List local, memory, archive, S3/GCS/Azure and HTTP-index locations with recursive/depth, long/JSON and absolute-name options. Native copy, delete, move and sync span writable local/memory/object-store paths; archives are read-only. Browser writes operate in memory, and remote listings use fetch.
  • ZIP central directories and members use bounded range reads; tar/tar.gz extraction streams. Byte copies use the shared transfer paths. Recursive deletion preserves exact objects and neighboring prefixes when deleting prefix children.
  • Directory-target naming, encoded object prefixes and sync strategies follow the documented GDAL behavior. URL prefixes decode once before query encoding. Root/home/cwd ancestors, whole buckets/containers, traversal and unresolved containment are refused; recursive-delete listings are validated before mutation.
  • HTML listing uses a shared 4 KiB sniff prefix and 4 MiB body limit. Browser responses stream and cancel on binary/oversized content; custom fetch returns a standard Response. Object-store XML pagination streams pages with a 16 MiB cap and requires the expected ListBucketResult/EnumerationResults root; HTML and error pages fail explicitly.
  • Byte operations refuse pipes, sockets and devices before opening them; recursive skip-errors copies report those entries and continue. Copy-delete moves preflight unsupported source types. Invalid DOS timestamps report no date. Valid UTF-8 archive names are retained; unflagged invalid UTF-8 names use CP437 Unicode decoding.

Validation

In a local environment with GDAL 3.13.3: 58 focused Rust VSI tests, nine CLI tests, five Python tests, nine current release-WASM/Node VSI tests, an optimized CLI build, workspace Clippy and changed-file pre-commit pass. Strict registered VSI conformance under Python -S runs without osgeo/numpy and gives 25/25 comparisons identical: listings, metadata, real-file bytes, copy/sync/delete behavior, local S3 emulation, remote ZIP queries and refusal cases.

Regressions cover encoded space/percent/slash prefixes, missing/../child containment, dot-segment deletion before mutation, portable upload names, invalid ZIP dates, CP437 names, FIFO refusal without blocking, preservation of special destinations, browser stream cancellation and HTML/XML size limits. Nonrecursive tar sync creates each S3 directory marker once for 100 nested members. A killed comparison with empty output now records a nonempty error; four harness tests pass. A legacy ZIP fixture lists café.tif as Python zipfile does and extracts its exact payload; GDAL emits raw non-UTF-8 name bytes for that case.

Earlier measured transfer behavior remains documented: an 8 MiB stored ZIP-member copy takes 131 requests instead of 515 with the same received bytes; ZIP listing takes four requests/32,885 bytes. Native S3 fixture uploads take 10 requests versus GDAL's 20. Integration with main includes #303 and passes 672 core tests (one ignored), the full CLI suite, 14 Python VSI/query tests and ten current release-WASM/Node VSI/query tests. Vector dataset and raster query APIs are preserved.

Scope and limits

Remote writes require host credentials/permissions; browser remote writes and signed S3 requests are unavailable. MCP uses the existing host/client permission model and destructive tool annotations. Ownership and source mutation during copy-delete moves remain caller responsibilities. Non-UTF-8 local names and unsupported links/special entries are refused when they cannot be represented or copied faithfully; metadata timestamps and Unicode filename normalization have the documented limits. Operation errors may leave partial remote work; sync deletion is fail-fast. These commands do not add archive writing or SOZip creation.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The change adds a Rust VSI module for file management across local, in-memory, remote, and archive locations. It exposes operations through the CLI, WebAssembly, and Python APIs, and adds remote storage support and GDAL comparison coverage.

Changes: VSI file management

Layer / File(s) Summary
VSI paths, listings, and archives
Cargo.toml, crates/terrio/Cargo.toml, crates/terrio/src/lib.rs, crates/terrio/src/memfs.rs, crates/terrio/src/vfs.rs, crates/terrio/src/civil_time.rs, crates/terrio/src/vsi.rs, crates/terrio/src/vsi/listing.rs, crates/terrio/src/vsi/zipdir.rs, crates/terrio/src/vsi/tests.rs, docs/rust.md
The library adds VSI location and entry types, listing and metadata operations, and ZIP and TAR archive access. In-memory path recognition and file helpers are extended.
Remote listings and storage operations
crates/terrio/src/http.rs, crates/terrio/src/http/store.rs, crates/terrio/src/s3.rs, crates/terrio/src/vsi/listing.rs
Remote listing and object-store support adds pagination, metadata retrieval, streamed downloads, signed S3 writes, Azure writes, and S3 server-side copies.
Copy, sync, move, and delete
crates/terrio/src/vsi.rs, crates/terrio/src/vsi/md5.rs, crates/terrio/src/vsi/tests.rs
The library adds file and tree operations, sync strategies, operation reports, and safeguards for protected paths and archive extraction. Tests cover operation behavior, errors, and path boundaries.
CLI commands and reporting
crates/terrio-cli/src/cmd/*, crates/terrio-cli/src/lib.rs, crates/terrio-cli/src/mcp.rs, crates/terrio-cli/tests/*, docs/cli.md, docs/mcp.md
The CLI adds list, copy, delete, move, and sync commands with text and JSON output. MCP command descriptions include subcommand help. CLI tests cover local safeguards and S3 operations.
WebAssembly and Python APIs
js/src/*, js/tests/node.test.mjs, python/src/*, python/python/terrio/*, python/tests/test_vsi.py, docs/javascript.md, docs/python.md
The WebAssembly and Python interfaces expose VSI operations. WebAssembly also adds remote URL listing. Tests exercise file operations, archive access, and remote listing behavior.
GDAL comparison and conformance suite
scripts/compare_vsi_with_gdal.py, scripts/conformance.py, scripts/tests/test_vsi_conformance.py, docs/testing.md
A comparison script checks local, archive, and S3 behavior against GDAL. The conformance runner registers and runs the VSI suite.

Priority: Normal

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI as terrio vsi CLI
  participant VSI as VSI operations
  participant Store as HTTP object store
  participant S3 as S3 endpoint
  CLI->>VSI: Dispatch copy or sync operation
  VSI->>Store: Request listing, upload, or server-side copy
  Store->>S3: Send signed request
  S3-->>Store: Return response
  Store-->>VSI: Return operation result
  VSI-->>CLI: Return operation report
Loading

Possibly related issues

  • opengeos/terrio#289 — The issue lists GDAL-style VSI commands and exposure through CLI, MCP, Python, and JavaScript. This change adds those interfaces.
Merge Risk: Low · previous review 0605e

The VSI feature looks sound overall. Before merging, make the conformance suite report a failure when the comparison produces no output, correct two inaccurate CLI doc statements, and avoid repeated directory creation in non-recursive tar sync. None of these is likely to break users.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the new Terrio VSI operations and their GDAL parity objective.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit lists the files at dawn
Then copies paths across the lawn
It syncs the leaves, moves one away
And guards the roots along the way
ZIP and TAR hold seeds in store
The rabbit hops to check once more

Comment @coderabbitai help to get the list of available commands.

Comment thread crates/terrio/src/vsi.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the CLI layer, the MCP changes, and the delete, move and sync logic in crates/terrio/src/vsi.rs. I did not read the HTTP/S3 store, vsi/listing.rs, vsi/zipdir.rs or the Python/JS bindings in depth, so they are not covered. I did not run any tests.

Bugs

  • rename falls back to copy-then-delete on any local fs::rename error, not only cross-device errors. A permission error or a non-empty destination can turn into a full copy followed by deleting the source, and the original error is lost. Inline comment posted on crates/terrio/src/vsi.rs:1417. Confidence: medium.

Security

  • No exploitable issues found in the delete path. check_deletable runs first, and delete_local_tree uses symlink_metadata and does not follow symlinks.
  • Minor: the canonicalize / starts_with(root) check inside delete_local_tree is effectively redundant. DirEntry::file_type() does not follow symlinks, so a symlinked directory is never treated as a directory and is removed as a link. It is harmless and gives defence in depth. Confidence: low.

Performance

  • Nothing significant. Recursive delete lists the whole prefix before deleting, which is acceptable.
  • S3 recursive delete issues one request per object rather than batching. That is a possible later optimisation. Confidence: low.

Quality

  • The test S3 server in crates/terrio-cli/tests/vsi.rs has a leftover let _ = key; and an unused binding. This is a nit.
  • report() in the CLI prints "0 file(s) copied" when nothing was copied and nothing was deleted, for example on an all-up-to-date sync. The unchanged count is appended, but the message could be tidier. This is a nit.
  • The MCP tool marks all of vsi as destructiveHint (checked by the new test). That is conservative but correct, since vsi list shares the tool with delete and move.

CLAUDE.md (AGENTS.md)

  • A regression test is included (CLI, MCP, and a local S3-compatible server), and scripts/compare_vsi_with_gdal.py and scripts/conformance.py are updated. This matches the validation guidance.
  • I did not check NOTICE attribution for the new MD5 implementation (vsi/md5.rs). Please confirm it is covered if the code is ported.

Change size

Compared: the whole PR against main (merge base 5f4a527 to PR head 7c71334)

Metric Value
Files changed 36 (12 added, 24 modified, 0 removed, 0 renamed)
Size before 651.5 KB
Size after 863.6 KB
Total size change +212.1 KB
File Before After Change
crates/terrio/src/vsi.rs 0 B 59.2 KB +59.2 KB
crates/terrio/src/vsi/listing.rs 0 B 25.2 KB +25.2 KB
scripts/compare_vsi_with_gdal.py 0 B 21.8 KB +21.8 KB
crates/terrio/src/http/store.rs 0 B 17.3 KB +17.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 17.2 KB +17.2 KB
crates/terrio/src/vsi/tests.rs 0 B 14.7 KB +14.7 KB
crates/terrio/src/vsi/zipdir.rs 0 B 9.9 KB +9.9 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 8.9 KB +8.9 KB
js/src/vsi.rs 0 B 7.4 KB +7.4 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio/src/http.rs 54.3 KB 47.7 KB -6.7 KB
docs/cli.md 53.8 KB 58.7 KB +4.9 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
python/tests/test_vsi.py 0 B 4.2 KB +4.2 KB
js/tests/node.test.mjs 88.7 KB 92.3 KB +3.7 KB
docs/testing.md 38.8 KB 40.6 KB +1.8 KB
python/python/terrio/_terrio.pyi 36.0 KB 37.6 KB +1.6 KB
scripts/conformance.py 72.5 KB 74.1 KB +1.6 KB
crates/terrio-cli/tests/mcp.rs 13.5 KB 15.0 KB +1.5 KB
docs/javascript.md 14.4 KB 15.6 KB +1.2 KB

Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read vsi.rs and http/store.rs in full, plus the memfs.rs and s3.rs changes. I did not review listing.rs, zipdir.rs, md5.rs, the CLI, Python or JS bindings, the tests or the docs in detail, and I ran nothing.

Bugs

  • Data loss in vsi move (medium-high confidence). is_within returns false when a local target is two or more levels below any existing path.
    • For move dir dir/x/y with dir/x missing, the "into itself" guard is skipped. rename then creates dir/x, and the OS rename fails with EINVAL.
    • The copy fallback copies dir into itself and delete(src, true) removes everything, including the copy.
    • copy has the same bypass, which copies a tree into itself.
    • Inline comment on vsi.rs:1065-1087 includes a fix and suggests a regression test.
  • Move fallback is too broad (low-medium confidence). Any std::fs::rename error falls back to copy plus recursive delete, not only cross-device (EXDEV) errors. Permission or type errors take the destructive path (vsi.rs:1417).

Security

  • No issues found. I checked these:
    • The delete guards cover empty paths, roots, home, cwd and its parents, the /vsimem root, whole buckets and containers, and archives.
    • Recursive local delete does not follow symlinks.
    • Object-store deletes are bounded to the prefix/ keys.
    • The SAS query is stripped from display_node, and write errors go through redact.
  • Minor (low confidence). Following a 307/308 redirect on a write re-signs the request for the new host. I did not see credentials leak, but a redirect to a different host would still resend the request body.

Performance

  • copy_file for S3→S3 calls stat_node(src) only to report a size, which costs one extra request per file in recursive copies. Use the listing's size or skip it (low confidence, minor).
  • up_to_date ETag mode reads whole local files to compute MD5. That is expected, but large trees will be slow.

Quality

  • tar_entries has two near-duplicate entry-building blocks (a push closure that is only used for TarGz, and an inline copy for Tar). Factor them into one helper.
  • check_deletable canonicalizes symlinks, so deleting a symlink that points at $HOME or a cwd parent is refused even though only the link would be removed. This is conservative rather than wrong.
  • The HTML_PAGE thread-local cache is invalidated manually via forget_html_page() in list only. A stale page could be served to later stat calls on the same thread after a mutation.

CLAUDE.md

  • This follows the repo's guidance on:
    • shared logic in crates/terrio;
    • surfaces added across CLI, MCP, Python and JS;
    • a conformance script registered in scripts/conformance.py;
    • docs and tests.
  • The PR says it was validated against GDAL, but the Azure write and delete paths are not exercised in CI (the PR states this). Treat them as unverified.

Change size

Compared: the whole PR against main (merge base 2d71f94 to PR head f131b5c)

Metric Value
Files changed 36 (12 added, 24 modified, 0 removed, 0 renamed)
Size before 654.9 KB
Size after 867.0 KB
Total size change +212.1 KB
File Before After Change
crates/terrio/src/vsi.rs 0 B 59.2 KB +59.2 KB
crates/terrio/src/vsi/listing.rs 0 B 25.2 KB +25.2 KB
scripts/compare_vsi_with_gdal.py 0 B 21.8 KB +21.8 KB
crates/terrio/src/http/store.rs 0 B 17.3 KB +17.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 17.2 KB +17.2 KB
crates/terrio/src/vsi/tests.rs 0 B 14.7 KB +14.7 KB
crates/terrio/src/vsi/zipdir.rs 0 B 9.9 KB +9.9 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 8.9 KB +8.9 KB
js/src/vsi.rs 0 B 7.4 KB +7.4 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio/src/http.rs 54.3 KB 47.7 KB -6.7 KB
docs/cli.md 53.8 KB 58.7 KB +4.9 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
python/tests/test_vsi.py 0 B 4.2 KB +4.2 KB
js/tests/node.test.mjs 88.7 KB 92.3 KB +3.7 KB
docs/testing.md 40.3 KB 42.1 KB +1.8 KB
python/python/terrio/_terrio.pyi 36.0 KB 37.6 KB +1.6 KB
scripts/conformance.py 73.9 KB 75.5 KB +1.6 KB
crates/terrio-cli/tests/mcp.rs 13.5 KB 15.0 KB +1.5 KB
docs/javascript.md 14.4 KB 15.6 KB +1.2 KB

Sizes use 1 KB = 1024 B. These are file sizes, not line counts.

Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This was a partial review. I read the CLI layer, the MCP changes, the CLI tests and the safety, delete and move logic in crates/terrio/src/vsi.rs. I did not read the listing, zipdir, md5, HTTP store, Python or JS bindings, or the docs and conformance script in detail. I ran nothing: no build, tests or Clippy.

Bugs

  • Move can overwrite an existing destination file without warning (vsi.rs:1422). std::fs::rename replaces an existing file, and the copy path overwrites too. Only an existing destination directory is rejected. This may be intended GDAL parity, but it should be documented or tested. Confidence: medium.
  • Move of a symlink to a directory leaves the data behind (vsi.rs:1448). The copy follows the link, but delete(src, true) uses symlink_metadata and removes only the link. The result is a duplicate rather than a move. Confidence: low-medium.

Security

  • No blocking issues found in the parts I read. The delete safety checks cover empty paths, roots, $HOME, cwd and its parents, whole buckets and containers, archives and read-only HTTP. Local recursive delete does not follow symlinks and checks that each directory stays under the root.
  • Dangling paths skip the HOME and cwd checks. If canonicalize fails, check_deletable returns Ok (vsi.rs:1027). This is probably harmless, since a dangling path has nothing to delete. Confidence: low.

Performance

  • No concerns found in the code I read.

Quality

  • The mixed ||/&& condition in check_deletable (vsi.rs:1023) needs parentheses for readability.
  • rename reuses check_deletable, so a refused move reports "refusing to delete …". That message is confusing for a move.
  • In crates/terrio-cli/tests/vsi.rs, the test server has a stray let _ = key; and uses unwrap() in the request handling. This is acceptable in tests but fragile.

CLAUDE.md

  • The PR adds CLI, MCP, Python and JS surfaces plus tests and docs, which matches the guidance on consistent exposure and regressions.
  • I did not check the NOTICE attribution for the MD5 port and tar usage.
  • I did not confirm that the new tar dependency, the scripts/conformance.py registration, or the roadmap and tracking-issue updates are complete.

Change size

Compared: the whole PR against main (merge base 2d71f94 to PR head 9619ecb)

Metric Value
Files changed 36 (12 added, 24 modified, 0 removed, 0 renamed)
Size before 654.9 KB
Size after 868.1 KB
Total size change +213.3 KB

Largest changes:

File Before After Change
crates/terrio/src/vsi.rs 0 B 59.6 KB +59.6 KB
crates/terrio/src/vsi/listing.rs 0 B 25.2 KB +25.2 KB
scripts/compare_vsi_with_gdal.py 0 B 21.8 KB +21.8 KB
crates/terrio/src/http/store.rs 0 B 17.3 KB +17.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 17.2 KB +17.2 KB
crates/terrio/src/vsi/tests.rs 0 B 15.5 KB +15.5 KB
crates/terrio/src/vsi/zipdir.rs 0 B 9.9 KB +9.9 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 8.9 KB +8.9 KB
js/src/vsi.rs 0 B 7.4 KB +7.4 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio/src/http.rs 54.3 KB 47.7 KB -6.7 KB
docs/cli.md 53.8 KB 58.7 KB +4.9 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
python/tests/test_vsi.py 0 B 4.2 KB +4.2 KB
js/tests/node.test.mjs 88.7 KB 92.3 KB +3.7 KB
docs/testing.md 40.3 KB 42.1 KB +1.8 KB
python/python/terrio/_terrio.pyi 36.0 KB 37.6 KB +1.6 KB
scripts/conformance.py 73.9 KB 75.5 KB +1.6 KB
crates/terrio-cli/tests/mcp.rs 13.5 KB 15.0 KB +1.5 KB
docs/javascript.md 14.4 KB 15.6 KB +1.2 KB

Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read crates/terrio/src/vsi.rs, crates/terrio/src/http/store.rs and the memfs.rs, s3.rs and vfs.rs changes. I did not review in detail the CLI, Python, JS, listing.rs, zipdir.rs, md5.rs, the tests or the docs. I could not run any code in this environment.

Bugs

  • Cross-device move can lose data (medium). walk_local silently skips entries whose names are not valid UTF-8 or whose metadata can't be read. After a CrossesDevices rename error, rename() copies the tree and then runs delete(src, true). Anything skipped is never copied but is still deleted. A symlink to a directory is copied as an empty directory, and then the link is deleted. See the inline comment at vsi.rs:594.
  • Stale HTML index cache (medium). The thread-local HTML_PAGE is cleared only inside list(). copy, sync, delete and rename can reuse an outdated index page in a long-lived Python, MCP or Node process. See the inline comment at vsi.rs:504.
  • sync hides target-listing errors (low-medium). read_dir(dst).unwrap_or_default() treats a failed listing of the target as an empty target, so everything is re-copied. See the inline comment at vsi.rs:1196.
  • Delete guard narrower than documented (low-medium). Parents of $HOME (e.g. /home) and system directories are not refused. A symlink that points at the current directory's parent is refused because canonicalize resolves it, even though only the link would be removed. See the inline comment at vsi.rs:1036.
  • write_local_atomic side effects (low). The rename replaces a symlink at the target, drops an existing file's permissions, and the temp name can exceed NAME_MAX. See the inline comment at vsi.rs:913.

Security

  • No injection or secret-leak issues found. Credentials are redacted in log and error output (redact). Recursive local deletion does not follow symlinks, and S3 deletion is bounded to prefix/. Both are good.
  • A time-of-check/time-of-use gap remains in delete_local_tree, where a directory could be swapped for a symlink between the canonical check and the recursion. It is a theoretical race (low).

Performance

  • Quadratic archive extraction (medium). read_member re-opens the archive for each member. Zip re-parses the central directory each time. Tar and tar.gz re-scan and re-decompress from the start. See the inline comment at vsi.rs:848.
  • Sync and upload hash a local file's SHA-256 in a full pass before uploading it (needed for signing), so large uploads read the file twice. This is acceptable but worth noting (low).

Quality

  • Duplicated tar-entry conversion in tar_entries. See the inline comment at vsi.rs:765 (high confidence).
  • vsi.rs is about 1.5k lines, and Node/stat/copy/archive logic could be split into modules for maintainability (low).

CLAUDE.md / AGENTS.md

  • Shared logic is in crates/terrio, and CLI, Python and JS are thin, which matches the instructions. The PR adds a conformance script and registers it in scripts/conformance.py, as required.
  • The new tar dependency is attributed in the PR description. I did not check whether the NOTICE files list the in-tree MD5 implementation and the ported zip-directory reader, so please confirm that.
  • The PR states GDAL comparison results but doesn't give CI evidence for cargo fmt, Clippy -D warnings or the WASM build. Please confirm these ran.

Change size

Compared: the whole PR against main (merge base 2d71f94 to PR head d56e12e)

Metric Value
Files changed 36 (12 added, 24 modified, 0 removed, 0 renamed)
Size before 654.9 KB
Size after 868.3 KB
Total size change +213.4 KB
File Before After Change
crates/terrio/src/vsi.rs 0 B 59.6 KB +59.6 KB
crates/terrio/src/vsi/listing.rs 0 B 25.2 KB +25.2 KB
scripts/compare_vsi_with_gdal.py 0 B 21.9 KB +21.9 KB
crates/terrio/src/http/store.rs 0 B 17.3 KB +17.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 17.2 KB +17.2 KB
crates/terrio/src/vsi/tests.rs 0 B 15.5 KB +15.5 KB
crates/terrio/src/vsi/zipdir.rs 0 B 9.9 KB +9.9 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 8.9 KB +8.9 KB
js/src/vsi.rs 0 B 7.4 KB +7.4 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio/src/http.rs 54.3 KB 47.7 KB -6.7 KB
docs/cli.md 53.8 KB 58.8 KB +4.9 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
python/tests/test_vsi.py 0 B 4.2 KB +4.2 KB
js/tests/node.test.mjs 88.7 KB 92.3 KB +3.7 KB
docs/testing.md 40.3 KB 42.1 KB +1.9 KB
python/python/terrio/_terrio.pyi 36.0 KB 37.6 KB +1.6 KB
scripts/conformance.py 73.9 KB 75.5 KB +1.6 KB
crates/terrio-cli/tests/mcp.rs 13.5 KB 15.0 KB +1.5 KB
docs/javascript.md 14.4 KB 15.6 KB +1.2 KB

@giswqs

giswqs commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai Please review the latest changes and approve this PR once your actionable findings are addressed. I am continuing to resolve the remaining review comments and CI failures.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

@giswqs I’ll review the latest changes. The approval workflow will check review readiness and required checks before approving. This reply does not confirm approval.

⚠️ Action not completed

Changes approved. Review threads were not changed.


Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/http/store.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi/zipdir.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I reviewed the full diff: the core vsi.rs, listing.rs, zipdir.rs, http/store.rs, the http.rs refactor, memfs, the bindings, and the MCP change. Eight inline comments are posted (listed below). I did not build or run the tests; the file references are from reading the proposed sources.

Bugs

  • Object-store names are joined into URLs without percent-encoding (vsi.rs:294). A GCS/Azure object named x#y.tif or a?b.tif can be read, copied, or deleted under the wrong URL. High confidence.
  • Moves into an existing directory are refused only for local-to-local (vsi.rs:1603). The doc promises refusal for all pairs. Low severity, medium confidence.
  • Symlinked directories are reported as directories and then not descended. copy -r silently creates an empty directory (vsi.rs:604). Medium confidence.

Security

  • The .. guard splits on / only, so on Windows an S3 key or HTML href containing ..\ can write outside the destination (vsi.rs:1346). Medium confidence, not verified on Windows.
  • Zip extraction writes the full stream before checking size and CRC, so a deflate bomb can fill the disk (zipdir.rs:180). Low severity.
  • The vsi MCP tool is marked destructive but not gated. Recursive delete and S3 writes run with ambient credentials. This follows the AGENTS.md CLI→MCP rule, and the guards cover only roots, home, and cwd. Low confidence as a concern; I did not post it inline.

Performance

  • Every plain-HTTP stat, list, or copy source buffers the whole response to check for HTML (store.rs:136). Medium confidence, since it depends on the server answering the file/ probe with 200.
  • Zip member copies re-parse the central directory for each member. Tar sync decompresses from the start for each member, since the streaming path applies only to copy (vsi.rs:828). High confidence on the mechanism.

Robustness

  • The plain-HTTP recursive crawl has no page cap, unlike RemoteLister's MAX_PAGES (vsi.rs:640). Medium confidence.

Quality and CLAUDE.md

  • Nits, not posted inline:
    • An empty S3 directory marker reports as "does not exist" on stat/list, though the parent listing shows it.
    • tree_json is O(directories × entries).
    • parse_html_index drops legitimate names that start with ...
    • write_member ignores skip_errors.
  • AGENTS.md asks for the roadmap and tracker to be updated as features land. ROADMAP.md has no file-management entry, and CHANGELOG.md's Unreleased section is not updated.
  • The new Hinnant-based date code follows an existing pattern in the repo without a NOTICE entry, so I did not flag it.

Change size

Compared with the base branch (merge base e607d5a to PR head 5ed8319).

Measure Value
Files changed 36 (12 added, 24 modified, 0 removed, 0 renamed)
Size before 660.8 KB
Size after 888.2 KB
Total size change +227.5 KB
Path Before After Change
crates/terrio/src/vsi.rs 0 B 67.1 KB +67.1 KB
crates/terrio/src/vsi/listing.rs 0 B 25.2 KB +25.2 KB
scripts/compare_vsi_with_gdal.py 0 B 21.9 KB +21.9 KB
crates/terrio/src/vsi/tests.rs 0 B 21.2 KB +21.2 KB
crates/terrio/src/http/store.rs 0 B 17.3 KB +17.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 17.2 KB +17.2 KB
crates/terrio/src/vsi/zipdir.rs 0 B 9.9 KB +9.9 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 8.9 KB +8.9 KB
js/src/vsi.rs 0 B 7.4 KB +7.4 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio/src/http.rs 54.3 KB 47.7 KB −6.7 KB
docs/cli.md 54.3 KB 59.9 KB +5.6 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
python/tests/test_vsi.py 0 B 4.2 KB +4.2 KB
js/tests/node.test.mjs 90.5 KB 94.1 KB +3.7 KB
docs/testing.md 40.6 KB 42.5 KB +1.9 KB
python/python/terrio/_terrio.pyi 36.1 KB 37.8 KB +1.7 KB
scripts/conformance.py 76.8 KB 78.4 KB +1.6 KB
crates/terrio-cli/tests/mcp.rs 13.5 KB 15.0 KB +1.5 KB
docs/javascript.md 14.4 KB 15.6 KB +1.2 KB

- Browser/WASM listings of s3:// keep the key raw, as native code does:
  the key is URL-encoded before Api::for_url decodes it once, so
  s3://bucket/a%20b lists the prefix "a%20b/", not "a b/" (regression
  s3_keys_are_listed_raw_as_natively).
- A 200 page that is not an object-store listing makes read-only
  discovery (Zarr children) and has_entries (stat) report a store that
  cannot list, as before; only complete listings for mutations fail
  (regression a_page_that_is_not_a_listing_fails_only_complete_listings).
- Note at the SigV4 payload hash that signed file uploads read the file
  twice, as docs/cli.md records; alternatives are tracked in #335.
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio-cli/tests/vsi.rs Resolved
Comment thread crates/terrio/src/http/store.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi/listing.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • Recursive delete removes an exact object that coexists with prefix/ children (high). crates/terrio/src/vsi.rs:1950-1954 deletes the object after its children. The docs (docs/cli.md), the PR description and the conformance check in scripts/compare_vsi_with_gdal.py say it is kept. The CLI test at crates/terrio-cli/tests/vsi.rs:459 asserts it is removed. Code, tests and docs disagree on a destructive path, so the stated 25/25 conformance result cannot hold for that check at this head. Removing the block matches the docs; the test would then need flipping. Inline comments posted on both lines.

Security

  • No findings. Error and log paths redact signed or SAS query strings; I checked the local-path and HTML-index traversal guards and found no escape.

Performance

  • Remote zip member extraction (medium-high). read_member opens a new RangeReader for every member (vsi.rs:799), and each open fetches a 64 KiB first block. Extracting N members costs at least N requests even though the central directory is cached. Inline comment posted.
  • New HTTP agent per write request (medium). write_request (http/store.rs:290) and per-page listing clients open a new connection and TLS handshake for every object in a recursive upload or sync. Inline comment posted.

Quality

  • rustfmt line width (medium). Several added test lines exceed max_width = 140, so cargo fmt --all -- --check will likely fail. Inline comment posted at vsi/listing.rs:763.
  • Delete counts are inconsistent (low). Local directories count toward deleted, but S3 directory markers do not, while the Report doc says "files and directories deleted".
  • print_stats depends on a feature gate (low). cmd/vsi.rs:207 calls terrio::http::fetch_stats(), which exists only under cfg(remote) (lib.rs:197-199). The CLI fails to build without terrio's default features.
  • CLI flags silently ignored (nit). --tree does nothing without --json, and --depth does nothing without -R.
  • Typographic apostrophe (nit). http/store.rs:279 has "store’s" in a doc comment.
  • Duplicated civil-date code (nit). vsi.rs::format_time repeats the Hinnant conversion already in drivers/vector/datetime.rs. It could live in civil_time.

CLAUDE.md (AGENTS.md)

  • Options are mostly consistent across CLI, Python and JS. --tree is CLI-only, which is reasonable because it is a JSON-output concern.
  • Regression tests are present for the behaviour changes.
  • Medium confidence: the memfs change routes every /vsimem/ path to memory, not only /vsimem/terrio. This looks intended, but existing readers now see a different error for a missing /vsimem/x path. Worth confirming.

Change size

Compared: the whole PR against main (merge base 040b145 to PR head 62a6d32).

Measure Value
Files changed 39 (14 added, 25 modified, 0 removed, 0 renamed)
Size before 825.0 KB
Size after 1.14 MB
Total size change +343.4 KB
Path Before After Change
crates/terrio/src/vsi.rs 0 B 86.9 KB +86.9 KB
crates/terrio/src/vsi/listing.rs 0 B 45.7 KB +45.7 KB
crates/terrio/src/vsi/tests.rs 0 B 45.2 KB +45.2 KB
crates/terrio/src/http/store.rs 0 B 28.1 KB +28.1 KB
scripts/compare_vsi_with_gdal.py 0 B 27.3 KB +27.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 24.4 KB +24.4 KB
crates/terrio/src/vsi/zipdir.rs 0 B 16.2 KB +16.2 KB
js/src/vsi.rs 0 B 10.8 KB +10.8 KB
docs/cli.md 108.9 KB 118.8 KB +9.8 KB
js/tests/node.test.mjs 107.5 KB 117.1 KB +9.7 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 6.9 KB +6.9 KB
crates/terrio/src/http.rs 54.3 KB 48.4 KB −5.9 KB
python/tests/test_vsi.py 0 B 4.7 KB +4.7 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
docs/testing.md 55.6 KB 59.5 KB +3.9 KB
scripts/tests/test_vsi_conformance.py 0 B 3.2 KB +3.2 KB
python/python/terrio/_terrio.pyi 49.2 KB 50.9 KB +1.7 KB
docs/javascript.md 21.7 KB 23.4 KB +1.7 KB
scripts/conformance.py 90.6 KB 92.2 KB +1.6 KB

- Recursive S3 delete keeps an exact object that coexists with prefix/
  children, as GDAL 3.13.3 does and docs/cli.md states: 236b4a3 had
  started deleting it. compare_vsi_with_gdal.py now reports 25/25
  identical again (24/25 before, on the coexisting-object check).
- The CLI regression asserts GDAL's behaviour: -r removes x/ and keeps
  x; deleting x without -r removes it.
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/vsi.rs Resolved
Comment thread crates/terrio/src/memfs.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: the full PR (39 files, about 8k added lines). I read the core vsi.rs, listing.rs, zipdir.rs, http/store.rs, memfs.rs, the S3 signing changes, the JS and Python bindings, the CLI and MCP wiring, and the MD5 code. I did not run the build or tests, since I have no shell.

Bugs

  • In-memory namespace collision (medium confidence). /vsimem/terrio/<n> mount roots now sit inside the user-visible /vsimem/ namespace. A user file under a live mount id can be overwritten, and Mount::drop deletes every key under that prefix, including user files. Commented inline on memfs.rs.

Performance

  • In-memory move copies bytes twice (high confidence). vsi::rename reads, rewrites and removes the source. Re-keying the stored Arc would avoid the copy. Commented inline on vsi.rs:2084.
  • Archive clone on every read (high confidence). with_archive_reader clones the whole /vsimem/ archive per call. Commented inline on vsi.rs:784.
  • Per-entry canonicalization (low confidence, nit). checked_child_target canonicalizes the destination root and walks ancestors for every entry of a tree copy. Caching the canonical root once per copy would cut the syscalls.

Security

  • No findings. Traversal is refused before any mutation. Recursive deletes do not follow symlinks and validate the full listing first. Redirects are same-origin for writes, the S3 region is validated before it is interpolated into a hostname, and ZIP and tar members are only streamed, never written to disk. Low-confidence note: vsi copy over MCP can upload any local file the server can read to a configured S3 or Azure endpoint. This matches how other write tools behave, and the tool is marked destructive.

Quality

  • The CLI --tree and JSON-nesting options have no Python or JavaScript equivalent. This is low confidence, since the tree is a presentation concern.
  • A JavaScript listing_body with a null response body (for example a 204) returns an error instead of an empty listing. This is an edge case.

CLAUDE.md (AGENTS.md)

  • Roadmap not updated (about 70% confidence). AGENTS.md asks for the roadmap to be updated as features land. The "Command-group progress" list under Tracking: parity with GDAL's unified gdal CLI commands #289 in ROADMAP.md has no VSI entry. I could not post this inline, since ROADMAP.md is not part of the PR diff.
  • NOTICE attribution (about 50% confidence). civil_time.rs and format_time in vsi.rs transcribe Howard Hinnant's date algorithms, and md5.rs implements RFC 1321. Neither is attributed in NOTICE (checked by search), which AGENTS.md requires for copied algorithms.

Two of my inline attempts were rejected because those lines are not in the PR diff (memfs.rs:70 and ROADMAP.md:72). The memfs comment was reposted on a changed line (memfs.rs:24).

Change size

Compared with the base branch, merge base 040b145 to PR head c2751c1 (the whole PR against main).

Measure Value
Files changed 39 (14 added, 25 modified, 0 removed, 0 renamed)
Size before 824.9 KB
Size after 1.14 MB
Total size change +343.6 KB
Path Before After Change
crates/terrio/src/vsi.rs 0 B 86.9 KB +86.9 KB
crates/terrio/src/vsi/listing.rs 0 B 45.7 KB +45.7 KB
crates/terrio/src/vsi/tests.rs 0 B 45.2 KB +45.2 KB
crates/terrio/src/http/store.rs 0 B 28.1 KB +28.1 KB
scripts/compare_vsi_with_gdal.py 0 B 27.3 KB +27.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 24.7 KB +24.7 KB
crates/terrio/src/vsi/zipdir.rs 0 B 16.2 KB +16.2 KB
js/src/vsi.rs 0 B 10.8 KB +10.8 KB
docs/cli.md 108.9 KB 118.8 KB +9.8 KB
js/tests/node.test.mjs 107.5 KB 117.1 KB +9.7 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 6.9 KB +6.9 KB
crates/terrio/src/http.rs 54.3 KB 48.4 KB −5.9 KB
python/tests/test_vsi.py 0 B 4.7 KB +4.7 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
docs/testing.md 55.6 KB 59.5 KB +3.9 KB
scripts/tests/test_vsi_conformance.py 0 B 3.2 KB +3.2 KB
python/python/terrio/_terrio.pyi 49.2 KB 50.9 KB +1.7 KB
docs/javascript.md 21.7 KB 23.4 KB +1.7 KB
scripts/conformance.py 90.6 KB 92.2 KB +1.6 KB

- In-memory mounts move to a reserved /vsimem/.terrio-mounts prefix:
  vsi refuses paths at or below it, and /vsimem listings above it leave
  mount files out. A user file such as /vsimem/terrio/1/x can no longer
  overwrite a live mount's file, be deleted when a mount drops, or let
  delete -r wipe mounts (regressions mounts_are_out_of_reach_of_vsi and
  mounts_are_reserved_and_left_out_of_listings).
@giswqs
giswqs merged commit 0953e0d into main Oct 27, 2026
19 checks passed
@giswqs
giswqs deleted the feat/289-vsi-dataset branch October 27, 2026 14:44
Comment thread crates/terrio/src/vsi.rs
Node::S3 { bucket, key: key.trim_end_matches('/').to_string() }
}
crate::vfs::Location::Url(u) => {
let (base, query) = u.split_once('?').map_or((u.as_str(), ""), |(b, q)| (b, q));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug (medium-low, confidence ~70%): gs:// and az:// keys are parsed as URLs, unlike s3://.

vfs::Location::parse_unarchived turns gs://b/k and az://a/c/k into raw https:// URLs, so Node::parse splits at the first ? (here, line 305) and Api::for_url percent-decodes the prefix (listing.rs lines 121–129). s3:// keys stay raw, and listing names come back as raw keys, so the round trip breaks:

  • A listed GCS/Azure name containing ?, # or %XX can't be passed back to vsi copy/delete. The text after ? is taken as a query.
  • For Azure with AZURE_STORAGE_SAS_TOKEN set, az://acct/c/a?b becomes …/c/a?b?sv=…, which Node::parse splits into base …/c/a, query b?sv=…. A vsi copy local az://acct/c/a?b would then overwrite blob a, and vsi delete az://acct/c/a?b would delete a.

Suggested fix: in Node::parse, handle gs://, /vsigs/, az:// and /vsiaz/ before delegating to vfs, and percent-encode the key the same way the s3:// branch of RemoteLister::new does (uri_encode(key, false)), appending the SAS token separately. Add a regression test with ?, # and %20 in an Azure blob name.

Api::Url { base: format!("{scheme}://{host}/{bucket}"), prefix: with_slash(&uri_decode(prefix)) }
} else if lower.ends_with(".blob.core.windows.net") {
let (container, prefix) = key.split_once('/').unwrap_or((key, ""));
Api::Azure { base: format!("{scheme}://{host}/{container}"), prefix: with_slash(&uri_decode(prefix)), sas: query.to_string() }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the other half of the gs:///az:// round-trip issue flagged in vsi.rs. uri_decode(prefix) decodes a raw key, so a Google or Azure key with %20 lists as a b/ while the same spelling on s3:// lists as a%20b/. The s3:// branch in RemoteLister::new encodes the key first to avoid exactly this. The fix belongs at the input boundary (see the comment on vsi.rs:305), so the decode here can remain URL-only for real https:// inputs.

Comment thread crates/terrio/src/vsi.rs
}
return Err(Error::Unsupported(message.into()));
}
let to = checked_child_target(dst, &e.name, portable)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (performance): checked_child_target re-canonicalizes the destination root and walks its ancestors for every entry, so a copy of N files costs several extra syscalls per file. The root could be canonicalized once in copy_tree and passed down, with only the per-entry ancestor walk left in the loop. This is minor for typical trees and is not a correctness issue.

if data.len() as u64 > MAX_HTML_BYTES {
return Err(Error::InvalidData("HTTP directory index exceeds 4 MiB".into()));
}
if !String::from_utf8_lossy(&data).to_ascii_lowercase().contains("<a ") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor inconsistency: this check requires a literal "<a " (space), but parse_html_index accepts any ASCII whitespace after <a. A page with <a\nhref=…> markup is therefore rejected as "not a listable HTML directory index" even though the parser would read it. The same check exists in RemoteLister::feed. Both could share one helper that accepts whitespace. Also, lowercasing the whole 4 MiB body just for this check is avoidable.

pub(crate) fn listing_api(dir: &Directory) -> Api {
match dir {
Directory::S3 { bucket, prefix } => {
let prefix = if prefix.is_empty() { String::new() } else { format!("{}/", prefix.trim_end_matches('/')) };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (duplication): this rebuilds the same trailing-slash prefix logic as with_slash in vsi/listing.rs. Making with_slash pub(crate) and calling it here would keep one definition.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I reviewed the PR statically from the staged diff and the working tree. I did not build or run the tests. The PR is large, so this is a sampled read of the core paths, not an exhaustive line-by-line audit.

Bugs

  • gs:// and az:// keys are parsed as URLs, unlike s3:// (crates/terrio/src/vsi.rs:305, confidence ~70%). A ? starts a query, and %XX is decoded. Listed names can't be passed back to copy/delete. With AZURE_STORAGE_SAS_TOKEN set, vsi copy local az://acct/c/a?b can overwrite blob a, and vsi delete az://acct/c/a?b can delete a. Suggested fix: encode the key at the input boundary, as the s3:// branch of RemoteLister::new already does, and add a regression test.
  • Decode mismatch on the listing side (crates/terrio/src/vsi/listing.rs:124, confidence ~70%). The same spelling lists differently on gs:///az:// (a b/) than on s3:// (a%20b/). This is the other half of the issue above.

Quality

  • Minor inconsistency between the HTML index check and the anchor parser (crates/terrio/src/http/store.rs:187, confidence high). Also avoidable lowercasing of up to 4 MiB.
  • Duplicated prefix logic (crates/terrio/src/http/store.rs:37; with_slash in listing.rs already does this).
  • The vsi MCP tool is annotated destructiveHint: true as a whole, so read-only list calls will prompt. Splitting the annotation or reconsidering it is worth a look.
  • js/src/vsi.rs describes vsiList's long option as fetching metadata, but in WebAssembly builds details is a no-op.

Performance

  • copy_tree re-canonicalizes the destination root for every entry (crates/terrio/src/vsi.rs:1772, confidence high, low impact).
  • vsi::read loads whole remote objects into memory with no size guard. This is probably intended, but Python callers should know.

Security

  • No command-injection or secret-leak issues found. Subprocess calls in the scripts use list form. Zip/tar member paths are checked against .. and absolute names, and redaction covers SAS/signed URLs in diagnostics.

CLAUDE.md / AGENTS.md

  • md5.rs and zipdir.rs read as original implementations, so no NOTICE update is clearly required. Please confirm that the GDAL-derived behaviour is documented as behaviour rather than copied code.

I did not verify the PR's stated test results, and I did not run cargo fmt, Clippy or the tests.

Change size

Compared with the base branch: the whole PR against main (merge base 040b145 to PR head 66ebc15).

Measure Value
Files changed 39 (added 14, modified 25, removed 0, renamed 0)
Size before 824.9 KB
Size after 1.1 MB
Total size change +344.6 KB

Largest changes:

Path Before After Change
crates/terrio/src/vsi.rs 0 B 87.1 KB +87.1 KB
crates/terrio/src/vsi/tests.rs 0 B 46.4 KB +46.4 KB
crates/terrio/src/vsi/listing.rs 0 B 45.7 KB +45.7 KB
crates/terrio/src/http/store.rs 0 B 28.1 KB +28.1 KB
scripts/compare_vsi_with_gdal.py 0 B 27.3 KB +27.3 KB
crates/terrio-cli/tests/vsi.rs 0 B 24.7 KB +24.7 KB
crates/terrio/src/vsi/zipdir.rs 0 B 16.2 KB +16.2 KB
js/src/vsi.rs 0 B 10.8 KB +10.8 KB
docs/cli.md 108.9 KB 118.8 KB +9.8 KB
js/tests/node.test.mjs 107.5 KB 117.1 KB +9.7 KB
python/src/vsi.rs 0 B 7.2 KB +7.2 KB
crates/terrio-cli/src/cmd/vsi.rs 0 B 6.9 KB +6.9 KB
crates/terrio/src/http.rs 54.3 KB 48.4 KB −5.9 KB
python/tests/test_vsi.py 0 B 4.7 KB +4.7 KB
crates/terrio/src/vsi/md5.rs 0 B 4.7 KB +4.7 KB
docs/testing.md 55.6 KB 59.5 KB +3.9 KB
scripts/tests/test_vsi_conformance.py 0 B 3.2 KB +3.2 KB
crates/terrio/src/memfs.rs 6.0 KB 8.5 KB +2.4 KB
python/python/terrio/_terrio.pyi 49.2 KB 50.9 KB +1.7 KB
docs/javascript.md 21.7 KB 23.4 KB +1.7 KB

giswqs added a commit that referenced this pull request Oct 27, 2026
* perf(vsi): cut remote request and I/O costs deferred from #302

- Recursive S3 deletion sends up to 1000 keys per DeleteObjects request
  (POST ?delete, quiet mode, Content-MD5), reporting the first key the
  service failed to delete. Services without it, and keys XML cannot
  carry, get one DELETE per key, as before.
- Signed S3 uploads of local files up to 8 MiB read them once, into
  memory; uploads staged through a temporary file are hashed as they are
  staged. The signature still covers the payload (no UNSIGNED-PAYLOAD).
- Copying, synchronizing or describing a plain HTTP URL without a
  trailing slash requests one byte first; a response typed other than
  HTML is a file, without the index probe. Listings and URLs ending with
  a slash fetch the index page first, as before.
- The HTTP requests of one vsi operation share one ureq agent, so its
  connections and TLS sessions, including writes and listing pages.
- Remote archive members are read through one cached reader per
  operation instead of opening one (and fetching a first block) each.
- /vsimem/ moves re-key the shared bytes, and /vsimem/ archives and
  file reads use them in place, without copies.

Part of #335.

* fix(vsi): fail DeleteObjects errors, keep key order, hash only signed staging

DeleteObjects falls back to single deletes only when the service
answers 400, 405 or 501 (or a success without a DeleteResult); other
statuses are errors. Keys XML cannot carry are deleted between the
batches around them, keeping the key order. Staged uploads are hashed
only when they will be signed.

* docs(testing): update the DeleteObjects regression count

* fix(vsi): keep write-error hints for DeleteObjects, narrow its fallback

Only 405, 501 and a 400 whose code is NotImplemented or
MethodNotAllowed fall back to one DELETE per key, logged with
TERRIO_HTTP_LOG; other statuses go through the ordinary write-error
path, with its missing-credentials hint. Document batch-level failure
and ordering, and that a typed object named without its slash is a
file.

* refactor(vsi): name the operation scope, escape delete keys once

Rename HtmlCacheScope to OperationScope and document what it scopes.
DeleteObjects batches keep each key's XML text instead of escaping it
twice, and only 405 and 501 among the remaining statuses fall back.

* fix(vsi): delete S3 markers after the objects; slash before the query

Directory markers go in requests of their own, sent once every object
is deleted, so a failed batch no longer removes the markers above the
objects it left. A URL whose path ends with a slash before its query is
probed as an index first.

* fix(vsi): report DeleteObjects failure counts as lower bounds

The DeleteObjects reply is read up to 1 MiB, so with long keys the count
of failed keys can undercount. Word it as "at least N", as the first
failing key is always reported.

Add regression coverage for two paths: a 400 MalformedXML must fail the
delete rather than fall back to one DELETE per key, and a bare ?delete
subresource must be signed as "delete=". Rewrap the S3 deletion paragraph
in docs/cli.md and list the new check in docs/testing.md.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

Applied by the claude-autofix workflow.

---------

Co-authored-by: giswqs <5016453+giswqs@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant