From c236a4c2df059c4f5ba4c6e4141c2ca1ab48aef1 Mon Sep 17 00:00:00 2001 From: aaltshuler Date: Thu, 11 Jun 2026 03:57:41 +0300 Subject: [PATCH] refactor(loader): load_jsonl helpers take &Omnigraph and document their role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The free helpers needlessly demanded &mut Omnigraph (every load API takes &self) and read as leftovers. Rather than rewriting their ~200 call sites across the test suites — which would have to re-derive the active-branch resolution at each site — keep the one convenience and make it honest: borrow immutably (&mut callers coerce, no churn) and document it as the active-branch shorthand over Omnigraph::load. Co-Authored-By: Claude Fable 5 --- crates/omnigraph/src/loader/mod.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/omnigraph/src/loader/mod.rs b/crates/omnigraph/src/loader/mod.rs index 0fabaea..09c2f7c 100644 --- a/crates/omnigraph/src/loader/mod.rs +++ b/crates/omnigraph/src/loader/mod.rs @@ -65,15 +65,18 @@ pub enum LoadMode { Merge, } -/// Load JSONL data into an Omnigraph database. -pub async fn load_jsonl(db: &mut Omnigraph, data: &str, mode: LoadMode) -> Result { +/// Convenience: load JSONL data onto the database handle's *active branch* +/// (`main` when unbound). Equivalent to `db.load(active_branch, data, mode)`; +/// use `Omnigraph::load`/`load_as` directly when targeting an explicit branch +/// or when fork-from-base semantics are needed. +pub async fn load_jsonl(db: &Omnigraph, data: &str, mode: LoadMode) -> Result { let current_branch = db.active_branch().await; let branch = current_branch.as_deref().unwrap_or("main"); db.load(branch, data, mode).await } -/// Load JSONL data from a file path. -pub async fn load_jsonl_file(db: &mut Omnigraph, path: &str, mode: LoadMode) -> Result { +/// Convenience: like [`load_jsonl`] but reading from a file path. +pub async fn load_jsonl_file(db: &Omnigraph, path: &str, mode: LoadMode) -> Result { let current_branch = db.active_branch().await; let branch = current_branch.as_deref().unwrap_or("main"); db.load_file(branch, path, mode).await