House rules: primary constructors, a cancellation token on every async call, and the rules fail the build
Build / Build (push) Successful in 30s

- Services, controllers and jobs take their dependencies through primary
  constructors and use them directly; where a method already named a local
  after a dependency, the dependency takes its type's name.
- Every async method takes a CancellationToken last and passes it down to
  MongoDB, HTTP and the job queue. The setup claim is still given back when
  a request is cancelled.
- The federation and media options are read through IOptionsMonitor.
- The Mastodon entities keep sending "" for empty strings, and every model
  field where null means something says so.
- The inbox's 503 with Retry-After, which other servers retry, is the one
  server error left, and says why.
- Arasaka.HouseRules.Analyzers checks all of this in every build, here and in
  PrivaPub.ClientModels as decePubClient builds it.

Checked against GoToSocial in the pasture: 64 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-11-10 01:24:43 +01:00
1 parent f0a14c737f
commit 0f73f69239
176 files changed
+2789 -3974

No files matched your search

+8 -16
View File
@@ -14,30 +14,22 @@ namespace PrivaPub.Services
// is deleted (PersonaRemoval: each group it owns, a Delete of the actor to everyone who follows it and everyone it
// follows, its posts emptied, its name kept reserved and its documents answering 410). The root's sessions end first, so
// nothing acts as it while it goes, and it keeps only a deleted-{id} name.
public class RootRemoval : IRootRemoval
public class RootRemoval(
DbEntities dbEntities,
IRootSessions sessions,
IPersonaRemoval personas) : IRootRemoval
{
readonly DbEntities _dbEntities;
readonly IRootSessions _sessions;
readonly IPersonaRemoval _personas;
public RootRemoval(DbEntities dbEntities, IRootSessions sessions, IPersonaRemoval personas)
{
_dbEntities = dbEntities;
_sessions = sessions;
_personas = personas;
}
public async Task<bool> Remove(string rootId, CancellationToken token)
{
var root = await _dbEntities.RootUsers.MatchID(rootId).Match(u => u.DeletedAt == null).ExecuteFirstAsync(token);
var root = await dbEntities.RootUsers.MatchID(rootId).Match(u => u.DeletedAt == null).ExecuteFirstAsync(token);
if (root == default)
return false;
await _sessions.Revoke(root.ID, token);
await sessions.Revoke(root.ID, token);
var now = DateTime.UtcNow;
var avatarIds = (await _dbEntities.RootToAvatars.Match(ra => ra.RootId == root.ID).ExecuteAsync(token)).Select(ra => ra.AvatarId).ToList();
var avatarIds = (await dbEntities.RootToAvatars.Match(ra => ra.RootId == root.ID).ExecuteAsync(token)).Select(ra => ra.AvatarId).ToList();
foreach (var avatarId in avatarIds)
await _personas.Remove(avatarId, token);
await personas.Remove(avatarId, token);
await DB.Default.Update<RootUser>().MatchID(root.ID)
.Modify(u => u.UserName, $"deleted-{root.ID}")//unique, so a second deletion never collides with the first