fix(inbounds): scale bulk client attachment selection (#7243)

With around 10,000 clients both attach dialogs loaded every client, pre-selected all of them and rendered every row, which locked the browser for minutes.

Both dialogs now ask the server for 100 rows at a time and render only the visible ones. Select All freezes the eligible client IDs that match the current search and group into a small server-issued token; the browser keeps that token plus the clients the operator unticked instead of thousands of emails, and the listing marks each row against the frozen filter so rows outside it stay unselected. On submit the server re-derives the same set and rejects the job before any write when its membership changed; clients created after the freeze stay outside it. The attach runs as a background job the dialog polls for counts.

Requests that post an email list keep their synchronous response. The Postgres job now runs the selection tests, which build their predicates by hand for both dialects.

Fixes #7236
This commit is contained in:
Hamed
2026-11-28 18:00:53 +03:30
committed by GitHub
parent 9088b8a768
commit 75dc6dc61c
34 changed files with 2643 additions and 492 deletions
+10
View File
@@ -163,6 +163,16 @@ jobs:
exit 1
fi
- name: PostgreSQL attach candidate selection
run: |
set -o pipefail
go test ./internal/web/service -run '^Test(AttachCandidatesSelection|FrozenAttachSelectionFollowsFilter)Postgres$' -count=1 -v | tee /tmp/postgres-attach-selection.log
passed=$(grep -c -- '^--- PASS' /tmp/postgres-attach-selection.log || true)
if [ "$passed" -ne 2 ]; then
echo "expected 2 passing PostgreSQL attach selection tests, got $passed" >&2
exit 1
fi
- name: PostgreSQL depletion query regressions
run: |
set -o pipefail