Skip to content

fix(groups): a member who left can be added back by the admin - #33

Merged
Henner4746 merged 2 commits into
mainfrom
fix/gruppe-wieder-aufnehmen
Nov 30, 2026
Merged

Henner4746 merged 2 commits into
mainfrom
fix/gruppe-wieder-aufnehmen

Conversation

@Henner4746

Copy link
Copy Markdown
Owner

Fixes the first high-severity finding of the Linux QA report from 16–18 Nov 2026 (T1-GRP-003, confirmed by all three testers).

Problem

After a member leaves a group and the admin adds them back, the member's client keeps believing it is out. Every later group state is dropped by if (alt.verlassen) return; in _nimmGruppenStand. Messages to the member stay at one tick forever, the member receives nothing and the admin sees no error.

That early return was deliberate (25.09.2026): an admin who has not yet processed the leave keeps announcing the member in later states (a rename, for example), and those stale states used to pull the member back in. But it also blocked every legitimate re-add.

Fix

  • The admin records in which group version a member was added: field j (address → version) in the announced state, only for members added after creation. A group without such members gets exactly the same state text as before.
  • A member who left (at version v) accepts a state again only if it lists them with an add version greater than v. A stale state from an admin who has not seen the leave still carries the old add version, so the member stays out, as before.
  • Persisted in a new column gruppen.aufgenommen (schema 17, repeatable like the earlier steps). Every member stores it, so a successor admin keeps announcing it.
  • Older apps ignore j: with an old admin or an old member nothing changes compared to today.
  • The admin rule stays strict: only the known admin (or the computed successor, same rule as before) can re-add someone.
  • "Leave group" now asks for confirmation first (the report noted that leaving had no confirmation).

Tests

  • test/net/gruppen_test.dart: real relay, three cores. Bob leaves, Anna adds him back, then Anna's message reaches Bob and gets two ticks, and Bob's reply reaches Carl. On main this test fails ("bob kennt die Gruppe nicht"); with the fix it passes.
  • test/net/protokoll_befunde_test.dart (M3): re-add is accepted, a stale state with the old add version (3 or 4 for a member who left at 4) keeps the member out, and a non-admin cannot re-add.
  • test/core/protokoll_befunde_test.dart: Gruppe.lies with j (round trip, unchanged text without it, malformed values make the state invalid).
  • test/store/schema17_test.dart: migration keeps existing groups and gives them NULL, repeatable, read/write/clear.

Run in CT 107 (Flutter 3.44.8, Linux): flutter analyze shows only the 29 existing hints; the five touched test files pass (63 tests).

Not covered

  • A member who left while running an old app still ignores the re-add (nothing the new admin client can do about it).
  • Group messages from other members that arrive before the admin's re-add state are dropped by the re-added member, as for any non-member.

🤖 Generated with Claude Code

Henner4746 and others added 2 commits November 22, 2026 23:38
The member's client ignored every group state after leaving, so a member
the admin re-added stayed out forever: all group messages to them stayed at
one tick and the admin saw no error (QA report 2026-11-18, T1-GRP-003).

The admin now records in which version a member was added (field "j" in
the group state, schema 17 column gruppen.aufgenommen). A stale state from an
admin who has not processed the leave yet still carries the old add version
and keeps the member out, as before. A real re-add carries a version higher
than the one the member left at and brings them back. Older apps ignore the
field and keep the old behaviour.

Leaving a group now asks for confirmation first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Henner4746 added a commit that referenced this pull request Nov 30, 2026
…dialog

The tests from #41, #50 and #51 were written before #46 added the
"Continue without protection?" question, and the payment test pinned
schema 16, which #33 raised to 17 for group re-adds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Henner4746
Henner4746 merged commit 5cbb0af into main Nov 30, 2026
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant