Add document embedding and retrieval via a dedicated embedding model #10

Merged
schaefera merged 10 commits from worktree-deep-research-max-turns-report into master 2026-08-19 15:37:33 +00:00
Showing only changes of commit ba9b61fcf3 - Show all commits

View file

@ -237,11 +237,29 @@ mod tests {
assert_eq!(documents[1].text, "scanned"); assert_eq!(documents[1].text, "scanned");
} }
/// Unix permission bits are meaningless to a root process — it can read
/// anything regardless of mode — so the two `chmod 0o000` tests below
/// would fail under a root-run CI container (e.g. an unmodified Docker
/// base image) despite the code being correct. Skip rather than assert
/// behavior the OS isn't actually enforcing.
#[cfg(unix)]
fn running_as_root() -> bool {
unsafe extern "C" {
fn geteuid() -> u32;
}
unsafe { geteuid() == 0 }
}
#[cfg(unix)] #[cfg(unix)]
#[test] #[test]
fn collect_documents_skips_an_unreadable_file_inside_a_directory_but_keeps_the_rest() { fn collect_documents_skips_an_unreadable_file_inside_a_directory_but_keeps_the_rest() {
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
if running_as_root() {
eprintln!("skipping: running as root, chmod 0o000 has no effect");
return;
}
let dir = tempdir().unwrap(); let dir = tempdir().unwrap();
let readable = dir.path().join("readable.txt"); let readable = dir.path().join("readable.txt");
let unreadable = dir.path().join("unreadable.txt"); let unreadable = dir.path().join("unreadable.txt");
@ -263,6 +281,11 @@ mod tests {
fn collect_documents_fails_outright_on_an_unreadable_directory() { fn collect_documents_fails_outright_on_an_unreadable_directory() {
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
if running_as_root() {
eprintln!("skipping: running as root, chmod 0o000 has no effect");
return;
}
let dir = tempdir().unwrap(); let dir = tempdir().unwrap();
std::fs::set_permissions(dir.path(), std::fs::Permissions::from_mode(0o000)).unwrap(); std::fs::set_permissions(dir.path(), std::fs::Permissions::from_mode(0o000)).unwrap();