fix(import): say where a document was already imported, and to what

"Already imported" left the reader to guess what had been compared —
names, paths, contents — when the answer is the source keys, the same
overlap that decides whether a re-import merges. The title now names the
workspace holding it and the detail says what importing here would do.

The destination row also stopped wedging the kind and the name into one
value: the row's label carries the kind, so the value is just the name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-10 09:31:50 -07:00
co-authored by Claude Opus 5
parent 0f939a5a03
commit 3084882829
2 changed files with 20 additions and 13 deletions
+8 -5
View File
@@ -331,8 +331,8 @@ fn warn_if_imported_elsewhere(db: &ClientDb, plan: &mut ImportPlan) -> Result<()
}
let names = names.iter().map(String::as_str).collect::<BTreeSet<_>>();
plan.warnings.push(ImportPlanWarning::warning(
"Already imported",
format!("{} · importing here makes a second copy", display_list(&names)),
format!("This document is already imported into {}", display_list(&names)),
"Importing it here makes a second copy instead of updating that one",
));
Ok(())
}
@@ -1758,14 +1758,17 @@ mod tests {
let warning = elsewhere
.warnings
.iter()
.find(|w| w.title == "Already imported")
.find(|w| w.title == "This document is already imported into Imported")
.expect("copying a document that already landed somewhere is called out");
assert_eq!(warning.detail, "Imported · importing here makes a second copy");
assert_eq!(
warning.detail,
"Importing it here makes a second copy instead of updating that one"
);
// Merging back into the workspace it created is the whole point, so it says nothing.
let merging = replan(&query_manager, &workspace_id, imported_resources());
assert!(
merging.warnings.iter().all(|w| w.title != "Already imported"),
merging.warnings.iter().all(|w| !w.title.starts_with("This document is already")),
"{:?}",
merging.warnings
);