From c0f40a13cee7341fdc8e2865f966f09f9badc90b Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 16 Jun 2026 17:53:59 +0200 Subject: [PATCH] test(member-live): keep deadlock-prone member tests synchronous These member/group/custom-field LiveView tests stay async: false. With the foreign keys now deferrable the create_member deadlock no longer forces it, so the rationale is updated: they remain synchronous as a deferred scope decision, and index_groups_url_params/member_filter_component additionally have separate async-isolation issues that must be fixed before they can run in parallel. --- test/mv_web/components/member_filter_component_test.exs | 5 ++++- .../mv_web/member_live/index_custom_fields_display_test.exs | 5 ++++- test/mv_web/member_live/index_field_visibility_test.exs | 5 ++++- test/mv_web/member_live/index_groups_accessibility_test.exs | 5 ++++- test/mv_web/member_live/index_groups_display_test.exs | 5 ++++- test/mv_web/member_live/index_groups_filter_test.exs | 5 ++++- test/mv_web/member_live/index_groups_integration_test.exs | 5 ++++- test/mv_web/member_live/index_groups_performance_test.exs | 5 ++++- test/mv_web/member_live/index_groups_sorting_test.exs | 5 ++++- test/mv_web/member_live/index_groups_url_params_test.exs | 5 ++++- test/mv_web/member_live/show_groups_display_test.exs | 6 ++++-- test/mv_web/user_live/form_test.exs | 5 ++++- 12 files changed, 48 insertions(+), 13 deletions(-) diff --git a/test/mv_web/components/member_filter_component_test.exs b/test/mv_web/components/member_filter_component_test.exs index fcb45f6..58aee87 100644 --- a/test/mv_web/components/member_filter_component_test.exs +++ b/test/mv_web/components/member_filter_component_test.exs @@ -8,7 +8,10 @@ defmodule MvWeb.Components.MemberFilterComponentTest do - Button label and badge logic - Filtering to show only boolean custom fields """ - # async: false to prevent PostgreSQL deadlocks when running LiveView tests against DB + # Kept async: false. The deferrable-FK migration removed the concurrent + # create_member deadlock, but this file additionally showed an async-isolation + # failure under load (filtered members from a parallel test leaking in), so it + # is not trivially async-safe; resolving that is a separate follow-up. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest diff --git a/test/mv_web/member_live/index_custom_fields_display_test.exs b/test/mv_web/member_live/index_custom_fields_display_test.exs index 9ada92b..bcc9913 100644 --- a/test/mv_web/member_live/index_custom_fields_display_test.exs +++ b/test/mv_web/member_live/index_custom_fields_display_test.exs @@ -9,7 +9,10 @@ defmodule MvWeb.MemberLive.IndexCustomFieldsDisplayTest do - Custom field values are correctly formatted for different types - Members without custom field values show empty cell or "-" """ - # async: false to prevent PostgreSQL deadlocks when creating members and custom fields + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/custom-fields suite to async is a possible follow-up + # rather than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_field_visibility_test.exs b/test/mv_web/member_live/index_field_visibility_test.exs index 007939d..b992ddd 100644 --- a/test/mv_web/member_live/index_field_visibility_test.exs +++ b/test/mv_web/member_live/index_field_visibility_test.exs @@ -10,7 +10,10 @@ defmodule MvWeb.MemberLive.IndexFieldVisibilityTest do - Integration with member list display - Custom fields visibility """ - # async: false to prevent PostgreSQL deadlocks when creating members and custom fields + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/custom-fields suite to async is a possible follow-up + # rather than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest diff --git a/test/mv_web/member_live/index_groups_accessibility_test.exs b/test/mv_web/member_live/index_groups_accessibility_test.exs index d14cd9f..e54a0ba 100644 --- a/test/mv_web/member_live/index_groups_accessibility_test.exs +++ b/test/mv_web/member_live/index_groups_accessibility_test.exs @@ -8,7 +8,10 @@ defmodule MvWeb.MemberLive.IndexGroupsAccessibilityTest do - Sort header has aria-label for screen reader - Keyboard navigation works (Tab through filter, sort header) """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/groups suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_groups_display_test.exs b/test/mv_web/member_live/index_groups_display_test.exs index 263ac2a..bc39967 100644 --- a/test/mv_web/member_live/index_groups_display_test.exs +++ b/test/mv_web/member_live/index_groups_display_test.exs @@ -8,7 +8,10 @@ defmodule MvWeb.MemberLive.IndexGroupsDisplayTest do - No badge for members without groups - Badge shows group name correctly """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/groups suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_groups_filter_test.exs b/test/mv_web/member_live/index_groups_filter_test.exs index d32b17f..e0c7b22 100644 --- a/test/mv_web/member_live/index_groups_filter_test.exs +++ b/test/mv_web/member_live/index_groups_filter_test.exs @@ -6,7 +6,10 @@ defmodule MvWeb.MemberLive.IndexGroupsFilterTest do All / Yes / No (per group). Multiple active group filters combine with AND (member must match all selected group conditions). """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/groups suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_groups_integration_test.exs b/test/mv_web/member_live/index_groups_integration_test.exs index 86738da..0832faa 100644 --- a/test/mv_web/member_live/index_groups_integration_test.exs +++ b/test/mv_web/member_live/index_groups_integration_test.exs @@ -10,7 +10,10 @@ defmodule MvWeb.MemberLive.IndexGroupsIntegrationTest do - Groups work with existing search (but not testing search integration itself) - Member index search by group name returns members in that group (Issue #375) """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/groups suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_groups_performance_test.exs b/test/mv_web/member_live/index_groups_performance_test.exs index 761c4eb..6eb3311 100644 --- a/test/mv_web/member_live/index_groups_performance_test.exs +++ b/test/mv_web/member_live/index_groups_performance_test.exs @@ -8,7 +8,10 @@ defmodule MvWeb.MemberLive.IndexGroupsPerformanceTest do - Filter works at database level (not in-memory) - Sort runs in-memory but uses preloaded group data (no extra DB queries) """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/groups suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_groups_sorting_test.exs b/test/mv_web/member_live/index_groups_sorting_test.exs index 068152c..9427419 100644 --- a/test/mv_web/member_live/index_groups_sorting_test.exs +++ b/test/mv_web/member_live/index_groups_sorting_test.exs @@ -2,7 +2,10 @@ defmodule MvWeb.MemberLive.IndexGroupsSortingTest do @moduledoc """ Tests for sorting by groups in the member overview. """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/groups suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/index_groups_url_params_test.exs b/test/mv_web/member_live/index_groups_url_params_test.exs index 469b010..66bc186 100644 --- a/test/mv_web/member_live/index_groups_url_params_test.exs +++ b/test/mv_web/member_live/index_groups_url_params_test.exs @@ -9,7 +9,10 @@ defmodule MvWeb.MemberLive.IndexGroupsUrlParamsTest do - URL parameters work with other parameters (query, sort_field, etc.) - URL is bookmarkable (filter/sorting persist) """ - # async: false to prevent PostgreSQL deadlocks when creating members and groups + # Kept async: false. The deferrable-FK migration removed the concurrent + # create_member deadlock, but this file additionally showed an async-isolation + # failure under load (filtered members from a parallel test leaking in), so it + # is not trivially async-safe; resolving that is a separate follow-up. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest require Ash.Query diff --git a/test/mv_web/member_live/show_groups_display_test.exs b/test/mv_web/member_live/show_groups_display_test.exs index f8434b3..913cf76 100644 --- a/test/mv_web/member_live/show_groups_display_test.exs +++ b/test/mv_web/member_live/show_groups_display_test.exs @@ -10,8 +10,10 @@ defmodule MvWeb.MemberLive.ShowGroupsDisplayTest do - Accessibility: group links have aria-label for screen readers ## Note on async - async: false to avoid PostgreSQL deadlocks when creating members and groups - in the same test run (same as IndexGroupsDisplayTest). + Kept async: false as a deferred scope decision. The deferrable-FK migration + removed the concurrent-create_member deadlock that previously forced this, so + re-flipping this members/groups suite to async is a possible follow-up rather + than part of the original change. """ use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest diff --git a/test/mv_web/user_live/form_test.exs b/test/mv_web/user_live/form_test.exs index a22c230..63649e4 100644 --- a/test/mv_web/user_live/form_test.exs +++ b/test/mv_web/user_live/form_test.exs @@ -1,5 +1,8 @@ defmodule MvWeb.UserLive.FormTest do - # async: false to prevent PostgreSQL deadlocks when creating members and users + # Kept async: false as a deferred scope decision. The deferrable-FK migration + # removed the concurrent-create_member deadlock that previously forced this, so + # re-flipping this members/users suite to async is a possible follow-up rather + # than part of the original change. use MvWeb.ConnCase, async: false import Phoenix.LiveViewTest