Latest Results
fix(io): emit canonical file:// URIs for Windows drive paths (#6817)
## Summary
Follow-up to #6791 / #6796. Both earlier PRs fixed Windows-path bugs in
specific call sites (the test helper, `S3CheckpointStore::put_bytes`).
This PR closes the loop on the matching emission side: `iter_dir` and a
few other helpers in `daft-io` were producing **non-canonical**
`file://` URIs on Windows drive-letter paths, which silently broke any
caller that string-compared the result against a canonically-built
prefix.
## Concrete failure
On Windows, an `S3CheckpointStore` is constructed against a canonical
prefix (`file:///C:/Users/.../tmp_XYZ`). Writes succeed via `put_bytes`,
which goes through `strip_file_uri_to_path` (handles both two- and
three-slash forms).
Reads call `glob_paths` → `daft_io::glob` → `iter_dir`. `iter_dir`
builds its emitted URI as:
```rust
filepath: format!("{LOCAL_PROTOCOL}{uri}") // "file://" + "C:/Users/..."
```
The result, `file://C:/Users/...` (two slashes), does not match the
canonical `file:///C:/Users/...` prefix the store was built with. In
`S3CheckpointStore::parse_id_from_manifest_path`:
```rust
let after_prefix = path.strip_prefix(&self.prefix)?.strip_prefix('/')?;
```
`strip_prefix` returns `None` for every entry → empty Vec → every
`get_checkpointed_keys` / `get_checkpointed_files` assertion on Windows
fails with `left: []`.
Net effect: 11 of 14 tests in `daft-checkpoint::tests::s3_store` red on
the Windows coverage job since #6791 + #6796 landed. POSIX is unaffected
because POSIX absolute paths start with `/`, so the same `format!`
already produces canonical `file:///tmp/...`.
## Fix
Add a `local_path_to_file_uri` helper alongside the existing
`strip_file_uri_to_path` (symmetric inverse). POSIX paths get two
slashes, Windows drive-letter paths get three.
Apply at every `daft-io` site that emits `file://` URIs:
- `iter_dir` file branch (the root cause)
- `iter_dir` dir-iteration branch (same bug for the directory variant)
- `parse_url` tilde-expansion fallback (`~/...`)
- `parse_url` `RelativeUrlWithoutBase` fallback
- `parse_url` Windows drive-letter scheme handler (`c:foo`)
Also switches `local::delete` from a hand-rolled
`strip_prefix("file://")` to `strip_file_uri_to_path` — same
Windows-drive-letter pitfall as the `put_bytes` issue fixed in #6796,
would silently break `delete` on Windows-canonical URIs.
## Test plan
- [x] `cargo test -p daft-io` — 61/61 pass locally (macOS).
- [x] `cargo test -p daft-checkpoint --test s3_store` — 14/14 pass
locally (macOS).
- [ ] Windows rust-tests on `main` should go from 3/14 to 14/14 after
merge.
## Lesson
The audit caught one defensive case: `local::delete` had the same
hand-rolled `strip_prefix("file://")` shape as the original `put_bytes`
bug. Per #6796's lesson, every URL-parsing call site should use the
canonical helpers — folded into this PR rather than left as a follow-up.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Latest Branches
0%
BABTUNA:feat/issue-components-labels 0%
XuQianJin-Stars:support-pylance-4.0.1 0%
XuQianJin-Stars:docs/add-cos-connector-docs © 2026 CodSpeed Technology