From b2ced48cc539686ff8d8d2518fa8eb9dba8312aa Mon Sep 17 00:00:00 2001 From: Chili Palmer Date: Fri, 1 May 2026 18:54:14 +0200 Subject: [PATCH] feat: alignment on import conflict resolution terms --- ALIGNMENT.md | 2 +- lib/bds/desktop/shell_live/import_editor.ex | 12 ++++++++++-- .../shell_live/import_editor/analysis_state.ex | 5 +++-- specs/editor_misc.allium | 6 +++--- test/bds/desktop/import_shell_live_test.exs | 18 ++++++++++++++++++ 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ALIGNMENT.md b/ALIGNMENT.md index 506a2e2..93963c9 100644 --- a/ALIGNMENT.md +++ b/ALIGNMENT.md @@ -61,7 +61,7 @@ Goal: align bDS2 with old bDS behavior. Use the Allium specs as the contract onl - Spec: duplicates `ImportMediaRequested` with conflicting argument order across media specs. - Action: normalize media specs to one event shape: source path plus project/context, with optional metadata where relevant. -## P2: Import Conflict Resolution Terms +## P2: Import Conflict Resolution Terms (done) - Old bDS: conflict resolutions are `ignore`, `overwrite`, and `import`. - bDS2 now: accepts/normalizes `skip -> ignore` and `merge -> overwrite`. diff --git a/lib/bds/desktop/shell_live/import_editor.ex b/lib/bds/desktop/shell_live/import_editor.ex index e1d4caf..71b1031 100644 --- a/lib/bds/desktop/shell_live/import_editor.ex +++ b/lib/bds/desktop/shell_live/import_editor.ex @@ -583,8 +583,8 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do @@ -883,4 +883,12 @@ defmodule BDS.Desktop.ShellLive.ImportEditor do defp present?(value), do: value not in [nil, ""] defp blank?(value), do: value in [nil, ""] + + defp conflict_resolution_selected?(item, "ignore") do + Map.get(item, :resolution, "ignore") in ["ignore", "skip"] + end + + defp conflict_resolution_selected?(item, "overwrite") do + Map.get(item, :resolution) in ["overwrite", "merge"] + end end diff --git a/lib/bds/desktop/shell_live/import_editor/analysis_state.ex b/lib/bds/desktop/shell_live/import_editor/analysis_state.ex index de4cfee..e6e6574 100644 --- a/lib/bds/desktop/shell_live/import_editor/analysis_state.ex +++ b/lib/bds/desktop/shell_live/import_editor/analysis_state.ex @@ -230,11 +230,12 @@ defmodule BDS.Desktop.ShellLive.ImportEditor.AnalysisState do def importable_entity_count(items) do Enum.count(items || [], fn item -> item.status == "new" or - (item.status == "conflict" and - Map.get(item, :resolution, "ignore") not in ["ignore", "skip"]) + (item.status == "conflict" and conflict_importable?(Map.get(item, :resolution, "ignore"))) end) end + defp conflict_importable?(resolution), do: resolution in ["overwrite", "merge", "import"] + @spec detail_items(term(), term()) :: term() def detail_items(nil, _bucket), do: [] diff --git a/specs/editor_misc.allium b/specs/editor_misc.allium index 101ab3b..60774a7 100644 --- a/specs/editor_misc.allium +++ b/specs/editor_misc.allium @@ -697,7 +697,7 @@ value ImportYearDistribution { value ImportConflict { item_type: String -- post | page | media item_name: String - resolution: String -- import | skip | merge + resolution: String -- ignore | overwrite | import } value ImportMacro { @@ -745,8 +745,8 @@ surface ImportAnalysisSurface { -- Year-by-year bar charts for posts + media. @guarantee ConflictsSection - -- Collapsible. Per-item dropdown: Import/Skip/Merge. - -- Default: Import for new items, Skip for existing matches. + -- Collapsible. Per-item dropdown: Ignore/Overwrite/Import. + -- Default: Import for new items, Ignore for existing matches. @guarantee TaxonomySection -- Collapsible. Category + tag pills. diff --git a/test/bds/desktop/import_shell_live_test.exs b/test/bds/desktop/import_shell_live_test.exs index 9f15a3e..813d303 100644 --- a/test/bds/desktop/import_shell_live_test.exs +++ b/test/bds/desktop/import_shell_live_test.exs @@ -56,6 +56,11 @@ defmodule BDS.Desktop.ImportShellLiveTest do assert html =~ "Ready to import:" assert html =~ "Import 5 Items" assert html =~ "Post Slug Conflicts" + assert html =~ ~s(