feat(studyset): deleted studysets wait 14 days in Recently deleted

Deleting a studyset blanked it with everything inside it once a
four-second Undo was over. It now only marks it (`studyset.deletedAt`, a
column as `archivedAt`): it leaves every list, count and session with
what is inside it and waits in the library's Recently deleted for 14
days, saying how many are left, with Restore and Delete now. Deleting no
longer asks first and offers Undo; Delete now asks. Once the 14 days are
over, whichever of the person's devices looks next (as their data opens,
after every sync) deletes it for good, blanking first as before; the
server can't blank a payload and never writes a person's space (ADR
0007). The connector, publishing and the learner count leave deleted
studysets out too.

The migration adds one nullable column: app versions before it stop
syncing until they update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-12 18:50:10 +02:00
commit 4644125cc4
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -605,6 +605,32 @@ void main() {
expect(published.releases.single.cardCount, 1);
});
test('a studyset waiting in Recently deleted is left out with '
'everything inside it, and not published itself', () async {
await profile(alice, 'alice');
final content = await japanese(alice);
// Set as a device's deletion sets it; in SQL, as the test above
// writes.
Future<void> delete(UuidValue studyset) => session.db.unsafeExecute(
'UPDATE "studyset" SET "deletedAt" = now() WHERE "id" = @id',
parameters: QueryParameters.named({'id': studyset.uuid}),
);
await delete(content.kanji);
final published = await publish(alice, content.root);
expect(
await git(published.publicId, ['ls-tree', '--name-only', 'v1']),
isNot(contains(content.kanji.uuid)),
);
expect(published.releases.single.cardCount, 1);
await delete(content.root);
await expectLater(
publish(alice, content.root),
throwsA(isA<NotFoundException>()),
);
});
test('its name is lower-case letters, digits and hyphens, one per '
'studyset of its person, and fixed from the first publish', () async {
await profile(alice, 'alice');