fix: fetch http(s) type: file vector sources, reject other schemes#149
Merged
Conversation
Validation accepted `s3://` and `http(s)://` paths, but `FBinReader::new` only opened local paths and unwrapped, so a URL panicked at upload time. Now http(s) paths download through the dataset downloader (cached under `$BFB_DATASETS_DIR/files/`), other schemes are rejected up front, and `FBinReader::new` returns `Result`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes source: { type: file } vector sources safer and more flexible by supporting remote HTTP(S) .fbin files via a download+cache path, rejecting non-HTTP(S) URL schemes during config validation, and eliminating panics when opening vector files.
Changes:
- Make
FBinReader::newfallible and propagate errors instead of panicking on open/mmap failures. - Add
ensure_local_fileto download/cache HTTP(S)type: filevector sources and update generators to use it. - Centralize file-source path validation (including scheme rejection) and add tests/docs for remote file sources.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/upload.rs | Propagates FBinReader open failures instead of panicking. |
| src/generators/queries.rs | Resolves VectorSource::File paths via ensure_local_file before reading .fbin. |
| src/generators/config.rs | Uses ensure_local_file for config-driven uploads and adds a test for remote .fbin vectors. |
| src/fbin_reader.rs | Converts .fbin reader construction to Result and adds basic header-length validation. |
| src/dataset/mod.rs | Re-exports download helpers and adds a small HTTP test server module for download-path tests. |
| src/dataset/download.rs | Implements remote-file detection, download-to-cache for file sources, and related tests. |
| src/config/search.rs | Switches to shared validate_file_source_path for search-config validation. |
| src/config/schema.rs | Updates schema docs to reflect HTTP(S) file-source support (and removal of s3://). |
| src/config/mod.rs | Adds validate_file_source_path and tests for scheme acceptance/rejection. |
| examples/upload-config.yaml | Documents HTTP(S) URL support and caching behavior for file vector sources. |
Comments suppressed due to low confidence (1)
src/fbin_reader.rs:5
size_ofis used in this file but not imported, which will fail to compile. Import it alongsidetransmute(or fully-qualify the calls).
use std::fs::OpenOptions;
use std::mem::transmute;
use std::path::Path;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1d401a6 to
4c64a97
Compare
timvisee
approved these changes
Jul 14, 2026
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.
Allow https:// url only, reject s3://.
All Submissions:
devbranch. Did you create your branch fromdev?