Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/archive/src/adapter/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::collections::HashMap;
use std::future::Future;
use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::time::Instant;

use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -481,6 +480,13 @@ impl Adapter for ScriptAdapter {
.stderr
.take()
.ok_or_else(|| Error::AdapterSync("failed to open stderr".into()))?;
// Best-effort: drain stderr so the child can't block on a full pipe.
tokio::spawn(async move {
let mut err_reader = BufReader::new(stderr).lines();
while let Ok(Some(line)) = err_reader.next_line().await {
tracing::warn!(line = %line, "adapter stderr");
}
});

let config_json = serde_json::to_string(config)
.map_err(|e| Error::AdapterSync(format!("failed to serialize config: {e}")))?;
Expand Down
16 changes: 8 additions & 8 deletions crates/archive/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::fmt::Write;

use crate::error::{Error, Result};
use crate::schema::{DataTypeSchema, RelationsDef};
use crate::schema::DataTypeSchema;

fn pluralize(name: &str) -> String {
format!("{name}s")
Expand Down Expand Up @@ -572,10 +572,10 @@ impl SourceDb {

if let Some(ref temp) = temporal {
if let Some(date_field) = &self.schema.search.date_field {
if let Some(after) = temp.date_after {
if let Some(_after) = temp.date_after {
sql.push_str(&format!(" AND t.\"{}\" >= ?", date_field));
}
if let Some(before) = temp.date_before {
if let Some(_before) = temp.date_before {
sql.push_str(&format!(" AND t.\"{}\" <= ?", date_field));
}
}
Expand All @@ -586,12 +586,12 @@ impl SourceDb {
let mut q = sqlx::query_as::<_, FtsHitRow>(&sql).bind(query);

if let Some(ref temp) = temporal {
if let Some(date_field) = &self.schema.search.date_field {
if temp.date_after.is_some() {
q = q.bind(temp.date_after.unwrap());
if self.schema.search.date_field.is_some() {

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, but is_some() + unwrap() here is a bit brittle/less idiomatic; if let keeps it simple and avoids accidental unwraps if this block ever gets edited.

Suggested change
if self.schema.search.date_field.is_some() {
if let Some(ref temp) = temporal {
if self.schema.search.date_field.is_some() {
if let Some(after) = temp.date_after {
q = q.bind(after);
}
if let Some(before) = temp.date_before {
q = q.bind(before);
}
}
}

if let Some(after) = temp.date_after {
q = q.bind(after);
}
if temp.date_before.is_some() {
q = q.bind(temp.date_before.unwrap());
if let Some(before) = temp.date_before {
q = q.bind(before);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/archive/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use std::path::PathBuf;
use std::sync::Arc;

use crate::adapter::script::{ConfigField, ScriptAdapter};
use crate::adapter::{Adapter, AdapterRegistry, AdapterUpdateResult, SyncReport};
use crate::adapter::script::ScriptAdapter;
use crate::adapter::{Adapter, AdapterRegistry, SyncReport};
use crate::embed::EmbeddingModel;
use crate::error::{Error, Result};
use crate::registry::{NewSource, Registry, SourceInfo};
Expand Down
5 changes: 1 addition & 4 deletions crates/archive/src/schema/migration.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! Schema migration: detect changes, apply safe migrations, refuse destructive ones.

use std::collections::HashMap;

use crate::error::{Error, Result};
use crate::schema::{DataTypeSchema, FieldType, ModelDef};
use crate::schema::DataTypeSchema;

/// Result of a schema migration attempt.
#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion crates/archive/src/search/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use std::sync::Arc;

use crate::db::{FtsHit, TemporalFilter};
use crate::db::TemporalFilter;
use crate::embed::EmbeddingModel;
use crate::error::Result;
use crate::registry::Registry;
Expand Down
1 change: 0 additions & 1 deletion crates/archive/src/search/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use std::path::Path;

use crate::embed::EMBEDDING_DIM;
use crate::error::Result;

/// Stub vector store (does nothing).
Expand Down
4 changes: 2 additions & 2 deletions crates/archive/src/source.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! SourceManager: manages source folders and their databases.

use std::path::{Path, PathBuf};
use std::path::PathBuf;

use crate::db::SourceDb;
use crate::error::{Error, Result};
Expand Down Expand Up @@ -106,7 +106,7 @@ impl SourceManager {
// Apply safe migrations
for action in &migration_result.applied {
match action {
crate::schema::migration::MigrationAction::AddTable { name } => {
crate::schema::migration::MigrationAction::AddTable { name: _ } => {
// Regenerate full DDL — SQLite doesn't support CREATE TABLE IF NOT EXISTS
// for adding new tables, so we run the full DDL and let it no-op for existing tables
let ddl = generate_ddl(current_schema);
Expand Down
11 changes: 11 additions & 0 deletions packages/interface/src/ShellLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ function ShellLayoutContent() {
return null;
}, [params.locationId, locationsQuery.data, currentPath]);

useEffect(() => {

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 a global document handler; it will also affect the web build (and non-Windows desktop) by disabling middle-click default behavior everywhere. Might be worth gating to Tauri+Windows only.

Suggested change
useEffect(() => {
useEffect(() => {
if (platform.platform !== 'tauri' || !navigator.userAgent.includes('Windows')) return;
// Prevent WebView2 (Windows) from entering autoscroll mode on middle-click,
// which causes forward-navigation after browser history traversal (#3008).
const preventMiddleClickScroll = (e: MouseEvent) => {
if (e.button === 1) e.preventDefault();
};
document.addEventListener('mousedown', preventMiddleClickScroll, { passive: false });
return () => document.removeEventListener('mousedown', preventMiddleClickScroll);
}, [platform.platform]);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

made suggested changes and updated

if (platform.platform !== 'tauri' || !navigator.userAgent.includes('Windows')) return;
// Prevent WebView2 (Windows) from entering autoscroll mode on middle-click,
// which causes forward-navigation after browser history traversal (#3008).
const preventMiddleClickScroll = (e: MouseEvent) => {
if (e.button === 1) e.preventDefault();
};
document.addEventListener('mousedown', preventMiddleClickScroll, {passive: false});
return () => document.removeEventListener('mousedown', preventMiddleClickScroll);
}, [platform.platform]);

useEffect(() => {
// Listen for inspector window close events
if (!platform.onWindowEvent) return;
Expand Down