Fix remaining flaky tests (unordered search result, async log capture, delete modal) #598
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
security
technical improvement
UX Improvement
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
local-it/mitgliederverwaltung#598
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
#533 removed the structural cause of the earlier flakiness (FK deadlocks in
create_member). Threeother flaky tests remain. They fail only in full
just ci-dev/just checkruns, never in isolation,and on branches that do not touch the tested code. Each occurrence costs a full gate re-run
(about 6 minutes); finalizing #539 needed three full runs.
Observed failures
Mv.Membership.FuzzySearchTest"returns only John Doe by fuzzy query 'john'"Mv.Authorization.Checks.HasPermissionTest"logs authorization failure for missing role"assert log =~ "Authorization failed" or log == ""failshas_permission_test.exslog-capture testMvWeb.CustomFieldLive.DeletionTest"confirm deletion successfully deletes custom field with correct slug"All re-runs in isolation (including with the reported seed) were green.
Analysis so far
1. Order assertion on an unordered read —
FuzzySearchTesttest/mv/membership/fuzzy_search_test.exs:51asserts the exact order[john.id, alice.id].:searchread action (Mv.Membership.Member, preparationMember.Preparations.FuzzySearch,filter in
Member.Search) has no sort, so Postgres returns plan/heap order, which depends on table state.The file is
async: false; this is order-dependence on DB state, not concurrency.fuzzy_search/2return results by relevance?test/mv_web/member_export/scope_test.exs:52andtest/mv_web/member_export/scope_overview_parity_property_test.exs:203(fine if their code path sorts explicitly).2.
capture_login an async test —HasPermissionTestasync: true. The "Authorization failed" message is logged atdebug(
lib/mv/authorization/checks/has_permission.ex:374) whileconfig/test.exssetslevel: :warning,so normally nothing is captured and
log == ""passes.capture_logalso captures messages from other processes. Concurrent async tests emit[warning]lines (OIDC authentication failures, join-email failures — visible in every CI log). If onelands in the capture window,
logis non-empty without "Authorization failed" and the test fails.=~ X or == ""). Options:async: false, assert on the returnvalue only, or capture at
:debugand match the own message explicitly.3. LiveView modal not found —
CustomFieldLive.DeletionTestasync: true, helperopen_delete_modal/2. One occurrence so far; likely timing. Collect moreoccurrences before changing anything.
Scope
Logger.warningduring the capture), then fix.Acceptance criteria
FuzzySearchTestandHasPermissionTestpass deterministically across 10 distinct seeded full-suite runs.Member.Searchor the test).just ci-devgreen.Notes
On every new flake: keep the full log, read
_build/test/lib/mv/.mix_test_failuresbefore re-running,and add the seed and test name to this issue.