feat(privacy): Finish takes in edits nobody signed once the person agrees (ADR 0019)

Finishing a partly readable studyset counts the edits a device without
the keys wrote readable while it was made private, by kind (flashcards,
notes, learning paths, PDFs, studysets), and asks: taken in, they are
sealed with the tree's key as the person's; left, they stay locked (the
short reading of 22 Oct, finding 11). In English and German. Tests on the
real gateways both ways, and of the dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-22 10:38:43 +02:00
commit 991bef47eb
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -77,6 +77,23 @@ class FakeStudysetGateway() implements StudysetGateway {
@override
bool keysMissing = false;
/// The unsigned edits each studyset holds, by kind.
final unsigned = <String, Map<String, int>>{};
/// The studysets whose unsigned edits were taken in.
final adopted = <String>[];
@override
Future<Map<String, int>> unsignedEditsOf(String id) async =>
unsigned[id] ?? const {};
@override
Future<int> adoptUnsignedEdits(String id) async {
adopted.add(id);
unsigned.remove(id);
return 0;
}
@override
Future<int> setPrivate(String id, {required bool private}) async {
final tree = {id};