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

@@ -29,7 +29,9 @@
public List<object> Roles { get; set; } = new();
public bool? Memorial { get; set; }
public bool? Limited { get; set; }//silenced by this server's staff, or its server silenced (Mastodon's `limited`)
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string AvatarDescription { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string HeaderDescription { get; set; } = string.Empty;
public List<Field> Fields { get; set; } = new();
public Source Source { get; set; }
@@ -57,6 +59,7 @@
public string Privacy { get; set; } = "public";
public bool Sensitive { get; set; }
public string Language { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Note { get; set; } = string.Empty;
public List<Field> Fields { get; set; } = new();
public int FollowRequestsCount { get; set; }
@@ -225,7 +228,9 @@
public class FilterResultEntity
{
public FilterEntity Filter { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0006", Justification = "The Mastodon API sends null when no keyword of the filter matched.")]
public List<string> KeywordMatches { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0006", Justification = "The Mastodon API sends null when no status of the filter matched.")]
public List<string> StatusMatches { get; set; }
}
@@ -263,6 +268,7 @@
public int VotesCount { get; set; }
public int? VotersCount { get; set; }
public bool? Voted { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0006", Justification = "The Mastodon API leaves own_votes null for a viewer who is not signed in.")]
public List<int> OwnVotes { get; set; }
public List<PollOptionEntity> Options { get; set; } = new();
public List<CustomEmojiEntity> Emojis { get; set; } = new();
@@ -277,18 +283,27 @@
public class PreviewCard
{
public string Url { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Title { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Description { get; set; } = string.Empty;
public string Type { get; set; } = "link";
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string AuthorName { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string AuthorUrl { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string ProviderName { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string ProviderUrl { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Html { get; set; } = string.Empty;
public int Width { get; set; }
public int Height { get; set; }
public string Image { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string ImageDescription { get; set; } = string.Empty;
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string EmbedUrl { get; set; } = string.Empty;
public string Blurhash { get; set; }
public string Language { get; set; }
@@ -305,6 +320,7 @@
public string InReplyToId { get; set; }
public string InReplyToAccountId { get; set; }
public Status Reblog { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Content { get; set; } = string.Empty;
public string CreatedAt { get; set; }
public string EditedAt { get; set; }
@@ -318,6 +334,7 @@
public bool Bookmarked { get; set; }
public bool Pinned { get; set; }
public bool Sensitive { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string SpoilerText { get; set; } = string.Empty;
public string Visibility { get; set; }
public List<MediaAttachment> MediaAttachments { get; set; } = new();
@@ -388,6 +405,7 @@
public string RedirectUri { get; set; }
public string ClientId { get; set; }
public string ClientSecret { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string VapidKey { get; set; } = string.Empty;
}
@@ -397,6 +415,7 @@
public bool Following { get; set; }
public bool ShowingReblogs { get; set; }
public bool Notifying { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0006", Justification = "The Mastodon API sends null when every language of the account is followed.")]
public List<string> Languages { get; set; }
public bool FollowedBy { get; set; }
public bool Blocking { get; set; }
@@ -407,6 +426,7 @@
public bool RequestedBy { get; set; }
public bool DomainBlocking { get; set; }
public bool Endorsed { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Note { get; set; } = string.Empty;
}
@@ -445,6 +465,7 @@
{
public string Id { get; set; }
public string Action { get; set; } = "none";
[System.Diagnostics.CodeAnalysis.SuppressMessage("HouseRules", "HR0005", Justification = "The Mastodon API sends this as a string, \"\" when empty; clients break on null.")]
public string Text { get; set; } = string.Empty;
public List<string> StatusIds { get; set; } = new();
public Account TargetAccount { get; set; }