[client] F22a: forget_contact, for Remove person #16

Closed
mnovak wants to merge 0 commits from feature/forget-contact into main
Owner

Client::forget_contact, for Amicitia's Remove person (F22). It deletes the contact's MLS group from OpenMLS's storage, drops its name and tokens, and stops fetching its mailbox. The other side is not told. Analysis: .agents/features/client-state.md, test 10. No change to PROTOCOL.md.

**`Client::forget_contact`**, for Amicitia's *Remove person* (F22). It deletes the contact's MLS group from OpenMLS's storage, drops its name and tokens, and stops fetching its mailbox. The other side is not told. Analysis: `.agents/features/client-state.md`, test 10. No change to `PROTOCOL.md`.
mnovak added 1 commit 2026-11-16 02:09:09 +01:00
mnovak reviewed 2026-11-16 02:09:09 +01:00
mnovak left a comment
Author
Owner

Adversarial self-review — forget_contact

Evidence

What Result
cargo test --workspace --locked (Windows) client 25 (2 + 8 + 1 + 14 state), protocol 14, relay 17: 56 passed, 0 failed
The client tests on the Android emulator (amicitia_test, Android 15, x86_64) 25 passed, 0 failed
Clippy (-D warnings), fmt clean
Planted bugs 12/13 (the two new ones caught; the miss is the equivalent one from PR #15)
New planted bug Caught by
the MLS group kept in storage a forgotten contact leaves nothing behind: putting the contact back into the snapshot must be refused, and was not
the contact kept altogether the same test: the name is still in the snapshot

Not verified

  • That OpenMLS's MlsGroup::delete removes every key of the group. The test shows the group cannot be loaded again, not that no byte of it is left. Signature keys are ours and shared by all groups, so they stay, as they should.

Verdict

Merging.

## Adversarial self-review — forget_contact ### Evidence | What | Result | |:--|:--| | `cargo test --workspace --locked` (Windows) | client **25** (2 + 8 + 1 + 14 state), protocol **14**, relay **17**: **56 passed, 0 failed** | | The client tests on the Android emulator (`amicitia_test`, Android 15, x86_64) | **25 passed, 0 failed** | | Clippy (`-D warnings`), fmt | clean | | Planted bugs | **12/13** (the two new ones caught; the miss is the equivalent one from PR #15) | | New planted bug | Caught by | |:--|:--| | the MLS group kept in storage | *a forgotten contact leaves nothing behind*: putting the contact back into the snapshot must be refused, and was not | | the contact kept altogether | the same test: the name is still in the snapshot | ### Not verified - That OpenMLS's `MlsGroup::delete` removes *every* key of the group. The test shows the group cannot be loaded again, not that no byte of it is left. Signature keys are ours and shared by all groups, so they stay, as they should. ### Verdict Merging.
@@ -304,0 +305,4 @@
/// client, and its mailbox is no longer fetched. The other side is not told, and anything it
/// still posts waits on the relay until it expires. Save the snapshot after it. Returns whether
/// there was such a contact.
pub fn forget_contact(&mut self, contact: ContactId) -> Result<bool, ClientError> {
Author
Owner

F1 — the other side is not told. Nothing is posted. What they send afterwards waits on the relay until the 30-day expiry, unread. That matches Remove person being local, and block is silent (PROTOCOL.md section 3). If they should be stopped from posting at all, that is block (F24): rotating the post token.

**F1 — the other side is not told.** Nothing is posted. What they send afterwards waits on the relay until the 30-day expiry, unread. That matches *Remove person* being local, and *block is silent* (`PROTOCOL.md` section 3). If they should be stopped from posting at all, that is block (F24): rotating the post token.
@@ -304,0 +310,4 @@
return Ok(false);
};
let mut c = self.contacts.remove(index);
c.group
Author
Owner

F2 — a failure part-way. The contact is removed from the list before the group is deleted. If deleting fails, the call returns State with the contact already gone from memory, and its group partly left in storage. The app saves the snapshot only on success, so the stored state stays whole, and a retry after a restart deletes it again.

**F2 — a failure part-way.** The contact is removed from the list before the group is deleted. If deleting fails, the call returns `State` with the contact already gone from memory, and its group partly left in storage. The app saves the snapshot only on success, so the stored state stays whole, and a retry after a restart deletes it again.
@@ -431,0 +436,4 @@
/// Forgetting a contact leaves no name in the snapshot, stops fetching its mailbox, and survives a
/// restart; the other contacts are untouched.
#[test]
fn a_forgotten_contact_leaves_nothing_behind() {
Author
Owner

F3 — what the test proves. The name is gone from the snapshot's bytes, and the group's state is gone from storage (a snapshot with the contact put back is refused). The mailbox is no longer fetched (the message waits), and the other contacts still work after a restart.

**F3 — what the test proves.** The name is gone from the snapshot's bytes, and the group's state is gone from storage (a snapshot with the contact put back is refused). The mailbox is no longer fetched (the message waits), and the other contacts still work after a restart.
Author
Owner

Merged into main with --no-ff as 2a8daa7570 (remote hash verified). The self-review is on this PR.

Merged into `main` with `--no-ff` as 2a8daa75707cdf08f1514b5081ef34c3f453fcd9 (remote hash verified). The self-review is on this PR.
mnovak closed this pull request 2026-11-16 02:09:23 +01:00
Some checks are pending
ci / check (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.