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

@@ -118,7 +118,7 @@ namespace PrivaPub.Domain.Portability
state.ImportFrom = actorId;
state.ImportSameActor = run.SameActor;
state.ImportCounts = [];
await Save(run, token, force: true);
await Save(run, force: true, token);
var parts = state.ImportParts.ToHashSet(StringComparer.Ordinal);
var privapub = Text((archive.Json("privapub/archive.json") as JsonObject)?["software"]) == "privapub";
@@ -185,7 +185,7 @@ namespace PrivaPub.Domain.Portability
.ExecuteAsync(token);
// progress written at most every two seconds; the answer to whether the root asked to stop
static async Task Save(Run run, CancellationToken token, bool force = false)
static async Task Save(Run run, bool force = false, CancellationToken token = default)
{
if (!force && DateTime.UtcNow - run.LastSaved < TimeSpan.FromSeconds(2))
return;
@@ -199,7 +199,7 @@ namespace PrivaPub.Domain.Portability
static async Task<bool> Stopped(Run run, CancellationToken token)
{
await Save(run, token);
await Save(run, token: token);
return await DB.Default.Find<PersonaArchive>().MatchID(run.State.ID).Match(a => a.StopAsked).ExecuteAnyAsync(token);
}
@@ -710,7 +710,7 @@ namespace PrivaPub.Domain.Portability
// Mastodon's columns: notify on new posts, and the languages (", " between them) its posts reach the home in (R8)
var notify = cells.Length >= 3 && cells[2].Trim().Equals("true", StringComparison.OrdinalIgnoreCase);
var languages = cells.Length >= 4 ? cells[3].Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) : [];
return await run.Services.GetRequiredService<IFollowService>().FollowAs(run.Me, uri, boosts, token, notify, languages) != default;
return await run.Services.GetRequiredService<IFollowService>().FollowAs(run.Me, uri, boosts, notify, languages, token) != default;
}
// lists by title, with only the accounts the persona follows
+1 -1
View File
@@ -29,7 +29,7 @@ namespace PrivaPub.Domain.Portability
public static (SafeArchive Archive, string Error) Open(string path)
{
ZipArchive zip;
var zip = default(ZipArchive);
try
{
zip = ZipFile.OpenRead(path);