perf(import): reuse auto-created groups across import chunks

This commit is contained in:
Moritz 2026-06-03 02:32:15 +02:00
parent 68a1a9530a
commit 118b9f8d57
5 changed files with 90 additions and 3 deletions

View file

@ -3,6 +3,24 @@ defmodule Mv.Membership.Import.ImportRunnerTest do
alias Mv.Membership.Import.ImportRunner
describe "carry_groups_forward/2" do
test "replaces import_state groups_found with the chunk's grown snapshot" do
import_state = %{groups_found: [%{id: "1", name: "A"}]}
chunk_result = %{groups_found: [%{id: "1", name: "A"}, %{id: "2", name: "B"}]}
assert ImportRunner.carry_groups_forward(import_state, chunk_result) == %{
groups_found: [%{id: "1", name: "A"}, %{id: "2", name: "B"}]
}
end
test "leaves import_state unchanged when the chunk result omits groups_found" do
import_state = %{groups_found: [%{id: "1", name: "A"}], other: :kept}
chunk_result = %{inserted: 1}
assert ImportRunner.carry_groups_forward(import_state, chunk_result) == import_state
end
end
describe "read_file_entry/2" do
test "returns {:ok, content} for a readable file" do
path =